FFmpeg
dshow_enumpins.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_IEnumPins,0} })
28 
29 long WINAPI
30 libAVEnumPins_Next(libAVEnumPins *this, unsigned long n, IPin **pins,
31  unsigned long *fetched)
32 {
33  int count = 0;
34  dshowdebug("libAVEnumPins_Next(%p)\n", this);
35  if (!pins)
36  return E_POINTER;
37  if (!this->pos && n == 1) {
38  libAVPin_AddRef(this->pin);
39  *pins = (IPin *) this->pin;
40  count = 1;
41  this->pos = 1;
42  }
43  if (fetched)
44  *fetched = count;
45  if (!count)
46  return S_FALSE;
47  return S_OK;
48 }
49 long WINAPI
50 libAVEnumPins_Skip(libAVEnumPins *this, unsigned long n)
51 {
52  dshowdebug("libAVEnumPins_Skip(%p)\n", this);
53  if (n) /* Any skip will always fall outside of the only valid pin. */
54  return S_FALSE;
55  return S_OK;
56 }
57 long WINAPI
59 {
60  dshowdebug("libAVEnumPins_Reset(%p)\n", this);
61  this->pos = 0;
62  return S_OK;
63 }
64 long WINAPI
66 {
67  libAVEnumPins *new;
68  dshowdebug("libAVEnumPins_Clone(%p)\n", this);
69  if (!pins)
70  return E_POINTER;
71  new = libAVEnumPins_Create(this->pin, this->filter);
72  if (!new)
73  return E_OUTOFMEMORY;
74  new->pos = this->pos;
75  *pins = new;
76  return S_OK;
77 }
78 
79 static int
81 {
82  IEnumPinsVtbl *vtbl = this->vtbl;
83  SETVTBL(vtbl, libAVEnumPins, QueryInterface);
84  SETVTBL(vtbl, libAVEnumPins, AddRef);
85  SETVTBL(vtbl, libAVEnumPins, Release);
86  SETVTBL(vtbl, libAVEnumPins, Next);
87  SETVTBL(vtbl, libAVEnumPins, Skip);
88  SETVTBL(vtbl, libAVEnumPins, Reset);
89  SETVTBL(vtbl, libAVEnumPins, Clone);
90 
91  this->pin = pin;
92  this->filter = filter;
93  libAVFilter_AddRef(this->filter);
94 
95  return 1;
96 }
97 static int
99 {
101  return 1;
102 }
104  libAVPin *pin, libAVFilter *filter)
n
int n
Definition: avisynth_c.h:760
E_POINTER
#define E_POINTER
Definition: windows2linux.h:43
libAVPin_AddRef
unsigned long WINAPI libAVPin_AddRef(libAVPin *)
dshow_capture.h
DECLARE_RELEASE
#define DECLARE_RELEASE(class)
Definition: dshow_capture.h:101
count
void INT64 INT64 count
Definition: avisynth_c.h:767
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
S_OK
#define S_OK
Definition: windows2linux.h:40
libAVEnumPins_Clone
long WINAPI libAVEnumPins_Clone(libAVEnumPins *this, libAVEnumPins **pins)
Definition: dshow_enumpins.c:65
DECLARE_ADDREF
#define DECLARE_ADDREF(class)
Definition: dshow_capture.h:94
libAVEnumPins_Skip
long WINAPI libAVEnumPins_Skip(libAVEnumPins *this, unsigned long n)
Definition: dshow_enumpins.c:50
libAVPin
Definition: dshow_capture.h:160
DECLARE_CREATE
#define DECLARE_CREATE(class, setup,...)
Definition: dshow_capture.h:123
dshowdebug
#define dshowdebug(...)
Definition: dshow_capture.h:50
SETVTBL
#define SETVTBL(vtbl, class, fn)
Definition: dshow_capture.h:145
libAVFilter_Release
unsigned long WINAPI libAVFilter_Release(libAVFilter *)
libAVEnumPins_Next
long WINAPI libAVEnumPins_Next(libAVEnumPins *, unsigned long, IPin **, unsigned long *)
libAVEnumPins_Cleanup
static int libAVEnumPins_Cleanup(libAVEnumPins *this)
Definition: dshow_enumpins.c:98
libAVEnumPins
Definition: dshow_capture.h:206
DECLARE_QUERYINTERFACE
DECLARE_QUERYINTERFACE(libAVEnumPins, { {&IID_IUnknown, 0}, {&IID_IEnumPins, 0} })
Definition: dshow_enumpins.c:24
E_OUTOFMEMORY
#define E_OUTOFMEMORY
Definition: windows2linux.h:45
libAVFilter
Definition: dshow_capture.h:249
DECLARE_DESTROY
#define DECLARE_DESTROY(class, func)
Definition: dshow_capture.h:112
S_FALSE
#define S_FALSE
Definition: windows2linux.h:41
libAVEnumPins_Reset
long WINAPI libAVEnumPins_Reset(libAVEnumPins *this)
Definition: dshow_enumpins.c:58
libAVFilter_AddRef
unsigned long WINAPI libAVFilter_AddRef(libAVFilter *)
libAVEnumPins_Setup
static int libAVEnumPins_Setup(libAVEnumPins *this, libAVPin *pin, libAVFilter *filter)
Definition: dshow_enumpins.c:80
libAVEnumPins_Create
libAVEnumPins * libAVEnumPins_Create(libAVPin *pin, libAVFilter *filter)