简体   繁体   中英

IMFMediaSink, how to set an encoder property?

I have a IMFMediaSink interface implemented that encodes through the native h264 codec a particular source (we're talking about the Windows 8 Modern (Metro) interface). I want to change the default options of the h264 codec, how to do that?

I searched online and I kind of understand that the ICodecAPI interface is something related to what I want to do, but how to use it? Does anyone have some sample code to look at to try and understand what to do?

I know I can use the MF_SINK_WRITER_ENCODER_CONFIG for a sinkwriter, but I'm not using that class unfortunately.

Maybe like this:

Try getting an IMFStreamSink on your h264 stream from the IMFMediaSink . GetStremSinkCount and GetStreamSinkByIndex should help you on that.

Then call GetMediaTypeHandler on IMFMediaSink object. Call GetCurrentMediaType on IMFMediaTypeHandler . Now you should have a pointer to an IMFMediaType , which is derived from the IMFAttributes . You should be able to configure your transformer here.

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

I found the solution myself. It doesn't exist a way to access ICodecAPI from WinRT Metro. This is by design and Microsoft don't think will change it anytime soon. It's a shame...:(

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM