oledb32: Coerce Variant to VT_DATE when converting data.
[wine.git] / dlls / mfreadwrite / main.c
blobe09120d5a4b50a4536c0bda370cf7991a8e08f7c
1 /*
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
19 #include "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "initguid.h"
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)
36 switch (reason)
38 case DLL_WINE_PREATTACH:
39 return FALSE; /* prefer native version */
40 case DLL_PROCESS_ATTACH:
41 DisableThreadLibraryCalls(instance);
42 break;
45 return TRUE;
49 HRESULT WINAPI MFCreateSourceReaderFromMediaSource(IMFMediaSource *source, IMFAttributes *attributes,
50 IMFSourceReader **reader)
52 FIXME("%p %p %p stub.\n", source, attributes, reader);
54 return E_NOTIMPL;
57 typedef struct _srcreader
59 IMFSourceReader IMFSourceReader_iface;
60 LONG ref;
61 } srcreader;
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;
79 else
81 FIXME("(%s, %p)\n", debugstr_guid(riid), out);
82 *out = NULL;
83 return E_NOINTERFACE;
86 IUnknown_AddRef((IUnknown*)*out);
87 return S_OK;
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);
97 return 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);
107 if (!ref)
109 HeapFree(GetProcessHeap(), 0, This);
112 return ref;
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);
119 return E_NOTIMPL;
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);
126 return E_NOTIMPL;
129 static HRESULT WINAPI src_reader_GetNativeMediaType(IMFSourceReader *iface, DWORD index, DWORD typeindex,
130 IMFMediaType **type)
132 srcreader *This = impl_from_IMFSourceReader(iface);
133 FIXME("%p, 0x%08x, %d, %p\n", This, index, typeindex, type);
134 return E_NOTIMPL;
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);
141 return E_NOTIMPL;
144 static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWORD index, DWORD *reserved,
145 IMFMediaType *type)
147 srcreader *This = impl_from_IMFSourceReader(iface);
148 FIXME("%p, 0x%08x, %p, %p\n", This, index, reserved, type);
149 return E_NOTIMPL;
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);
156 return E_NOTIMPL;
159 static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index,
160 DWORD flags, DWORD *actualindex, DWORD *sampleflags, LONGLONG *timestamp,
161 IMFSample **sample)
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);
166 return E_NOTIMPL;
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);
173 return E_NOTIMPL;
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);
181 return E_NOTIMPL;
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);
189 return E_NOTIMPL;
192 struct IMFSourceReaderVtbl srcreader_vtbl =
194 src_reader_QueryInterface,
195 src_reader_AddRef,
196 src_reader_Release,
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,
204 src_reader_Flush,
205 src_reader_GetServiceForStream,
206 src_reader_GetPresentationAttribute
209 HRESULT WINAPI MFCreateSourceReaderFromByteStream(IMFByteStream *stream, IMFAttributes *attributes, IMFSourceReader **reader)
211 srcreader *object;
213 TRACE("%p, %p, %p\n", stream, attributes, reader);
215 object = HeapAlloc( GetProcessHeap(), 0, sizeof(*object) );
216 if(!object)
217 return E_OUTOFMEMORY;
219 object->ref = 1;
220 object->IMFSourceReader_iface.lpVtbl = &srcreader_vtbl;
222 *reader = &object->IMFSourceReader_iface;
223 return S_OK;