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 ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
30  unsigned long *fetched)
31 {
32  int count = 0;
33  dshowdebug("ff_dshow_enumpins_Next(%p)\n", this);
34  if (!pins)
35  return E_POINTER;
36  if (!this->pos && n == 1) {
37  ff_dshow_pin_AddRef(this->pin);
38  *pins = (IPin *) this->pin;
39  count = 1;
40  this->pos = 1;
41  }
42  if (fetched)
43  *fetched = count;
44  if (!count)
45  return S_FALSE;
46  return S_OK;
47 }
48 long WINAPI ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
49 {
50  dshowdebug("ff_dshow_enumpins_Skip(%p)\n", this);
51  if (n) /* Any skip will always fall outside of the only valid pin. */
52  return S_FALSE;
53  return S_OK;
54 }
56 {
57  dshowdebug("ff_dshow_enumpins_Reset(%p)\n", this);
58  this->pos = 0;
59  return S_OK;
60 }
62 {
63  DShowEnumPins *new;
64  dshowdebug("ff_dshow_enumpins_Clone(%p)\n", this);
65  if (!pins)
66  return E_POINTER;
67  new = ff_dshow_enumpins_Create(this->pin, this->filter);
68  if (!new)
69  return E_OUTOFMEMORY;
70  new->pos = this->pos;
71  *pins = new;
72  return S_OK;
73 }
74 
76 {
77  IEnumPinsVtbl *vtbl = this->vtbl;
78  SETVTBL(vtbl, enumpins, QueryInterface);
79  SETVTBL(vtbl, enumpins, AddRef);
80  SETVTBL(vtbl, enumpins, Release);
81  SETVTBL(vtbl, enumpins, Next);
82  SETVTBL(vtbl, enumpins, Skip);
83  SETVTBL(vtbl, enumpins, Reset);
84  SETVTBL(vtbl, enumpins, Clone);
85 
86  this->pin = pin;
87  this->filter = filter;
88  ff_dshow_filter_AddRef(this->filter);
89 
90  return 1;
91 }
93 {
95  return 1;
96 }
DECLARE_CREATE
#define DECLARE_CREATE(prefix, class, setup,...)
Definition: dshow_capture.h:124
DShowEnumPins
Definition: dshow_capture.h:207
dshow_capture.h
ff_dshow_enumpins_Setup
static int ff_dshow_enumpins_Setup(DShowEnumPins *this, DShowPin *pin, DShowFilter *filter)
Definition: dshow_enumpins.c:75
ff_dshow_enumpins_Skip
long WINAPI ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
Definition: dshow_enumpins.c:48
ff_dshow_enumpins_Clone
long WINAPI ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
Definition: dshow_enumpins.c:61
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
ff_dshow_enumpins_Cleanup
static int ff_dshow_enumpins_Cleanup(DShowEnumPins *this)
Definition: dshow_enumpins.c:92
DECLARE_ADDREF
#define DECLARE_ADDREF(prefix, class)
Definition: dshow_capture.h:95
dshowdebug
#define dshowdebug(...)
Definition: dshow_capture.h:51
DECLARE_QUERYINTERFACE
DECLARE_QUERYINTERFACE(enumpins, DShowEnumPins, { {&IID_IUnknown, 0}, {&IID_IEnumPins, 0} })
Definition: dshow_enumpins.c:24
DShowFilter
Definition: dshow_capture.h:250
SETVTBL
#define SETVTBL(vtbl, prefix, fn)
Definition: dshow_capture.h:146
DECLARE_DESTROY
#define DECLARE_DESTROY(prefix, class, func)
Definition: dshow_capture.h:113
ff_dshow_enumpins_Create
DShowEnumPins * ff_dshow_enumpins_Create(DShowPin *pin, DShowFilter *filter)
ff_dshow_filter_AddRef
unsigned long WINAPI ff_dshow_filter_AddRef(DShowFilter *)
DECLARE_RELEASE
#define DECLARE_RELEASE(prefix, class)
Definition: dshow_capture.h:102
pos
unsigned int pos
Definition: spdifenc.c:413
ff_dshow_enumpins_Reset
long WINAPI ff_dshow_enumpins_Reset(DShowEnumPins *this)
Definition: dshow_enumpins.c:55
ff_dshow_pin_AddRef
unsigned long WINAPI ff_dshow_pin_AddRef(DShowPin *)
DShowPin
Definition: dshow_capture.h:161
ff_dshow_enumpins_Next
long WINAPI ff_dshow_enumpins_Next(DShowEnumPins *, unsigned long, IPin **, unsigned long *)
ff_dshow_filter_Release
unsigned long WINAPI ff_dshow_filter_Release(DShowFilter *)