ReactOS  0.4.14-dev-1112-g2b067d6
mediadet.c File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "qedit_private.h"
#include "wine/debug.h"
Include dependency graph for mediadet.c:

Go to the source code of this file.

Classes

struct  MediaDetImpl
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct MediaDetImpl MediaDetImpl
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (qedit)
 
static MediaDetImplimpl_from_IUnknown (IUnknown *iface)
 
static MediaDetImplimpl_from_IMediaDet (IMediaDet *iface)
 
static void MD_cleanup (MediaDetImpl *This)
 
static HRESULT WINAPI MediaDet_inner_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MediaDet_inner_AddRef (IUnknown *iface)
 
static ULONG WINAPI MediaDet_inner_Release (IUnknown *iface)
 
static HRESULT WINAPI MediaDet_QueryInterface (IMediaDet *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI MediaDet_AddRef (IMediaDet *iface)
 
static ULONG WINAPI MediaDet_Release (IMediaDet *iface)
 
static HRESULT WINAPI MediaDet_get_Filter (IMediaDet *iface, IUnknown **pVal)
 
static HRESULT WINAPI MediaDet_put_Filter (IMediaDet *iface, IUnknown *newVal)
 
static HRESULT WINAPI MediaDet_get_OutputStreams (IMediaDet *iface, LONG *pVal)
 
static HRESULT WINAPI MediaDet_get_CurrentStream (IMediaDet *iface, LONG *pVal)
 
static HRESULT SetCurPin (MediaDetImpl *This, LONG strm)
 
static HRESULT WINAPI MediaDet_put_CurrentStream (IMediaDet *iface, LONG newVal)
 
static HRESULT WINAPI MediaDet_get_StreamType (IMediaDet *iface, GUID *pVal)
 
static HRESULT WINAPI MediaDet_get_StreamTypeB (IMediaDet *iface, BSTR *pVal)
 
static HRESULT WINAPI MediaDet_get_StreamLength (IMediaDet *iface, double *pVal)
 
static HRESULT WINAPI MediaDet_get_Filename (IMediaDet *iface, BSTR *pVal)
 
static HRESULT GetFilterInfo (IMoniker *pMoniker, GUID *pclsid, VARIANT *pvar)
 
static HRESULT GetSplitter (MediaDetImpl *This)
 
static HRESULT WINAPI MediaDet_put_Filename (IMediaDet *iface, BSTR newVal)
 
static HRESULT WINAPI MediaDet_GetBitmapBits (IMediaDet *iface, double StreamTime, LONG *pBufferSize, char *pBuffer, LONG Width, LONG Height)
 
static HRESULT WINAPI MediaDet_WriteBitmapBits (IMediaDet *iface, double StreamTime, LONG Width, LONG Height, BSTR Filename)
 
static HRESULT WINAPI MediaDet_get_StreamMediaType (IMediaDet *iface, AM_MEDIA_TYPE *pVal)
 
static HRESULT WINAPI MediaDet_GetSampleGrabber (IMediaDet *iface, ISampleGrabber **ppVal)
 
static HRESULT WINAPI MediaDet_get_FrameRate (IMediaDet *iface, double *pVal)
 
static HRESULT WINAPI MediaDet_EnterBitmapGrabMode (IMediaDet *iface, double SeekTime)
 
HRESULT MediaDet_create (IUnknown *pUnkOuter, LPVOID *ppv)
 

Variables

static const IUnknownVtbl mediadet_vtbl
 
static const IMediaDetVtbl IMediaDet_VTable
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file mediadet.c.

Typedef Documentation

◆ MediaDetImpl

Function Documentation

◆ GetFilterInfo()

static HRESULT GetFilterInfo ( IMoniker pMoniker,
GUID pclsid,
VARIANT pvar 
)
static

Definition at line 341 of file mediadet.c.

342 {
343  static const WCHAR wszClsidName[] = {'C','L','S','I','D',0};
344  static const WCHAR wszFriendlyName[] = {'F','r','i','e','n','d','l','y','N','a','m','e',0};
345  IPropertyBag *pPropBagCat = NULL;
346  HRESULT hr;
347 
348  VariantInit(pvar);
349  V_VT(pvar) = VT_BSTR;
350 
351  hr = IMoniker_BindToStorage(pMoniker, NULL, NULL, &IID_IPropertyBag,
352  (LPVOID *) &pPropBagCat);
353 
354  if (SUCCEEDED(hr))
355  hr = IPropertyBag_Read(pPropBagCat, wszClsidName, pvar, NULL);
356 
357  if (SUCCEEDED(hr))
358  {
359  hr = CLSIDFromString(V_BSTR(pvar), pclsid);
360  VariantClear(pvar);
361  V_VT(pvar) = VT_BSTR;
362  }
363 
364  if (SUCCEEDED(hr))
365  hr = IPropertyBag_Read(pPropBagCat, wszFriendlyName, pvar, NULL);
366 
367  if (SUCCEEDED(hr))
368  TRACE("Moniker = %s - %s\n", debugstr_guid(pclsid), debugstr_w(V_BSTR(pvar)));
369 
370  if (pPropBagCat)
371  IPropertyBag_Release(pPropBagCat);
372 
373  return hr;
374 }
static const WCHAR wszFriendlyName[]
Definition: createdevenum.c:51
HRESULT hr
Definition: shlfolder.c:183
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IPropertyBag
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static const WCHAR wszClsidName[]
Definition: filtermapper.c:84
LONG HRESULT
Definition: typedefs.h:78
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by GetSplitter().

◆ GetSplitter()

static HRESULT GetSplitter ( MediaDetImpl This)
static

Definition at line 376 of file mediadet.c.

377 {
379  LPOLESTR name;
380  AM_MEDIA_TYPE mt;
381  GUID type[2];
383  IEnumMoniker *filters;
384  IMoniker *mon;
385  VARIANT var;
386  GUID clsid;
387  IBaseFilter *splitter;
388  IEnumPins *pins;
389  IPin *source_pin, *splitter_pin;
390  HRESULT hr;
391 
392  hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
393  &IID_IFilterMapper2, (void **) &map);
394  if (FAILED(hr))
395  return hr;
396 
397  hr = IBaseFilter_QueryInterface(This->source, &IID_IFileSourceFilter,
398  (void **) &file);
399  if (FAILED(hr))
400  {
401  IFilterMapper2_Release(map);
402  return hr;
403  }
404 
405  hr = IFileSourceFilter_GetCurFile(file, &name, &mt);
406  IFileSourceFilter_Release(file);
408  if (FAILED(hr))
409  {
410  IFilterMapper2_Release(map);
411  return hr;
412  }
413  type[0] = mt.majortype;
414  type[1] = mt.subtype;
415  CoTaskMemFree(mt.pbFormat);
416 
417  hr = IFilterMapper2_EnumMatchingFilters(map, &filters, 0, TRUE,
418  MERIT_UNLIKELY, FALSE, 1, type,
419  NULL, NULL, FALSE, TRUE,
420  0, NULL, NULL, NULL);
421  IFilterMapper2_Release(map);
422  if (FAILED(hr))
423  return hr;
424 
425  hr = E_NOINTERFACE;
426  while (IEnumMoniker_Next(filters, 1, &mon, NULL) == S_OK)
427  {
428  hr = GetFilterInfo(mon, &clsid, &var);
429  IMoniker_Release(mon);
430  if (FAILED(hr))
431  continue;
432 
433  hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
434  &IID_IBaseFilter, (void **) &splitter);
435  if (FAILED(hr))
436  {
437  VariantClear(&var);
438  continue;
439  }
440 
441  hr = IGraphBuilder_AddFilter(This->graph, splitter, V_BSTR(&var));
442  VariantClear(&var);
443  This->splitter = splitter;
444  if (FAILED(hr))
445  goto retry;
446 
447  hr = IBaseFilter_EnumPins(This->source, &pins);
448  if (FAILED(hr))
449  goto retry;
450  IEnumPins_Next(pins, 1, &source_pin, NULL);
451  IEnumPins_Release(pins);
452 
453  hr = IBaseFilter_EnumPins(splitter, &pins);
454  if (FAILED(hr))
455  {
456  IPin_Release(source_pin);
457  goto retry;
458  }
459  IEnumPins_Next(pins, 1, &splitter_pin, NULL);
460  IEnumPins_Release(pins);
461 
462  hr = IPin_Connect(source_pin, splitter_pin, NULL);
463  IPin_Release(source_pin);
464  IPin_Release(splitter_pin);
465  if (SUCCEEDED(hr))
466  break;
467 
468 retry:
469  IBaseFilter_Release(splitter);
470  This->splitter = NULL;
471  }
472 
473  IEnumMoniker_Release(filters);
474  if (FAILED(hr))
475  return hr;
476 
477  return S_OK;
478 }
const char * var
Definition: shader.c:5666
const GUID IID_IBaseFilter
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static LPOLESTR
Definition: stg_prop.c:27
static HRESULT GetFilterInfo(IMoniker *pMoniker, GUID *pclsid, VARIANT *pvar)
Definition: mediadet.c:341
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:78
const char file[]
Definition: icontest.c:11
Definition: _map.h:44
REFCLSID clsid
Definition: msctf.c:82
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:59
Definition: axcore.idl:91
Definition: name.c:38
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262
Definition: fci.c:126
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by MediaDet_put_Filename().

