【问题标题】:Is it possible to get the value of MF_SOURCE_READER_ASYNC_CALLBACK from IMFSourceReader or IMFMediaSource object?是否可以从 IMFSourceReader 或 IMFMediaSource 对象获取 MF_SOURCE_READER_ASYNC_CALLBACK 的值?
【发布时间】:2019-12-21 20:09:42
【问题描述】:

我使用 MediaFoundation API 从相机中获取样本并遇到了这样的问题。

С创建一个source reader object(例如,使用函数MFCreateSourceReaderFromMediaSource),我们可以在异步模式下使用IMFSourceReader。为此,我们必须在属性存储上设置 MF_SOURCE_READER_ASYNC_CALLBACK 属性。然后将此属性存储传递给 MFCreateSourceReaderFromMediaSource 函数。

    HRESULT hr = S_OK;
    IMFAttributes *pAttributes = NULL;

    hr = MFCreateAttributes(&pAttributes, 1);

    // set our callback
    hr = pAttributes->SetUnknown(MF_SOURCE_READER_ASYNC_CALLBACK, pCallback);

    // pass attributes and create source reader
    hr = MFCreateSourceReaderFromMediaSource(pMediaSource, pAttributes, ppSourceReader);

从逻辑上讲,我们在创建 IMFSourceReader 时设置的参数应该存储在其中的某个位置。

其实,问题。是否可以获取我们在 MFCreateSourceReaderFromMediaSource 中传递的 IMFSourceReader 对象的 IMFAttributes(尤其是 MF_SOURCE_READER_ASYNC_CALLBACK 属性的值)?

我尝试使用 QueryInterface 获取它们

pSourceReader->QueryInterface(IID_IMFAttributes, (void**)&pAttributes);

但是返回值说不支持该接口。

媒体源对象返回属性但不包含必要的属性。 我认为使用 IMFSourceReader::GetServiceForStream 方法可以获得我想要的东西,但我不知道需要什么服务。

提前致谢,我会很高兴得到任何帮助。

【问题讨论】:

    标签: windows webcam video-capture ms-media-foundation


    【解决方案1】:

    没有定义方法来读取回调的值。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-07
      • 2012-10-09
      • 2019-03-05
      • 2018-05-24
      • 2020-08-24
      • 2013-04-02
      • 2011-01-03
      相关资源
      最近更新 更多