3 * Copyright 2014 Austin English
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "mfreadwrite.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mfplat
);
34 BOOL WINAPI
DllMain(HINSTANCE instance
, DWORD reason
, LPVOID reserved
)
38 case DLL_WINE_PREATTACH
:
39 return FALSE
; /* prefer native version */
40 case DLL_PROCESS_ATTACH
:
41 DisableThreadLibraryCalls(instance
);
49 HRESULT WINAPI
MFCreateSourceReaderFromMediaSource(IMFMediaSource
*source
, IMFAttributes
*attributes
,
50 IMFSourceReader
**reader
)
52 FIXME("%p %p %p stub.\n", source
, attributes
, reader
);
57 typedef struct _srcreader
59 IMFSourceReader IMFSourceReader_iface
;
63 static inline srcreader
*impl_from_IMFSourceReader(IMFSourceReader
*iface
)
65 return CONTAINING_RECORD(iface
, srcreader
, IMFSourceReader_iface
);
68 static HRESULT WINAPI
src_reader_QueryInterface(IMFSourceReader
*iface
, REFIID riid
, void **out
)
70 srcreader
*This
= impl_from_IMFSourceReader(iface
);
72 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), out
);
74 if(IsEqualGUID(riid
, &IID_IUnknown
) ||
75 IsEqualGUID(riid
, &IID_IMFSourceReader
))
77 *out
= &This
->IMFSourceReader_iface
;
81 FIXME("(%s, %p)\n", debugstr_guid(riid
), out
);
86 IUnknown_AddRef((IUnknown
*)*out
);
90 static ULONG WINAPI
src_reader_AddRef(IMFSourceReader
*iface
)
92 srcreader
*This
= impl_from_IMFSourceReader(iface
);
93 ULONG ref
= InterlockedIncrement(&This
->ref
);
95 TRACE("(%p) ref=%u\n", This
, ref
);
100 static ULONG WINAPI
src_reader_Release(IMFSourceReader
*iface
)
102 srcreader
*This
= impl_from_IMFSourceReader(iface
);
103 ULONG ref
= InterlockedDecrement(&This
->ref
);
105 TRACE("(%p) ref=%u\n", This
, ref
);
109 HeapFree(GetProcessHeap(), 0, This
);
115 static HRESULT WINAPI
src_reader_GetStreamSelection(IMFSourceReader
*iface
, DWORD index
, BOOL
*selected
)
117 srcreader
*This
= impl_from_IMFSourceReader(iface
);
118 FIXME("%p, 0x%08x, %p\n", This
, index
, selected
);
122 static HRESULT WINAPI
src_reader_SetStreamSelection(IMFSourceReader
*iface
, DWORD index
, BOOL selected
)
124 srcreader
*This
= impl_from_IMFSourceReader(iface
);
125 FIXME("%p, 0x%08x, %d\n", This
, index
, selected
);
129 static HRESULT WINAPI
src_reader_GetNativeMediaType(IMFSourceReader
*iface
, DWORD index
, DWORD typeindex
,
132 srcreader
*This
= impl_from_IMFSourceReader(iface
);
133 FIXME("%p, 0x%08x, %d, %p\n", This
, index
, typeindex
, type
);
137 static HRESULT WINAPI
src_reader_GetCurrentMediaType(IMFSourceReader
*iface
, DWORD index
, IMFMediaType
**type
)
139 srcreader
*This
= impl_from_IMFSourceReader(iface
);
140 FIXME("%p, 0x%08x, %p\n", This
, index
, type
);
144 static HRESULT WINAPI
src_reader_SetCurrentMediaType(IMFSourceReader
*iface
, DWORD index
, DWORD
*reserved
,
147 srcreader
*This
= impl_from_IMFSourceReader(iface
);
148 FIXME("%p, 0x%08x, %p, %p\n", This
, index
, reserved
, type
);
152 static HRESULT WINAPI
src_reader_SetCurrentPosition(IMFSourceReader
*iface
, REFGUID format
, REFPROPVARIANT position
)
154 srcreader
*This
= impl_from_IMFSourceReader(iface
);
155 FIXME("%p, %s, %p\n", This
, debugstr_guid(format
), position
);
159 static HRESULT WINAPI
src_reader_ReadSample(IMFSourceReader
*iface
, DWORD index
,
160 DWORD flags
, DWORD
*actualindex
, DWORD
*sampleflags
, LONGLONG
*timestamp
,
163 srcreader
*This
= impl_from_IMFSourceReader(iface
);
164 FIXME("%p, 0x%08x, 0x%08x, %p, %p, %p, %p\n", This
, index
, flags
, actualindex
,
165 sampleflags
, timestamp
, sample
);
169 static HRESULT WINAPI
src_reader_Flush(IMFSourceReader
*iface
, DWORD index
)
171 srcreader
*This
= impl_from_IMFSourceReader(iface
);
172 FIXME("%p, 0x%08x\n", This
, index
);
176 static HRESULT WINAPI
src_reader_GetServiceForStream(IMFSourceReader
*iface
, DWORD index
, REFGUID service
,
177 REFIID riid
, void **object
)
179 srcreader
*This
= impl_from_IMFSourceReader(iface
);
180 FIXME("%p, 0x%08x, %s, %s, %p\n", This
, index
, debugstr_guid(service
), debugstr_guid(riid
), object
);
184 static HRESULT WINAPI
src_reader_GetPresentationAttribute(IMFSourceReader
*iface
, DWORD index
,
185 REFGUID guid
, PROPVARIANT
*attr
)
187 srcreader
*This
= impl_from_IMFSourceReader(iface
);
188 FIXME("%p, 0x%08x, %s, %p\n", This
, index
, debugstr_guid(guid
), attr
);
192 struct IMFSourceReaderVtbl srcreader_vtbl
=
194 src_reader_QueryInterface
,
197 src_reader_GetStreamSelection
,
198 src_reader_SetStreamSelection
,
199 src_reader_GetNativeMediaType
,
200 src_reader_GetCurrentMediaType
,
201 src_reader_SetCurrentMediaType
,
202 src_reader_SetCurrentPosition
,
203 src_reader_ReadSample
,
205 src_reader_GetServiceForStream
,
206 src_reader_GetPresentationAttribute
209 HRESULT WINAPI
MFCreateSourceReaderFromByteStream(IMFByteStream
*stream
, IMFAttributes
*attributes
, IMFSourceReader
**reader
)
213 TRACE("%p, %p, %p\n", stream
, attributes
, reader
);
215 object
= HeapAlloc( GetProcessHeap(), 0, sizeof(*object
) );
217 return E_OUTOFMEMORY
;
220 object
->IMFSourceReader_iface
.lpVtbl
= &srcreader_vtbl
;
222 *reader
= &object
->IMFSourceReader_iface
;