25 #define imemoffset offsetof(libAVPin, imemvtbl)
28 { {&IID_IUnknown,0}, {&IID_IPin,0}, {&IID_IMemInputPin,
imemoffset} })
35 dshowdebug(
"libAVPin_Connect(%p, %p, %p)\n",
this, pin, type);
41 const AM_MEDIA_TYPE *
type)
44 dshowdebug(
"libAVPin_ReceiveConnection(%p)\n",
this);
48 if (this->connectedto)
49 return VFW_E_ALREADY_CONNECTED;
53 if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Video))
54 return VFW_E_TYPE_NOT_ACCEPTED;
56 if (!IsEqualGUID(&type->majortype, &MEDIATYPE_Audio))
57 return VFW_E_TYPE_NOT_ACCEPTED;
61 this->connectedto = pin;
72 if (this->
filter->state != State_Stopped)
73 return VFW_E_NOT_STOPPED;
74 if (!this->connectedto)
76 IPin_Release(this->connectedto);
77 this->connectedto = NULL;
84 dshowdebug(
"libAVPin_ConnectedTo(%p)\n",
this);
88 if (!this->connectedto)
89 return VFW_E_NOT_CONNECTED;
90 IPin_AddRef(this->connectedto);
91 *pin = this->connectedto;
98 dshowdebug(
"libAVPin_ConnectionMediaType(%p)\n",
this);
102 if (!this->connectedto)
103 return VFW_E_NOT_CONNECTED;
110 dshowdebug(
"libAVPin_QueryPinInfo(%p)\n",
this);
118 info->pFilter = (IBaseFilter *) this->
filter;
119 info->dir = PINDIR_INPUT;
120 wcscpy(info->achName,
L"Capture");
127 dshowdebug(
"libAVPin_QueryDirection(%p)\n",
this);
141 *
id = wcsdup(
L"libAV Pin");
148 dshowdebug(
"libAVPin_QueryAccept(%p)\n",
this);
154 const AM_MEDIA_TYPE *
type = NULL;
156 dshowdebug(
"libAVPin_EnumMediaTypes(%p)\n",
this);
164 *enumtypes = (IEnumMediaTypes *)
new;
171 dshowdebug(
"libAVPin_QueryInternalConnections(%p)\n",
this);
177 dshowdebug(
"libAVPin_EndOfStream(%p)\n",
this);
184 dshowdebug(
"libAVPin_BeginFlush(%p)\n",
this);
199 dshowdebug(
"libAVPin_NewSegment(%p)\n",
this);
207 IPinVtbl *vtbl = this->vtbl;
208 IMemInputPinVtbl *imemvtbl;
213 imemvtbl =
av_malloc(
sizeof(IMemInputPinVtbl));
227 this->imemvtbl = imemvtbl;
263 dshowdebug(
"libAVMemInputPin_QueryInterface(%p)\n",
this);
270 dshowdebug(
"libAVMemInputPin_AddRef(%p)\n",
this);
277 dshowdebug(
"libAVMemInputPin_Release(%p)\n",
this);
283 dshowdebug(
"libAVMemInputPin_GetAllocator(%p)\n",
this);
284 return VFW_E_NO_ALLOCATOR;
290 dshowdebug(
"libAVMemInputPin_NotifyAllocator(%p)\n",
this);
295 ALLOCATOR_PROPERTIES *props)
297 dshowdebug(
"libAVMemInputPin_GetAllocatorRequirements(%p)\n",
this);
311 dshowdebug(
"libAVMemInputPin_Receive(%p)\n",
this);
319 IReferenceClock_GetTime(clock, &curtime);
322 IMediaSample_GetTime(sample, &curtime, &dummy);
326 buf_size = IMediaSample_GetActualDataLength(sample);
327 IMediaSample_GetPointer(sample, &buf);
337 IMediaSample **samples,
long n,
long *nproc)
340 dshowdebug(
"libAVMemInputPin_ReceiveMultiple(%p)\n",
this);
342 for (i = 0; i <
n; i++)
351 dshowdebug(
"libAVMemInputPin_ReceiveCanBlock(%p)\n",
this);
360 dshowdebug(
"libAVMemInputPin_Destroy(%p)\n",
this);
void libAVMemInputPin_Destroy(libAVMemInputPin *)
long WINAPI libAVMemInputPin_GetAllocator(libAVMemInputPin *, IMemAllocator **)
long WINAPI libAVPin_EndFlush(libAVPin *)
enum dshowDeviceType type
long WINAPI libAVMemInputPin_ReceiveMultiple(libAVMemInputPin *, IMediaSample **, long, long *)
#define DECLARE_DESTROY(class, func)
long WINAPI libAVMemInputPin_NotifyAllocator(libAVMemInputPin *, IMemAllocator *, BOOL)
unsigned long WINAPI libAVPin_Release(libAVPin *)
long WINAPI libAVPin_ReceiveConnection(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI libAVMemInputPin_Receive(libAVMemInputPin *, IMediaSample *)
long WINAPI libAVPin_QueryPinInfo(libAVPin *, PIN_INFO *)
long WINAPI libAVPin_EndOfStream(libAVPin *)
long WINAPI libAVPin_QueryId(libAVPin *, wchar_t **)
long WINAPI libAVPin_NewSegment(libAVPin *, REFERENCE_TIME, REFERENCE_TIME, double)
#define DECLARE_CREATE(class, setup,...)
void libAVPin_Destroy(libAVPin *)
long WINAPI libAVMemInputPin_ReceiveCanBlock(libAVMemInputPin *)
long WINAPI libAVPin_EnumMediaTypes(libAVPin *, IEnumMediaTypes **)
long WINAPI libAVPin_Connect(libAVPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI libAVPin_QueryInternalConnections(libAVPin *, IPin **, unsigned long *)
#define DECLARE_RELEASE(class)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
long WINAPI libAVPin_BeginFlush(libAVPin *)
unsigned long WINAPI libAVPin_AddRef(libAVPin *)
long WINAPI libAVMemInputPin_GetAllocatorRequirements(libAVMemInputPin *, ALLOCATOR_PROPERTIES *)
static void filter(MpegAudioContext *s, int ch, const short *samples, int incr)
unsigned long WINAPI libAVMemInputPin_AddRef(libAVMemInputPin *)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
long WINAPI libAVPin_ConnectedTo(libAVPin *, IPin **)
long WINAPI libAVMemInputPin_QueryInterface(libAVMemInputPin *, const GUID *, void **)
#define DECLARE_QUERYINTERFACE(class,...)
unsigned long WINAPI libAVMemInputPin_Release(libAVMemInputPin *)
#define SETVTBL(vtbl, class, fn)
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time)
unsigned long WINAPI libAVFilter_AddRef(libAVFilter *)
static int libAVPin_Setup(libAVPin *this, libAVFilter *filter)
static void nothing(void *foo)
long WINAPI libAVPin_Disconnect(libAVPin *)
long WINAPI libAVPin_QueryAccept(libAVPin *, const AM_MEDIA_TYPE *)
long WINAPI libAVPin_QueryInterface(libAVPin *, const GUID *, void **)
long WINAPI libAVPin_QueryDirection(libAVPin *, PIN_DIRECTION *)
long WINAPI libAVPin_ConnectionMediaType(libAVPin *, AM_MEDIA_TYPE *)
libAVEnumMediaTypes * libAVEnumMediaTypes_Create(const AM_MEDIA_TYPE *type)
void ff_print_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *type)
struct libAVMemInputPin libAVMemInputPin
#define DECLARE_ADDREF(class)