• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libavdevice/dshow_enumpins.c

Go to the documentation of this file.
00001 /*
00002  * DirectShow capture interface
00003  * Copyright (c) 2010 Ramiro Polla
00004  *
00005  * This file is part of FFmpeg.
00006  *
00007  * FFmpeg is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * FFmpeg is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with FFmpeg; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00020  */
00021 
00022 #include "dshow.h"
00023 
00024 DECLARE_QUERYINTERFACE(libAVEnumPins,
00025     { {&IID_IUnknown,0}, {&IID_IEnumPins,0} })
00026 DECLARE_ADDREF(libAVEnumPins)
00027 DECLARE_RELEASE(libAVEnumPins)
00028 
00029 long WINAPI
00030 libAVEnumPins_Next(libAVEnumPins *this, unsigned long n, IPin **pins,
00031                    unsigned long *fetched)
00032 {
00033     int count = 0;
00034     dshowdebug("libAVEnumPins_Next(%p)\n", this);
00035     if (!pins)
00036         return E_POINTER;
00037     if (!this->pos && n == 1) {
00038         libAVPin_AddRef(this->pin);
00039         *pins = (IPin *) this->pin;
00040         count = 1;
00041         this->pos = 1;
00042     }
00043     if (fetched)
00044         *fetched = count;
00045     if (!count)
00046         return S_FALSE;
00047     return S_OK;
00048 }
00049 long WINAPI
00050 libAVEnumPins_Skip(libAVEnumPins *this, unsigned long n)
00051 {
00052     dshowdebug("libAVEnumPins_Skip(%p)\n", this);
00053     if (n) /* Any skip will always fall outside of the only valid pin. */
00054         return S_FALSE;
00055     return S_OK;
00056 }
00057 long WINAPI
00058 libAVEnumPins_Reset(libAVEnumPins *this)
00059 {
00060     dshowdebug("libAVEnumPins_Reset(%p)\n", this);
00061     this->pos = 0;
00062     return S_OK;
00063 }
00064 long WINAPI
00065 libAVEnumPins_Clone(libAVEnumPins *this, libAVEnumPins **pins)
00066 {
00067     libAVEnumPins *new;
00068     dshowdebug("libAVEnumPins_Clone(%p)\n", this);
00069     if (!pins)
00070         return E_POINTER;
00071     new = libAVEnumPins_Create(this->pin, this->filter);
00072     if (!new)
00073         return E_OUTOFMEMORY;
00074     new->pos = this->pos;
00075     *pins = new;
00076     return S_OK;
00077 }
00078 
00079 static int
00080 libAVEnumPins_Setup(libAVEnumPins *this, libAVPin *pin, libAVFilter *filter)
00081 {
00082     IEnumPinsVtbl *vtbl = this->vtbl;
00083     SETVTBL(vtbl, libAVEnumPins, QueryInterface);
00084     SETVTBL(vtbl, libAVEnumPins, AddRef);
00085     SETVTBL(vtbl, libAVEnumPins, Release);
00086     SETVTBL(vtbl, libAVEnumPins, Next);
00087     SETVTBL(vtbl, libAVEnumPins, Skip);
00088     SETVTBL(vtbl, libAVEnumPins, Reset);
00089     SETVTBL(vtbl, libAVEnumPins, Clone);
00090 
00091     this->pin = pin;
00092     this->filter = filter;
00093     libAVFilter_AddRef(this->filter);
00094 
00095     return 1;
00096 }
00097 DECLARE_CREATE(libAVEnumPins, libAVEnumPins_Setup(this, pin, filter),
00098                libAVPin *pin, libAVFilter *filter)
00099 DECLARE_DESTROY(libAVEnumPins, nothing)

Generated on Wed Apr 11 2012 07:31:35 for FFmpeg by  doxygen 1.7.1