mfreadwrite: Implement MFCreateSourceReaderFromByteStream.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2017-07-06 02:38:10 +00:00 committed by Alexandre Julliard
parent 34b9b1002e
commit bf0cad095f
3 changed files with 175 additions and 1 deletions

View File

@ -20,8 +20,11 @@
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "initguid.h"
#include "mfreadwrite.h"
#include "wine/debug.h"
@ -50,3 +53,172 @@ HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *source, IMFAt
return E_NOTIMPL;
}
typedef struct _srcreader
{
IMFSourceReader IMFSourceReader_iface;
LONG ref;
} srcreader;
static inline srcreader *impl_from_IMFSourceReader(IMFSourceReader *iface)
{
return CONTAINING_RECORD(iface, srcreader, IMFSourceReader_iface);
}
static HRESULT WINAPI src_reader_QueryInterface(IMFSourceReader *iface, REFIID riid, void **out)
{
srcreader *This = impl_from_IMFSourceReader(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), out);
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IMFSourceReader))
{
*out = &This->IMFSourceReader_iface;
}
else
{
FIXME("(%s, %p)\n", debugstr_guid(riid), out);
*out = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*out);
return S_OK;
}
static ULONG WINAPI src_reader_AddRef(IMFSourceReader *iface)
{
srcreader *This = impl_from_IMFSourceReader(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
return ref;
}
static ULONG WINAPI src_reader_Release(IMFSourceReader *iface)
{
srcreader *This = impl_from_IMFSourceReader(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
if (!ref)
{
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI src_reader_GetStreamSelection(IMFSourceReader *iface, DWORD index, BOOL *selected)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %p\n", This, index, selected);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_SetStreamSelection(IMFSourceReader *iface, DWORD index, BOOL selected)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %d\n", This, index, selected);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWORD index, DWORD typeindex,
IMFMediaType **type)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %d, %p\n", This, index, typeindex, type);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_GetCurrentMediaType(IMFSourceReader *iface, DWORD index, IMFMediaType **type)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %p\n", This, index, type);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWORD index, DWORD *reserved,
IMFMediaType *type)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %p, %p\n", This, index, reserved, type);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_SetCurrentPosition(IMFSourceReader *iface, REFGUID format, REFPROPVARIANT position)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, %s, %p\n", This, debugstr_guid(format), position);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index,
DWORD flags, DWORD *actualindex, DWORD *sampleflags, LONGLONG *timestamp,
IMFSample **sample)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, 0x%08x, %p, %p, %p, %p\n", This, index, flags, actualindex,
sampleflags, timestamp, sample);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_Flush(IMFSourceReader *iface, DWORD index)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x\n", This, index);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_GetServiceForStream(IMFSourceReader *iface, DWORD index, REFGUID service,
REFIID riid, void **object)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %s, %s, %p\n", This, index, debugstr_guid(service), debugstr_guid(riid), object);
return E_NOTIMPL;
}
static HRESULT WINAPI src_reader_GetPresentationAttribute(IMFSourceReader *iface, DWORD index,
REFGUID guid, PROPVARIANT *attr)
{
srcreader *This = impl_from_IMFSourceReader(iface);
FIXME("%p, 0x%08x, %s, %p\n", This, index, debugstr_guid(guid), attr);
return E_NOTIMPL;
}
struct IMFSourceReaderVtbl srcreader_vtbl =
{
src_reader_QueryInterface,
src_reader_AddRef,
src_reader_Release,
src_reader_GetStreamSelection,
src_reader_SetStreamSelection,
src_reader_GetNativeMediaType,
src_reader_GetCurrentMediaType,
src_reader_SetCurrentMediaType,
src_reader_SetCurrentPosition,
src_reader_ReadSample,
src_reader_Flush,
src_reader_GetServiceForStream,
src_reader_GetPresentationAttribute
};
HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *stream, IMFAttributes *attributes, IMFSourceReader **reader)
{
srcreader *object;
TRACE("%p, %p, %p\n", stream, attributes, reader);
object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
if(!object)
return E_OUTOFMEMORY;
object->ref = 1;
object->IMFSourceReader_iface.lpVtbl = &srcreader_vtbl;
*reader = &object->IMFSourceReader_iface;
return S_OK;
}

View File

@ -2,6 +2,6 @@
@ stub DllGetClassObject
@ stub MFCreateSinkWriterFromMediaSink
@ stub MFCreateSinkWriterFromURL
@ stub MFCreateSourceReaderFromByteStream
@ stdcall MFCreateSourceReaderFromByteStream(ptr ptr ptr)
@ stdcall MFCreateSourceReaderFromMediaSource(ptr ptr ptr)
@ stub MFCreateSourceReaderFromURL

View File

@ -93,5 +93,7 @@ interface IMFSinkWriter : IUnknown
HRESULT GetStatistics([in] DWORD index, [out] MF_SINK_WRITER_STATISTICS *stats);
};
cpp_quote( "HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *stream, IMFAttributes *attributes," )
cpp_quote( " IMFSourceReader **reader);" )
cpp_quote( "HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *source, IMFAttributes *attributes," )
cpp_quote( " IMFSourceReader **reader);" )