v***@gmail.com
2007-01-05 12:54:23 UTC
Hi All,
I am working with a DirectShow transform which converts compressed
video frame into NV12 uncompressed data. I have set output pin of the
transform as MEDIATYPE_Video, MEDIASUBTYPE_NV12. However, I am not able
to connect this output pin directly to a renderer. Instead, the output
pin gets connected to AVI decompresser and then to renderer. When I
press play in GraphEdit, it crashes.
If I convert NV12 into YUV2, then I am able to render the output pin of
transform filter. But converting takes lot of time. Please let me know
if I can render NV12 format directly without such conversion.
Thanks,
Vikram
Below is the code segment I am using:
---------------------------------------------------------------
//-------------------------------------------------------------------------------------------
// GetMediaType - Returns the media type supported by the output pin.
//-------------------------------------------------------------------------------------------
HRESULT CH264TransFilter::GetMediaType(int iPosition,CMediaType
*pMediaType)
{
if (m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
if(iPosition < 0) return E_INVALIDARG;
if(iPosition >= 1) return VFW_S_NO_MORE_ITEMS;
pMediaType->majortype = MEDIATYPE_Video;
pMediaType->subtype = MEDIASUBTYPE_NV12;
BITMAPINFOHEADER bihOut;
memset(&bihOut, 0, sizeof(bihOut));
bihOut.biSize = sizeof(bihOut);
bihOut.biWidth = m_cWidth;
bihOut.biHeight = m_cHeight;
bihOut.biPlanes = 1;
bihOut.biBitCount = BPP;
bihOut.biCompression = '2YUY';
bihOut.biSizeImage = m_cWidth*m_cHeight*1.5;
....
I am working with a DirectShow transform which converts compressed
video frame into NV12 uncompressed data. I have set output pin of the
transform as MEDIATYPE_Video, MEDIASUBTYPE_NV12. However, I am not able
to connect this output pin directly to a renderer. Instead, the output
pin gets connected to AVI decompresser and then to renderer. When I
press play in GraphEdit, it crashes.
If I convert NV12 into YUV2, then I am able to render the output pin of
transform filter. But converting takes lot of time. Please let me know
if I can render NV12 format directly without such conversion.
Thanks,
Vikram
Below is the code segment I am using:
---------------------------------------------------------------
//-------------------------------------------------------------------------------------------
// GetMediaType - Returns the media type supported by the output pin.
//-------------------------------------------------------------------------------------------
HRESULT CH264TransFilter::GetMediaType(int iPosition,CMediaType
*pMediaType)
{
if (m_pInput->IsConnected() == FALSE) return E_UNEXPECTED;
if(iPosition < 0) return E_INVALIDARG;
if(iPosition >= 1) return VFW_S_NO_MORE_ITEMS;
pMediaType->majortype = MEDIATYPE_Video;
pMediaType->subtype = MEDIASUBTYPE_NV12;
BITMAPINFOHEADER bihOut;
memset(&bihOut, 0, sizeof(bihOut));
bihOut.biSize = sizeof(bihOut);
bihOut.biWidth = m_cWidth;
bihOut.biHeight = m_cHeight;
bihOut.biPlanes = 1;
bihOut.biBitCount = BPP;
bihOut.biCompression = '2YUY';
bihOut.biSizeImage = m_cWidth*m_cHeight*1.5;
....