How to specify language list object in Windows Media Foundation SDK

旧城冷巷雨未停 提交于 2021-01-29 08:52:54

问题


Currently I'm trying to use Windows Media Foundation SDK (C++) to create WMV file on Windows 10.

I was able to create a WMV file, but I have difficulty to add language list object (7C4346A9-EFE0-4BFC-B229-393EDE415C85) into the asf file.

I am using WMSinkWriter to create a file, and how I pass input video/audio data is as following article mentions: https://docs.microsoft.com/en-us/windows/desktop/medfound/tutorial--using-the-sink-writer-to-encode-video

Here's summary of what I'm doing:

  1. Call CoInitializeEx to initialize the COM library.
  2. Call MFStartup to initialize Microsoft Media Foundation.
  3. Create the sink writer.
  4. Send video frames to the sink writer.
  5. Call IMFSinkWriter::Finalize to finalize the output file.
  6. Release the pointer to the sink writer.
  7. Call MFShutdown.
  8. Call CoUninitialize.

There's no much information on the internet since it is old SDK.

If you have any clue, please let me know.


回答1:


IMFASFContentInfo interface of the ASF Media Sink can be obtained from the Sink Writer using GetServiceForStream and specifying MF_SINK_WRITER_MEDIASINK like this:

pSinkWriter->GetServiceForStream(MF_SINK_WRITER_MEDIASINK, GUID_NULL, IID_PPV_ARGS(&pContentInfo));

where pContentInfo points to an IMFASFContentInfo.

You should be able to use IMFASFContentInfo to set the language list by using any or all of the MF_SD_LANGUAGE, MF_SD_ASF_EXTSTRMPROP_LANGUAGE_ID_INDEX, MF_PD_ASF_LANGLIST attributes on the corresponding IMFStreamDescriptor of the IMFPresentationDescriptor obtained by the IMFASFContentInfo object using GeneratePresentationDescriptor method.



来源:https://stackoverflow.com/questions/51033401/how-to-specify-language-list-object-in-windows-media-foundation-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!