Re: CTransInPlaceFilter woes

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance





"Tim Roberts" wrote:

Why don't you post the graph building code? We'll see if anything looks
strange. I've done this kind of thing many times.

I've built loads of graphs but never seen this happen. However I've not
often needed to create my own filters. Anyhow, the code :-

----[snip]----------

// This creates a fully working graph minus our filter
hr = m_pCapture->RenderStream( &PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
m_pVideoCapture, pGrabber, NULL ) ;
CHECK(hr) ;

// Add our filter

if( TRUE ) // TO DO : Make optional
{
hr = AddScyronTextOverlay( &m_pScyronTextOverlay ) ;

if( FAILED(hr) )
{
pLog->LogMessage( eLOG_NORM, _T("Error : Could not add Scyron text
overlay (is filter installed?)") ) ;
}
else
{
// Locate the video renderer

CComPtr <IBaseFilter> pRenderer ;
hr = Builder.FindRenderer( m_pGraph, MEDIATYPE_Video, TRUE, &pRenderer ) ;

if( FAILED(hr) )
{
ASSERT(false) ;
}
else
{
// Get input and output pin of our filter

CComPtr <IPin> ppinOverlayIn ;
hr = Builder.GetUnconnectedPin( m_pScyronTextOverlay, PINDIR_INPUT,
&ppinOverlayIn ) ;
ASSERT( SUCCEEDED(hr) ) ;

CComPtr <IPin> ppinOverlayOut ;
hr = Builder.GetUnconnectedPin( m_pScyronTextOverlay, PINDIR_OUTPUT,
&ppinOverlayOut ) ;
ASSERT( SUCCEEDED(hr) ) ;

// Split connection to video renderer input

CComPtr <IPin> ppinRenderer ;
hr = Builder.GetConnectedPin( pRenderer, PINDIR_INPUT, &ppinRenderer ) ;

if( SUCCEEDED(hr) )
{
CComPtr <IPin> ppinPreRenderer ;
hr = ppinRenderer->ConnectedTo( &ppinPreRenderer ) ;
ASSERT( SUCCEEDED(hr) ) ;

VERIFY( SUCCEEDED(ppinRenderer->Disconnect()) ) ;

VERIFY( SUCCEEDED(ppinPreRenderer->Disconnect()) ) ;

//
// Now insert our filter
//
#if 1
//hr = ppinPreRenderer->Connect( ppinOverlayIn, NULL ) ;
hr = m_pGraph->Connect( ppinPreRenderer, ppinOverlayIn ) ;
CHECK(hr) ;

AfxMessageBox( _T("Connected filter input ...") ) ;

//hr = ppinOverlayOut->Connect( ppinRenderer, NULL ) ;
m_pGraph->Connect( ppinOverlayOut, ppinRenderer ) ;
CHECK(hr) ;

AfxMessageBox( _T("ConnectedFilterOutput") ) ;

// Above will have disconnected grabber !!... this'll re-connect it
//hr = ppinPreRenderer->Connect( ppinOverlayIn, NULL ) ;
hr = m_pGraph->Connect( ppinPreRenderer, ppinOverlayIn ) ;
CHECK(hr) ;
#else
// This results in everything connected up but it still don't work :-(
hr = m_pCapture->RenderStream( NULL, &MEDIATYPE_Video, pGrabber,
m_pScyronTextOverlay, pRenderer ) ;
CHECK(hr) ;

// For some reason grabber now disconnected. So re-connect it again
hr = m_pCapture->RenderStream( NULL, &MEDIATYPE_Video, pGrabber,
NULL, m_pScyronTextOverlay ) ;
CHECK(hr) ;
#endif


----[/snip/--------

Buried in there are three different methods, IPin::Connect,
IGraphBuilder::Connect and ICaptureGraphBuilder2::RenderStream, all with the
same result.

Also remember that attaching to the graph remotely from Graphedt is not
always benign. It is a useful trick, but it has occasionally caused
unexpected problems for me.

Apart from sometimes GPF'ing during the initial connect phase, I don't
usually find any repercussions providing I'm not doing anything more than
querying pin details.

But using GraphEdt only, my filter behaves correctly, be it a live video
stream (as is case in above example), or playing back a recorded file, works
every time.

Totally stumped.

TTFN,
Jon
.



Relevant Pages

  • Re: Crash on seek and stop
    ... for one of the worker threads that is blocked inside a filter. ... The graph will pause before stopping or seeking. ... // MPEG-2 Stream Splitter ... IPin splitterInputPin = RpsUtils.getPin(mpgSplitterIntfc, ...
    (microsoft.public.win32.programmer.directx.video)
  • Cant create video preview window -- the video stream freezes almost immediately?
    ... simple graph like this: ... Create webcam filter ... Right-click on capture pin, ... CComPtr pBuilder; ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: WMV file is not being closed properly after being read
    ... other filters in a graph (the object is of type MyFilter, ... CComPtr is of type IBaseFilter for reasons of consistancy throughout my ... CComPtr to my already instantiated and connected filter to a new filter ...
    (microsoft.public.win32.programmer.directx.video)
  • AddSourceFilterForMoniker() locks up sometimes.
    ... I've coded a simple filter graph to capture frames from a video camera ... I can grab frames from the Sample Grabber with no ...
    (microsoft.public.win32.programmer.directx.video)
  • AddSourceFilterForMoniker() locks up sometimes.
    ... I've coded a simple filter graph to capture frames from a video camera ... I can grab frames from the Sample Grabber with no ...
    (microsoft.public.multimedia.directx.dshow.programming)