37#include "wine/unicode.h"
66 DWORD cbDstStream, cbSrcStream;
73 LONGLONG tStart = -1, tStop = -1, tMed;
74 LONGLONG mtStart = -1, mtStop = -1, mtMed;
77 hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
80 ERR(
"Cannot get pointer to sample data (%x)\n",
hr);
85 preroll = (IMediaSample_IsPreroll(pSample) ==
S_OK);
87 IMediaSample_GetTime(pSample, &tStart, &tStop);
88 if (IMediaSample_GetMediaTime(pSample, &mtStart, &mtStop) !=
S_OK)
89 mtStart = mtStop = -1;
90 cbSrcStream = IMediaSample_GetActualDataLength(pSample);
93 if (IMediaSample_IsDiscontinuity(pSample) ==
S_OK)
95 This->lasttime_real = tStart;
96 This->lasttime_sent = tStart;
98 else if (
This->lasttime_real == tStart)
99 tStart =
This->lasttime_sent;
101 WARN(
"Discontinuity\n");
106 TRACE(
"Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
108 hr = IPin_ConnectionMediaType(
This->tf.ppPins[0], &amt);
111 ERR(
"Unable to retrieve media type\n");
116 ash.
pbSrc = pbSrcStream;
124 ERR(
"Unable to get delivery buffer (%x)\n",
hr);
128 IMediaSample_SetPreroll(pOutSample, preroll);
130 hr = IMediaSample_SetActualDataLength(pOutSample, 0);
133 hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
135 ERR(
"Unable to get pointer to buffer (%x)\n",
hr);
138 cbDstStream = IMediaSample_GetSize(pOutSample);
143 ash.
pbDst = pbDstStream;
147 ERR(
"Cannot prepare header %d\n",
res);
150 unprepare_header =
TRUE;
152 if (IMediaSample_IsDiscontinuity(pSample) ==
S_OK)
155 IMediaSample_SetDiscontinuity(pOutSample,
TRUE);
157 IMediaSample_SetDiscontinuity(pSample,
FALSE);
162 IMediaSample_SetDiscontinuity(pOutSample,
FALSE);
168 ERR(
"Cannot convert data header %d\n",
res);
185 TRACE(
"Sample start time: %u.%03u\n", (
DWORD)(tStart/10000000), (
DWORD)((tStart/10000)%1000));
188 IMediaSample_SetTime(pOutSample, &tStart, &tStop);
189 tStart = tMed = tStop;
191 else if (tStop != tStart)
193 tMed = tStop - tStart;
195 IMediaSample_SetTime(pOutSample, &tStart, &tMed);
200 ERR(
"No valid timestamp found\n");
201 IMediaSample_SetTime(pOutSample,
NULL,
NULL);
205 IMediaSample_SetMediaTime(pOutSample,
NULL,
NULL);
207 IMediaSample_SetMediaTime(pOutSample, &mtStart, &mtStop);
208 mtStart = mtMed = mtStop;
209 }
else if (mtStop >= mtStart) {
210 mtMed = mtStop - mtStart;
212 IMediaSample_SetMediaTime(pOutSample, &mtStart, &mtMed);
215 IMediaSample_SetMediaTime(pOutSample,
NULL,
NULL);
218 TRACE(
"Sample stop time: %u.%03u\n", (
DWORD)(tStart/10000000), (
DWORD)((tStart/10000)%1000));
226 ERR(
"Error sending sample (%x)\n",
hr);
232 ERR(
"Cannot unprepare header %d\n",
res);
233 unprepare_header =
FALSE;
237 IMediaSample_Release(pOutSample);
242 This->lasttime_real = tStop;
243 This->lasttime_sent = tMed;
260 if ((
IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio)) &&
261 (!
memcmp(((
const char *)&pmt->subtype)+4, ((
const char *)&MEDIATYPE_Audio)+4,
sizeof(
GUID)-4)) &&
262 (
IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)))
283 This->pWfOut->wBitsPerSample = 16;
284 This->pWfOut->nBlockAlign =
This->pWfOut->wBitsPerSample *
This->pWfOut->nChannels / 8;
285 This->pWfOut->cbSize = 0;
286 This->pWfOut->nAvgBytesPerSec =
This->pWfOut->nChannels *
This->pWfOut->nSamplesPerSec
287 * (
This->pWfOut->wBitsPerSample/8);
293 TRACE(
"Connection accepted\n");
297 FIXME(
"acmStreamOpen returned %d\n",
res);
299 TRACE(
"Unable to find a suitable ACM decompressor\n");
302 TRACE(
"Connection refused\n");
321 TRACE(
"Connection accepted\n");
325 FIXME(
"acmStreamOpen returned %d\n",
res);
326 TRACE(
"Unable to find a suitable ACM decompressor\n");
342 This->lasttime_real =
This->lasttime_sent = -1;
353 if (!ppropInputRequest->
cbAlign)
354 ppropInputRequest->
cbAlign = 1;
362 return IMemAllocator_SetProperties(pAlloc, ppropInputRequest, &actual);
385 TRACE(
"(%p, %p)\n", pUnkOuter,
ppv);
397 *
ppv = &
This->tf.filter.IBaseFilter_iface;
398 This->lasttime_real =
This->lasttime_sent = -1;
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSample)
static HRESULT WINAPI ACMWrapper_BreakConnect(TransformFilter *tf, PIN_DIRECTION dir)
HRESULT ACMWrapper_create(IUnknown *pUnkOuter, LPVOID *ppv)
static HRESULT WINAPI ACMWrapper_SetMediaType(TransformFilter *tf, PIN_DIRECTION dir, const AM_MEDIA_TYPE *pmt)
static const TransformFilterFuncTable ACMWrapper_FuncsTable
static HRESULT WINAPI ACMWrapper_DecideBufferSize(TransformFilter *tf, IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
static const IBaseFilterVtbl ACMWrapper_Vtbl
static ACMWrapperImpl * impl_from_TransformFilter(TransformFilter *iface)
static HRESULT WINAPI ACMWrapper_CompleteConnect(TransformFilter *tf, PIN_DIRECTION dir, IPin *pin)
enum _PinDirection PIN_DIRECTION
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
MMRESULT WINAPI acmStreamClose(HACMSTREAM has, DWORD fdwClose)
MMRESULT WINAPI acmStreamPrepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwPrepare)
MMRESULT WINAPI acmStreamConvert(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwConvert)
MMRESULT WINAPI acmStreamUnprepareHeader(HACMSTREAM has, PACMSTREAMHEADER pash, DWORD fdwUnprepare)
MMRESULT WINAPI acmStreamOpen(PHACMSTREAM phas, HACMDRIVER had, PWAVEFORMATEX pwfxSrc, PWAVEFORMATEX pwfxDst, PWAVEFILTER pwfltr, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen)
struct _WAVEFORMATEX * LPWAVEFORMATEX
#define MMSYSERR_MOREDATA
static void FreeMediaType(AM_MEDIA_TYPE *pMediaType)
static HRESULT CopyMediaType(AM_MEDIA_TYPE *pDest, const AM_MEDIA_TYPE *pSrc)
#define ACM_STREAMCONVERTF_START
#define IsEqualIID(riid1, riid2)
HRESULT WINAPI BaseFilterImpl_SetSyncSource(IBaseFilter *iface, IReferenceClock *pClock)
HRESULT WINAPI TransformFilterImpl_Pause(IBaseFilter *iface)
HRESULT WINAPI TransformFilterImpl_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
HRESULT WINAPI BaseFilterImpl_GetClassID(IBaseFilter *iface, CLSID *pClsid)
HRESULT WINAPI BaseFilterImpl_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *pInfo)
HRESULT WINAPI TransformFilterImpl_Stop(IBaseFilter *iface)
HRESULT WINAPI TransformFilterImpl_FindPin(IBaseFilter *iface, LPCWSTR Id, IPin **ppPin)
ULONG WINAPI BaseFilterImpl_AddRef(IBaseFilter *iface)
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin *This, IMediaSample *pSample)
HRESULT WINAPI BaseFilterImpl_GetState(IBaseFilter *iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
ULONG WINAPI TransformFilterImpl_Release(IBaseFilter *iface)
HRESULT TransformFilter_Construct(const IBaseFilterVtbl *filterVtbl, LONG filter_size, const CLSID *pClsid, const TransformFilterFuncTable *pFuncsTable, IBaseFilter **ppTransformFilter)
HRESULT WINAPI BaseFilterImpl_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *pGraph, LPCWSTR pName)
HRESULT WINAPI TransformFilterImpl_QueryInterface(IBaseFilter *iface, REFIID riid, LPVOID *ppv)
HRESULT WINAPI BaseFilterImpl_QueryVendorInfo(IBaseFilter *iface, LPWSTR *pVendorInfo)
HRESULT WINAPI BaseFilterImpl_GetSyncSource(IBaseFilter *iface, IReferenceClock **ppClock)
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin *This, IMediaSample **ppSample, REFERENCE_TIME *tStart, REFERENCE_TIME *tStop, DWORD dwFlags)
HRESULT WINAPI BaseFilterImpl_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum)
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_TYPE_NOT_ACCEPTED
#define VFW_E_NOT_CONNECTED
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define CLASS_E_NOAGGREGATION