2005-02-01 14:22:00 +00:00
|
|
|
/*
|
|
|
|
* ACM Wrapper
|
|
|
|
*
|
|
|
|
* Copyright 2005 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-02-01 14:22:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "pin.h"
|
|
|
|
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "mmreg.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "dshow.h"
|
|
|
|
#include "strmif.h"
|
|
|
|
#include "vfwmsgs.h"
|
|
|
|
#include "msacm.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
|
|
|
typedef struct ACMWrapperImpl
|
|
|
|
{
|
2010-10-07 19:48:19 +00:00
|
|
|
TransformFilter tf;
|
|
|
|
IUnknown *seekthru_unk;
|
|
|
|
|
2005-02-01 14:22:00 +00:00
|
|
|
HACMSTREAM has;
|
|
|
|
LPWAVEFORMATEX pWfIn;
|
|
|
|
LPWAVEFORMATEX pWfOut;
|
2008-04-25 21:15:42 +00:00
|
|
|
|
|
|
|
LONGLONG lasttime_real;
|
|
|
|
LONGLONG lasttime_sent;
|
2005-02-01 14:22:00 +00:00
|
|
|
} ACMWrapperImpl;
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
static const IBaseFilterVtbl ACMWrapper_Vtbl;
|
|
|
|
|
|
|
|
static HRESULT WINAPI ACMWrapper_Receive(TransformFilter *tf, IMediaSample *pSample)
|
2005-02-01 14:22:00 +00:00
|
|
|
{
|
2010-10-07 19:48:19 +00:00
|
|
|
ACMWrapperImpl* This = (ACMWrapperImpl*)tf;
|
2005-02-01 14:22:00 +00:00
|
|
|
AM_MEDIA_TYPE amt;
|
2007-04-07 09:32:45 +00:00
|
|
|
IMediaSample* pOutSample = NULL;
|
2008-03-21 21:55:03 +00:00
|
|
|
DWORD cbDstStream, cbSrcStream;
|
2005-02-01 14:22:00 +00:00
|
|
|
LPBYTE pbDstStream;
|
2007-04-07 09:32:45 +00:00
|
|
|
LPBYTE pbSrcStream = NULL;
|
2005-02-01 14:22:00 +00:00
|
|
|
ACMSTREAMHEADER ash;
|
2008-04-18 23:07:05 +00:00
|
|
|
BOOL unprepare_header = FALSE, preroll;
|
2005-02-01 14:22:00 +00:00
|
|
|
MMRESULT res;
|
2007-04-07 09:32:45 +00:00
|
|
|
HRESULT hr;
|
2008-03-21 21:55:03 +00:00
|
|
|
LONGLONG tStart = -1, tStop = -1, tMed;
|
2008-07-04 23:59:22 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->tf.filter.csFilter);
|
2007-04-07 09:32:45 +00:00
|
|
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->tf.filter.csFilter);
|
2008-07-04 23:59:22 +00:00
|
|
|
return hr;
|
2007-04-07 09:32:45 +00:00
|
|
|
}
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2008-04-30 17:33:07 +00:00
|
|
|
preroll = (IMediaSample_IsPreroll(pSample) == S_OK);
|
2008-04-28 23:32:57 +00:00
|
|
|
|
2008-04-30 17:33:07 +00:00
|
|
|
IMediaSample_GetTime(pSample, &tStart, &tStop);
|
|
|
|
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
|
2008-04-28 23:32:57 +00:00
|
|
|
|
2008-04-30 17:33:07 +00:00
|
|
|
/* Prevent discontinuities when codecs 'absorb' data but not give anything back in return */
|
|
|
|
if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
|
2008-04-28 23:32:57 +00:00
|
|
|
{
|
2008-04-30 17:33:07 +00:00
|
|
|
This->lasttime_real = tStart;
|
|
|
|
This->lasttime_sent = tStart;
|
2008-04-28 23:32:57 +00:00
|
|
|
}
|
2008-04-30 17:33:07 +00:00
|
|
|
else if (This->lasttime_real == tStart)
|
|
|
|
tStart = This->lasttime_sent;
|
|
|
|
else
|
|
|
|
WARN("Discontinuity\n");
|
|
|
|
|
2008-04-25 21:15:42 +00:00
|
|
|
tMed = tStart;
|
|
|
|
|
2010-05-19 23:14:09 +00:00
|
|
|
TRACE("Sample data ptr = %p, size = %d\n", pbSrcStream, cbSrcStream);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
|
|
|
hr = IPin_ConnectionMediaType(This->tf.ppPins[0], &amt);
|
2008-07-04 23:59:22 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("Unable to retrieve media type\n");
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->tf.filter.csFilter);
|
2008-07-04 23:59:22 +00:00
|
|
|
return hr;
|
2005-02-01 14:22:00 +00:00
|
|
|
}
|
|
|
|
|
2008-03-21 21:55:03 +00:00
|
|
|
ash.pbSrc = pbSrcStream;
|
|
|
|
ash.cbSrcLength = cbSrcStream;
|
|
|
|
|
|
|
|
while(hr == S_OK && ash.cbSrcLength)
|
2005-02-01 14:22:00 +00:00
|
|
|
{
|
2010-10-05 19:37:56 +00:00
|
|
|
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0);
|
2008-07-04 23:59:22 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
ERR("Unable to get delivery buffer (%x)\n", hr);
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->tf.filter.csFilter);
|
2008-07-04 23:59:22 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
IMediaSample_SetPreroll(pOutSample, preroll);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2007-04-07 09:32:45 +00:00
|
|
|
hr = IMediaSample_SetActualDataLength(pOutSample, 0);
|
2005-02-01 14:22:00 +00:00
|
|
|
assert(hr == S_OK);
|
|
|
|
|
2007-04-07 09:32:45 +00:00
|
|
|
hr = IMediaSample_GetPointer(pOutSample, &pbDstStream);
|
2005-02-01 14:22:00 +00:00
|
|
|
if (FAILED(hr)) {
|
2006-10-12 18:57:23 +00:00
|
|
|
ERR("Unable to get pointer to buffer (%x)\n", hr);
|
2005-02-01 14:22:00 +00:00
|
|
|
goto error;
|
|
|
|
}
|
2007-04-07 09:32:45 +00:00
|
|
|
cbDstStream = IMediaSample_GetSize(pOutSample);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
|
|
|
ash.cbStruct = sizeof(ash);
|
|
|
|
ash.fdwStatus = 0;
|
|
|
|
ash.dwUser = 0;
|
|
|
|
ash.pbDst = pbDstStream;
|
|
|
|
ash.cbDstLength = cbDstStream;
|
|
|
|
|
|
|
|
if ((res = acmStreamPrepareHeader(This->has, &ash, 0))) {
|
|
|
|
ERR("Cannot prepare header %d\n", res);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
unprepare_header = TRUE;
|
|
|
|
|
2008-04-01 21:49:54 +00:00
|
|
|
if (IMediaSample_IsDiscontinuity(pSample) == S_OK)
|
2008-04-18 23:13:25 +00:00
|
|
|
{
|
2008-04-01 21:49:54 +00:00
|
|
|
res = acmStreamConvert(This->has, &ash, ACM_STREAMCONVERTF_START);
|
2008-04-22 20:37:34 +00:00
|
|
|
IMediaSample_SetDiscontinuity(pOutSample, TRUE);
|
2008-04-18 23:13:25 +00:00
|
|
|
/* One sample could be converted to multiple packets */
|
|
|
|
IMediaSample_SetDiscontinuity(pSample, FALSE);
|
|
|
|
}
|
2008-04-01 21:49:54 +00:00
|
|
|
else
|
2008-04-22 20:37:34 +00:00
|
|
|
{
|
2008-04-01 21:49:54 +00:00
|
|
|
res = acmStreamConvert(This->has, &ash, 0);
|
2008-04-22 20:37:34 +00:00
|
|
|
IMediaSample_SetDiscontinuity(pOutSample, FALSE);
|
|
|
|
}
|
2008-04-01 21:49:54 +00:00
|
|
|
|
|
|
|
if (res)
|
|
|
|
{
|
2008-04-25 21:15:42 +00:00
|
|
|
if(res != MMSYSERR_MOREDATA)
|
|
|
|
ERR("Cannot convert data header %d\n", res);
|
|
|
|
goto error;
|
|
|
|
}
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2008-04-25 21:15:42 +00:00
|
|
|
TRACE("used in %u/%u, used out %u/%u\n", ash.cbSrcLengthUsed, ash.cbSrcLength, ash.cbDstLengthUsed, ash.cbDstLength);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2008-04-25 21:15:42 +00:00
|
|
|
hr = IMediaSample_SetActualDataLength(pOutSample, ash.cbDstLengthUsed);
|
|
|
|
assert(hr == S_OK);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2008-04-25 21:15:42 +00:00
|
|
|
/* Bug in acm codecs? It apparantly uses the input, but doesn't necessarily output immediately kl*/
|
2008-04-01 21:49:54 +00:00
|
|
|
if (!ash.cbSrcLengthUsed)
|
|
|
|
{
|
2008-04-25 21:15:42 +00:00
|
|
|
WARN("Sample was skipped? Outputted: %u\n", ash.cbDstLengthUsed);
|
2008-04-01 21:49:54 +00:00
|
|
|
ash.cbSrcLength = 0;
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2008-03-26 17:01:09 +00:00
|
|
|
TRACE("Sample start time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
|
2008-03-21 21:55:03 +00:00
|
|
|
if (ash.cbSrcLengthUsed == cbSrcStream)
|
|
|
|
{
|
|
|
|
IMediaSample_SetTime(pOutSample, &tStart, &tStop);
|
2008-04-25 22:14:54 +00:00
|
|
|
tStart = tMed = tStop;
|
2008-03-21 21:55:03 +00:00
|
|
|
}
|
|
|
|
else if (tStop != tStart)
|
|
|
|
{
|
|
|
|
tMed = tStop - tStart;
|
|
|
|
tMed = tStart + tMed * ash.cbSrcLengthUsed / cbSrcStream;
|
|
|
|
IMediaSample_SetTime(pOutSample, &tStart, &tMed);
|
|
|
|
tStart = tMed;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ERR("No valid timestamp found\n");
|
|
|
|
IMediaSample_SetTime(pOutSample, NULL, NULL);
|
|
|
|
}
|
2008-03-26 17:01:09 +00:00
|
|
|
TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->tf.filter.csFilter);
|
2010-10-05 19:37:56 +00:00
|
|
|
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample);
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->tf.filter.csFilter);
|
2008-04-01 21:49:54 +00:00
|
|
|
|
2008-03-10 08:50:57 +00:00
|
|
|
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {
|
|
|
|
if (FAILED(hr))
|
|
|
|
ERR("Error sending sample (%x)\n", hr);
|
|
|
|
goto error;
|
2005-02-01 14:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error:
|
2007-03-13 17:21:17 +00:00
|
|
|
if (unprepare_header && (res = acmStreamUnprepareHeader(This->has, &ash, 0)))
|
|
|
|
ERR("Cannot unprepare header %d\n", res);
|
|
|
|
unprepare_header = FALSE;
|
2008-03-21 21:55:03 +00:00
|
|
|
ash.pbSrc += ash.cbSrcLengthUsed;
|
|
|
|
ash.cbSrcLength -= ash.cbSrcLengthUsed;
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2007-04-07 09:32:45 +00:00
|
|
|
if (pOutSample)
|
|
|
|
IMediaSample_Release(pOutSample);
|
|
|
|
pOutSample = NULL;
|
2008-04-30 17:33:07 +00:00
|
|
|
|
2005-02-01 14:22:00 +00:00
|
|
|
}
|
|
|
|
|
2008-04-25 21:15:42 +00:00
|
|
|
This->lasttime_real = tStop;
|
|
|
|
This->lasttime_sent = tMed;
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->tf.filter.csFilter);
|
2005-02-01 14:22:00 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
static HRESULT WINAPI ACMWrapper_SetMediaType(TransformFilter *tf, PIN_DIRECTION dir, const AM_MEDIA_TYPE * pmt)
|
2005-02-01 14:22:00 +00:00
|
|
|
{
|
2010-10-07 19:48:19 +00:00
|
|
|
ACMWrapperImpl* This = (ACMWrapperImpl *)tf;
|
2005-02-01 14:22:00 +00:00
|
|
|
MMRESULT res;
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
TRACE("(%p)->(%i %p)\n", This, dir, pmt);
|
|
|
|
|
|
|
|
if (dir != PINDIR_INPUT)
|
|
|
|
return S_OK;
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2006-09-22 17:50:12 +00:00
|
|
|
/* Check root (GUID w/o FOURCC) */
|
2005-02-01 14:22:00 +00:00
|
|
|
if ((IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio)) &&
|
2006-09-22 17:50:12 +00:00
|
|
|
(!memcmp(((const char *)&pmt->subtype)+4, ((const char *)&MEDIATYPE_Audio)+4, sizeof(GUID)-4)) &&
|
2005-02-01 14:22:00 +00:00
|
|
|
(IsEqualIID(&pmt->formattype, &FORMAT_WaveFormatEx)))
|
|
|
|
{
|
|
|
|
HACMSTREAM drv;
|
2008-07-11 04:41:35 +00:00
|
|
|
AM_MEDIA_TYPE* outpmt = &This->tf.pmt;
|
|
|
|
FreeMediaType(outpmt);
|
|
|
|
|
2005-02-01 14:22:00 +00:00
|
|
|
This->pWfIn = (LPWAVEFORMATEX)pmt->pbFormat;
|
|
|
|
|
|
|
|
/* HACK */
|
|
|
|
/* TRACE("ALIGN = %d\n", pACMWrapper->pWfIn->nBlockAlign); */
|
|
|
|
/* pACMWrapper->pWfIn->nBlockAlign = 1; */
|
|
|
|
|
|
|
|
/* Set output audio data to PCM */
|
|
|
|
CopyMediaType(outpmt, pmt);
|
|
|
|
outpmt->subtype.Data1 = WAVE_FORMAT_PCM;
|
|
|
|
This->pWfOut = (WAVEFORMATEX*)outpmt->pbFormat;
|
|
|
|
This->pWfOut->wFormatTag = WAVE_FORMAT_PCM;
|
|
|
|
This->pWfOut->wBitsPerSample = 16;
|
2008-10-21 10:50:12 +00:00
|
|
|
This->pWfOut->nBlockAlign = This->pWfOut->wBitsPerSample * This->pWfOut->nChannels / 8;
|
2005-02-01 14:22:00 +00:00
|
|
|
This->pWfOut->cbSize = 0;
|
|
|
|
This->pWfOut->nAvgBytesPerSec = This->pWfOut->nChannels * This->pWfOut->nSamplesPerSec
|
|
|
|
* (This->pWfOut->wBitsPerSample/8);
|
|
|
|
|
|
|
|
if (!(res = acmStreamOpen(&drv, NULL, This->pWfIn, This->pWfOut, NULL, 0, 0, 0)))
|
|
|
|
{
|
|
|
|
This->has = drv;
|
|
|
|
|
2005-02-22 14:50:16 +00:00
|
|
|
/* Update buffer size of media samples in output */
|
2010-10-05 19:37:56 +00:00
|
|
|
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pWfOut->nAvgBytesPerSec / 2;
|
2005-02-01 14:22:00 +00:00
|
|
|
TRACE("Connection accepted\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
FIXME("acmStreamOpen returned %d\n", res);
|
2005-06-05 19:18:34 +00:00
|
|
|
FreeMediaType(outpmt);
|
2005-02-01 14:22:00 +00:00
|
|
|
TRACE("Unable to find a suitable ACM decompressor\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Connection refused\n");
|
2007-06-05 03:11:25 +00:00
|
|
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
2005-02-01 14:22:00 +00:00
|
|
|
}
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
static HRESULT WINAPI ACMWrapper_CompleteConnect(TransformFilter *tf, PIN_DIRECTION dir, IPin *pin)
|
2005-02-01 14:22:00 +00:00
|
|
|
{
|
2010-10-07 19:48:19 +00:00
|
|
|
ACMWrapperImpl* This = (ACMWrapperImpl *)tf;
|
|
|
|
MMRESULT res;
|
|
|
|
HACMSTREAM drv;
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
TRACE("(%p)\n", This);
|
2008-07-22 12:35:28 +00:00
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
if (dir != PINDIR_INPUT)
|
|
|
|
return S_OK;
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
if (!(res = acmStreamOpen(&drv, NULL, This->pWfIn, This->pWfOut, NULL, 0, 0, 0)))
|
|
|
|
{
|
|
|
|
This->has = drv;
|
|
|
|
|
|
|
|
/* Update buffer size of media samples in output */
|
|
|
|
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pWfOut->nAvgBytesPerSec / 2;
|
|
|
|
TRACE("Connection accepted\n");
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
FIXME("acmStreamOpen returned %d\n", res);
|
|
|
|
TRACE("Unable to find a suitable ACM decompressor\n");
|
|
|
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ACMWrapper_BreakConnect(TransformFilter *tf, PIN_DIRECTION dir)
|
|
|
|
{
|
|
|
|
ACMWrapperImpl *This = (ACMWrapperImpl *)tf;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%i)\n", This,dir);
|
|
|
|
|
|
|
|
if (dir == PINDIR_INPUT)
|
|
|
|
{
|
|
|
|
if (This->has)
|
|
|
|
acmStreamClose(This->has, 0);
|
|
|
|
|
|
|
|
This->has = 0;
|
|
|
|
This->lasttime_real = This->lasttime_sent = -1;
|
|
|
|
}
|
2008-04-28 23:32:57 +00:00
|
|
|
|
2005-02-01 14:22:00 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
static const TransformFilterFuncTable ACMWrapper_FuncsTable = {
|
|
|
|
NULL,
|
|
|
|
ACMWrapper_Receive,
|
|
|
|
NULL,
|
2005-02-21 20:37:45 +00:00
|
|
|
NULL,
|
2010-10-07 19:48:19 +00:00
|
|
|
ACMWrapper_SetMediaType,
|
|
|
|
ACMWrapper_CompleteConnect,
|
|
|
|
ACMWrapper_BreakConnect,
|
2005-02-21 20:37:45 +00:00
|
|
|
NULL,
|
2007-04-03 07:06:16 +00:00
|
|
|
NULL,
|
2010-10-07 19:48:19 +00:00
|
|
|
NULL,
|
|
|
|
NULL
|
2005-02-21 20:37:45 +00:00
|
|
|
};
|
|
|
|
|
2005-02-01 14:22:00 +00:00
|
|
|
HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
ACMWrapperImpl* This;
|
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
2010-10-07 19:48:19 +00:00
|
|
|
hr = TransformFilter_Construct(&ACMWrapper_Vtbl, sizeof(ACMWrapperImpl), &CLSID_ACMWrapper, &ACMWrapper_FuncsTable, (IBaseFilter**)&This);
|
2005-02-01 14:22:00 +00:00
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
2010-10-07 19:48:19 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
ISeekingPassThru *passthru;
|
|
|
|
hr = CoCreateInstance(&CLSID_SeekingPassThru, (IUnknown*)This, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&This->seekthru_unk);
|
|
|
|
IUnknown_QueryInterface(This->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
|
|
|
ISeekingPassThru_Init(passthru, FALSE, (IPin*)This->tf.ppPins[0]);
|
|
|
|
ISeekingPassThru_Release(passthru);
|
|
|
|
}
|
2005-02-01 14:22:00 +00:00
|
|
|
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = This;
|
2008-04-25 21:15:42 +00:00
|
|
|
This->lasttime_real = This->lasttime_sent = -1;
|
2005-02-01 14:22:00 +00:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2010-10-07 19:48:19 +00:00
|
|
|
|
|
|
|
HRESULT WINAPI ACMWrapper_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
ACMWrapperImpl *This = (ACMWrapperImpl *)iface;
|
|
|
|
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IMediaSeeking))
|
|
|
|
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
|
|
|
|
|
|
|
hr = TransformFilterImpl_QueryInterface(iface, riid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl ACMWrapper_Vtbl =
|
|
|
|
{
|
|
|
|
ACMWrapper_QueryInterface,
|
|
|
|
BaseFilterImpl_AddRef,
|
|
|
|
TransformFilterImpl_Release,
|
|
|
|
BaseFilterImpl_GetClassID,
|
|
|
|
TransformFilterImpl_Stop,
|
|
|
|
TransformFilterImpl_Pause,
|
|
|
|
TransformFilterImpl_Run,
|
|
|
|
BaseFilterImpl_GetState,
|
|
|
|
BaseFilterImpl_SetSyncSource,
|
|
|
|
BaseFilterImpl_GetSyncSource,
|
|
|
|
BaseFilterImpl_EnumPins,
|
|
|
|
TransformFilterImpl_FindPin,
|
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
|
|
|
};
|