2 * DirectShow capture interface
3 * Copyright (c) 2010 Ramiro Polla
5 * This file is part of FFmpeg.
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.
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.
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
22 #include "dshow_capture.h"
24 DECLARE_QUERYINTERFACE(enumpins, DShowEnumPins,
25 { {&IID_IUnknown,0}, {&IID_IEnumPins,0} })
26 DECLARE_ADDREF(enumpins, DShowEnumPins)
27 DECLARE_RELEASE(enumpins, DShowEnumPins)
29 long ff_dshow_enumpins_Next(DShowEnumPins *this, unsigned long n, IPin **pins,
30 unsigned long *fetched)
33 dshowdebug("ff_dshow_enumpins_Next(%p)\n", this);
36 if (!this->pos && n == 1) {
37 ff_dshow_pin_AddRef(this->pin);
38 *pins = (IPin *) this->pin;
48 long ff_dshow_enumpins_Skip(DShowEnumPins *this, unsigned long n)
50 dshowdebug("ff_dshow_enumpins_Skip(%p)\n", this);
51 if (n) /* Any skip will always fall outside of the only valid pin. */
55 long ff_dshow_enumpins_Reset(DShowEnumPins *this)
57 dshowdebug("ff_dshow_enumpins_Reset(%p)\n", this);
61 long ff_dshow_enumpins_Clone(DShowEnumPins *this, DShowEnumPins **pins)
64 dshowdebug("ff_dshow_enumpins_Clone(%p)\n", this);
67 new = ff_dshow_enumpins_Create(this->pin, this->filter);
75 static int ff_dshow_enumpins_Setup(DShowEnumPins *this, DShowPin *pin, DShowFilter *filter)
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);
87 this->filter = filter;
88 ff_dshow_filter_AddRef(this->filter);
92 static int ff_dshow_enumpins_Cleanup(DShowEnumPins *this)
94 ff_dshow_filter_Release(this->filter);
97 DECLARE_CREATE(enumpins, DShowEnumPins, ff_dshow_enumpins_Setup(this, pin, filter),
98 DShowPin *pin, DShowFilter *filter)
99 DECLARE_DESTROY(enumpins, DShowEnumPins, ff_dshow_enumpins_Cleanup)