FFmpeg
Loading...
Searching...
No Matches
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
29long 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}
48long 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}
#define DECLARE_QUERYINTERFACE(prefix, class,...)
#define DECLARE_CREATE(prefix, class, setup,...)
#define dshowdebug(...)
#define DECLARE_RELEASE(prefix, class)
unsigned long WINAPI ff_dshow_filter_AddRef(DShowFilter *)
DShowEnumPins * ff_dshow_enumpins_Create(DShowPin *pin, DShowFilter *filter)
#define DECLARE_ADDREF(prefix, class)
long WINAPI ff_dshow_enumpins_Next(DShowEnumPins *, unsigned long, IPin **, unsigned long *)
#define SETVTBL(vtbl, prefix, fn)
#define DECLARE_DESTROY(prefix, class, func)
unsigned long WINAPI ff_dshow_pin_AddRef(DShowPin *)
unsigned long WINAPI ff_dshow_filter_Release(DShowFilter *)
long WINAPI ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
static int ff_dshow_enumpins_Setup(DShowEnumPins *this, DShowPin *pin, DShowFilter *filter)
static int ff_dshow_enumpins_Cleanup(DShowEnumPins *this)
long WINAPI ff_dshow_enumpins_Reset(DShowEnumPins *this)
long WINAPI ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
unsigned int pos
Definition spdifenc.c:431
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29