◆ impl_from_IMediaDet()

static MediaDetImpl* impl_from_IMediaDet ( IMediaDet iface)
inlinestatic

◆ impl_from_IUnknown()

static MediaDetImpl* impl_from_IUnknown ( IUnknown iface)
inlinestatic

Definition at line 48 of file mediadet.c.

49 {
50  return CONTAINING_RECORD(iface, MediaDetImpl, IUnknown_inner);
51 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by MediaDet_inner_AddRef(), MediaDet_inner_QueryInterface(), and MediaDet_inner_Release().

◆ MD_cleanup()

static void MD_cleanup ( MediaDetImpl This)
static

Definition at line 58 of file mediadet.c.

59 {
60  if (This->cur_pin) IPin_Release(This->cur_pin);
61  This->cur_pin = NULL;
62  if (This->source) IBaseFilter_Release(This->source);
63  This->source = NULL;
64  if (This->splitter) IBaseFilter_Release(This->splitter);
65  This->splitter = NULL;
66  if (This->graph) IGraphBuilder_Release(This->graph);
67  This->graph = NULL;
68  This->num_streams = -1;
69  This->cur_stream = 0;
70 }
smooth NULL
Definition: ftsmooth.c:416

Referenced by MediaDet_inner_Release(), and MediaDet_put_Filename().

◆ MediaDet_AddRef()

static ULONG WINAPI MediaDet_AddRef ( IMediaDet iface)
static

Definition at line 134 of file mediadet.c.

135 {
137  return IUnknown_AddRef(This->outer_unk);
138 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53

◆ MediaDet_create()

HRESULT MediaDet_create ( IUnknown pUnkOuter,
LPVOID ppv 
)

Definition at line 639 of file mediadet.c.

639  {
640  MediaDetImpl* obj = NULL;
641 
642  TRACE("(%p,%p)\n", pUnkOuter, ppv);
643 
644  obj = CoTaskMemAlloc(sizeof(MediaDetImpl));
645  if (NULL == obj) {
646  *ppv = NULL;
647  return E_OUTOFMEMORY;
648  }
649  ZeroMemory(obj, sizeof(MediaDetImpl));
650 
651  obj->ref = 1;
652  obj->IUnknown_inner.lpVtbl = &mediadet_vtbl;
653  obj->IMediaDet_iface.lpVtbl = &IMediaDet_VTable;
654  obj->graph = NULL;
655  obj->source = NULL;
656  obj->splitter = NULL;
657  obj->cur_pin = NULL;
658  obj->num_streams = -1;
659  obj->cur_stream = 0;
660 
661  if (pUnkOuter)
662  obj->outer_unk = pUnkOuter;
663  else
664  obj->outer_unk = &obj->IUnknown_inner;
665 
666  *ppv = &obj->IUnknown_inner;
667  return S_OK;
668 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define ZeroMemory
Definition: winbase.h:1642
static const IUnknownVtbl mediadet_vtbl
Definition: mediadet.c:120
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const IMediaDetVtbl IMediaDet_VTable
Definition: mediadet.c:616
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ MediaDet_EnterBitmapGrabMode()

static HRESULT WINAPI MediaDet_EnterBitmapGrabMode ( IMediaDet iface,
double  SeekTime 
)
static

Definition at line 608 of file mediadet.c.

610 {
612  FIXME("(%p)->(%f): not implemented!\n", This, SeekTime);
613  return E_NOTIMPL;
614 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_get_CurrentStream()

static HRESULT WINAPI MediaDet_get_CurrentStream ( IMediaDet iface,
LONG pVal 
)
static

Definition at line 204 of file mediadet.c.

205 {
207  TRACE("(%p)\n", This);
208 
209  if (!pVal)
210  return E_POINTER;
211 
212  *pVal = This->cur_stream;
213  return S_OK;
214 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365

◆ MediaDet_get_Filename()

static HRESULT WINAPI MediaDet_get_Filename ( IMediaDet iface,
BSTR pVal 
)
static

Definition at line 304 of file mediadet.c.

305 {
308  LPOLESTR name;
309  HRESULT hr;
310 
311  TRACE("(%p)\n", This);
312 
313  if (!pVal)
314  return E_POINTER;
315 
316  *pVal = NULL;
317  /* MSDN says it should return E_FAIL if no file is open, but tests
318  show otherwise. */
319  if (!This->source)
320  return S_OK;
321 
322  hr = IBaseFilter_QueryInterface(This->source, &IID_IFileSourceFilter,
323  (void **) &file);
324  if (FAILED(hr))
325  return hr;
326 
327  hr = IFileSourceFilter_GetCurFile(file, &name, NULL);
328  IFileSourceFilter_Release(file);
329  if (FAILED(hr))
330  return hr;
331 
332  *pVal = SysAllocString(name);
334  if (!*pVal)
335  return E_OUTOFMEMORY;
336 
337  return S_OK;
338 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
static LPOLESTR
Definition: stg_prop.c:27
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
const char file[]
Definition: icontest.c:11
#define S_OK
Definition: intsafe.h:59
Definition: name.c:38
#define E_POINTER
Definition: winerror.h:2365
Definition: fci.c:126
GLuint const GLchar * name
Definition: glext.h:6031

◆ MediaDet_get_Filter()

static HRESULT WINAPI MediaDet_get_Filter ( IMediaDet iface,
IUnknown **  pVal 
)
static

Definition at line 146 of file mediadet.c.

147 {
149  FIXME("(%p)->(%p): not implemented!\n", This, pVal);
150  return E_NOTIMPL;
151 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_get_FrameRate()

static HRESULT WINAPI MediaDet_get_FrameRate ( IMediaDet iface,
double pVal 
)
static

Definition at line 579 of file mediadet.c.

580 {
582  AM_MEDIA_TYPE mt;
583  VIDEOINFOHEADER *vh;
584  HRESULT hr;
585 
586  TRACE("(%p)\n", This);
587 
588  if (!pVal)
589  return E_POINTER;
590 
591  hr = MediaDet_get_StreamMediaType(iface, &mt);
592  if (FAILED(hr))
593  return hr;
594 
595  if (!IsEqualGUID(&mt.majortype, &MEDIATYPE_Video))
596  {
597  CoTaskMemFree(mt.pbFormat);
598  return VFW_E_INVALIDMEDIATYPE;
599  }
600 
601  vh = (VIDEOINFOHEADER *) mt.pbFormat;
602  *pVal = 1.0e7 / (double) vh->AvgTimePerFrame;
603 
604  CoTaskMemFree(mt.pbFormat);
605  return S_OK;
606 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet *iface, AM_MEDIA_TYPE *pVal)
Definition: mediadet.c:537
REFERENCE_TIME AvgTimePerFrame
Definition: amvideo.idl:187
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#define VFW_E_INVALIDMEDIATYPE
Definition: vfwmsgs.h:39
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_POINTER
Definition: winerror.h:2365

◆ MediaDet_get_OutputStreams()

static HRESULT WINAPI MediaDet_get_OutputStreams ( IMediaDet iface,
LONG pVal 
)
static

Definition at line 160 of file mediadet.c.

161 {
163  IEnumPins *pins;
164  IPin *pin;
165  HRESULT hr;
166 
167  TRACE("(%p)\n", This);
168 
169  if (!This->splitter)
170  return E_INVALIDARG;
171 
172  if (This->num_streams != -1)
173  {
174  *pVal = This->num_streams;
175  return S_OK;
176  }
177 
178  *pVal = 0;
179 
180  hr = IBaseFilter_EnumPins(This->splitter, &pins);
181  if (FAILED(hr))
182  return hr;
183 
184  while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK)
185  {
187  hr = IPin_QueryDirection(pin, &dir);
188  IPin_Release(pin);
189  if (FAILED(hr))
190  {
191  IEnumPins_Release(pins);
192  return hr;
193  }
194 
195  if (dir == PINDIR_OUTPUT)
196  ++*pVal;
197  }
198  IEnumPins_Release(pins);
199 
200  This->num_streams = *pVal;
201  return S_OK;
202 }
HRESULT hr
Definition: shlfolder.c:183
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
Definition: regsvr.c:103
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
Definition: axcore.idl:91
enum _PinDirection PIN_DIRECTION

Referenced by MediaDet_put_CurrentStream().

◆ MediaDet_get_StreamLength()

static HRESULT WINAPI MediaDet_get_StreamLength ( IMediaDet iface,
double pVal 
)
static

Definition at line 297 of file mediadet.c.

298 {
300  FIXME("(%p): stub!\n", This);
301  return VFW_E_INVALIDMEDIATYPE;
302 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define VFW_E_INVALIDMEDIATYPE
Definition: vfwmsgs.h:39

◆ MediaDet_get_StreamMediaType()

static HRESULT WINAPI MediaDet_get_StreamMediaType ( IMediaDet iface,
AM_MEDIA_TYPE pVal 
)
static

Definition at line 537 of file mediadet.c.

539 {
542  AM_MEDIA_TYPE *pmt;
543  HRESULT hr;
544 
545  TRACE("(%p)\n", This);
546 
547  if (!pVal)
548  return E_POINTER;
549 
550  if (!This->cur_pin)
551  return E_INVALIDARG;
552 
553  hr = IPin_EnumMediaTypes(This->cur_pin, &types);
554  if (SUCCEEDED(hr))
555  {
556  hr = (IEnumMediaTypes_Next(types, 1, &pmt, NULL) == S_OK
557  ? S_OK
558  : E_NOINTERFACE);
559  IEnumMediaTypes_Release(types);
560  }
561 
562  if (SUCCEEDED(hr))
563  {
564  *pVal = *pmt;
565  CoTaskMemFree(pmt);
566  }
567 
568  return hr;
569 }
#define E_NOINTERFACE
Definition: winerror.h:2364
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT hr
Definition: shlfolder.c:183
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
GLsizei GLenum GLenum * types
Definition: glext.h:7753
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cmds.c:130
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by MediaDet_get_FrameRate().

◆ MediaDet_get_StreamType()

static HRESULT WINAPI MediaDet_get_StreamType ( IMediaDet iface,
GUID pVal 
)
static

Definition at line 283 of file mediadet.c.

284 {
286  FIXME("(%p)->(%s): not implemented!\n", This, debugstr_guid(pVal));
287  return E_NOTIMPL;
288 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_get_StreamTypeB()

static HRESULT WINAPI MediaDet_get_StreamTypeB ( IMediaDet iface,
BSTR pVal 
)
static

Definition at line 290 of file mediadet.c.

291 {
293  FIXME("(%p)->(%p): not implemented!\n", This, pVal);
294  return E_NOTIMPL;
295 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_GetBitmapBits()

static HRESULT WINAPI MediaDet_GetBitmapBits ( IMediaDet iface,
double  StreamTime,
LONG pBufferSize,
char pBuffer,
LONG  Width,
LONG  Height 
)
static

Definition at line 517 of file mediadet.c.

521 {
523  FIXME("(%p)->(%f %p %p %d %d): not implemented!\n", This, StreamTime, pBufferSize, pBuffer,
524  Width, Height);
525  return E_NOTIMPL;
526 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
_Must_inspect_result_ _In_ ULONG _Out_writes_bytes_ pBufferSize PVOID _Inout_ PULONG pBufferSize
Definition: fsrtlfuncs.h:1164
#define FIXME(fmt,...)
Definition: debug.h:110
PVOID pBuffer
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_GetSampleGrabber()

static HRESULT WINAPI MediaDet_GetSampleGrabber ( IMediaDet iface,
ISampleGrabber **  ppVal 
)
static

Definition at line 571 of file mediadet.c.

573 {
575  FIXME("(%p)->(%p): not implemented!\n", This, ppVal);
576  return E_NOTIMPL;
577 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_inner_AddRef()

static ULONG WINAPI MediaDet_inner_AddRef ( IUnknown iface)
static

Definition at line 94 of file mediadet.c.

95 {
98 
99  TRACE("(%p) new ref = %u\n", This, ref);
100 
101  return ref;
102 }
Definition: send.c:47
static MediaDetImpl * impl_from_IUnknown(IUnknown *iface)
Definition: mediadet.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ MediaDet_inner_QueryInterface()

static HRESULT WINAPI MediaDet_inner_QueryInterface ( IUnknown iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 73 of file mediadet.c.

74 {
76 
77  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
78 
79  *ppv = NULL;
81  *ppv = &This->IUnknown_inner;
82  else if (IsEqualIID(riid, &IID_IMediaDet))
83  *ppv = &This->IMediaDet_iface;
84  else
85  WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv);
86 
87  if (!*ppv)
88  return E_NOINTERFACE;
89 
90  IUnknown_AddRef((IUnknown*)*ppv);
91  return S_OK;
92 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
REFIID LPVOID * ppv
Definition: atlbase.h:39
static MediaDetImpl * impl_from_IUnknown(IUnknown *iface)
Definition: mediadet.c:48
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ MediaDet_inner_Release()

static ULONG WINAPI MediaDet_inner_Release ( IUnknown iface)
static

Definition at line 104 of file mediadet.c.

105 {
108 
109  TRACE("(%p) new ref = %u\n", This, ref);
110 
111  if (ref == 0)
112  {
113  MD_cleanup(This);
115  }
116 
117  return ref;
118 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
Definition: send.c:47
static MediaDetImpl * impl_from_IUnknown(IUnknown *iface)
Definition: mediadet.c:48
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static void MD_cleanup(MediaDetImpl *This)
Definition: mediadet.c:58
unsigned int ULONG
Definition: retypes.h:1

◆ MediaDet_put_CurrentStream()

static HRESULT WINAPI MediaDet_put_CurrentStream ( IMediaDet iface,
LONG  newVal 
)
static

Definition at line 257 of file mediadet.c.

258 {
260  HRESULT hr;
261 
262  TRACE("(%p)->(%d)\n", This, newVal);
263 
264  if (This->num_streams == -1)
265  {
266  LONG n;
267  hr = MediaDet_get_OutputStreams(iface, &n);
268  if (FAILED(hr))
269  return hr;
270  }
271 
272  if (newVal < 0 || This->num_streams <= newVal)
273  return E_INVALIDARG;
274 
275  hr = SetCurPin(This, newVal);
276  if (FAILED(hr))
277  return hr;
278 
279  This->cur_stream = newVal;
280  return S_OK;
281 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT SetCurPin(MediaDetImpl *This, LONG strm)
Definition: mediadet.c:216
static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet *iface, LONG *pVal)
Definition: mediadet.c:160
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
GLdouble n
Definition: glext.h:7729
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59

Referenced by MediaDet_put_Filename().

◆ MediaDet_put_Filename()

static HRESULT WINAPI MediaDet_put_Filename ( IMediaDet iface,
BSTR  newVal 
)
static

Definition at line 480 of file mediadet.c.

481 {
482  static const WCHAR reader[] = {'R','e','a','d','e','r',0};
484  IGraphBuilder *gb;
485  IBaseFilter *bf;
486  HRESULT hr;
487 
488  TRACE("(%p)->(%s)\n", This, debugstr_w(newVal));
489 
490  if (This->graph)
491  {
492  WARN("MSDN says not to call this method twice\n");
493  MD_cleanup(This);
494  }
495 
496  hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
497  &IID_IGraphBuilder, (void **) &gb);
498  if (FAILED(hr))
499  return hr;
500 
501  hr = IGraphBuilder_AddSourceFilter(gb, newVal, reader, &bf);
502  if (FAILED(hr))
503  {
504  IGraphBuilder_Release(gb);
505  return hr;
506  }
507 
508  This->graph = gb;
509  This->source = bf;
510  hr = GetSplitter(This);
511  if (FAILED(hr))
512  return hr;
513 
514  return MediaDet_put_CurrentStream(iface, 0);
515 }
HRESULT hr
Definition: shlfolder.c:183
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define WARN(fmt,...)
Definition: debug.h:111
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:78
static void MD_cleanup(MediaDetImpl *This)
Definition: mediadet.c:58
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet *iface, LONG newVal)
Definition: mediadet.c:257
static HRESULT GetSplitter(MediaDetImpl *This)
Definition: mediadet.c:376
Definition: reader.h:83

◆ MediaDet_put_Filter()

static HRESULT WINAPI MediaDet_put_Filter ( IMediaDet iface,
IUnknown newVal 
)
static

Definition at line 153 of file mediadet.c.

154 {
156  FIXME("(%p)->(%p): not implemented!\n", This, newVal);
157  return E_NOTIMPL;
158 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ MediaDet_QueryInterface()

static HRESULT WINAPI MediaDet_QueryInterface ( IMediaDet iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 128 of file mediadet.c.

129 {
131  return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
132 }
REFIID riid
Definition: precomp.h:44
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ MediaDet_Release()

static ULONG WINAPI MediaDet_Release ( IMediaDet iface)
static

Definition at line 140 of file mediadet.c.

141 {
143  return IUnknown_Release(This->outer_unk);
144 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53

◆ MediaDet_WriteBitmapBits()

static HRESULT WINAPI MediaDet_WriteBitmapBits ( IMediaDet iface,
double  StreamTime,
LONG  Width,
LONG  Height,
BSTR  Filename 
)
static

Definition at line 528 of file mediadet.c.

531 {
533  FIXME("(%p)->(%f %d %d %p): not implemented!\n", This, StreamTime, Width, Height, Filename);
534  return E_NOTIMPL;
535 }
static MediaDetImpl * impl_from_IMediaDet(IMediaDet *iface)
Definition: mediadet.c:53
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:925
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ SetCurPin()

static HRESULT SetCurPin ( MediaDetImpl This,
LONG  strm 
)
static

Definition at line 216 of file mediadet.c.

217 {
218  IEnumPins *pins;
219  IPin *pin;
220  HRESULT hr;
221 
222  assert(This->splitter);
223  assert(0 <= strm && strm < This->num_streams);
224 
225  if (This->cur_pin)
226  {
227  IPin_Release(This->cur_pin);
228  This->cur_pin = NULL;
229  }
230 
231  hr = IBaseFilter_EnumPins(This->splitter, &pins);
232  if (FAILED(hr))
233  return hr;
234 
235  while (IEnumPins_Next(pins, 1, &pin, NULL) == S_OK && !This->cur_pin)
236  {
238  hr = IPin_QueryDirection(pin, &dir);
239  if (FAILED(hr))
240  {
241  IPin_Release(pin);
242  IEnumPins_Release(pins);
243  return hr;
244  }
245 
246  if (dir == PINDIR_OUTPUT && strm-- == 0)
247  This->cur_pin = pin;
248  else
249  IPin_Release(pin);
250  }
251  IEnumPins_Release(pins);
252 
253  assert(This->cur_pin);
254  return S_OK;
255 }
HRESULT hr
Definition: shlfolder.c:183
#define assert(x)
Definition: debug.h:53
Definition: regsvr.c:103
smooth NULL
Definition: ftsmooth.c:416
unsigned int dir
Definition: maze.c:112
LONG HRESULT
Definition: typedefs.h:78
#define S_OK
Definition: intsafe.h:59
Definition: axcore.idl:91
enum _PinDirection PIN_DIRECTION

Referenced by MediaDet_put_CurrentStream().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( qedit  )

Variable Documentation

◆ IMediaDet_VTable

const IMediaDetVtbl IMediaDet_VTable
static
Initial value:
=
{
}
static ULONG WINAPI MediaDet_Release(IMediaDet *iface)
Definition: mediadet.c:140
static ULONG WINAPI MediaDet_AddRef(IMediaDet *iface)
Definition: mediadet.c:134
static HRESULT WINAPI MediaDet_get_OutputStreams(IMediaDet *iface, LONG *pVal)
Definition: mediadet.c:160
static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet *iface, AM_MEDIA_TYPE *pVal)
Definition: mediadet.c:537
static HRESULT WINAPI MediaDet_get_FrameRate(IMediaDet *iface, double *pVal)
Definition: mediadet.c:579
static HRESULT WINAPI MediaDet_GetBitmapBits(IMediaDet *iface, double StreamTime, LONG *pBufferSize, char *pBuffer, LONG Width, LONG Height)
Definition: mediadet.c:517
static HRESULT WINAPI MediaDet_get_StreamType(IMediaDet *iface, GUID *pVal)
Definition: mediadet.c:283
static HRESULT WINAPI MediaDet_get_StreamLength(IMediaDet *iface, double *pVal)
Definition: mediadet.c:297
static HRESULT WINAPI MediaDet_put_Filter(IMediaDet *iface, IUnknown *newVal)
Definition: mediadet.c:153
static HRESULT WINAPI MediaDet_get_Filter(IMediaDet *iface, IUnknown **pVal)
Definition: mediadet.c:146
static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet *iface, LONG *pVal)
Definition: mediadet.c:204
static HRESULT WINAPI MediaDet_get_Filename(IMediaDet *iface, BSTR *pVal)
Definition: mediadet.c:304
static HRESULT WINAPI MediaDet_EnterBitmapGrabMode(IMediaDet *iface, double SeekTime)
Definition: mediadet.c:608
static HRESULT WINAPI MediaDet_put_Filename(IMediaDet *iface, BSTR newVal)
Definition: mediadet.c:480
static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet *iface, LONG newVal)
Definition: mediadet.c:257
static HRESULT WINAPI MediaDet_QueryInterface(IMediaDet *iface, REFIID riid, void **ppv)
Definition: mediadet.c:128
static HRESULT WINAPI MediaDet_WriteBitmapBits(IMediaDet *iface, double StreamTime, LONG Width, LONG Height, BSTR Filename)
Definition: mediadet.c:528
static HRESULT WINAPI MediaDet_get_StreamTypeB(IMediaDet *iface, BSTR *pVal)
Definition: mediadet.c:290
static HRESULT WINAPI MediaDet_GetSampleGrabber(IMediaDet *iface, ISampleGrabber **ppVal)
Definition: mediadet.c:571

Definition at line 616 of file mediadet.c.

Referenced by MediaDet_create().

◆ mediadet_vtbl

const IUnknownVtbl mediadet_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI MediaDet_inner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
Definition: mediadet.c:73
static ULONG WINAPI MediaDet_inner_Release(IUnknown *iface)
Definition: mediadet.c:104
static ULONG WINAPI MediaDet_inner_AddRef(IUnknown *iface)
Definition: mediadet.c:94

Definition at line 120 of file mediadet.c.

Referenced by MediaDet_create().