Search code examples
profilespecificationsms-media-foundationwmv

how to set wmv spec info for decoder in media foundation


In some of the multimedia framework, we send the spec info such as VC1 Profile Type (AP/SP/MP) and bit stream format (RCV) as the first frame between WMV parser and WMV decoder. The spec info is for initializing WMV decoder.

I am using the default Media Foundation WMV Source and my own WMV decoder MFT. When I dump the data from the MFT, it only has the video data and no spec info. So, I think that the spec info is set using some other interface.

Can someone give me a litter message about this?


Solution

  • By spec info if you mean VC1 sequence header then look at MF_MT_USER_DATA attribute. When MF Session Manager calls SetOutputType() of your decoder MFT, it supplies MF_MT_USER_DATA as a blob. Following snippet might give you a hint.

    HRESULT SetOutputType(DWORD dwStreamID, IMFMediaType* pmt, DWORD dwFlags)
    {
       ...
    
       BYTE* seqData;
       DWORD seqLength;
       HRESULT hr;
    
       hr = pmt->GetBlobSize(MF_MT_USER_DATA, &seqLength);
       if (SUCCEEDED(hr))
       {
          seqData = (BYTE*) malloc(seqLength);
    
          if (seqData != NULL)
          {
            hr = pmt->GetBlob(MF_MT_USER_DATA, seqLength, &seqLength);
          }
       }
    
       /* Use MF_MT_USER_DATA to do something. */
    
       ...
    }