Go to the documentation of this file.
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 int use_sample_time = 1;
302 const char *devtypename = (devtype ==
VideoDevice) ?
"video" :
"audio";
309 dshowdebug(
"ff_dshow_meminputpin_Receive(%p)\n",
this);
318 hr = IMediaSample_GetTime(
sample, &sampletime, &
dummy);
319 IReferenceClock_GetTime(clock, &graphtime);
320 if (devtype ==
VideoDevice && !
ctx->use_video_device_timestamps) {
322 chosentime = graphtime;
325 if (hr == VFW_E_SAMPLE_TIME_NOT_SET || sampletime == 0) {
326 chosentime = graphtime;
329 "frame with missing sample timestamp encountered, falling back to graph timestamp\n");
331 else if (sampletime > 400000000000000000LL) {
336 "dropping initial (or ending) sample with odd PTS too high %"PRId64
"\n", sampletime);
339 chosentime = sampletime;
346 buf_size = IMediaSample_GetActualDataLength(
sample);
347 IMediaSample_GetPointer(
sample, &buf);
351 "timestamp %"PRId64
" orig timestamp %"PRId64
" graph timestamp %"PRId64
" diff %"PRId64
" %s\n",
352 devtypename, buf_size, chosentime, sampletime, graphtime, graphtime - sampletime,
ctx->device_name[devtype]);
358 IMediaSample **
samples,
long n,
long *nproc)
361 dshowdebug(
"ff_dshow_meminputpin_ReceiveMultiple(%p)\n",
this);
363 for (
i = 0;
i < n;
i++)
371 dshowdebug(
"ff_dshow_meminputpin_ReceiveCanBlock(%p)\n",
this);
379 dshowdebug(
"ff_dshow_meminputpin_Destroy(%p)\n",
this);
long WINAPI ff_dshow_meminputpin_Receive(DShowMemInputPin *this, IMediaSample *sample)
#define DECLARE_CREATE(prefix, class, setup,...)
long WINAPI ff_dshow_meminputpin_QueryInterface(DShowMemInputPin *this, const GUID *riid, void **ppvObject)
unsigned long WINAPI ff_dshow_meminputpin_AddRef(DShowMemInputPin *this)
long WINAPI ff_dshow_meminputpin_GetAllocatorRequirements(DShowMemInputPin *this, ALLOCATOR_PROPERTIES *props)
long WINAPI ff_dshow_pin_QueryInterface(DShowPin *, const GUID *, void **)
unsigned long WINAPI ff_dshow_pin_Release(DShowPin *)
long WINAPI ff_dshow_pin_BeginFlush(DShowPin *this)
long WINAPI ff_dshow_pin_QueryInternalConnections(DShowPin *this, IPin **pin, unsigned long *npin)
#define AV_LOG_VERBOSE
Detailed information.
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
long WINAPI ff_dshow_pin_EndOfStream(DShowPin *this)
long WINAPI ff_dshow_pin_ConnectionMediaType(DShowPin *this, AM_MEDIA_TYPE *type)
void ff_dshow_pin_Destroy(DShowPin *)
long WINAPI ff_dshow_pin_EnumMediaTypes(DShowPin *this, IEnumMediaTypes **enumtypes)
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)
#define DECLARE_ADDREF(prefix, class)
long WINAPI ff_dshow_meminputpin_ReceiveCanBlock(DShowMemInputPin *this)
long WINAPI ff_dshow_pin_ConnectedTo(DShowPin *this, IPin **pin)
static void ff_dshow_pin_Free(DShowPin *this)
long WINAPI ff_dshow_pin_EndFlush(DShowPin *this)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
enum dshowDeviceType type
#define SETVTBL(vtbl, prefix, fn)
long WINAPI ff_dshow_pin_QueryPinInfo(DShowPin *this, PIN_INFO *info)
long WINAPI ff_dshow_meminputpin_GetAllocator(DShowMemInputPin *this, IMemAllocator **alloc)
DShowEnumMediaTypes * ff_dshow_enummediatypes_Create(const AM_MEDIA_TYPE *type)
long WINAPI ff_dshow_pin_NewSegment(DShowPin *this, REFERENCE_TIME start, REFERENCE_TIME stop, double rate)
long WINAPI ff_dshow_pin_ReceiveConnection(DShowPin *this, IPin *pin, const AM_MEDIA_TYPE *type)
struct DShowMemInputPin DShowMemInputPin
long WINAPI ff_dshow_pin_QueryDirection(DShowPin *this, PIN_DIRECTION *dir)
#define DECLARE_DESTROY(prefix, class, func)
unsigned long WINAPI ff_dshow_meminputpin_Release(DShowMemInputPin *this)
long WINAPI ff_dshow_pin_Disconnect(DShowPin *this)
#define i(width, name, range_min, range_max)
static int ff_dshow_pin_Setup(DShowPin *this, DShowFilter *filter)
void ff_dshow_meminputpin_Destroy(DShowMemInputPin *this)
unsigned long WINAPI ff_dshow_filter_AddRef(DShowFilter *)
#define DECLARE_RELEASE(prefix, class)
long WINAPI ff_dshow_pin_QueryAccept(DShowPin *this, const AM_MEDIA_TYPE *type)
Filter the word “frame” indicates either a video frame or a group of audio samples
unsigned long WINAPI ff_dshow_pin_AddRef(DShowPin *)
DECLARE_QUERYINTERFACE(pin, DShowPin, { {&IID_IUnknown, 0}, {&IID_IPin, 0}, {&IID_IMemInputPin, imemoffset} })
long WINAPI ff_dshow_pin_Connect(DShowPin *, IPin *, const AM_MEDIA_TYPE *)
long WINAPI ff_dshow_meminputpin_ReceiveMultiple(DShowMemInputPin *this, IMediaSample **samples, long n, long *nproc)
long WINAPI ff_dshow_pin_QueryId(DShowPin *this, wchar_t **id)
long WINAPI ff_dshow_meminputpin_NotifyAllocator(DShowMemInputPin *this, IMemAllocator *alloc, BOOL rdwr)
void(* callback)(void *priv_data, int index, uint8_t *buf, int buf_size, int64_t time, enum dshowDeviceType type)