summaryrefslogtreecommitdiffstats
path: root/stream/tvi_dshow.h
blob: dc5a7c37418899d1fdfef7bc258b341acc5c7231 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
#ifndef MPLAYER_TVI_DSHOW_H
#define MPLAYER_TVI_DSHOW_H

/// \defgroup tvi_dshow TV driver (Directshow)

#define INITGUID
#include <inttypes.h>
#include <windows.h>
//#include <ole2.h>
#include <vfw.h>
#include "loader/dshow/mediatype.h"
#include "loader/dshow/guids.h"

#define wtoa(strW,strA,lenA) WideCharToMultiByte(0,0,strW,-1,strA,lenA,NULL,NULL)
#define atow(strA,strW,lenW) MultiByteToWideChar(0,0,strA,strlen(strA),strW,lenW)

typedef struct DISPPARAMS *LPDISPPARAMS;
typedef struct IFileSinkFilter *LPFILESINKFILTER;
typedef struct IAMCopyCaptureFileProgress *LPAMCOPYCAPTUREFILEPROGRESS;
typedef struct IErrorLog *LPERRORLOG;
typedef struct IAMTunerNotification *LPAMTUNERNOTIFICATION;
typedef struct IFilterGraph *LPFILTERGRAPH;
typedef struct IBaseFilter *LPBASEFILTER;
typedef struct IPin *LPPIN;
typedef struct IEnumPins *LPENUMPINS;
typedef struct IEnumFilters *LPENUMFILTERS;
typedef struct IEnumMediaTypes *LPENUMMEDIATYPES;
typedef struct IReferenceClock *LPREFERENCECLOCK;
typedef struct IMediaSample *LPMEDIASAMPLE;
typedef struct IVideoWindow *LPVIDEOWINDOW;

typedef struct
{
    long cBuffers;
    long cbBuffer;
    long cbAlign;
    long cbPrefix;
}ALLOCATOR_PROPERTIES;

typedef
    enum tagTunerInputType { TunerInputCable = 0,
    TunerInputAntenna = TunerInputCable + 1
} TunerInputType;
typedef enum tagAMTunerModeType {
    AMTUNER_MODE_DEFAULT = 0x0000,
    AMTUNER_MODE_TV = 0x0001,
    AMTUNER_MODE_FM_RADIO = 0x0002,
    AMTUNER_MODE_AM_RADIO = 0x0004,
    AMTUNER_MODE_DSS = 0x0008
} AMTunerModeType;
enum tagAMTunerSubChannel { AMTUNER_SUBCHAN_NO_TUNE = -2,
    AMTUNER_SUBCHAN_DEFAULT = -1
} AMTunerSubChannel;
typedef enum tagVideoProcAmpProperty {
    VideoProcAmp_Brightness,
    VideoProcAmp_Contrast,
    VideoProcAmp_Hue,
    VideoProcAmp_Saturation,
    VideoProcAmp_Sharpness,
    VideoProcAmp_Gamma,
    VideoProcAmp_ColorEnable,
    VideoProcAmp_WhiteBalance,
    VideoProcAmp_BacklightCompensation,
    VideoProcAmp_Gain
} VideoProcAmpProperty;

typedef long OAFilterState;
typedef
    enum tagAnalogVideoStandard { AnalogVideo_None = 0,
    AnalogVideo_NTSC_M = 0x1,
    AnalogVideo_NTSC_M_J = 0x2,
    AnalogVideo_NTSC_433 = 0x4,
    AnalogVideo_PAL_B = 0x10,
    AnalogVideo_PAL_D = 0x20,
    AnalogVideo_PAL_G = 0x40,
    AnalogVideo_PAL_H = 0x80,
    AnalogVideo_PAL_I = 0x100,
    AnalogVideo_PAL_M = 0x200,
    AnalogVideo_PAL_N = 0x400,
    AnalogVideo_PAL_60 = 0x800,
    AnalogVideo_SECAM_B = 0x1000,
    AnalogVideo_SECAM_D = 0x2000,
    AnalogVideo_SECAM_G = 0x4000,
    AnalogVideo_SECAM_H = 0x8000,
    AnalogVideo_SECAM_K = 0x10000,
    AnalogVideo_SECAM_K1 = 0x20000,
    AnalogVideo_SECAM_L = 0x40000,
    AnalogVideo_SECAM_L1 = 0x80000
} AnalogVideoStandard;


