Go to the documentation of this file.
22 #ifndef AVDEVICE_DSHOW_CAPTURE_H
23 #define AVDEVICE_DSHOW_CAPTURE_H
30 #define WIN32_LEAN_AND_MEAN
32 #define NO_DSHOW_STRSAFE
40 #ifndef EC_DEVICE_LOST
41 #define EC_DEVICE_LOST 0x1f
51 #define dshowdebug(...) ff_dlog(&ff_dshow_context_class_ptr, __VA_ARGS__)
72 #define DECLARE_QUERYINTERFACE(prefix, class, ...) \
74 ff_dshow_##prefix##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
76 struct GUIDoffset ifaces[] = __VA_ARGS__; \
78 dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_QueryInterface(%p, %p, %p)\n", this, riid, ppvObject); \
82 for (i = 0; i < sizeof(ifaces)/sizeof(ifaces[0]); i++) { \
83 if (IsEqualGUID(riid, ifaces[i].iid)) { \
84 void *obj = (void *) ((uint8_t *) this + ifaces[i].offset); \
85 ff_dshow_##prefix##_AddRef(this); \
86 dshowdebug("\tfound %d with offset %d\n", i, ifaces[i].offset); \
87 *ppvObject = (void *) obj; \
91 dshowdebug("\tE_NOINTERFACE\n"); \
93 return E_NOINTERFACE; \
95 #define DECLARE_ADDREF(prefix, class) \
96 unsigned long WINAPI \
97 ff_dshow_##prefix##_AddRef(class *this) \
99 dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_AddRef(%p)\t%ld\n", this, this->ref+1); \
100 return InterlockedIncrement(&this->ref); \
102 #define DECLARE_RELEASE(prefix, class) \
103 unsigned long WINAPI \
104 ff_dshow_##prefix##_Release(class *this) \
106 long ref = InterlockedDecrement(&this->ref); \
107 dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Release(%p)\t%ld\n", this, ref); \
109 ff_dshow_##prefix##_Destroy(this); \
113 #define DECLARE_DESTROY(prefix, class, func) \
114 void ff_dshow_##prefix##_Destroy(class *this) \
116 dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Destroy(%p)\n", this); \
120 CoTaskMemFree(this->vtbl); \
121 CoTaskMemFree(this); \
124 #define DECLARE_CREATE(prefix, class, setup, ...) \
125 class *ff_dshow_##prefix##_Create(__VA_ARGS__) \
127 class *this = CoTaskMemAlloc(sizeof(class)); \
128 void *vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
129 dshowdebug("ff_dshow_"AV_STRINGIFY(prefix)"_Create(%p)\n", this); \
130 if (!this || !vtbl) \
132 ZeroMemory(this, sizeof(class)); \
133 ZeroMemory(vtbl, sizeof(*this->vtbl)); \
138 dshowdebug("created ff_dshow_"AV_STRINGIFY(prefix)" %p\n", this); \
141 ff_dshow_##prefix##_Destroy(this); \
142 dshowdebug("could not create ff_dshow_"AV_STRINGIFY(prefix)"\n"); \
146 #define SETVTBL(vtbl, prefix, fn) \
147 do { (vtbl)->fn = (void *) ff_dshow_##prefix##_##fn; } while(0)
230 IEnumMediaTypesVtbl *
vtbl;
251 IBaseFilterVtbl *
vtbl;
void ff_printGUID(const GUID *g)
enum AVCodecID video_codec_id
int show_audio_crossbar_connection_dialog
AVPixelFormat
Pixel format.
long WINAPI ff_dshow_enummediatypes_Reset(DShowEnumMediaTypes *)
long WINAPI ff_dshow_pin_QueryId(DShowPin *, wchar_t **)
long WINAPI ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *, IMemAllocator **)
long WINAPI ff_dshow_filter_Run(DShowFilter *, REFERENCE_TIME)
static void nothing(void *foo)
unsigned long WINAPI ff_dshow_meminputpin_AddRef(DShowMemInputPin *)
long WINAPI ff_dshow_pin_QueryInterface(DShowPin *, const GUID *, void **)
unsigned long WINAPI ff_dshow_pin_Release(DShowPin *)
IMediaEvent * media_event
long WINAPI ff_dshow_pin_ReceiveConnection(DShowPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI ff_dshow_filter_GetState(DShowFilter *, DWORD, FILTER_STATE *)
void ff_dshow_show_filter_properties(IBaseFilter *pFilter, AVFormatContext *avctx)
Pops up a user dialog allowing them to adjust properties for the given filter, if possible.
char * video_filter_save_file
unsigned int video_frame_num
unsigned long WINAPI ff_dshow_enumpins_AddRef(DShowEnumPins *)
void ff_print_VIDEO_STREAM_CONFIG_CAPS(const VIDEO_STREAM_CONFIG_CAPS *caps)
long WINAPI ff_dshow_pin_EndFlush(DShowPin *)
long WINAPI ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *)
long WINAPI ff_dshow_pin_QueryAccept(DShowPin *, const AM_MEDIA_TYPE *)
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
IBaseFilter * device_filter[2]
unsigned long WINAPI ff_dshow_enummediatypes_Release(DShowEnumMediaTypes *)
char * video_filter_load_file
long WINAPI ff_dshow_filter_Stop(DShowFilter *)
unsigned long WINAPI ff_dshow_enummediatypes_AddRef(DShowEnumMediaTypes *)
long WINAPI ff_dshow_filter_QueryFilterInfo(DShowFilter *, FILTER_INFO *)
DShowPin * capture_pin[2]
void ff_dshow_pin_Destroy(DShowPin *)
long WINAPI ff_dshow_filter_EnumPins(DShowFilter *, IEnumPins **)
long WINAPI ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *, ALLOCATOR_PROPERTIES *)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
DShowFilter * ff_dshow_filter_Create(void *, void *, enum dshowDeviceType)
void ff_print_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *type)
long WINAPI ff_dshow_filter_Pause(DShowFilter *)
IMemInputPinVtbl * imemvtbl
int show_analog_tv_tuner_audio_dialog
HRESULT ff_dshow_try_setup_crossbar_options(ICaptureGraphBuilder2 *graph_builder2, IBaseFilter *device_filter, enum dshowDeviceType devtype, AVFormatContext *avctx)
Given a fully constructed graph, check if there is a cross bar filter, and configure its pins if so.
long WINAPI ff_dshow_enummediatypes_Skip(DShowEnumMediaTypes *, unsigned long)
long WINAPI ff_dshow_enummediatypes_Next(DShowEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
enum dshowDeviceType type
void ff_dshow_filter_Destroy(DShowFilter *)
unsigned long WINAPI ff_dshow_meminputpin_Release(DShowMemInputPin *)
long WINAPI ff_dshow_pin_EndOfStream(DShowPin *)
long WINAPI ff_dshow_enumpins_Skip(DShowEnumPins *, unsigned long)
Describe the class of an AVClass context structure.
void ff_dshow_meminputpin_Destroy(DShowMemInputPin *)
Rational number (pair of numerator and denominator).
long WINAPI ff_dshow_filter_GetSyncSource(DShowFilter *, IReferenceClock **)
long WINAPI ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *, IMemAllocator *, BOOL)
long WINAPI ff_dshow_pin_Disconnect(DShowPin *)
long WINAPI ff_dshow_filter_FindPin(DShowFilter *, const wchar_t *, IPin **)
long WINAPI ff_dshow_pin_BeginFlush(DShowPin *)
void ff_print_AUDIO_STREAM_CONFIG_CAPS(const AUDIO_STREAM_CONFIG_CAPS *caps)
DShowEnumMediaTypes * ff_dshow_enummediatypes_Create(const AM_MEDIA_TYPE *type)
int show_audio_device_dialog
AVCodecID
Identify the syntax and semantics of the bitstream.
long WINAPI ff_dshow_pin_QueryInternalConnections(DShowPin *, IPin **, unsigned long *)
long WINAPI ff_dshow_pin_QueryPinInfo(DShowPin *, PIN_INFO *)
long WINAPI ff_dshow_filter_QueryInterface(DShowFilter *, const GUID *, void **)
long WINAPI ff_dshow_enumpins_Clone(DShowEnumPins *, DShowEnumPins **)
AVRational requested_framerate
int use_video_device_timestamps
struct DShowMemInputPin DShowMemInputPin
long WINAPI ff_dshow_pin_QueryDirection(DShowPin *, PIN_DIRECTION *)
long WINAPI ff_dshow_enumpins_Reset(DShowEnumPins *)
int crossbar_audio_input_pin_number
long WINAPI ff_dshow_pin_NewSegment(DShowPin *, REFERENCE_TIME, REFERENCE_TIME, double)
void ff_dshow_enumpins_Destroy(DShowEnumPins *)
int show_video_device_dialog
long WINAPI ff_dshow_filter_GetClassID(DShowFilter *, CLSID *)
long WINAPI ff_dshow_filter_JoinFilterGraph(DShowFilter *, IFilterGraph *, const wchar_t *)
char * audio_filter_save_file
DShowEnumPins * ff_dshow_enumpins_Create(DShowPin *pin, DShowFilter *filter)
long WINAPI ff_dshow_meminputpin_Receive(DShowMemInputPin *, IMediaSample *)
long WINAPI ff_dshow_pin_EnumMediaTypes(DShowPin *, IEnumMediaTypes **)
void ff_dshow_enummediatypes_Destroy(DShowEnumMediaTypes *)
long WINAPI ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *, const GUID *, void **)
unsigned long WINAPI ff_dshow_filter_AddRef(DShowFilter *)
enum AVPixelFormat pixel_format
DShowFilter * capture_filter[2]
int crossbar_video_input_pin_number
long WINAPI ff_dshow_enumpins_QueryInterface(DShowEnumPins *, const GUID *, void **)
long WINAPI ff_dshow_pin_ConnectedTo(DShowPin *, IPin **)
const AVClass * ff_dshow_context_class_ptr
long WINAPI ff_dshow_filter_SetSyncSource(DShowFilter *, IReferenceClock *)
int show_analog_tv_tuner_dialog
long WINAPI ff_dshow_pin_ConnectionMediaType(DShowPin *, AM_MEDIA_TYPE *)
long WINAPI ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *, IMediaSample **, long, long *)
unsigned long WINAPI ff_dshow_pin_AddRef(DShowPin *)
char * audio_filter_load_file
long WINAPI ff_dshow_pin_Connect(DShowPin *, IPin *, const AM_MEDIA_TYPE *)
int show_video_crossbar_connection_dialog
long WINAPI ff_dshow_enummediatypes_QueryInterface(DShowEnumMediaTypes *, const GUID *, void **)
DShowPin * ff_dshow_pin_Create(DShowFilter *filter)
long WINAPI ff_dshow_enummediatypes_Clone(DShowEnumMediaTypes *, DShowEnumMediaTypes **)
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type)
unsigned long WINAPI ff_dshow_enumpins_Release(DShowEnumPins *)
long WINAPI ff_dshow_enumpins_Next(DShowEnumPins *, unsigned long, IPin **, unsigned long *)
unsigned long WINAPI ff_dshow_filter_Release(DShowFilter *)
long WINAPI ff_dshow_filter_QueryVendorInfo(DShowFilter *, wchar_t **)
char * device_unique_name[2]