quartz: Silence requests for ipin on filters.
[wine] / dlls / qedit / mediadet.c
1 /*              DirectShow Media Detector object (QEDIT.DLL)
2  *
3  * Copyright 2008 Google (Lei Zhang)
4  *
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.
9  *
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.
14  *
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
18  */
19
20 #include "qedit_private.h"
21 #include "wine/debug.h"
22
23 WINE_DEFAULT_DEBUG_CHANNEL(qedit);
24
25 typedef struct MediaDetImpl {
26     const IMediaDetVtbl *MediaDet_Vtbl;
27     LONG refCount;
28 } MediaDetImpl;
29
30 static ULONG WINAPI MediaDet_AddRef(IMediaDet* iface)
31 {
32     MediaDetImpl *This = (MediaDetImpl *)iface;
33     ULONG refCount = InterlockedIncrement(&This->refCount);
34     TRACE("(%p)->() AddRef from %d\n", This, refCount - 1);
35     return refCount;
36 }
37
38 static ULONG WINAPI MediaDet_Release(IMediaDet* iface)
39 {
40     MediaDetImpl *This = (MediaDetImpl *)iface;
41     ULONG refCount = InterlockedDecrement(&This->refCount);
42     TRACE("(%p)->() Release from %d\n", This, refCount + 1);
43
44     if (refCount == 0)
45     {
46         CoTaskMemFree(This);
47         return 0;
48     }
49
50     return refCount;
51 }
52
53 static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet* iface, REFIID riid,
54                                               void **ppvObject)
55 {
56     MediaDetImpl *This = (MediaDetImpl *)iface;
57     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
58
59     if (IsEqualIID(riid, &IID_IUnknown) ||
60         IsEqualIID(riid, &IID_IMediaDet)) {
61         MediaDet_AddRef(iface);
62         *ppvObject = This;
63         return S_OK;
64     }
65     *ppvObject = NULL;
66     WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
67     return E_NOINTERFACE;
68 }
69
70 static HRESULT WINAPI MediaDet_get_Filter(IMediaDet* iface, IUnknown **pVal)
71 {
72     MediaDetImpl *This = (MediaDetImpl *)iface;
73     FIXME("(%p)->(%p)\n", This, pVal);
74     return E_NOTIMPL;
75 }
76
77 static HRESULT WINAPI MediaDet_put_Filter(IMediaDet* iface, IUnknown *newVal)
78 {
79     MediaDetImpl *This = (MediaDetImpl *)iface;
80     FIXME("(%p)->(%p)\n", This, newVal);
81     return E_NOTIMPL;
82 }
83
84 static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet* iface, long *pVal)
85 {
86     MediaDetImpl *This = (MediaDetImpl *)iface;
87     FIXME("(%p)->(%p)\n", This, pVal);
88     return E_NOTIMPL;
89 }
90
91 static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, long *pVal)
92 {
93     MediaDetImpl *This = (MediaDetImpl *)iface;
94     FIXME("(%p)->(%p)\n", This, pVal);
95     return E_NOTIMPL;
96 }
97
98 static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, long newVal)
99 {
100     MediaDetImpl *This = (MediaDetImpl *)iface;
101     FIXME("(%p)->(%ld)\n", This, newVal);
102     return E_NOTIMPL;
103 }
104
105 static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet* iface, GUID *pVal)
106 {
107     MediaDetImpl *This = (MediaDetImpl *)iface;
108     FIXME("(%p)->(%p)\n", This, debugstr_guid(pVal));
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet* iface, BSTR *pVal)
113 {
114     MediaDetImpl *This = (MediaDetImpl *)iface;
115     FIXME("(%p)->(%p)\n", This, pVal);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet* iface, double *pVal)
120 {
121     MediaDetImpl *This = (MediaDetImpl *)iface;
122     FIXME("(%p)->(%p)\n", This, pVal);
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI MediaDet_get_Filename(IMediaDet* iface, BSTR *pVal)
127 {
128     MediaDetImpl *This = (MediaDetImpl *)iface;
129     FIXME("(%p)->(%p)\n", This, pVal);
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal)
134 {
135     MediaDetImpl *This = (MediaDetImpl *)iface;
136     FIXME("(%p)->(%p)\n", This, newVal);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet* iface,
141                                              double StreamTime,
142                                              long *pBufferSize, char *pBuffer,
143                                              long Width, long Height)
144 {
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;
149 }
150
151 static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet* iface,
152                                                double StreamTime, long Width,
153                                                long Height, BSTR Filename)
154 {
155     MediaDetImpl *This = (MediaDetImpl *)iface;
156     FIXME("(%p)->(%f %ld %ld %p)\n", This, StreamTime, Width, Height, Filename);
157     return E_NOTIMPL;
158 }
159
160 static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface,
161                                                    AM_MEDIA_TYPE *pVal)
162 {
163     MediaDetImpl *This = (MediaDetImpl *)iface;
164     FIXME("(%p)->(%p)\n", This, pVal);
165     return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet* iface,
169                                                 ISampleGrabber **ppVal)
170 {
171     MediaDetImpl *This = (MediaDetImpl *)iface;
172     FIXME("(%p)->(%p)\n", This, ppVal);
173     return E_NOTIMPL;
174 }
175
176 static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet* iface, double *pVal)
177 {
178     MediaDetImpl *This = (MediaDetImpl *)iface;
179     FIXME("(%p)->(%p)\n", This, pVal);
180     return E_NOTIMPL;
181 }
182
183 static HRESULT WINAPI MediaDet_EnterBitmapGrabMode(IMediaDet* iface,
184                                                    double SeekTime)
185 {
186     MediaDetImpl *This = (MediaDetImpl *)iface;
187     FIXME("(%p)->(%f)\n", This, SeekTime);
188     return E_NOTIMPL;
189 }
190
191 static const IMediaDetVtbl IMediaDet_VTable =
192 {
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,
212 };
213
214 HRESULT MediaDet_create(IUnknown * pUnkOuter, LPVOID * ppv) {
215     MediaDetImpl* obj = NULL;
216
217     TRACE("(%p,%p)\n", ppv, pUnkOuter);
218
219     if (pUnkOuter)
220         return CLASS_E_NOAGGREGATION;
221
222     obj = CoTaskMemAlloc(sizeof(MediaDetImpl));
223     if (NULL == obj) {
224         *ppv = NULL;
225         return E_OUTOFMEMORY;
226     }
227     ZeroMemory(obj, sizeof(MediaDetImpl));
228
229     obj->refCount = 1;
230     obj->MediaDet_Vtbl = &IMediaDet_VTable;
231     *ppv = obj;
232
233     return S_OK;
234 }