typedef LONG_PTR OAHWND;
typedef enum tagPhysicalConnectorType { PhysConn_Video_Tuner = 1,
    PhysConn_Video_Composite = PhysConn_Video_Tuner + 1,
    PhysConn_Video_SVideo = PhysConn_Video_Composite + 1,
    PhysConn_Video_RGB = PhysConn_Video_SVideo + 1,
    PhysConn_Video_YRYBY = PhysConn_Video_RGB + 1,
    PhysConn_Video_SerialDigital = PhysConn_Video_YRYBY + 1,
    PhysConn_Video_ParallelDigital = PhysConn_Video_SerialDigital + 1,
    PhysConn_Video_SCSI = PhysConn_Video_ParallelDigital + 1,
    PhysConn_Video_AUX = PhysConn_Video_SCSI + 1,
    PhysConn_Video_1394 = PhysConn_Video_AUX + 1,
    PhysConn_Video_USB = PhysConn_Video_1394 + 1,
    PhysConn_Video_VideoDecoder = PhysConn_Video_USB + 1,
    PhysConn_Video_VideoEncoder = PhysConn_Video_VideoDecoder + 1,
    PhysConn_Video_SCART = PhysConn_Video_VideoEncoder + 1,
    PhysConn_Video_Black = PhysConn_Video_SCART + 1,
    PhysConn_Audio_Tuner = 0x1000,
    PhysConn_Audio_Line = PhysConn_Audio_Tuner + 1,
    PhysConn_Audio_Mic = PhysConn_Audio_Line + 1,
    PhysConn_Audio_AESDigital = PhysConn_Audio_Mic + 1,
    PhysConn_Audio_SPDIFDigital = PhysConn_Audio_AESDigital + 1,
    PhysConn_Audio_SCSI = PhysConn_Audio_SPDIFDigital + 1,
    PhysConn_Audio_AUX = PhysConn_Audio_SCSI + 1,
    PhysConn_Audio_1394 = PhysConn_Audio_AUX + 1,
    PhysConn_Audio_USB = PhysConn_Audio_1394 + 1,
    PhysConn_Audio_AudioDecoder = PhysConn_Audio_USB + 1
} PhysicalConnectorType;

typedef struct VIDEO_STREAM_CONFIG_CAPS {
    GUID guid;			// will be MEDIATYPE_Video
    ULONG VideoStandard;	// logical OR of all AnalogVideoStandards
    // supported
    SIZE InputSize;		// the inherent size of the incoming signal
    // (every pixel unique)
    SIZE MinCroppingSize;	// smallest rcSrc cropping rect allowed
    SIZE MaxCroppingSize;	// largest rcSrc cropping rect allowed
    int CropGranularityX;	// granularity of cropping size
    int CropGranularityY;
    int CropAlignX;		// alignment of cropping rect
    int CropAlignY;
    SIZE MinOutputSize;		// smallest bitmap stream can produce
    SIZE MaxOutputSize;		// largest  bitmap stream can produce
    int OutputGranularityX;	// granularity of output bitmap size
    int OutputGranularityY;
    int StretchTapsX;		// 0, no stretch, 1 pix dup, 2 interp, ...
    int StretchTapsY;		//    Describes quality of hardware scaler
    int ShrinkTapsX;		//
    int ShrinkTapsY;		//
    LONGLONG MinFrameInterval;	// 100 nS units
    LONGLONG MaxFrameInterval;
    LONG MinBitsPerSecond;
    LONG MaxBitsPerSecond;
} VIDEO_STREAM_CONFIG_CAPS, *PVIDEO_STREAM_CONFIG_CAPS;

typedef struct AUDIO_STREAM_CONFIG_CAPS {
    GUID guid;
    ULONG MinimumChannels;
    ULONG MaximumChannels;
    ULONG ChannelsGranularity;
    ULONG MinimumBitsPerSample;
    ULONG MaximumBitsPerSample;
    ULONG BitsPerSampleGranularity;
    ULONG MinimumSampleFrequency;
    ULONG MaximumSampleFrequency;
    ULONG SampleFrequencyGranularity;
} AUDIO_STREAM_CONFIG_CAPS;

typedef enum tagVideoProcAmpFlags {
    VideoProcAmp_Flags_Auto = 0x0001,
    VideoProcAmp_Flags_Manual = 0x0002
} VideoProcAmpFlags;
typedef enum {
    PINDIR_INPUT = 0,
    PINDIR_OUTPUT
} PIN_DIRECTION;

