* dshow.c : DirectShow access module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: dshow.cpp,v 1.3 2003/08/25 22:57:40 gbazin Exp $
+ * $Id: dshow.cpp,v 1.4 2003/08/26 19:14:09 gbazin Exp $
*
* Author: Gildas Bazin <gbazin@netcourrier.com>
*
if( !p_sys->i_streams )
{
- /* Uninitialize OLE/COM */
- CoUninitialize();
-
/* Release directshow objects */
p_sys->p_control->Release();
p_sys->p_graph->Release();
+
+ /* Uninitialize OLE/COM */
+ CoUninitialize();
+
free( p_sys->p_header );
free( p_sys );
return VLC_EGENERIC;
p_sys->p_control->Stop();
p_sys->p_control->Release();
-#if 0
/* Remove filters from graph */
for( int i = 0; i < p_sys->i_streams; i++ )
{
p_sys->pp_streams[i]->p_capture_filter->Release();
}
p_sys->p_graph->Release();
-#endif
/* Uninitialize OLE/COM */
CoUninitialize();
}
/* Get new sample/frame from next stream */
- //if( p_sream->sample.p_sample ) p_stream->sample.p_sample->Release();
+ //if( p_stream->sample.p_sample ) p_stream->sample.p_sample->Release();
p_sys->i_current_stream =
(p_sys->i_current_stream + 1) % p_sys->i_streams;
p_stream = p_sys->pp_streams[p_sys->i_current_stream];
* filter.c : DirectShow access module for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
- * $Id: filter.cpp,v 1.2 2003/08/25 21:45:04 gbazin Exp $
+ * $Id: filter.cpp,v 1.3 2003/08/26 19:14:10 gbazin Exp $
*
* Author: Gildas Bazin <gbazin@netcourrier.com>
*
if( riid == IID_IUnknown ||
riid == IID_IPin )
{
+ AddRef();
*ppv = (IPin *)this;
return NOERROR;
}
if( riid == IID_IMemInputPin )
{
+ AddRef();
*ppv = (IMemInputPin *)this;
return NOERROR;
}
msg_Dbg( p_input, "CapturePin::AddRef" );
#endif
- i_ref++;
- return NOERROR;
+ return i_ref++;
};
STDMETHODIMP_(ULONG) CapturePin::Release()
{
i_ref--;
if( !i_ref ) delete this;
- return NOERROR;
+ return i_ref;
};
/* IPin methods */
msg_Dbg( p_input, "CapturePin::ConnectedTo" );
#endif
+ if( !p_connected_pin ) return VFW_E_NOT_CONNECTED;
+
p_connected_pin->AddRef();
*pPin = p_connected_pin;
if( riid == IID_IUnknown )
{
+ AddRef();
*ppv = (IUnknown *)this;
return NOERROR;
}
if( riid == IID_IPersist )
{
+ AddRef();
*ppv = (IPersist *)this;
return NOERROR;
}
if( riid == IID_IMediaFilter )
{
+ AddRef();
*ppv = (IMediaFilter *)this;
return NOERROR;
}
if( riid == IID_IBaseFilter )
{
+ AddRef();
*ppv = (IBaseFilter *)this;
return NOERROR;
}
msg_Dbg( p_input, "CaptureFilter::AddRef" );
#endif
- i_ref++;
- return NOERROR;
+ return i_ref++;
};
STDMETHODIMP_(ULONG) CaptureFilter::Release()
{
i_ref--;
if( !i_ref ) delete this;
- return NOERROR;
+ return i_ref;
};
/* IPersist method */
if( riid == IID_IUnknown ||
riid == IID_IEnumPins )
{
+ AddRef();
*ppv = (IEnumPins *)this;
return NOERROR;
}
msg_Dbg( p_input, "CaptureEnumPins::AddRef" );
#endif
- i_ref++;
- return NOERROR;
+ return i_ref++;
};
STDMETHODIMP_(ULONG) CaptureEnumPins::Release()
{
i_ref--;
if( !i_ref ) delete this;
- return NOERROR;
+ return i_ref;
};
/* IEnumPins */
pPin->AddRef();
*pcFetched = 1;
i_position++;
- return NOERROR;
}
- return S_FALSE;
+ return *pcFetched == cPins ? NOERROR : S_FALSE;
};
STDMETHODIMP CaptureEnumPins::Skip( ULONG cPins )
{
if( riid == IID_IUnknown ||
riid == IID_IEnumMediaTypes )
{
+ AddRef();
*ppv = (IEnumMediaTypes *)this;
return NOERROR;
}
msg_Dbg( p_input, "CaptureEnumMediaTypes::AddRef" );
#endif
- i_ref++;
- return NOERROR;
+ return i_ref++;
};
STDMETHODIMP_(ULONG) CaptureEnumMediaTypes::Release()
{
i_ref--;
if( !i_ref ) delete this;
- return NOERROR;
+ return i_ref;
};
/* IEnumMediaTypes */
msg_Dbg( p_input, "CaptureEnumMediaTypes::Skip" );
#endif
- if( cMediaTypes > 1 )
+ if( cMediaTypes > 0 )
{
return S_FALSE;
}