add_savefile: remove callback parameter
[vlc/asuraparaju-public.git] / modules / access / dshow / common.h
blob573db27a3de883a63ff7a2358a2f930747cb3ecd
1 /*****************************************************************************
2 * common.h : DirectShow access module for vlc
3 *****************************************************************************
4 * Copyright (C) 2002, 2004, 2010 the VideoLAN team
5 * $Id$
7 * Author: Gildas Bazin <gbazin@videolan.org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 /*****************************************************************************
25 * Preamble
26 *****************************************************************************/
27 #include <string>
28 #include <list>
29 #include <deque>
30 using namespace std;
32 #ifndef _MSC_VER
33 # include <wtypes.h>
34 # include <unknwn.h>
35 # include <ole2.h>
36 # include <limits.h>
37 # ifdef _WINGDI_
38 # undef _WINGDI_
39 # endif
40 # define _WINGDI_ 1
41 # define AM_NOVTABLE
42 # define _OBJBASE_H_
43 # undef _X86_
44 # ifndef _I64_MAX
45 # define _I64_MAX LONG_LONG_MAX
46 # endif
47 # define LONGLONG long long
48 #endif
50 #include <dshow.h>
52 typedef struct dshow_stream_t dshow_stream_t;
54 /****************************************************************************
55 * Crossbar stuff
56 ****************************************************************************/
57 #define MAX_CROSSBAR_DEPTH 10
59 typedef struct CrossbarRouteRec
61 IAMCrossbar *pXbar;
62 LONG VideoInputIndex;
63 LONG VideoOutputIndex;
64 LONG AudioInputIndex;
65 LONG AudioOutputIndex;
67 } CrossbarRoute;
69 void DeleteCrossbarRoutes( access_sys_t * );
70 HRESULT FindCrossbarRoutes( vlc_object_t *, access_sys_t *,
71 IPin *, LONG, int = 0 );
73 /****************************************************************************
74 * Access descriptor declaration
75 ****************************************************************************/
76 struct access_sys_t
78 /* These 2 must be left at the beginning */
79 vlc_mutex_t lock;
80 vlc_cond_t wait;
82 IFilterGraph *p_graph;
83 ICaptureGraphBuilder2 *p_capture_graph_builder2;
84 IMediaControl *p_control;
86 int i_crossbar_route_depth;
87 CrossbarRoute crossbar_routes[MAX_CROSSBAR_DEPTH];
89 /* list of elementary streams */
90 dshow_stream_t **pp_streams;
91 int i_streams;
92 int i_current_stream;
94 /* misc properties */
95 int i_width;
96 int i_height;
97 int i_chroma;
98 bool b_chroma; /* Force a specific chroma on the dshow input */
102 #define INSTANCEDATA_OF_PROPERTY_PTR(x) ((PKSPROPERTY((x))) + 1)
103 #define INSTANCEDATA_OF_PROPERTY_SIZE(x) (sizeof((x)) - sizeof(KSPROPERTY))
105 /*****************************************************************************
106 * DirectShow GUIDs.
107 *****************************************************************************/
108 static const GUID PROPSETID_TUNER = {0x6a2e0605, 0x28e4, 0x11d0, {0xa1, 0x8c, 0x00, 0xa0, 0xc9, 0x11, 0x89, 0x56}};
110 /****************************************************************************
111 * The following should be in ks.h and ksmedia.h, but since they are not in
112 * the current version of Mingw, we will be defined here.
113 ****************************************************************************/
115 /* http://msdn.microsoft.com/en-us/library/ff567297%28VS.85%29.aspx */
116 typedef enum {
117 KS_AnalogVideo_None = 0x00000000,
118 KS_AnalogVideo_NTSC_M = 0x00000001,
119 KS_AnalogVideo_NTSC_M_J = 0x00000002,
120 KS_AnalogVideo_NTSC_433 = 0x00000004,
121 KS_AnalogVideo_PAL_B = 0x00000010,
122 KS_AnalogVideo_PAL_D = 0x00000020,
123 KS_AnalogVideo_PAL_G = 0x00000040,
124 KS_AnalogVideo_PAL_H = 0x00000080,
125 KS_AnalogVideo_PAL_I = 0x00000100,
126 KS_AnalogVideo_PAL_M = 0x00000200,
127 KS_AnalogVideo_PAL_N = 0x00000400,
128 KS_AnalogVideo_PAL_60 = 0x00000800,
129 KS_AnalogVideo_SECAM_B = 0x00001000,
130 KS_AnalogVideo_SECAM_D = 0x00002000,
131 KS_AnalogVideo_SECAM_G = 0x00004000,
132 KS_AnalogVideo_SECAM_H = 0x00008000,
133 KS_AnalogVideo_SECAM_K = 0x00010000,
134 KS_AnalogVideo_SECAM_K1 = 0x00020000,
135 KS_AnalogVideo_SECAM_L = 0x00040000,
136 KS_AnalogVideo_SECAM_L1 = 0x00080000,
137 KS_AnalogVideo_PAL_N_COMBO = 0x00100000
138 } KS_AnalogVideoStandard;
140 /* http://msdn.microsoft.com/en-us/library/ff567800%28VS.85%29.aspx and following */
141 typedef enum {
142 KSPROPERTY_TUNER_CAPS, // R -overall device capabilities
143 KSPROPERTY_TUNER_MODE_CAPS, // R -capabilities in this mode
144 KSPROPERTY_TUNER_MODE, // RW -set a mode (TV, FM, AM, DSS)
145 KSPROPERTY_TUNER_STANDARD, // R -get TV standard (only if TV mode)
146 KSPROPERTY_TUNER_FREQUENCY, // RW -set/get frequency
147 KSPROPERTY_TUNER_INPUT, // RW -select an input
148 KSPROPERTY_TUNER_STATUS, // R -tuning status
150 /* Optional */
151 KSPROPERTY_TUNER_IF_MEDIUM, // R O-Medium for IF or Transport Pin
153 /* Mandatory for Vista and + */
154 KSPROPERTY_TUNER_SCAN_CAPS, // R -overall device capabilities for scanning
156 /* Optional ones */
157 KSPROPERTY_TUNER_SCAN_STATUS, // R -status of scan
158 KSPROPERTY_TUNER_STANDARD_MODE, // RW -autodetect mode for signal standard
159 KSPROPERTY_TUNER_NETWORKTYPE_SCAN_CAPS // R -network type specific tuner capabilities
160 } KSPROPERTY_TUNER;
162 /* http://msdn.microsoft.com/en-us/library/ff567689%28v=VS.85%29.aspx */
163 typedef enum {
164 KS_TUNER_TUNING_EXACT = 1, // Tunes directly to the right freq
165 KS_TUNER_TUNING_FINE, // Comprehensive search to the right freq
166 KS_TUNER_TUNING_COARSE, // Fast search
167 }KS_TUNER_TUNING_FLAGS;
169 /* http://msdn.microsoft.com/en-us/library/ff567687%28v=VS.85%29.aspx */
170 typedef enum {
171 KS_TUNER_STRATEGY_PLL = 0X01, // Phase locked loop (PLL) offset tuning
172 KS_TUNER_STRATEGY_SIGNAL_STRENGTH = 0X02, // Signal strength tuning
173 KS_TUNER_STRATEGY_DRIVER_TUNES = 0X04, // Driver tunes
174 }KS_TUNER_STRATEGY;
176 /* http://msdn.microsoft.com/en-us/library/ff562676%28VS.85%29.aspx */
177 typedef struct {
178 union {
179 struct {
180 GUID Set;
181 ULONG Id;
182 ULONG Flags;
184 LONGLONG Alignment;
186 } KSIDENTIFIER, *PKSIDENTIFIER;
188 typedef KSIDENTIFIER KSPROPERTY, *PKSPROPERTY;
190 /* http://msdn.microsoft.com/en-us/library/ff565872%28v=VS.85%29.aspx */
191 typedef struct {
192 KSPROPERTY Property;
193 ULONG Mode; // KSPROPERTY_TUNER_MODE_*
194 ULONG StandardsSupported; // KS_AnalogVideo_* (if Mode is TV or DSS)
195 ULONG MinFrequency; // Hz
196 ULONG MaxFrequency; // Hz
197 ULONG TuningGranularity; // Hz
198 ULONG NumberOfInputs; // number of inputs
199 ULONG SettlingTime; // milliSeconds
200 ULONG Strategy; // KS_TUNER_STRATEGY
201 } KSPROPERTY_TUNER_MODE_CAPS_S, *PKSPROPERTY_TUNER_MODE_CAPS_S;
203 /* http://msdn.microsoft.com/en-us/library/ff565839%28v=VS.85%29.aspx */
204 typedef struct {
205 KSPROPERTY Property;
206 ULONG Frequency; // Hz
207 ULONG LastFrequency; // Hz (last tuned)
208 ULONG TuningFlags; // KS_TUNER_TUNING_FLAGS
209 ULONG VideoSubChannel; // DSS
210 ULONG AudioSubChannel; // DSS
211 ULONG Channel; // VBI decoders
212 ULONG Country; // VBI decoders
213 } KSPROPERTY_TUNER_FREQUENCY_S, *PKSPROPERTY_TUNER_FREQUENCY_S;
215 /* http://msdn.microsoft.com/en-us/library/ff565918%28v=VS.85%29.aspx */
216 typedef struct {
217 KSPROPERTY Property;
218 ULONG Standard; // KS_AnalogVideo_*
219 } KSPROPERTY_TUNER_STANDARD_S, *PKSPROPERTY_TUNER_STANDARD_S;