#define KSPROPERTY_SUPPORT_GET  1
#define KSPROPERTY_SUPPORT_SET  2
typedef struct {
    GUID Set;
    ULONG Id;
    ULONG Flags;
} KSIDENTIFIER;

typedef KSIDENTIFIER KSPROPERTY;


typedef struct {
    KSPROPERTY Property;
    ULONG Mode;			// IN: KSPROPERTY_TUNER_MODE
    ULONG StandardsSupported;	// KS_AnalogVideo_* (if TV or DSS)
    ULONG MinFrequency;		// Hz
    ULONG MaxFrequency;		// Hz
    ULONG TuningGranularity;	// Hz
    ULONG NumberOfInputs;	// count of inputs
    ULONG SettlingTime;		// milliSeconds
    ULONG Strategy;		// KS_TUNER_STRATEGY
} KSPROPERTY_TUNER_MODE_CAPS_S, *PKSPROPERTY_TUNER_MODE_CAPS_S;

typedef struct {
    KSPROPERTY Property;
    ULONG Mode;			// IN: KSPROPERTY_TUNER_MODE
} KSPROPERTY_TUNER_MODE_S, *PKSPROPERTY_TUNER_MODE_S;

typedef struct {
    KSPROPERTY Property;
    ULONG Frequency;		// Hz
    ULONG LastFrequency;	// Hz (last known good)
    ULONG TuningFlags;		// KS_TUNER_TUNING_FLAGS
    ULONG VideoSubChannel;	// DSS
    ULONG AudioSubChannel;	// DSS
    ULONG Channel;		// VBI decoders
    ULONG Country;		// VBI decoders
} KSPROPERTY_TUNER_FREQUENCY_S, *PKSPROPERTY_TUNER_FREQUENCY_S;
typedef struct {
    KSPROPERTY Property;
    ULONG CurrentFrequency;
    ULONG PLLOffset;
    ULONG SignalStrength;
    ULONG Busy;
} KSPROPERTY_TUNER_STATUS_S, *PKSPROPERTY_TUNER_STATUS_S;
typedef enum {
    KS_TUNER_TUNING_EXACT = 1,	// No fine tuning
    KS_TUNER_TUNING_FINE,	// Fine grained search
    KS_TUNER_TUNING_COARSE,	// Coarse search
} KS_TUNER_TUNING_FLAGS;

typedef enum {
    KSPROPERTY_TUNER_CAPS,	// R  -overall device capabilities
    KSPROPERTY_TUNER_MODE_CAPS,	// R  -capabilities in this mode
    KSPROPERTY_TUNER_MODE,	// RW -set a mode (TV, FM, AM, DSS)
    KSPROPERTY_TUNER_STANDARD,	// R  -get TV standard (only if TV mode)
    KSPROPERTY_TUNER_FREQUENCY,	// RW -set/get frequency
    KSPROPERTY_TUNER_INPUT,	// RW -select an input
    KSPROPERTY_TUNER_STATUS,	// R  -tuning status
    KSPROPERTY_TUNER_IF_MEDIUM	// R O-Medium for IF or Transport Pin
} KSPROPERTY_TUNER;
typedef enum {
    KS_TUNER_STRATEGY_PLL = 0X01,	// Tune by PLL offset
    KS_TUNER_STRATEGY_SIGNAL_STRENGTH = 0X02,	// Tune by signal strength
    KS_TUNER_STRATEGY_DRIVER_TUNES = 0X04,	// Driver does fine tuning
} KS_TUNER_STRATEGY;
typedef enum tagTVAudioMode {
    AMTVAUDIO_MODE_MONO = 0x0001,
    AMTVAUDIO_MODE_STEREO = 0x0002,
    AMTVAUDIO_MODE_LANG_A = 0x0010,
    AMTVAUDIO_MODE_LANG_B = 0x0020,
    AMTVAUDIO_MODE_LANG_C = 0x0040,
} TVAudioMode;

typedef struct FilterInfo {
    WCHAR achName[128];
    LPFILTERGRAPH pGraph;
} FILTER_INFO;

typedef struct PinInfo {
    LPBASEFILTER pFilter;
    PIN_DIRECTION dir;
    unsigned short achName[128];
} PIN_INFO;
//-----------------------------------


#undef INTERFACE
#define INTERFACE IPin
DECLARE_INTERFACE(IPin)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(Connect) (THIS_ IPin *, AM_MEDIA_TYPE *);
    STDMETHOD(ReceiveConnection) (THIS_ IPin *, const AM_MEDIA_TYPE *);
    STDMETHOD(Disconnect) (THIS);
    STDMETHOD(ConnectedTo) (THIS_ IPin **);
    STDMETHOD(ConnectionMediaType) (THIS_ AM_MEDIA_TYPE * pmt);
    STDMETHOD(QueryPinInfo) (THIS_ PIN_INFO *);
    STDMETHOD(QueryDirection) (THIS_ PIN_DIRECTION *);
    STDMETHOD(QueryId) (THIS_ unsigned short **);
    STDMETHOD(QueryAccept) (THIS_ const AM_MEDIA_TYPE *);
    STDMETHOD(EnumMediaTypes) (THIS_ LPENUMMEDIATYPES *);
    STDMETHOD(QueryInternalConnections) (THIS_ IPin **, unsigned long *);
    STDMETHOD(EndOfStream) (THIS);
    STDMETHOD(BeginFlush) (THIS);
    STDMETHOD(EndFlush) (THIS);
    STDMETHOD(NewSegment) (THIS_ REFERENCE_TIME, REFERENCE_TIME, double);
};

#undef INTERFACE
#define INTERFACE IBaseFilter
DECLARE_INTERFACE(IBaseFilter)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(GetClassID) (THIS_ CLSID * pClassID);
    STDMETHOD(Stop) (THIS);
    STDMETHOD(Pause) (THIS);
    STDMETHOD(Run) (THIS_ REFERENCE_TIME tStart);
    STDMETHOD(GetState) (THIS_ unsigned long, void *);
    STDMETHOD(SetSyncSource) (THIS_ LPREFERENCECLOCK);
    STDMETHOD(GetSyncSource) (THIS_ LPREFERENCECLOCK *);
    STDMETHOD(EnumPins) (THIS_ LPENUMPINS *);
    STDMETHOD(FindPin) (THIS_ const unsigned short *, LPPIN *);
    STDMETHOD(QueryFilterInfo) (THIS_ void *);
    STDMETHOD(JoinFilterGraph) (THIS_ LPFILTERGRAPH,
				const unsigned short *);
    STDMETHOD(QueryVendorInfo) (THIS_ unsigned short **);
};

#undef INTERFACE
#define INTERFACE IAMTVTuner
DECLARE_INTERFACE(IAMTVTuner)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(put_Channel) (THIS_ long, long, long);
    STDMETHOD(get_Channel) (THIS_ long *, long *, long *);
    STDMETHOD(ChannelMinMax) (THIS_ long *, long *);
    STDMETHOD(put_CountryCode) (THIS_ long);
    STDMETHOD(get_CountryCode) (THIS_ long *);
    STDMETHOD(put_TuningSpace) (THIS_ long);
    STDMETHOD(get_TuningSpace) (THIS_ long *);
    STDMETHOD(Logon) (THIS_ HANDLE);
    STDMETHOD(Logout) (IAMTVTuner *);
    STDMETHOD(SignalPresen) (THIS_ long *);
    STDMETHOD(put_Mode) (THIS_ AMTunerModeType);
    STDMETHOD(get_Mode) (THIS_ AMTunerModeType *);
    STDMETHOD(GetAvailableModes) (THIS_ long *);
    STDMETHOD(RegisterNotificationCallBack) (THIS_ LPAMTUNERNOTIFICATION,
					     long);
    STDMETHOD(UnRegisterNotificationCallBack) (THIS_
					       LPAMTUNERNOTIFICATION);
    STDMETHOD(get_AvailableTVFormats) (THIS_ long *);
    STDMETHOD(get_TVFormat) (THIS_ long *);
    STDMETHOD(AutoTune) (THIS_ long, long *);
    STDMETHOD(StoreAutoTune) (IAMTVTuner *);
    STDMETHOD(get_NumInputConnections) (THIS_ long *);
    STDMETHOD(put_InputType) (THIS_ long, TunerInputType);
    STDMETHOD(get_InputType) (THIS_ long, TunerInputType *);
    STDMETHOD(put_ConnectInput) (THIS_ long);
    STDMETHOD(get_ConnectInput) (THIS_ long *);
    STDMETHOD(get_VideoFrequency) (THIS_ long *);
    STDMETHOD(get_AudioFrequency) (THIS_ long *);
};

#undef INTERFACE
#define INTERFACE IMediaControl
DECLARE_INTERFACE(IMediaControl)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(GetTypeInfoCount) (THIS_ UINT *);
    STDMETHOD(GetTypeInfo) (THIS_ UINT, LCID, LPTYPEINFO *);
    STDMETHOD(GetIDsOfNames) (THIS_ REFIID, LPOLESTR *, UINT, LCID,
			      DISPID *);
    STDMETHOD(Invoke) (THIS_ DISPID, REFIID, LCID, WORD, LPDISPPARAMS,
		       VARIANT *, EXCEPINFO *, UINT *);
    STDMETHOD(Run) (THIS);
    STDMETHOD(Pause) (THIS);
    STDMETHOD(Stop) (THIS);
    STDMETHOD(GetState) (THIS_ LONG, OAFilterState *);
    STDMETHOD(RenderFile) (THIS_ BSTR);
    STDMETHOD(AddSourceFilter) (THIS_ BSTR, LPDISPATCH *);
    STDMETHOD(get_FilterCollection) (THIS_ LPDISPATCH *);
    STDMETHOD(get_RegFilterCollection) (THIS_ LPDISPATCH *);
    STDMETHOD(StopWhenReady) (IMediaControl *);
};

#undef INTERFACE
#define INTERFACE IGraphBuilder
DECLARE_INTERFACE(IGraphBuilder)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(AddFilter) (THIS_ IBaseFilter *, LPCWSTR);
    STDMETHOD(RemoveFilter) (THIS_ IBaseFilter *);
    STDMETHOD(EnumFilters) (THIS_ LPENUMFILTERS *);
    STDMETHOD(FindFilterByName) (THIS_ LPCWSTR, IBaseFilter **);
    STDMETHOD(ConnectDirect) (THIS_ IPin *, IPin *, const AM_MEDIA_TYPE *);
    STDMETHOD(Reconnect) (THIS_ IPin *);
    STDMETHOD(Disconnect) (THIS_ IPin *);
    STDMETHOD(SetDefaultSyncSource) (IGraphBuilder *);
    STDMETHOD(Connect) (THIS_ IPin *, IPin *);
    STDMETHOD(Render) (THIS_ IPin *);
    STDMETHOD(RenderFile) (THIS_ LPCWSTR, LPCWSTR);
    STDMETHOD(AddSourceFilter) (THIS_ LPCWSTR, LPCWSTR, IBaseFilter **);
    STDMETHOD(SetLogFile) (THIS_ DWORD_PTR);
    STDMETHOD(Abort) (IGraphBuilder *);
    STDMETHOD(ShouldOperationContinue) (IGraphBuilder *);
};


#undef INTERFACE
#define INTERFACE ICaptureGraphBuilder2
DECLARE_INTERFACE(ICaptureGraphBuilder2)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(SetFiltergraph) (THIS_ IGraphBuilder *);
    STDMETHOD(GetFiltergraph) (THIS_ IGraphBuilder **);
    STDMETHOD(SetOutputFileName) (THIS_ const GUID *, LPCOLESTR,
				  IBaseFilter **, LPFILESINKFILTER *);
    STDMETHOD(FindInterface) (THIS_ const GUID *, const GUID *,
			      IBaseFilter *, REFIID, void **);
    STDMETHOD(RenderStream) (THIS_ const GUID *, const GUID *, IUnknown *,
			     IBaseFilter *, IBaseFilter *);
    STDMETHOD(ControlStream) (THIS_ const GUID *, const GUID *,
			      IBaseFilter *, REFERENCE_TIME *,
			      REFERENCE_TIME *, WORD, WORD);
    STDMETHOD(AllocCapFile) (THIS_ LPCOLESTR, DWORDLONG);
    STDMETHOD(CopyCaptureFile) (THIS_ LPOLESTR, LPOLESTR, int,
				LPAMCOPYCAPTUREFILEPROGRESS);
    STDMETHOD(FindPin) (THIS_ IUnknown *, PIN_DIRECTION, const GUID *,
			const GUID *, BOOL, int, IPin **);
};

#undef INTERFACE
#define INTERFACE ICreateDevEnum
DECLARE_INTERFACE(ICreateDevEnum)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(CreateClassEnumerator) (THIS_ REFCLSID, IEnumMoniker **,
				      DWORD);
};

#undef INTERFACE
#define INTERFACE IAMCrossbar
DECLARE_INTERFACE(IAMCrossbar)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(get_PinCounts) (THIS_ long *, long *);
    STDMETHOD(CanRoute) (THIS_ long, long);
    STDMETHOD(Route) (THIS_ long, long);
    STDMETHOD(get_IsRoutedTo) (THIS_ long, long *);
    STDMETHOD(get_CrossbarPinInfo) (THIS_ BOOL, long, long *, long *);
};

#undef INTERFACE
#define INTERFACE IPropertyBag
DECLARE_INTERFACE(IPropertyBag)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(Read) (THIS_ LPCOLESTR, LPVARIANT, LPERRORLOG);
    STDMETHOD(Write) (THIS_ LPCOLESTR, LPVARIANT);
};

#undef INTERFACE
#define INTERFACE IAMStreamConfig
DECLARE_INTERFACE(IAMStreamConfig)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    HRESULT(STDMETHODCALLTYPE * SetFormat) (THIS_ AM_MEDIA_TYPE *);
    HRESULT(STDMETHODCALLTYPE * GetFormat) (THIS_ AM_MEDIA_TYPE **);
    HRESULT(STDMETHODCALLTYPE * GetNumberOfCapabilities) (THIS_ int *,int *);
    HRESULT(STDMETHODCALLTYPE * GetStreamCaps) (THIS_ int,AM_MEDIA_TYPE **, BYTE *);
};

#undef INTERFACE
#define INTERFACE IAMVideoProcAmp
DECLARE_INTERFACE(IAMVideoProcAmp)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(GetRange) (THIS_ long, long *, long *, long *, long *,long *);
    STDMETHOD(Set) (THIS_ long, long, long);
    STDMETHOD(Get) (THIS_ long, long *, long *);
};

#undef INTERFACE
#define INTERFACE IKsPropertySet
DECLARE_INTERFACE(IKsPropertySet)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    HRESULT(STDMETHODCALLTYPE * Set) (THIS_ REFGUID, DWORD, LPVOID, DWORD,LPVOID, DWORD);
    HRESULT(STDMETHODCALLTYPE * Get) (THIS_ REFGUID, DWORD, LPVOID, DWORD,LPVOID, DWORD, DWORD *);
    HRESULT(STDMETHODCALLTYPE * QuerySupported) (THIS_ REFGUID, DWORD,DWORD *);
};

#undef INTERFACE
#define INTERFACE IAMAnalogVideoDecoder
DECLARE_INTERFACE(IAMAnalogVideoDecoder)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(get_AvailableTVFormats) (THIS_ long *);
    STDMETHOD(put_TVFormat) (THIS_ long);
    STDMETHOD(get_TVFormat) (THIS_ long *);
    STDMETHOD(get_HorizontalLocked) (THIS_ long *);
    STDMETHOD(put_VCRHorizontalLocking) (THIS_ long);
    STDMETHOD(get_VCRHorizontalLocking) (THIS_ long *);
    STDMETHOD(get_NumberOfLines) (THIS_ long *);
    STDMETHOD(put_OutputEnable) (THIS_ long);
    STDMETHOD(get_OutputEnable) (THIS_ long *);
};

#undef INTERFACE
#define INTERFACE IAMTVAudio
DECLARE_INTERFACE(IAMTVAudio)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(GetHardwareSupportedTVAudioModes) (THIS_ long *);
    STDMETHOD(GetAvailableTVAudioModes) (THIS_ long *);
    STDMETHOD(get_TVAudioMode) (THIS_ long *);
    STDMETHOD(put_TVAudioMode) (THIS_ long);
    STDMETHOD(RegisterNotificationCallBack) (THIS_ LPAMTUNERNOTIFICATION,
					     long);
    STDMETHOD(UnRegisterNotificationCallBack) (THIS_
					       LPAMTUNERNOTIFICATION);
};


#undef INTERFACE
#define INTERFACE ISampleGrabberCB
DECLARE_INTERFACE(ISampleGrabberCB)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(SampleCB) (THIS_ double, LPMEDIASAMPLE);
    STDMETHOD(BufferCB) (THIS_ double, BYTE *, long);
};

#undef INTERFACE
#define INTERFACE ISampleGrabber
DECLARE_INTERFACE(ISampleGrabber)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(SetOneShot) (THIS_ BOOL);
    STDMETHOD(SetMediaType) (THIS_ const AM_MEDIA_TYPE *);
    STDMETHOD(GetConnectedMediaType) (THIS_ AM_MEDIA_TYPE *);
    STDMETHOD(SetBufferSamples) (THIS_ BOOL);
    STDMETHOD(GetCurrentBuffer) (THIS_ long *, long *);
    STDMETHOD(GetCurrentSample) (THIS_ LPMEDIASAMPLE *);
    STDMETHOD(SetCallback) (THIS_ ISampleGrabberCB *, long);
};

#undef INTERFACE
#define INTERFACE IFilterGraph
DECLARE_INTERFACE(IFilterGraph)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(AddFilter) (THIS_ LPBASEFILTER, LPCWSTR);
    STDMETHOD(RemoveFilter) (THIS_ LPBASEFILTER);
    STDMETHOD(EnumFilters) (THIS_ LPENUMFILTERS *);
    STDMETHOD(FindFilterByName) (THIS_ LPCWSTR, LPBASEFILTER *);
    STDMETHOD(ConnectDirect) (THIS_ IPin *, IPin *, const AM_MEDIA_TYPE *);
    STDMETHOD(Reconnect) (THIS_ LPPIN);
    STDMETHOD(Disconnect) (THIS_ LPPIN);
    STDMETHOD(SetDefaultSyncSource) (THIS);
};

#undef INTERFACE
#define INTERFACE IAMAudioInputMixer
DECLARE_INTERFACE(IAMAudioInputMixer)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(put_Enable) (THIS_ BOOL);
    STDMETHOD(get_Enable) (THIS_ BOOL *);
    STDMETHOD(put_Mono) (THIS_ BOOL);
    STDMETHOD(get_Mono) (THIS_ BOOL *);
    STDMETHOD(put_MixLevel) (THIS_ double);
    STDMETHOD(get_MixLevel) (THIS_ double *);
    STDMETHOD(put_Pan) (THIS_ double);
    STDMETHOD(get_Pan) (THIS_ double *);
    STDMETHOD(put_Loudness) (THIS_ BOOL);
    STDMETHOD(get_Loudness) (THIS_ BOOL *);
    STDMETHOD(put_Treble) (THIS_ double);
    STDMETHOD(get_Treble) (THIS_ double *);
    STDMETHOD(get_TrebleRange) (THIS_ double *);
    STDMETHOD(put_Bass) (THIS_ double);
    STDMETHOD(get_Bass) (THIS_ double *);
    STDMETHOD(get_BassRange) (THIS_ double *);
};


#undef INTERFACE
#define INTERFACE IMediaSample
DECLARE_INTERFACE(IMediaSample)
{
    STDMETHOD(QueryInterface) (THIS_ const GUID *, void **);
    STDMETHOD_(long, AddRef) (THIS);
    STDMETHOD_(long, Release) (THIS);
    STDMETHOD(GetPointer )(THIS_ unsigned char** );
    STDMETHOD_(LONG,GetSize )(THIS);
    STDMETHOD(GetTime )(THIS_ REFERENCE_TIME* ,REFERENCE_TIME* );
    STDMETHOD(SetTime )(THIS_ REFERENCE_TIME* ,REFERENCE_TIME* );
    STDMETHOD(IsSyncPoint )(THIS);
    STDMETHOD(SetSyncPoint )(THIS_ long );
    STDMETHOD(IsPreroll )(THIS);
    STDMETHOD(SetPreroll )(THIS_ long );
    STDMETHOD_(LONG,GetActualDataLength)(THIS);
    STDMETHOD(SetActualDataLength )(THIS_ long );
    STDMETHOD(GetMediaType )(THIS_ AM_MEDIA_TYPE** );
    STDMETHOD(SetMediaType )(THIS_ AM_MEDIA_TYPE* );
    STDMETHOD(IsDiscontinuity )(THIS);
    STDMETHOD(SetDiscontinuity )(THIS_ long );
    STDMETHOD(GetMediaTime )(THIS_ long long* ,long long* );
    STDMETHOD(SetMediaTime )(THIS_ long long* ,long long* );
};


#undef INTERFACE
#define INTERFACE IAMBufferNegotiation
DECLARE_INTERFACE(IAMBufferNegotiation)
{
    STDMETHOD(QueryInterface )(THIS_ REFIID ,void **);
    STDMETHOD_(ULONG,AddRef )(THIS);
    STDMETHOD_(ULONG,Release )(THIS);
    STDMETHOD(SuggestAllocatorProperties )(THIS_ const ALLOCATOR_PROPERTIES *);
    STDMETHOD(GetAllocatorProperties )(THIS_ ALLOCATOR_PROPERTIES *);
};


