bdagraph.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * bdagraph.h : DirectShow BDA graph builder header for vlc
00003  *****************************************************************************
00004  * Copyright ( C ) 2007 the VideoLAN team
00005  *
00006  * Author: Ken Self <kenself(at)optusnet(dot)com(dot)au>
00007  *
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * ( at your option ) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00021  *****************************************************************************/
00022 
00023 /*****************************************************************************
00024  * Preamble
00025  *****************************************************************************/
00026 
00027 #include "bda.h"
00028 
00029 using namespace std;
00030 #ifndef _MSC_VER
00031 #   include <wtypes.h>
00032 #   include <unknwn.h>
00033 #   include <ole2.h>
00034 #   include <limits.h>
00035 #   ifdef _WINGDI_
00036 #      undef _WINGDI_
00037 #   endif
00038 #   define _WINGDI_ 1
00039 #   define AM_NOVTABLE
00040 #   define _OBJBASE_H_
00041 #   undef _X86_
00042 #   define _I64_MAX LONG_LONG_MAX
00043 #   define LONGLONG long long
00044 /* Work-around a bug in w32api-2.5 */
00045 /* #   define QACONTAINERFLAGS QACONTAINERFLAGS_SOMETHINGELSE */
00046 #endif
00047 
00048 /* Needed to call CoInitializeEx */
00049 #define _WIN32_DCOM
00050 
00051 #include <dshow.h>
00052 #include <comcat.h>
00053 #include "bdadefs.h"
00054 
00055 class BDAOutput
00056 {
00057 public:
00058     BDAOutput( access_t * );
00059     ~BDAOutput();
00060 
00061     void    Push( block_t * );
00062     block_t *Pop();
00063     void    Empty();
00064 
00065 private:
00066     access_t    *p_access;
00067     vlc_mutex_t lock;
00068     vlc_cond_t  wait;
00069     block_t     *p_first;
00070     block_t     **pp_next;
00071 };
00072 
00073 /* The main class for building the filter graph */
00074 class BDAGraph : public ISampleGrabberCB
00075 {
00076 public:
00077     BDAGraph( access_t* p_access );
00078     virtual ~BDAGraph();
00079 
00080     /* */
00081     int SubmitATSCTuneRequest();
00082     int SubmitDVBTTuneRequest();
00083     int SubmitDVBCTuneRequest();
00084     int SubmitDVBSTuneRequest();
00085 
00086     /* */
00087     block_t *Pop();
00088 
00089 private:
00090     /* ISampleGrabberCB methods */
00091     ULONG ul_cbrc;
00092     STDMETHODIMP_( ULONG ) AddRef( ) { return ++ul_cbrc; }
00093     STDMETHODIMP_( ULONG ) Release( ) { return --ul_cbrc; }
00094     STDMETHODIMP QueryInterface( REFIID riid, void** p_p_object )
00095         { return E_NOTIMPL; }
00096     STDMETHODIMP SampleCB( double d_time, IMediaSample* p_sample );
00097     STDMETHODIMP BufferCB( double d_time, BYTE* p_buffer, long l_buffer_len );
00098 
00099     access_t* p_access;
00100     CLSID     guid_network_type;
00101     long      l_tuner_used;        /* Index of the Tuning Device */
00102     /* registration number for the RunningObjectTable */
00103     DWORD     d_graph_register;
00104 
00105     BDAOutput       output;
00106 
00107     IMediaControl*  p_media_control;
00108     IGraphBuilder*  p_filter_graph;
00109     ITuningSpace*   p_tuning_space;
00110     ITuneRequest*   p_tune_request;
00111 
00112     ICreateDevEnum* p_system_dev_enum;
00113     IBaseFilter*    p_network_provider;
00114     IScanningTuner* p_scanning_tuner;
00115     IBaseFilter*    p_tuner_device;
00116     IBaseFilter*    p_capture_device;
00117     IBaseFilter*    p_sample_grabber;
00118     IBaseFilter*    p_mpeg_demux;
00119     IBaseFilter*    p_transport_info;
00120     ISampleGrabber* p_grabber;
00121 
00122     HRESULT CreateTuneRequest( );
00123     HRESULT Build( );
00124     HRESULT FindFilter( REFCLSID clsid, long* i_moniker_used,
00125         IBaseFilter* p_upstream, IBaseFilter** p_p_downstream );
00126     HRESULT Connect( IBaseFilter* p_filter_upstream,
00127         IBaseFilter* p_filter_downstream );
00128     HRESULT Start( );
00129     HRESULT Destroy( );
00130     HRESULT Register( );
00131     void Deregister( );
00132 };

Generated on Tue May 25 08:04:52 2010 for VLC by  doxygen 1.5.6