1
votes

I am writing a File Source filter which has an Video output PIN, the output pin type is H.264 raw format:

HRESULT CVideoOutPin::GetMediaType(CMediaType *pMediaType)
{
    CAutoLock lock(m_pFilter->pStateLock());

    ZeroMemory(pMediaType, sizeof(CMediaType));


    pMediaType->InitMediaType();
    // {7807c3af-524f-11ce-9f53-0020af0ba770}
    pMediaType->SetSubtype(&MEDIASUBTYPE_h264raw);

    unsigned int * pSize = (unsigned int *) pMediaType->ReallocFormatBuffer(sizeof(unsigned int) * 2);
    pSize[0] = m_pFlvFile->GetWidth();
    pSize[1] = m_pFlvFile->GetHeight();

    pMediaType->SetFormat((BYTE *)pSize, sizeof(unsigned int) * 2);

    //*pMediaType = m_oVideoMediaType;

    return S_OK;
}

I tried several decompress filter in GraphEdit.exe, and none of them can connect to my output pin.

Is there any DirectShow Filter I can use to complete the graph?

1
There is little mystery about well-formed H.264 media types. Build a graph with one of the H.264 files, such as .AVI or .MP4 with GraphEdit and inspect media types there.Roman R.

1 Answers

4
votes

MEDIASUBTYPE_h264raw doesn't look like a standard media subtype. You should use MEDIASUBTYPE_AVC1 (no start codes) or MEDIASUBTYPE_H264 (with start codes) instead; see H.264 Media Types. If you use either of those subtypes, a suitable H.264 decoder should be able to connect to your output pin. Windows 7 comes with such an H.264 decoder, and third-party decoders should supply an appropriate input filter.