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 }
#define S_OK
Definition: windows2linux.h:40
long WINAPI libAVEnumPins_Reset(libAVEnumPins *this)
#define dshowdebug(...)
Definition: dshow_capture.h:50
#define DECLARE_DESTROY(class, func)
#define E_POINTER
Definition: windows2linux.h:43
#define DECLARE_CREATE(class, setup,...)
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common 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
#define DECLARE_RELEASE(class)
Definition: dshow_capture.h:97
unsigned long WINAPI libAVPin_AddRef(libAVPin *)
long WINAPI libAVEnumPins_Next(libAVEnumPins *, unsigned long, IPin **, unsigned long *)
#define SETVTBL(vtbl, class, fn)
static int libAVEnumPins_Cleanup(libAVEnumPins *this)
long WINAPI libAVEnumPins_Skip(libAVEnumPins *this, unsigned long n)
DECLARE_QUERYINTERFACE(libAVEnumPins,{{&IID_IUnknown, 0},{&IID_IEnumPins, 0}})
unsigned long WINAPI libAVFilter_AddRef(libAVFilter *)
libAVEnumPins * libAVEnumPins_Create(libAVPin *pin, libAVFilter *filter)
#define E_OUTOFMEMORY
Definition: windows2linux.h:45
unsigned long WINAPI libAVFilter_Release(libAVFilter *)
#define S_FALSE
Definition: windows2linux.h:41
half analysis window size pin
static int libAVEnumPins_Setup(libAVEnumPins *this, libAVPin *pin, libAVFilter *filter)
long WINAPI libAVEnumPins_Clone(libAVEnumPins *this, libAVEnumPins **pins)
void INT64 INT64 count
Definition: avisynth_c.h:594
#define DECLARE_ADDREF(class)
Definition: dshow_capture.h:90