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
39 #ifndef EC_DEVICE_LOST
40 #define EC_DEVICE_LOST 0x1f
50 #define dshowdebug(...) ff_dlog(&ff_dshow_context_class_ptr, __VA_ARGS__)
71 #define DECLARE_QUERYINTERFACE(class, ...) \
73 class##_QueryInterface(class *this, const GUID *riid, void **ppvObject) \
75 struct GUIDoffset ifaces[] = __VA_ARGS__; \
77 dshowdebug(AV_STRINGIFY(class)"_QueryInterface(%p, %p, %p)\n", this, riid, ppvObject); \
81 for (i = 0; i < sizeof(ifaces)/sizeof(ifaces[0]); i++) { \
82 if (IsEqualGUID(riid, ifaces[i].iid)) { \
83 void *obj = (void *) ((uint8_t *) this + ifaces[i].offset); \
84 class##_AddRef(this); \
85 dshowdebug("\tfound %d with offset %d\n", i, ifaces[i].offset); \
86 *ppvObject = (void *) obj; \
90 dshowdebug("\tE_NOINTERFACE\n"); \
92 return E_NOINTERFACE; \
94 #define DECLARE_ADDREF(class) \
95 unsigned long WINAPI \
96 class##_AddRef(class *this) \
98 dshowdebug(AV_STRINGIFY(class)"_AddRef(%p)\t%ld\n", this, this->ref+1); \
99 return InterlockedIncrement(&this->ref); \
101 #define DECLARE_RELEASE(class) \
102 unsigned long WINAPI \
103 class##_Release(class *this) \
105 long ref = InterlockedDecrement(&this->ref); \
106 dshowdebug(AV_STRINGIFY(class)"_Release(%p)\t%ld\n", this, ref); \
108 class##_Destroy(this); \
112 #define DECLARE_DESTROY(class, func) \
113 void class##_Destroy(class *this) \
115 dshowdebug(AV_STRINGIFY(class)"_Destroy(%p)\n", this); \
119 CoTaskMemFree(this->vtbl); \
120 CoTaskMemFree(this); \
123 #define DECLARE_CREATE(class, setup, ...) \
124 class *class##_Create(__VA_ARGS__) \
126 class *this = CoTaskMemAlloc(sizeof(class)); \
127 void *vtbl = CoTaskMemAlloc(sizeof(*this->vtbl)); \
128 dshowdebug(AV_STRINGIFY(class)"_Create(%p)\n", this); \
129 if (!this || !vtbl) \
131 ZeroMemory(this, sizeof(class)); \
132 ZeroMemory(vtbl, sizeof(*this->vtbl)); \
137 dshowdebug("created "AV_STRINGIFY(class)" %p\n", this); \
140 class##_Destroy(this); \
141 dshowdebug("could not create "AV_STRINGIFY(class)"\n"); \
145 #define SETVTBL(vtbl, class, fn) \
146 do { (vtbl)->fn = (void *) class##_##fn; } while(0)
229 IEnumMediaTypesVtbl *
vtbl;
250 IBaseFilterVtbl *
vtbl;
long WINAPI libAVFilter_QueryInterface(libAVFilter *, const GUID *, void **)
void ff_printGUID(const GUID *g)
enum AVCodecID video_codec_id
int show_audio_crossbar_connection_dialog
AVPixelFormat
Pixel format.
static void nothing(void *foo)
long WINAPI libAVFilter_GetState(libAVFilter *, DWORD, FILTER_STATE *)
IMediaEvent * media_event
unsigned long WINAPI libAVPin_AddRef(libAVPin *)
char * video_filter_save_file
unsigned int video_frame_num
struct libAVMemInputPin libAVMemInputPin
void ff_print_VIDEO_STREAM_CONFIG_CAPS(const VIDEO_STREAM_CONFIG_CAPS *caps)
long WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO *)
long WINAPI libAVPin_EndOfStream(libAVPin *)
long WINAPI libAVFilter_FindPin(libAVFilter *, const wchar_t *, IPin **)
long WINAPI libAVPin_EnumMediaTypes(libAVPin *, IEnumMediaTypes **)
libAVEnumMediaTypes * libAVEnumMediaTypes_Create(const AM_MEDIA_TYPE *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
void libAVFilter_Destroy(libAVFilter *)
IBaseFilter * device_filter[2]
long WINAPI libAVFilter_EnumPins(libAVFilter *, IEnumPins **)
char * video_filter_load_file
void libAVPin_Destroy(libAVPin *)
long WINAPI libAVFilter_GetSyncSource(libAVFilter *, IReferenceClock **)
unsigned long WINAPI libAVEnumMediaTypes_Release(libAVEnumMediaTypes *)
long WINAPI libAVPin_QueryId(libAVPin *, wchar_t **)
unsigned long WINAPI libAVEnumPins_Release(libAVEnumPins *)
enum dshowDeviceType type
long WINAPI libAVMemInputPin_Receive(libAVMemInputPin *, IMediaSample *)
long WINAPI libAVEnumMediaTypes_Next(libAVEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *)
void libAVEnumMediaTypes_Destroy(libAVEnumMediaTypes *)
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
void ff_print_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *type)
long WINAPI libAVMemInputPin_QueryInterface(libAVMemInputPin *, const GUID *, void **)
long WINAPI libAVMemInputPin_ReceiveCanBlock(libAVMemInputPin *)
unsigned long WINAPI libAVEnumMediaTypes_AddRef(libAVEnumMediaTypes *)
int show_analog_tv_tuner_audio_dialog
libAVPin * libAVPin_Create(libAVFilter *filter)
HRESULT 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 libAVFilter_Pause(libAVFilter *)
void libAVEnumPins_Destroy(libAVEnumPins *)
long WINAPI libAVPin_Connect(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
long WINAPI libAVPin_BeginFlush(libAVPin *)
long WINAPI libAVPin_Disconnect(libAVPin *)
unsigned long WINAPI libAVMemInputPin_AddRef(libAVMemInputPin *)
long WINAPI libAVEnumPins_QueryInterface(libAVEnumPins *, const GUID *, void **)
libAVPin * capture_pin[2]
long WINAPI libAVMemInputPin_ReceiveMultiple(libAVMemInputPin *, IMediaSample **, long, long *)
Describe the class of an AVClass context structure.
long WINAPI libAVPin_ReceiveConnection(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
unsigned long WINAPI libAVPin_Release(libAVPin *)
long WINAPI libAVMemInputPin_GetAllocatorRequirements(libAVMemInputPin *, ALLOCATOR_PROPERTIES *)
Rational number (pair of numerator and denominator).
libAVFilter * libAVFilter_Create(void *, void *, enum dshowDeviceType)
void ff_print_AUDIO_STREAM_CONFIG_CAPS(const AUDIO_STREAM_CONFIG_CAPS *caps)
int show_audio_device_dialog
AVCodecID
Identify the syntax and semantics of the bitstream.
unsigned long WINAPI libAVFilter_Release(libAVFilter *)
long WINAPI libAVEnumPins_Next(libAVEnumPins *, unsigned long, IPin **, unsigned long *)
long WINAPI libAVEnumPins_Reset(libAVEnumPins *)
AVRational requested_framerate
long WINAPI libAVFilter_GetClassID(libAVFilter *, CLSID *)
long WINAPI libAVEnumMediaTypes_Clone(libAVEnumMediaTypes *, libAVEnumMediaTypes **)
unsigned long WINAPI libAVEnumPins_AddRef(libAVEnumPins *)
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type)
int crossbar_audio_input_pin_number
long WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t **)
int show_video_device_dialog
long WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph *, const wchar_t *)
long WINAPI libAVPin_ConnectedTo(libAVPin *, IPin **)
unsigned long WINAPI libAVMemInputPin_Release(libAVMemInputPin *)
char * audio_filter_save_file
long WINAPI libAVFilter_Run(libAVFilter *, REFERENCE_TIME)
void libAVMemInputPin_Destroy(libAVMemInputPin *)
long WINAPI libAVPin_QueryInterface(libAVPin *, const GUID *, void **)
long WINAPI libAVPin_QueryDirection(libAVPin *, PIN_DIRECTION *)
enum AVPixelFormat pixel_format
long WINAPI libAVPin_ConnectionMediaType(libAVPin *, AM_MEDIA_TYPE *)
int crossbar_video_input_pin_number
long WINAPI libAVEnumPins_Skip(libAVEnumPins *, unsigned long)
long WINAPI libAVPin_EndFlush(libAVPin *)
long WINAPI libAVPin_QueryAccept(libAVPin *, const AM_MEDIA_TYPE *)
const AVClass * ff_dshow_context_class_ptr
long WINAPI libAVFilter_Stop(libAVFilter *)
void dshow_show_filter_properties(IBaseFilter *pFilter, AVFormatContext *avctx)
Pops up a user dialog allowing them to adjust properties for the given filter, if possible.
IMemInputPinVtbl * imemvtbl
long WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO *)
int show_analog_tv_tuner_dialog
long WINAPI libAVPin_NewSegment(libAVPin *, REFERENCE_TIME, REFERENCE_TIME, double)
long WINAPI libAVEnumMediaTypes_Reset(libAVEnumMediaTypes *)
long WINAPI libAVMemInputPin_NotifyAllocator(libAVMemInputPin *, IMemAllocator *, BOOL)
char * audio_filter_load_file
int show_video_crossbar_connection_dialog
long WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, unsigned long *)
long WINAPI libAVFilter_SetSyncSource(libAVFilter *, IReferenceClock *)
unsigned long WINAPI libAVFilter_AddRef(libAVFilter *)
long WINAPI libAVEnumMediaTypes_Skip(libAVEnumMediaTypes *, unsigned long)
libAVEnumPins * libAVEnumPins_Create(libAVPin *pin, libAVFilter *filter)
long WINAPI libAVMemInputPin_GetAllocator(libAVMemInputPin *, IMemAllocator **)
libAVFilter * capture_filter[2]
char * device_unique_name[2]
long WINAPI libAVEnumPins_Clone(libAVEnumPins *, libAVEnumPins **)
long WINAPI libAVEnumMediaTypes_QueryInterface(libAVEnumMediaTypes *, const GUID *, void **)