push 1a31a9cb1b14d0c41b748a6144c6aef5fac5e083
[wine/hacks.git] / dlls / qedit / mediadet.c
blobf7e6966cc470e095ebe38813cb4af4f65db2de2f
1 /* DirectShow Media Detector object (QEDIT.DLL)
3 * Copyright 2008 Google (Lei Zhang)
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
20 #include "qedit_private.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(qedit);
25 typedef struct MediaDetImpl {
26 const IMediaDetVtbl *MediaDet_Vtbl;
27 LONG refCount;
28 } MediaDetImpl;
30 static ULONG WINAPI MediaDet_AddRef(IMediaDet* iface)
32 MediaDetImpl *This = (MediaDetImpl *)iface;
33 ULONG refCount = InterlockedIncrement(&This->refCount);
34 TRACE("(%p)->() AddRef from %d\n", This, refCount - 1);
35 return refCount;
38 static ULONG WINAPI MediaDet_Release(IMediaDet* iface)
40 MediaDetImpl *This = (MediaDetImpl *)iface;
41 ULONG refCount = InterlockedDecrement(&This->refCount);
42 TRACE("(%p)->() Release from %d\n", This, refCount + 1);
44 if (refCount == 0)
46 CoTaskMemFree(This);
47 return 0;
50 return refCount;
53 static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet* iface, REFIID riid,
54 void **ppvObject)
56 MediaDetImpl *This = (MediaDetImpl *)iface;
57 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
59 if (IsEqualIID(riid, &IID_IUnknown) ||
60 IsEqualIID(riid, &IID_IMediaDet)) {
61 MediaDet_AddRef(iface);
62 *ppvObject = This;
63 return S_OK;
65 *ppvObject = NULL;
66 WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
67 return E_NOINTERFACE;
70 static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal)
72 MediaDetImpl *This = (MediaDetImpl *)iface;
73 FIXME("(%p)->(%p)\n", This, pVal);
74 return E_NOTIMPL;
77 static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)
79 MediaDetImpl *This = (MediaDetImpl *)iface;
80 FIXME("(%p)->(%p)\n", This, newVal);
81 return E_NOTIMPL;
84 static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, long *pVal)
86 MediaDetImpl *This = (MediaDetImpl *)iface;
87 FIXME("(%p)->(%p)\n", This, pVal);
88 return E_NOTIMPL;
91 static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, long *pVal)
93 MediaDetImpl *This = (MediaDetImpl *)iface;
94 FIXME("(%p)->(%p)\n", This, pVal);
95 return E_NOTIMPL;
98 static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, long newVal)
100 MediaDetImpl *This = (MediaDetImpl *)iface;
101 FIXME("(%p)->(%ld)\n", This, newVal);
102 return E_NOTIMPL;
105 static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet* iface, GUID *pVal)
107 MediaDetImpl *This = (MediaDetImpl *)iface;
108 FIXME("(%p)->(%p)\n", This, debugstr_guid(pVal));
109 return E_NOTIMPL;
112 static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal)
114 MediaDetImpl *This = (MediaDetImpl *)iface;
115 FIXME("(%p)->(%p)\n", This, pVal);
116 return E_NOTIMPL;
119 static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet* iface, double *pVal)
121 MediaDetImpl *This = (MediaDetImpl *)iface;
122 FIXME("(%p)->(%p)\n", This, pVal);
123 return E_NOTIMPL;
126 static HRESULT WINAPI MediaDet_get_Filename(IMediaDet* iface, BSTR *pVal)
128 MediaDetImpl *This = (MediaDetImpl *)iface;
129 FIXME("(%p)->(%p)\n", This, pVal);
130 return E_NOTIMPL;
133 static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal)
135 MediaDetImpl *This = (MediaDetImpl *)iface;
136 FIXME("(%p)->(%p)\n", This, newVal);
137 return E_NOTIMPL;
140 static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet* iface,
141 double StreamTime,
142 long *pBufferSize, char *pBuffer,
143 long Width, long Height)
145 MediaDetImpl *This = (MediaDetImpl *)iface;
146 FIXME("(%p)->(%f %p %p %ld %ld)\n", This, StreamTime, pBufferSize, pBuffer,
147 Width, Height);
148 return E_NOTIMPL;
151 static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet* iface,
152 double StreamTime, long Width,
153 long Height, BSTR Filename)
155 MediaDetImpl *This = (MediaDetImpl *)iface;
156 FIXME("(%p)->(%f %ld %ld %p)\n", This, StreamTime, Width, Height, Filename);
157 return E_NOTIMPL;
160 static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface,
161 AM_MEDIA_TYPE *pVal)
163 MediaDetImpl *This = (MediaDetImpl *)iface;
164 FIXME("(%p)->(%p)\n", This, pVal);
165 return E_NOTIMPL;
168 static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet* iface,
169 ISampleGrabber **ppVal)
171 MediaDetImpl *This = (MediaDetImpl *)iface;
172 FIXME("(%p)->(%p)\n", This, ppVal);
173 return E_NOTIMPL;
176 static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet* iface, double *pVal)
178 MediaDetImpl *This = (MediaDetImpl *)iface;
179 FIXME("(%p)->(%p)\n", This, pVal);
180 return E_NOTIMPL;
183 static HRESULT WINAPI MediaDet_EnterBitmapGrabMode(IMediaDet* iface,
184 double SeekTime)
186 MediaDetImpl *This = (MediaDetImpl *)iface;
187 FIXME("(%p)->(%f)\n", This, SeekTime);
188 return E_NOTIMPL;
191 static const IMediaDetVtbl IMediaDet_VTable =
193 MediaDet_QueryInterface,
194 MediaDet_AddRef,
195 MediaDet_Release,
196 MediaDet_get_Filter,
197 MediaDet_put_Filter,
198 MediaDet_get_OutputStreams,
199 MediaDet_get_CurrentStream,
200 MediaDet_put_CurrentStream,
201 MediaDet_get_StreamType,
202 MediaDet_get_StreamTypeB,
203 MediaDet_get_StreamLength,
204 MediaDet_get_Filename,
205 MediaDet_put_Filename,
206 MediaDet_GetBitmapBits,
207 MediaDet_WriteBitmapBits,
208 MediaDet_get_StreamMediaType,
209 MediaDet_GetSampleGrabber,
210 MediaDet_get_FrameRate,
211 MediaDet_EnterBitmapGrabMode,
214 HRESULT MediaDet_create(IUnknown * pUnkOuter, LPVOID * ppv) {
215 MediaDetImpl* obj = NULL;
217 TRACE("(%p,%p)\n", ppv, pUnkOuter);
219 if (pUnkOuter)
220 return CLASS_E_NOAGGREGATION;
222 obj = CoTaskMemAlloc(sizeof(MediaDetImpl));
223 if (NULL == obj) {
224 *ppv = NULL;
225 return E_OUTOFMEMORY;
227 ZeroMemory(obj, sizeof(MediaDetImpl));
229 obj->refCount = 1;
230 obj->MediaDet_Vtbl = &IMediaDet_VTable;
231 *ppv = obj;
233 return S_OK;