Tuesday, November 18, 2008

Single Input mediasample and Multiple Output media Sample to be delivered from Transform Filter

Single Input mediasample and Multiple Output media Sample in Transform Filter:
===============================================================================
Solution :
---------

implement the Receive() fn:


HRESULT TransformFilter:: Receive(IMediaSample* pMediaSample)
{
HRESULT hr = S_OK;
do
{
hr = GetDeliveryBuffer(&pOutputSample);
if (FAILED(hr)) return hr;
hr = Transform(pSample,pOutputSample);
if(FAILED(hr)) return hr;

hr = m_pOutput->Deliver(pOutputSample);
pOutputSample->Release();
}while(nOutputSample != 0);

return hr;
}

Error while building PC based Dshow baseclasses:

Error while building PC based Dshow baseclasses:
==================================================

>D:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h(222) : error C2146: syntax error :

missing ';' before identifier 'PVOID64'
1>D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(222) : error C4430: missing type

specifier - int assumed. Note: C++ does not support default-int
1>D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C2146: syntax error :

missing ';' before identifier 'Buffer'
1>D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C4430: missing type

specifier - int assumed. Note: C++ does not support default-int
1>D:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\winnt.h(5940) : error C4430: missing type

specifier - int assumed. Note: C++ does not support default-int

Solution:
-----------
include the following macro in the the Winnt.h before the following lines

typedef void *PVOID;
typedef void *POINTER_64 PVOID64;


After code change:
#define POINTER_64 __ptr64
typedef void *PVOID;
typedef void *POINTER_64 PVOID64;

AnotherSolution:
====================
Update BaseTsd.h with latest platform SDk file.

Wednesday, November 05, 2008

RenderStream Failure

RenderStream Failure :
========================
hr = CaptureGraphBuilder2->RenderStream(
NULL,NULL,mp4Source,mpeg4videoDecoder,Mpeg4Encoder);

returns the "No combination of intermediate filters found"

Observation:
if we connected the Mpeg1 Encoder that is connecting pins in the
RenderStream as follows:

hr = CaptureGraphBuilder2->RenderStream(
NULL,NULL,SourceFilter,mpeg1VideoDecoder,Mpeg4Encoder);


( Source FIlter might be AddSourceFilter() with URL).

RenderStream is running successfully.


Solution:
============


hr = CaptureGraphBuilder2->RenderStream(
NULL,&MEDIATYPE_Video,mp4Source,mpeg4videoDecoder,Mpeg4Encoder);

if we modified it as follows: it is working fine...

The Reason is RenderStream() media type is NULL means it will
directly connects the Source Filter's First Pin the Video Decoder
Filter.

In case of MPEG1 Source Filter, the First output pin is video so it
is running successfully without any problem.

In case of MP4 Source Filter failure case, First output pin is audio
Pin. So the RenderStream() tries to connect with MP4 Source Audio
output pin with Video decoder. So that causes the error.

if we specified the MediaType as video, RenderStream() will takes the
Source Filter's Video output pin and tries to connect it with video
decoder. So it is working fine...