]> git.sesse.net Git - vlc/blob - modules/access/bda/bdagraph.h
CDDA: Typo
[vlc] / modules / access / bda / bdagraph.h
1 /*****************************************************************************
2  * bdagraph.h : DirectShow BDA graph builder header for vlc
3  *****************************************************************************
4  * Copyright ( C ) 2007 the VideoLAN team
5  *
6  * Author: Ken Self <kenself(at)optusnet(dot)com(dot)au>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * ( at your option ) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
21  *****************************************************************************/
22
23 /*****************************************************************************
24  * Preamble
25  *****************************************************************************/
26 #include <queue>
27
28 using namespace std;
29 #ifndef _MSC_VER
30 #   include <wtypes.h>
31 #   include <unknwn.h>
32 #   include <ole2.h>
33 #   include <limits.h>
34 #   ifdef _WINGDI_
35 #      undef _WINGDI_
36 #   endif
37 #   define _WINGDI_ 1
38 #   define AM_NOVTABLE
39 #   define _OBJBASE_H_
40 #   undef _X86_
41 #   define _I64_MAX LONG_LONG_MAX
42 #   define LONGLONG long long
43 /* Work-around a bug in w32api-2.5 */
44 /* #   define QACONTAINERFLAGS QACONTAINERFLAGS_SOMETHINGELSE */
45 #endif
46 /* Needed to call CoInitializeEx */
47 #define _WIN32_DCOM
48
49 #include <dshow.h>
50 #include <comcat.h>
51 #include "bdadefs.h"
52 #include "bda.h"
53
54 class BDAOutput
55 {
56 public:
57     BDAOutput( access_t * );
58     ~BDAOutput();
59
60     void    Push( block_t * );
61     block_t *Pop();
62     void    Empty();
63
64 private:
65     access_t    *p_access;
66     vlc_mutex_t lock;
67     vlc_cond_t  wait;
68     block_t     *p_first;
69     block_t     **pp_next;
70 };
71
72 /* The main class for building the filter graph */
73 class BDAGraph : public ISampleGrabberCB
74 {
75 public:
76     BDAGraph( access_t* p_access );
77     virtual ~BDAGraph();
78
79     /* */
80     int SubmitATSCTuneRequest();
81     int SubmitDVBTTuneRequest();
82     int SubmitDVBCTuneRequest();
83     int SubmitDVBSTuneRequest();
84
85     /* */
86     block_t *Pop();
87
88 private:
89     /* ISampleGrabberCB methods */
90     ULONG ul_cbrc;
91     STDMETHODIMP_( ULONG ) AddRef( ) { return ++ul_cbrc; }
92     STDMETHODIMP_( ULONG ) Release( ) { return --ul_cbrc; }
93     STDMETHODIMP QueryInterface( REFIID riid, void** p_p_object )
94         { return E_NOTIMPL; }
95     STDMETHODIMP SampleCB( double d_time, IMediaSample* p_sample );
96     STDMETHODIMP BufferCB( double d_time, BYTE* p_buffer, long l_buffer_len );
97
98     access_t* p_access;
99     CLSID     guid_network_type;
100     long      l_tuner_used;        /* Index of the Tuning Device */
101     /* registration number for the RunningObjectTable */
102     DWORD     d_graph_register;
103
104     BDAOutput       output;
105
106     IMediaControl*  p_media_control;
107     IGraphBuilder*  p_filter_graph;
108     ITuningSpace*   p_tuning_space;
109     ITuneRequest*   p_tune_request;
110
111     ICreateDevEnum* p_system_dev_enum;
112     IBaseFilter*    p_network_provider;
113     IScanningTuner* p_scanning_tuner;
114     IBaseFilter*    p_tuner_device;
115     IBaseFilter*    p_capture_device;
116     IBaseFilter*    p_sample_grabber;
117     IBaseFilter*    p_mpeg_demux;
118     IBaseFilter*    p_transport_info;
119     ISampleGrabber* p_grabber;
120
121     HRESULT CreateTuneRequest( );
122     HRESULT Build( );
123     HRESULT FindFilter( REFCLSID clsid, long* i_moniker_used,
124         IBaseFilter* p_upstream, IBaseFilter** p_p_downstream );
125     HRESULT Connect( IBaseFilter* p_filter_upstream,
126         IBaseFilter* p_filter_downstream );
127     HRESULT Start( );
128     HRESULT Destroy( );
129     HRESULT Register( );
130     void Deregister( );
131 };