Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Decode H264 stream using H264 Decoder MFT

$
0
0
Hello. I am trying to decode H264 video stream using H264 decoder MFT. I take the compressed data from a local mp4 file. Here is how I am approaching this problem.

1- Get the decoder using MFTEnumEx().
2- Get the stream IDs using IMFTransform::GetStreamIDs(). Since it is a decoder it will have only one input and out stream.
3- Set the input type of IMFTransform. I set the same type as I set on IMFSourceReader when reading the compressed frames from mp4 file.

4- Set the output type of IMFTransform. Same type for getting uncompressed frames from IMFSourceReader.
5- I allocate the output buffer (IMFSample) because dwFlags of _MFT_OUTPUT_STREAM_INFO_FLAGS is 7 when I callIMFTransform::GetOutputStreamInfo .

6- Now I start getting compressed from IMFSourceReader in a loop. I get the compressed data and pass it toIMFTransform::ProcessInput();
7- Then I call IMFTransform::ProcessOutput(). This gives errorMF_E_TRANSFORM_NEED_MORE_INPUT
8- I keep on getting data from source reader, calling ProcessInput and the ProcessOutput. But ProcessOutput() always returns MF_E_TRANSFORM_NEED_MORE_INPUT.

9- I even tried merging two samples using IMFSample::AddBuffer() and even merging two buffers of the same sample usingIMFSample::ConvertToContoguousBuffer(). But still the same.

Is anyone of you have any idea what am I doing wrong? Should I be calling ProcessInput at all? If yes then why, because I am already giving it the encoded data to produce output. Thanks in advance for any pointer.

Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>