FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dshow_enummediatypes.c
Go to the documentation of this file.
1 /*
2  * DirectShow capture interface
3  * Copyright (c) 2010 Ramiro Polla
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "dshow_capture.h"
23 
25  { {&IID_IUnknown,0}, {&IID_IEnumMediaTypes,0} })
28 
29 long WINAPI
31  AM_MEDIA_TYPE **types, unsigned long *fetched)
32 {
33  int count = 0;
34  dshowdebug("libAVEnumMediaTypes_Next(%p)\n", this);
35  if (!types)
36  return E_POINTER;
37  if (!this->pos && n == 1) {
38  if (!IsEqualGUID(&this->type.majortype, &GUID_NULL)) {
39  AM_MEDIA_TYPE *type = av_malloc(sizeof(AM_MEDIA_TYPE));
40  ff_copy_dshow_media_type(type, &this->type);
41  *types = type;
42  count = 1;
43  }
44  this->pos = 1;
45  }
46  if (fetched)
47  *fetched = count;
48  if (!count)
49  return S_FALSE;
50  return S_OK;
51 }
52 long WINAPI
54 {
55  dshowdebug("libAVEnumMediaTypes_Skip(%p)\n", this);
56  if (n) /* Any skip will always fall outside of the only valid type. */
57  return S_FALSE;
58  return S_OK;
59 }
60 long WINAPI
62 {
63  dshowdebug("libAVEnumMediaTypes_Reset(%p)\n", this);
64  this->pos = 0;
65  return S_OK;
66 }
67 long WINAPI
69 {
71  dshowdebug("libAVEnumMediaTypes_Clone(%p)\n", this);
72  if (!enums)
73  return E_POINTER;
74  new = libAVEnumMediaTypes_Create(&this->type);
75  if (!new)
76  return E_OUTOFMEMORY;
77  new->pos = this->pos;
78  *enums = new;
79  return S_OK;
80 }
81 
82 static int
84 {
85  IEnumMediaTypesVtbl *vtbl = this->vtbl;
86  SETVTBL(vtbl, libAVEnumMediaTypes, QueryInterface);
87  SETVTBL(vtbl, libAVEnumMediaTypes, AddRef);
88  SETVTBL(vtbl, libAVEnumMediaTypes, Release);
89  SETVTBL(vtbl, libAVEnumMediaTypes, Next);
90  SETVTBL(vtbl, libAVEnumMediaTypes, Skip);
91  SETVTBL(vtbl, libAVEnumMediaTypes, Reset);
92  SETVTBL(vtbl, libAVEnumMediaTypes, Clone);
93 
94  if (!type) {
95  this->type.majortype = GUID_NULL;
96  } else {
97  ff_copy_dshow_media_type(&this->type, type);
98  }
99 
100  return 1;
101 }
#define S_OK
Definition: windows2linux.h:40
#define dshowdebug(...)
Definition: dshow_capture.h:50
#define DECLARE_DESTROY(class, func)
#define E_POINTER
Definition: windows2linux.h:43
#define DECLARE_CREATE(class, setup,...)
long WINAPI libAVEnumMediaTypes_Next(libAVEnumMediaTypes *, unsigned long, AM_MEDIA_TYPE **, unsigned long *)
#define av_malloc(s)
long WINAPI libAVEnumMediaTypes_Skip(libAVEnumMediaTypes *this, unsigned long n)
#define DECLARE_RELEASE(class)
long WINAPI libAVEnumMediaTypes_Reset(libAVEnumMediaTypes *this)
long ff_copy_dshow_media_type(AM_MEDIA_TYPE *dst, const AM_MEDIA_TYPE *src)
Definition: dshow_common.c:24
GLsizei count
Definition: opengl_enc.c:109
int n
Definition: avisynth_c.h:547
#define SETVTBL(vtbl, class, fn)
GLint GLenum type
Definition: opengl_enc.c:105
long WINAPI libAVEnumMediaTypes_Clone(libAVEnumMediaTypes *this, libAVEnumMediaTypes **enums)
static void nothing(void *foo)
Definition: dshow_capture.h:52
#define E_OUTOFMEMORY
Definition: windows2linux.h:45
static int libAVEnumMediaTypes_Setup(libAVEnumMediaTypes *this, const AM_MEDIA_TYPE *type)
DECLARE_QUERYINTERFACE(libAVEnumMediaTypes,{{&IID_IUnknown, 0},{&IID_IEnumMediaTypes, 0}})
#define S_FALSE
Definition: windows2linux.h:41
libAVEnumMediaTypes * libAVEnumMediaTypes_Create(const AM_MEDIA_TYPE *type)
#define DECLARE_ADDREF(class)
Definition: dshow_capture.h:94