25 #define imemoffset offsetof(DShowPin, imemvtbl)
28 { {&IID_IUnknown,0}, {&IID_IPin,0}, {&IID_IMemInputPin,
imemoffset} })
39 const AM_MEDIA_TYPE *
type)
42 dshowdebug(
"ff_dshow_pin_ReceiveConnection(%p)\n",
this);
46 if (this->connectedto)
47 return VFW_E_ALREADY_CONNECTED;
51 if (!IsEqualGUID(&
type->majortype, &MEDIATYPE_Video))
52 return VFW_E_TYPE_NOT_ACCEPTED;
54 if (!IsEqualGUID(&
type->majortype, &MEDIATYPE_Audio))
55 return VFW_E_TYPE_NOT_ACCEPTED;
59 this->connectedto = pin;
67 dshowdebug(
"ff_dshow_pin_Disconnect(%p)\n",
this);
69 if (this->
filter->state != State_Stopped)
70 return VFW_E_NOT_STOPPED;
71 if (!this->connectedto)
73 IPin_Release(this->connectedto);
74 this->connectedto =
NULL;
80 dshowdebug(
"ff_dshow_pin_ConnectedTo(%p)\n",
this);
84 if (!this->connectedto)
85 return VFW_E_NOT_CONNECTED;
86 IPin_AddRef(this->connectedto);
87 *pin = this->connectedto;
93 dshowdebug(
"ff_dshow_pin_ConnectionMediaType(%p)\n",
this);
97 if (!this->connectedto)
98 return VFW_E_NOT_CONNECTED;
104 dshowdebug(
"ff_dshow_pin_QueryPinInfo(%p)\n",
this);
112 info->pFilter = (IBaseFilter *) this->
filter;
113 info->dir = PINDIR_INPUT;
114 wcscpy(info->achName,
L"Capture");
120 dshowdebug(
"ff_dshow_pin_QueryDirection(%p)\n",
this);
128 dshowdebug(
"ff_dshow_pin_QueryId(%p)\n",
this);
133 *
id = wcsdup(
L"libAV Pin");
139 dshowdebug(
"ff_dshow_pin_QueryAccept(%p)\n",
this);
146 dshowdebug(
"ff_dshow_pin_EnumMediaTypes(%p)\n",
this);
152 return E_OUTOFMEMORY;
154 *enumtypes = (IEnumMediaTypes *)
new;
160 dshowdebug(
"ff_dshow_pin_QueryInternalConnections(%p)\n",
this);
165 dshowdebug(
"ff_dshow_pin_EndOfStream(%p)\n",
this);
171 dshowdebug(
"ff_dshow_pin_BeginFlush(%p)\n",
this);
177 dshowdebug(
"ff_dshow_pin_EndFlush(%p)\n",
this);
184 dshowdebug(
"ff_dshow_pin_NewSegment(%p)\n",
this);
191 IPinVtbl *vtbl = this->vtbl;
192 IMemInputPinVtbl *imemvtbl;
197 imemvtbl =
av_malloc(
sizeof(IMemInputPinVtbl));
201 SETVTBL(imemvtbl, meminputpin, QueryInterface);
202 SETVTBL(imemvtbl, meminputpin, AddRef);
203 SETVTBL(imemvtbl, meminputpin, Release);
204 SETVTBL(imemvtbl, meminputpin, GetAllocator);
205 SETVTBL(imemvtbl, meminputpin, NotifyAllocator);
206 SETVTBL(imemvtbl, meminputpin, GetAllocatorRequirements);
207 SETVTBL(imemvtbl, meminputpin, Receive);
208 SETVTBL(imemvtbl, meminputpin, ReceiveMultiple);
209 SETVTBL(imemvtbl, meminputpin, ReceiveCanBlock);
211 this->imemvtbl = imemvtbl;
213 SETVTBL(vtbl, pin, QueryInterface);
217 SETVTBL(vtbl, pin, ReceiveConnection);
218 SETVTBL(vtbl, pin, Disconnect);
219 SETVTBL(vtbl, pin, ConnectedTo);
220 SETVTBL(vtbl, pin, ConnectionMediaType);
221 SETVTBL(vtbl, pin, QueryPinInfo);
222 SETVTBL(vtbl, pin, QueryDirection);
224 SETVTBL(vtbl, pin, QueryAccept);
225 SETVTBL(vtbl, pin, EnumMediaTypes);
226 SETVTBL(vtbl, pin, QueryInternalConnections);
227 SETVTBL(vtbl, pin, EndOfStream);
228 SETVTBL(vtbl, pin, BeginFlush);
230 SETVTBL(vtbl, pin, NewSegment);
242 if (this->
type.pbFormat) {
243 CoTaskMemFree(this->
type.pbFormat);
257 dshowdebug(
"ff_dshow_meminputpin_QueryInterface(%p)\n",
this);
263 dshowdebug(
"ff_dshow_meminputpin_AddRef(%p)\n",
this);
269 dshowdebug(
"ff_dshow_meminputpin_Release(%p)\n",
this);
274 dshowdebug(
"ff_dshow_meminputpin_GetAllocator(%p)\n",
this);
275 return VFW_E_NO_ALLOCATOR;
280 dshowdebug(
"ff_dshow_meminputpin_NotifyAllocator(%p)\n",
this);
284 ALLOCATOR_PROPERTIES *props)
286 dshowdebug(
"ff_dshow_meminputpin_GetAllocatorRequirements(%p)\n",
this);
301 const char *devtypename = (devtype ==
VideoDevice) ?
"video" :
"audio";
307 dshowdebug(
"ff_dshow_meminputpin_Receive(%p)\n",
this);
312 IMediaSample_GetTime(
sample, &orig_curtime, &
dummy);
314 IReferenceClock_GetTime(clock, &graphtime);
317 IReferenceClock_GetTime(clock, &curtime);
320 if(curtime > 400000000000000000LL) {
325 "dshow dropping initial (or ending) audio frame with odd PTS too high %"PRId64
"\n", curtime);
331 buf_size = IMediaSample_GetActualDataLength(
sample);
332 IMediaSample_GetPointer(
sample, &buf);
339 "timestamp %"PRId64
" orig timestamp %"PRId64
" graph timestamp %"PRId64
" diff %"PRId64
" %s\n",
340 devtypename, buf_size, curtime, orig_curtime, graphtime, graphtime - orig_curtime,
ctx->device_name[devtype]);
346 IMediaSample **samples,
long n,
long *nproc)
349 dshowdebug(
"ff_dshow_meminputpin_ReceiveMultiple(%p)\n",
this);
351 for (
i = 0;
i < n;
i++)
359 dshowdebug(
"ff_dshow_meminputpin_ReceiveCanBlock(%p)\n",
this);
367 dshowdebug(
"ff_dshow_meminputpin_Destroy(%p)\n",
this);
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
DShowEnumMediaTypes * ff_dshow_enummediatypes_Create(const AM_MEDIA_TYPE *type)
unsigned long ff_dshow_pin_AddRef(DShowPin *)
unsigned long ff_dshow_pin_Release(DShowPin *)
#define DECLARE_CREATE(prefix, class, setup,...)
void ff_print_AM_MEDIA_TYPE(const AM_MEDIA_TYPE *type)
void ff_dshow_pin_Destroy(DShowPin *)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
#define DECLARE_RELEASE(prefix, class)
unsigned long ff_dshow_filter_AddRef(DShowFilter *)
#define DECLARE_ADDREF(prefix, class)
struct DShowMemInputPin DShowMemInputPin
long ff_dshow_pin_Connect(DShowPin *, IPin *, const AM_MEDIA_TYPE *)
long ff_dshow_pin_QueryInterface(DShowPin *, const GUID *, void **)
#define SETVTBL(vtbl, prefix, fn)
#define DECLARE_DESTROY(prefix, class, func)
long ff_dshow_pin_EndFlush(DShowPin *this)
long ff_dshow_pin_QueryInternalConnections(DShowPin *this, IPin **pin, unsigned long *npin)
long ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
long ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
long ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *this)
unsigned long ff_dshow_meminputpin_Release(DShowMemInputPin *this)
static void ff_dshow_pin_Free(DShowPin *this)
long ff_dshow_pin_BeginFlush(DShowPin *this)
long ff_dshow_pin_Disconnect(DShowPin *this)
static int ff_dshow_pin_Setup(DShowPin *this, DShowFilter *filter)
long ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
long ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *this, IMemAllocator *alloc, BOOL rdwr)
long ff_dshow_pin_NewSegment(DShowPin *this, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
void ff_dshow_meminputpin_Destroy(DShowMemInputPin *this)
long ff_dshow_pin_EndOfStream(DShowPin *this)
long ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *this, IMemAllocator **alloc)
long ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this, IMediaSample **samples, long n, long *nproc)
long ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *this, ALLOCATOR_PROPERTIES *props)
long ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *this, const GUID *riid, void **ppvObject)
long ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
long ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
long ff_dshow_pin_QueryAccept(DShowPin *this, const AM_MEDIA_TYPE *type)
long ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
DECLARE_QUERYINTERFACE(pin, DShowPin, { {&IID_IUnknown, 0}, {&IID_IPin, 0}, {&IID_IMemInputPin, imemoffset} })
unsigned long ff_dshow_meminputpin_AddRef(DShowMemInputPin *this)
long ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
long ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_VERBOSE
Detailed information.
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type)
enum dshowDeviceType type