IMFMediaSink,如何设置编码器属性?

IMFMediaSink, how to set an encoder property?

我实现了一个 IMFMediaSink 接口,它通过本机 h264 编解码器对特定源进行编码(我们正在谈论 Windows 8 Modern (Metro) 接口)。我想更改 h264 编解码器的默认选项,该怎么做?

在网上查了一下,大概明白了ICodecAPI接口是和我想做的有关的东西,但是怎么用呢?有没有人有一些示例代码可以查看以尝试理解该怎么做?

我知道我可以将 MF_SINK_WRITER_ENCODER_CONFIG 用于 sinkwriter,但不幸的是我没有使用 class。

可能是这样的:

尝试从 IMFMediaSink 获取 h264 流中的 IMFStreamSinkGetStremSinkCountGetStreamSinkByIndex 应该可以帮助你。

然后在 IMFMediaSink 对象上调用 GetMediaTypeHandler。 在 IMFMediaTypeHandler 上致电 GetCurrentMediaType。 现在您应该有一个指向 IMFMediaType 的指针,它派生自 IMFAttributes。您应该可以在这里配置变压器。

Hey, I did hear back from our architect. He cofirmed that the current implientation is "by design". The team is aware of the limitaion but I'm not sure if they will be able to consider a design change. I hope this helps, James

https://social.msdn.microsoft.com/Forums/windowsapps/en-US/74f02476-05aa-4520-8ee6-1b794321173e/how-to-access-icodec-property?forum=winappswithhtml5

我自己找到了解决方案。它不存在从 WinRT Metro 访问 ICodecAPI 的方法。这是设计使然,Microsoft 认为不会很快更改它。真可惜...:(