25#include "wine/unicode.h"
32#define ALIGNDOWN(value,boundary) ((value)/(boundary)*(boundary))
33#define ALIGNUP(value,boundary) (ALIGNDOWN((value)+(boundary)-1, (boundary)))
71 IPin_QueryDirection(
from, &from_dir );
73 hr = IPin_QueryInternalConnections(
from,
NULL, &amount );
75 FIXME(
"Use QueryInternalConnections!\n");
77 pin_info.pFilter =
NULL;
78 hr = IPin_QueryPinInfo(
from, &pin_info );
82 hr = IBaseFilter_EnumPins( pin_info.pFilter, &enumpins );
86 hr = IEnumPins_Reset( enumpins );
89 hr = IEnumPins_Next( enumpins, 1, &
pin,
NULL );
92 hr = IEnumPins_Reset( enumpins );
99 IPin_QueryDirection(
pin, &
dir );
111 hr_return =
updatehres( hr_return, hr_local );
130 hr_return =
updatehres( hr_return, hr_local );
135 IEnumPins_Release( enumpins );
136 if (pin_info.pFilter)
137 IBaseFilter_Release( pin_info.pFilter );
148 strcpyW(pDest->achName, pSrc->achName);
149 pDest->dir = pSrc->dir;
150 pDest->pFilter = pSrc->pFilter;
155 return IPin_EndOfStream(
pin );
160 return IPin_BeginFlush(
pin );
165 return IPin_EndFlush(
pin );
210 pPinImpl->
dRate = 1.0;
232 ERR(
"Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
241 if (
SUCCEEDED(
PullPin_Init(PullPin_Vtbl, pPinInfo, pSampleProc, pUserData, pQueryAccept, pCleanUp, pCustomRequest, pDone, pCritSec, pPinImpl)))
259 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, pReceivePin, pmt);
263 if (!
This->pin.pConnectedTo)
268 props.cbBuffer = 64 * 1024;
278 IPin_QueryDirection(pReceivePin, &pindirReceive);
282 ERR(
"Can't connect from non-output pin\n");
297 hr =
This->fnPreConnect(iface, pReceivePin, &
props);
318 This->pin.pConnectedTo = pReceivePin;
319 IPin_AddRef(pReceivePin);
320 hr = IMemAllocator_Commit(
This->pAlloc);
329 IAsyncReader_Release(
This->pReader);
332 IMemAllocator_Release(
This->prefAlloc);
335 IMemAllocator_Release(
This->pAlloc);
360 return IBaseFilter_QueryInterface(
This->pin.pinInfo.pFilter,
riid,
ppv);
379 TRACE(
"(%p)->() Release from %d\n",
This, refCount + 1);
387 IMemAllocator_Release(
This->prefAlloc);
389 IMemAllocator_Release(
This->pAlloc);
391 IAsyncReader_Release(
This->pReader);
394 This->thread_lock.DebugInfo->Spare[0] = 0;
405 TRACE(
"Flushing!\n");
413 IAsyncReader_BeginFlush(
This->pReader);
420 IAsyncReader_WaitForNext(
This->pReader, 0, &pSample, &dwUser);
425 assert(!IMediaSample_GetActualDataLength(pSample));
427 IMediaSample_Release(pSample);
430 IAsyncReader_EndFlush(
This->pReader);
442 hr = IMemAllocator_GetProperties(
This->pAlloc, &allocProps);
446 if (
This->rtCurrent <
This->rtStart)
451 if (
This->rtCurrent >=
This->rtStop)
453 IPin_EndOfStream(&
This->pin.IPin_iface);
461 ERR(
"Request error: %x\n",
hr);
472 TRACE(
"Process sample\n");
475 hr = IAsyncReader_WaitForNext(
This->pReader, 10000, &pSample, &dwUser);
480 hr =
This->fnSampleProc(
This->pUserData, pSample, dwUser);
487 WARN(
"Non-NULL sample returned with VFW_E_TIMEOUT.\n");
492 ERR(
"Processing error: %x\n",
hr);
497 IMediaSample_Release(pSample);
514 IMediaSample_Release(pSample);
516 IAsyncReader_WaitForNext(
This->pReader, 0, &pSample, &dwUser);
547 IBaseFilter_Release(
This->pin.pinInfo.pFilter);
571 case Req_Sleepy:
ERR(
"Should not be signalled with SLEEPY!\n");
break;
572 default:
ERR(
"Unknown state request: %d\n",
This->state);
break;
600 IBaseFilter_AddRef(
This->pin.pinInfo.pFilter);
607 IBaseFilter_Release(
This->pin.pinInfo.pFilter);
677 IAsyncReader_WaitForNext(
This->pReader, 0, &pSample, &dwUser);
679 IMediaSample_Release(pSample);
719 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pmt);
729 TRACE(
"(%p)->()\n", iface);
753 IAsyncReader_BeginFlush(
This->pReader);
777 TRACE(
"(%p)->()\n", iface);
789 IAsyncReader_EndFlush(
This->pReader);
793 if (
state != State_Stopped)
813 ERR(
"Allocator decommit failed with error %x. Possible memory leak\n",
hr);
815 if (
This->pin.pConnectedTo)
817 IPin_Release(
This->pin.pConnectedTo);
842 args.tStart = tStart;
#define InterlockedDecrement
enum _PinDirection PIN_DIRECTION
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
const GUID IID_IAsyncReader
const char * qzdebugstr_guid(const GUID *id)
HRESULT StdMemAllocator_create(LPUNKNOWN lpUnkOuter, LPVOID *ppv)
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, LPCRITICAL_SECTION pCritSec, IPin **ppPin)
HRESULT PullPin_StartProcessing(PullPin *This)
HRESULT WINAPI PullPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
static HRESULT deliver_beginflush(IPin *pin, LPVOID unused)
static HRESULT SendFurther(IPin *from, SendPinFunc fnMiddle, LPVOID arg, SendPinFunc fnEnd)
HRESULT WINAPI PullPin_EndFlush(IPin *iface)
HRESULT(* SendPinFunc)(IPin *to, LPVOID arg)
HRESULT WINAPI PullPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
static HRESULT PullPin_InitProcessing(PullPin *This)
HRESULT WINAPI PullPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
static HRESULT deliver_endofstream(IPin *pin, LPVOID unused)
#define ALIGNDOWN(value, boundary)
HRESULT WINAPI PullPin_QueryInterface(IPin *iface, REFIID riid, LPVOID *ppv)
HRESULT WINAPI PullPin_EndOfStream(IPin *iface)
static void Copy_PinInfo(PIN_INFO *pDest, const PIN_INFO *pSrc)
static void PullPin_Thread_Pause(PullPin *This)
static DWORD WINAPI PullPin_Thread_Main(LPVOID pv)
struct newsegmentargs newsegmentargs
HRESULT WINAPI PullPin_BeginFlush(IPin *iface)
static void PullPin_Thread_Stop(PullPin *This)
static void PullPin_Flush(PullPin *This)
static HRESULT deliver_endflush(IPin *pin, LPVOID unused)
static HRESULT PullPin_StopProcessing(PullPin *This)
HRESULT WINAPI PullPin_Disconnect(IPin *iface)
HRESULT PullPin_WaitForStateChange(PullPin *This, DWORD dwMilliseconds)
ULONG WINAPI PullPin_Release(IPin *iface)
static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, LPCRITICAL_SECTION pCritSec, PullPin *pPinImpl)
static void PullPin_Thread_Process(PullPin *This)
HRESULT PullPin_PauseProcessing(PullPin *This)
static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
static HRESULT updatehres(HRESULT original, HRESULT new)
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
VOID WINAPI ExitThread(IN DWORD uExitCode)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
HRESULT(* QUERYACCEPTPROC)(LPVOID userdata, const AM_MEDIA_TYPE *pmt)
HRESULT(* STOPPROCESSPROC)(LPVOID userdata)
HRESULT(* SAMPLEPROC_PULL)(LPVOID userdata, IMediaSample *pSample, DWORD_PTR cookie)
HRESULT(* REQUESTPROC)(LPVOID userdata)
HRESULT(* CLEANUPPROC)(LPVOID userdata)
static PullPin * impl_PullPin_from_IPin(IPin *iface)
#define IsEqualIID(riid1, riid2)
#define MEDIATIME_FROM_BYTES(x)
#define BYTES_FROM_MEDIATIME(time)
LPCRITICAL_SECTION pCritSec
QUERYACCEPTPROC fnQueryAccept
SAMPLEPROC_PULL fnSampleProc
CRITICAL_SECTION thread_lock
PRECONNECTPROC fnPreConnect
HANDLE hEventStateChanged
REQUESTPROC fnCustomRequest
IMemAllocator * prefAlloc
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
PCRITICAL_SECTION_DEBUG DebugInfo
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
#define VFW_E_ALREADY_CONNECTED
#define VFW_E_TYPE_NOT_ACCEPTED
#define VFW_E_INVALID_DIRECTION
#define VFW_E_ENUM_OUT_OF_SYNC
static const WCHAR props[]
DWORD WINAPI GetLastError(void)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define HRESULT_FROM_WIN32(x)