#undef INTERFACE
#define INTERFACE IVideoWindow
DECLARE_INTERFACE(IVideoWindow)
{
    STDMETHOD(QueryInterface )(THIS_ REFIID ,void **);
    STDMETHOD_(ULONG,AddRef )(THIS);
    STDMETHOD_(ULONG,Release )(THIS);
    STDMETHOD(GetTypeInfoCount) (THIS_ UINT * );
    STDMETHOD(GetTypeInfo) (THIS_  UINT ,LCID , ITypeInfo ** );
    STDMETHOD(GetIDsOfNames) (THIS_  REFIID ,LPOLESTR * , UINT ,LCID , DISPID * );
    STDMETHOD(Invoke) (THIS_  DISPID ,REFIID , LCID , WORD ,void *, VARIANT * ,EXCEPINFO * , UINT * );
    STDMETHOD(put_Caption) (THIS_  BSTR );
    STDMETHOD(get_Caption) (THIS_  BSTR * );
    STDMETHOD(put_WindowStyle) (THIS_ long );
    STDMETHOD(get_WindowStyle) (THIS_ long *);
    STDMETHOD(put_WindowStyleEx) (THIS_ long );
    STDMETHOD(get_WindowStyleEx) (THIS_ long *);
    STDMETHOD(put_AutoShow) (THIS_  long );
    STDMETHOD(get_AutoShow) (THIS_  long *);
    STDMETHOD(put_WindowState) (THIS_ long );
    STDMETHOD(get_WindowState) (THIS_ long *);
    STDMETHOD(put_BackgroundPalette) (THIS_ long );
    STDMETHOD(get_BackgroundPalette) (THIS_ long *);
    STDMETHOD(put_Visible) (THIS_  long );
    STDMETHOD(get_Visible) (THIS_  long *);
    STDMETHOD(put_Left) (THIS_  long );
    STDMETHOD(get_Left) (THIS_  long *);
    STDMETHOD(put_Width) (THIS_  long );
    STDMETHOD(get_Width) (THIS_  long *);
    STDMETHOD(put_Top) (THIS_  long );
    STDMETHOD(get_Top) (THIS_  long *);
    STDMETHOD(put_Height) (THIS_  long );
    STDMETHOD(get_Height) (THIS_  long *);
    STDMETHOD(put_Owner) (THIS_  OAHWND );
    STDMETHOD(get_Owner) (THIS_  OAHWND * );
    STDMETHOD(put_MessageDrain) (THIS_  OAHWND );
    STDMETHOD(get_MessageDrain) (THIS_ OAHWND * );
    STDMETHOD(get_BorderColor) (THIS_  long *);
    STDMETHOD(put_BorderColor) (THIS_  long );
    STDMETHOD(get_FullScreenMode) (THIS_ long *);
    STDMETHOD(put_FullScreenMode) (THIS_ long );
    STDMETHOD(SetWindowForeground) (THIS_ long );
    STDMETHOD(NotifyOwnerMessage) (THIS_  OAHWND ,long , LONG_PTR ,LONG_PTR );
    STDMETHOD(SetWindowPosition) (THIS_  long ,long , long ,long );
    STDMETHOD(GetWindowPosition) (THIS_  long *,long *, long *,long *);
    STDMETHOD(GetMinIdealImageSize) (THIS_ long *, long *);
    STDMETHOD(GetMaxIdealImageSize) (THIS_ long *, long *);
    STDMETHOD(GetRestorePosition) (THIS_  long *,long *, long *,long *);
    STDMETHOD(HideCursor) (THIS_  long );
    STDMETHOD(IsCursorHidden) (THIS_ long *);
};

DECLARE_ENUMERATOR_(IEnumFilters, LPBASEFILTER);
DECLARE_ENUMERATOR_(IEnumPins, LPPIN);
DECLARE_ENUMERATOR_(IEnumMediaTypes, AM_MEDIA_TYPE *);

#define OLE_CALL(p,method)               (p)->lpVtbl->method(p)
#ifdef __GNUC__
#define OLE_CALL_ARGS(p, method, a1, args...) (p)->lpVtbl->method(p, a1, ##args)
#else
#define OLE_CALL_ARGS(p, method, ...) (p)->lpVtbl->method(p, __VA_ARGS__)
#endif
#define OLE_RELEASE_SAFE(p) if(p){ OLE_CALL((IUnknown*)p,Release); p=NULL;}
#define OLE_QUERYINTERFACE(p,iface,ptr) OLE_CALL_ARGS((IUnknown*)p,QueryInterface,&iface,(void*)&ptr)

#endif	/* MPLAYER_TVI_DSHOW_H */