22 #ifndef AVDEVICE_DSHOW_H
23 #define AVDEVICE_DSHOW_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)
void libAVEnumPins_Destroy(libAVEnumPins *)
void libAVEnumMediaTypes_Destroy(libAVEnumMediaTypes *)
void libAVMemInputPin_Destroy(libAVMemInputPin *)
long WINAPI libAVMemInputPin_GetAllocator(libAVMemInputPin *, IMemAllocator **)
libAVPin * libAVPin_Create(libAVFilter *filter)
long WINAPI libAVFilter_Pause(libAVFilter *)
char * audio_filter_load_file
void ff_print_VIDEO_STREAM_CONFIG_CAPS(const VIDEO_STREAM_CONFIG_CAPS *caps)
long WINAPI libAVPin_EndFlush(libAVPin *)
enum dshowDeviceType type
long WINAPI libAVMemInputPin_ReceiveMultiple(libAVMemInputPin *, IMediaSample **, long, long *)
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 libAVMemInputPin_NotifyAllocator(libAVMemInputPin *, IMemAllocator *, BOOL)
unsigned long WINAPI libAVPin_Release(libAVPin *)
IMediaEvent * media_event
long WINAPI libAVEnumMediaTypes_Skip(libAVEnumMediaTypes *, unsigned long)
char * video_filter_load_file
long WINAPI libAVFilter_EnumPins(libAVFilter *, IEnumPins **)
long WINAPI libAVFilter_Stop(libAVFilter *)
long WINAPI libAVPin_ReceiveConnection(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI libAVMemInputPin_Receive(libAVMemInputPin *, IMediaSample *)
unsigned long WINAPI libAVEnumMediaTypes_Release(libAVEnumMediaTypes *)
long WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO *)
enum AVCodecID video_codec_id
long WINAPI libAVPin_EndOfStream(libAVPin *)
long WINAPI libAVPin_QueryId(libAVPin *, wchar_t **)
int show_analog_tv_tuner_audio_dialog
long WINAPI libAVPin_NewSegment(libAVPin *, REFERENCE_TIME, REFERENCE_TIME, double)
int show_audio_crossbar_connection_dialog
long WINAPI libAVEnumPins_Reset(libAVEnumPins *)
long WINAPI libAVFilter_SetSyncSource(libAVFilter *, IReferenceClock *)
void libAVPin_Destroy(libAVPin *)
long WINAPI libAVEnumMediaTypes_Next(libAVEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *)
IBaseFilter * device_filter[2]
long WINAPI libAVMemInputPin_ReceiveCanBlock(libAVMemInputPin *)
long WINAPI libAVPin_EnumMediaTypes(libAVPin *, IEnumMediaTypes **)
long WINAPI libAVFilter_QueryInterface(libAVFilter *, const GUID *, void **)
libAVFilter * libAVFilter_Create(void *, void *, enum dshowDeviceType)
char * video_filter_save_file
long WINAPI libAVPin_Connect(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI libAVEnumMediaTypes_Clone(libAVEnumMediaTypes *, libAVEnumMediaTypes **)
long WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, unsigned long *)
unsigned long WINAPI libAVEnumMediaTypes_AddRef(libAVEnumMediaTypes *)
Main libavdevice API header.
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
AVCodecID
Identify the syntax and semantics of the bitstream.
libAVPin * capture_pin[2]
unsigned long WINAPI libAVEnumPins_AddRef(libAVEnumPins *)
long WINAPI libAVPin_BeginFlush(libAVPin *)
long WINAPI libAVEnumPins_QueryInterface(libAVEnumPins *, const GUID *, void **)
long WINAPI libAVFilter_FindPin(libAVFilter *, const wchar_t *, IPin **)
unsigned long WINAPI libAVPin_AddRef(libAVPin *)
long WINAPI libAVMemInputPin_GetAllocatorRequirements(libAVMemInputPin *, ALLOCATOR_PROPERTIES *)
long WINAPI libAVEnumPins_Next(libAVEnumPins *, unsigned long, IPin **, unsigned long *)
void ff_print_AUDIO_STREAM_CONFIG_CAPS(const AUDIO_STREAM_CONFIG_CAPS *caps)
unsigned long WINAPI libAVMemInputPin_AddRef(libAVMemInputPin *)
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
AVRational requested_framerate
char * audio_filter_save_file
long WINAPI libAVPin_ConnectedTo(libAVPin *, IPin **)
long WINAPI libAVFilter_GetSyncSource(libAVFilter *, IReferenceClock **)
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...
long WINAPI libAVFilter_JoinFilterGraph(libAVFilter *, IFilterGraph *, const wchar_t *)
long WINAPI libAVMemInputPin_QueryInterface(libAVMemInputPin *, const GUID *, void **)
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type)
long WINAPI libAVFilter_QueryFilterInfo(libAVFilter *, FILTER_INFO *)
void ff_printGUID(const GUID *g)
unsigned long WINAPI libAVMemInputPin_Release(libAVMemInputPin *)
unsigned long WINAPI libAVFilter_AddRef(libAVFilter *)
Describe the class of an AVClass context structure.
enum AVPixelFormat pixel_format
rational number numerator/denominator
int show_audio_device_dialog
int show_video_device_dialog
static void nothing(void *foo)
libAVEnumPins * libAVEnumPins_Create(libAVPin *pin, libAVFilter *filter)
int crossbar_audio_input_pin_number
long WINAPI libAVPin_Disconnect(libAVPin *)
long WINAPI libAVPin_QueryAccept(libAVPin *, const AM_MEDIA_TYPE *)
IMemInputPinVtbl * imemvtbl
long WINAPI libAVPin_QueryInterface(libAVPin *, const GUID *, void **)
const AVClass * ff_dshow_context_class_ptr
long WINAPI libAVPin_QueryDirection(libAVPin *, PIN_DIRECTION *)
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
unsigned long WINAPI libAVFilter_Release(libAVFilter *)
common internal api header.
libAVFilter * capture_filter[2]
long WINAPI libAVFilter_Run(libAVFilter *, REFERENCE_TIME)
long WINAPI libAVEnumMediaTypes_Reset(libAVEnumMediaTypes *)
long WINAPI libAVPin_ConnectionMediaType(libAVPin *, AM_MEDIA_TYPE *)
long WINAPI libAVEnumPins_Skip(libAVEnumPins *, unsigned long)
int crossbar_video_input_pin_number
unsigned long WINAPI libAVEnumPins_Release(libAVEnumPins *)
libAVEnumMediaTypes * libAVEnumMediaTypes_Create(const AM_MEDIA_TYPE *type)
long WINAPI libAVFilter_GetState(libAVFilter *, DWORD, FILTER_STATE *)
void ff_print_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *type)
long WINAPI libAVFilter_GetClassID(libAVFilter *, CLSID *)
struct libAVMemInputPin libAVMemInputPin
int show_video_crossbar_connection_dialog
unsigned int video_frame_num
void libAVFilter_Destroy(libAVFilter *)
AVPixelFormat
Pixel format.
int show_analog_tv_tuner_dialog
long WINAPI libAVFilter_QueryVendorInfo(libAVFilter *, wchar_t **)
long WINAPI libAVEnumMediaTypes_QueryInterface(libAVEnumMediaTypes *, const GUID *, void **)
long WINAPI libAVEnumPins_Clone(libAVEnumPins *, libAVEnumPins **)