2004-03-09 02:29:56 +01:00
|
|
|
/*
|
|
|
|
* Implementation of IAMMultiMediaStream Interface
|
|
|
|
*
|
|
|
|
* Copyright 2004 Christian Costa
|
2006-06-24 21:08:58 +02:00
|
|
|
* Copyright 2006 Ivan Leo Puoti
|
2004-03-09 02:29:56 +01:00
|
|
|
*
|
|
|
|
* This file contains the (internal) driver registration functions,
|
|
|
|
* driver enumeration APIs and DirectDraw creation functions.
|
|
|
|
*
|
|
|
|
* 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 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-09 02:29:56 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2004-10-07 05:06:48 +02:00
|
|
|
#define COBJMACROS
|
|
|
|
|
2004-03-09 02:29:56 +01:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "wingdi.h"
|
|
|
|
|
|
|
|
#include "amstream_private.h"
|
|
|
|
#include "amstream.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
|
|
|
|
|
|
|
typedef struct {
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStream IAMMultiMediaStream_iface;
|
2005-07-11 15:21:17 +02:00
|
|
|
LONG ref;
|
2005-11-07 17:38:48 +01:00
|
|
|
IGraphBuilder* pFilterGraph;
|
2006-06-24 21:08:58 +02:00
|
|
|
IPin* ipin;
|
|
|
|
IGraphBuilder* GraphBuilder;
|
2005-11-07 17:38:48 +01:00
|
|
|
ULONG nbStreams;
|
|
|
|
IMediaStream** pStreams;
|
|
|
|
STREAM_TYPE StreamType;
|
2004-03-09 02:29:56 +01:00
|
|
|
} IAMMultiMediaStreamImpl;
|
|
|
|
|
2010-12-04 22:12:01 +01:00
|
|
|
static inline IAMMultiMediaStreamImpl *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, IAMMultiMediaStreamImpl, IAMMultiMediaStream_iface);
|
|
|
|
}
|
|
|
|
|
2005-05-27 22:17:35 +02:00
|
|
|
static const struct IAMMultiMediaStreamVtbl AM_Vtbl;
|
2004-03-09 02:29:56 +01:00
|
|
|
|
|
|
|
HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|
|
|
{
|
|
|
|
IAMMultiMediaStreamImpl* object;
|
|
|
|
|
2005-11-07 17:38:48 +01:00
|
|
|
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
|
2004-10-18 23:21:19 +02:00
|
|
|
|
|
|
|
if( pUnkOuter )
|
2005-11-01 19:06:03 +01:00
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
2004-03-09 02:29:56 +01:00
|
|
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl));
|
2008-12-14 19:07:32 +01:00
|
|
|
if (!object)
|
|
|
|
{
|
|
|
|
ERR("Out of memory\n");
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
2005-11-01 19:06:03 +01:00
|
|
|
|
2010-12-04 22:12:01 +01:00
|
|
|
object->IAMMultiMediaStream_iface.lpVtbl = &AM_Vtbl;
|
2004-03-09 02:29:56 +01:00
|
|
|
object->ref = 1;
|
|
|
|
|
|
|
|
*ppObj = object;
|
2005-11-01 19:06:03 +01:00
|
|
|
|
2004-03-09 02:29:56 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream* iface, REFIID riid, void** ppvObject)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
if (IsEqualGUID(riid, &IID_IUnknown) ||
|
2010-04-05 20:30:09 +02:00
|
|
|
IsEqualGUID(riid, &IID_IMultiMediaStream) ||
|
2005-11-01 19:06:03 +01:00
|
|
|
IsEqualGUID(riid, &IID_IAMMultiMediaStream))
|
|
|
|
{
|
2010-04-05 20:30:15 +02:00
|
|
|
IUnknown_AddRef(iface);
|
2005-11-01 19:06:03 +01:00
|
|
|
*ppvObject = This;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAMMultiMediaStreamImpl_AddRef(IAMMultiMediaStream* iface)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-01 19:06:03 +01:00
|
|
|
|
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return InterlockedIncrement(&This->ref);
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-01 19:06:03 +01:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
TRACE("(%p/%p)\n", iface, This);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
if (!ref)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return ref;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IMultiMediaStream methods ***/
|
2006-07-10 10:16:18 +02:00
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream* iface, DWORD* pdwFlags, STREAM_TYPE* pStreamType)
|
2004-03-09 02:29:56 +01:00
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetMediaStream(IAMMultiMediaStream* iface, REFMSPID idPurpose, IMediaStream** ppMediaStream)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
MSPID PurposeId;
|
2007-03-17 15:13:10 +01:00
|
|
|
unsigned int i;
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-03-30 13:21:45 +02:00
|
|
|
TRACE("(%p/%p)->(%s,%p)\n", This, iface, debugstr_guid(idPurpose), ppMediaStream);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-07 17:38:48 +01:00
|
|
|
for (i = 0; i < This->nbStreams; i++)
|
|
|
|
{
|
|
|
|
IMediaStream_GetInformation(This->pStreams[i], &PurposeId, NULL);
|
|
|
|
if (IsEqualIID(&PurposeId, idPurpose))
|
|
|
|
{
|
|
|
|
*ppMediaStream = This->pStreams[i];
|
|
|
|
IMediaStream_AddRef(*ppMediaStream);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return MS_E_NOSTREAM;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
2009-03-12 23:04:35 +01:00
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStream* iface, LONG Index, IMediaStream** ppMediaStream)
|
2004-03-09 02:29:56 +01:00
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-03-12 23:04:35 +01:00
|
|
|
FIXME("(%p/%p)->(%d,%p) stub!\n", This, iface, Index, ppMediaStream);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* iface, STREAM_STATE* pCurrentState)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* iface, STREAM_STATE NewState)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-01 19:06:03 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->() stub!\n", This, iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface, STREAM_TIME* pCurrentTime)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* iface, STREAM_TIME* pDuration)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, STREAM_TIME SeekTime)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->() stub!\n", This, iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream* iface, HANDLE* phEOS)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** IAMMultiMediaStream methods ***/
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_Initialize(IAMMultiMediaStream* iface, STREAM_TYPE StreamType, DWORD dwFlags, IGraphBuilder* pFilterGraph)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
HRESULT hr = S_OK;
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-04-13 10:07:47 +02:00
|
|
|
TRACE("(%p/%p)->(%x,%x,%p)\n", This, iface, (DWORD)StreamType, dwFlags, pFilterGraph);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-07 17:38:48 +01:00
|
|
|
if (pFilterGraph)
|
|
|
|
{
|
|
|
|
This->pFilterGraph = pFilterGraph;
|
|
|
|
IGraphBuilder_AddRef(This->pFilterGraph);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&This->pFilterGraph);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
This->StreamType = StreamType;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream* iface, IGraphBuilder** ppGraphBuilder)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-03-25 22:55:03 +01:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, ppGraphBuilder);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-03-25 22:55:03 +01:00
|
|
|
if (!ppGraphBuilder)
|
|
|
|
return E_POINTER;
|
|
|
|
|
|
|
|
if (This->pFilterGraph)
|
|
|
|
return IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)ppGraphBuilder);
|
|
|
|
else
|
|
|
|
*ppGraphBuilder = NULL;
|
|
|
|
|
|
|
|
return S_OK;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppFilter);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream* iface, IUnknown* pStreamObject, const MSPID* PurposeId,
|
|
|
|
DWORD dwFlags, IMediaStream** ppNewStream)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2005-11-07 17:38:48 +01:00
|
|
|
HRESULT hr;
|
|
|
|
IMediaStream* pStream;
|
|
|
|
IMediaStream** pNewStreams;
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2009-03-30 13:21:45 +02:00
|
|
|
FIXME("(%p/%p)->(%p,%s,%x,%p) partial stub!\n", This, iface, pStreamObject, debugstr_guid(PurposeId), dwFlags, ppNewStream);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2011-08-16 10:24:15 +02:00
|
|
|
hr = mediastream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream);
|
2005-11-07 17:38:48 +01:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2011-08-16 10:32:27 +02:00
|
|
|
pNewStreams = CoTaskMemRealloc(This->pStreams, (This->nbStreams+1) * sizeof(IMediaStream*));
|
2005-11-07 17:38:48 +01:00
|
|
|
if (!pNewStreams)
|
|
|
|
{
|
|
|
|
IMediaStream_Release(pStream);
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
}
|
|
|
|
This->pStreams = pNewStreams;
|
|
|
|
This->pStreams[This->nbStreams] = pStream;
|
|
|
|
This->nbStreams++;
|
|
|
|
|
|
|
|
if (ppNewStream)
|
|
|
|
*ppNewStream = pStream;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* iface, LPCWSTR pszFileName, DWORD dwFlags)
|
|
|
|
{
|
2006-06-24 21:08:58 +02:00
|
|
|
HRESULT ret;
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2006-06-24 21:08:58 +02:00
|
|
|
IFileSourceFilter *SourceFilter;
|
|
|
|
IBaseFilter *BaseFilter;
|
|
|
|
IEnumPins *EnumPins;
|
|
|
|
IPin *ipin;
|
|
|
|
PIN_DIRECTION pin_direction;
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
TRACE("(%p/%p)->(%s,%x)\n", This, iface, debugstr_w(pszFileName), dwFlags);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2006-06-24 21:08:58 +02:00
|
|
|
ret = CoCreateInstance(&CLSID_AsyncReader, NULL, CLSCTX_INPROC_SERVER, &IID_IFileSourceFilter, (void**)&SourceFilter);
|
|
|
|
if(ret != S_OK)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
ret = IFileSourceFilter_Load(SourceFilter, pszFileName, NULL);
|
|
|
|
if(ret != S_OK)
|
|
|
|
{
|
|
|
|
IFileSourceFilter_Release(SourceFilter);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = IFileSourceFilter_QueryInterface(SourceFilter, &IID_IBaseFilter, (void**)&BaseFilter);
|
|
|
|
if(ret != S_OK)
|
|
|
|
{
|
|
|
|
IFileSourceFilter_Release(SourceFilter);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = IBaseFilter_EnumPins(BaseFilter, &EnumPins);
|
|
|
|
if(ret != S_OK)
|
|
|
|
{
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = IEnumPins_Next(EnumPins, 1, &ipin, NULL);
|
|
|
|
if(ret == S_OK)
|
|
|
|
{
|
|
|
|
ret = IPin_QueryDirection(ipin, &pin_direction);
|
|
|
|
IEnumPins_Release(EnumPins);
|
|
|
|
if(ret == S_OK && pin_direction == PINDIR_OUTPUT)
|
|
|
|
This->ipin = ipin;
|
|
|
|
else
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
IEnumPins_Release(EnumPins);
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2009-04-13 10:07:41 +02:00
|
|
|
/* If Initialize was not called before, we do it here */
|
|
|
|
if (!This->pFilterGraph)
|
|
|
|
{
|
|
|
|
ret = IAMMultiMediaStream_Initialize(iface, STREAMTYPE_READ, 0, NULL);
|
|
|
|
if (FAILED(ret))
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
2006-06-24 21:08:58 +02:00
|
|
|
ret = IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)&This->GraphBuilder);
|
|
|
|
if(ret != S_OK)
|
|
|
|
{
|
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = IGraphBuilder_AddSourceFilter(This->GraphBuilder, pszFileName, pszFileName, &BaseFilter);
|
2008-12-14 19:07:32 +01:00
|
|
|
|
|
|
|
end:
|
2006-06-24 21:08:58 +02:00
|
|
|
IBaseFilter_Release(BaseFilter);
|
|
|
|
IFileSourceFilter_Release(SourceFilter);
|
|
|
|
return ret;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenMoniker(IAMMultiMediaStream* iface, IBindCtx* pCtx, IMoniker* pMoniker, DWORD dwFlags)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2006-10-06 23:01:52 +02:00
|
|
|
FIXME("(%p/%p)->(%p,%p,%x) stub!\n", This, iface, pCtx, pMoniker, dwFlags);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2005-11-01 19:06:03 +01:00
|
|
|
return E_NOTIMPL;
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface, DWORD dwFlags)
|
|
|
|
{
|
2010-12-04 22:12:01 +01:00
|
|
|
IAMMultiMediaStreamImpl *This = impl_from_IAMMultiMediaStream(iface);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2008-12-14 19:07:32 +01:00
|
|
|
FIXME("(%p/%p)->(%x) partial stub!\n", This, iface, dwFlags);
|
2004-03-09 02:29:56 +01:00
|
|
|
|
2006-06-24 21:08:58 +02:00
|
|
|
if(dwFlags != AMMSF_NOCLOCK)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
return IGraphBuilder_Render(This->GraphBuilder, This->ipin);
|
2004-03-09 02:29:56 +01:00
|
|
|
}
|
|
|
|
|
2005-05-27 22:17:35 +02:00
|
|
|
static const IAMMultiMediaStreamVtbl AM_Vtbl =
|
2004-03-09 02:29:56 +01:00
|
|
|
{
|
|
|
|
IAMMultiMediaStreamImpl_QueryInterface,
|
|
|
|
IAMMultiMediaStreamImpl_AddRef,
|
|
|
|
IAMMultiMediaStreamImpl_Release,
|
|
|
|
IAMMultiMediaStreamImpl_GetInformation,
|
|
|
|
IAMMultiMediaStreamImpl_GetMediaStream,
|
|
|
|
IAMMultiMediaStreamImpl_EnumMediaStreams,
|
|
|
|
IAMMultiMediaStreamImpl_GetState,
|
|
|
|
IAMMultiMediaStreamImpl_SetState,
|
|
|
|
IAMMultiMediaStreamImpl_GetTime,
|
|
|
|
IAMMultiMediaStreamImpl_GetDuration,
|
|
|
|
IAMMultiMediaStreamImpl_Seek,
|
|
|
|
IAMMultiMediaStreamImpl_GetEndOfStream,
|
|
|
|
IAMMultiMediaStreamImpl_Initialize,
|
|
|
|
IAMMultiMediaStreamImpl_GetFilterGraph,
|
|
|
|
IAMMultiMediaStreamImpl_GetFilter,
|
|
|
|
IAMMultiMediaStreamImpl_AddMediaStream,
|
|
|
|
IAMMultiMediaStreamImpl_OpenFile,
|
|
|
|
IAMMultiMediaStreamImpl_OpenMoniker,
|
|
|
|
IAMMultiMediaStreamImpl_Render
|
|
|
|
};
|