include/avcap/windows/DS_DeviceDescriptor.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de>
00003  *
00004  * This file is part of avcap.
00005  *
00006  * avcap is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * avcap is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with avcap.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 /* avcap is free for non-commercial use.
00021  * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>.
00022  */
00023 
00024 
00025 #ifndef DSDEVICEDESCRIPTOR_H_
00026 #define DSDEVICEDESCRIPTOR_H_
00027 
00028 #include <iostream>
00029 #include <string>
00030 #include <DShow.h>
00031 
00032 #include "DeviceDescriptor.h"
00033 #include "avcap-export.h"
00034 
00035 class IBaseFilter;
00036 
00037 namespace avcap
00038 {
00039 class CaptureDevice;
00040 class DS_Device;
00041 
00043 
00044         class AVCAP_Export DS_DeviceDescriptor : public DeviceDescriptor
00045         {
00046         public:
00047                 // Used by AddToRot() and RemoveFromRot() for spying on
00048                 // filter graph with GraphEdit software
00049                 unsigned long mRegister; // For debugging purpose
00050 
00051         private:
00052                 std::string mName;
00053                 std::string mCard;
00054                 std::string mInfo;
00055 
00056                 int                     mCapabilities;
00057                 DEV_HANDLE_T    mHandle;
00058                 bool                    mValid;
00059                 bool                    mIsOpen;
00060                 DS_Device*              mDevice;
00061 
00062         public:
00063                 DS_DeviceDescriptor(const std::string &card);
00064 
00065                 virtual ~DS_DeviceDescriptor();
00066 
00067                 virtual CaptureDevice* getDevice();
00068 
00069                 int open();
00070 
00071                 int close();
00072 
00073                 virtual inline const std::string& getName() const
00074                         { return mName; }
00075 
00076                 // implementation of pure virtual method
00077                 inline const DEV_HANDLE_T getHandle() const
00078                         { return mHandle; }
00079 
00080                 // but non-const access is needed by the device-class
00081                 inline DEV_HANDLE_T getHandle()
00082                         { return mHandle; }
00083 
00084                 bool isAVDev() const;
00085 
00086                 bool isVideoCaptureDev() const;
00087 
00088                 bool isVBIDev() const;
00089 
00090                 bool isTuner() const;
00091 
00092                 bool isAudioDev() const;
00093 
00094                 bool isRadioDev() const;
00095 
00096                 bool isOverlayDev() const;
00097 
00099 
00100                 bool isVfWDevice() const;
00101 
00102         private:
00103                 bool queryCapabilities();
00104 
00105                 void findDevice(std::string &UniqueDeviceID, IBaseFilter **CaptureFilter,
00106                                 std::string &DeviceName, std::string &DeviceInfo,
00107                                 bool *IsVideoDevice=NULL, bool *IsAudioDevice=NULL);
00108 
00109                 bool createCaptureFilterGraph(std::string &UniqueDeviceID,
00110                                 IBaseFilter *CaptureFilter);
00111 
00112                 bool getInfosFromDevice(IBaseFilter *CaptureFilter, int *Capabilities,
00113                                 std::string &Card, std::string &Info);
00114 
00115                 bool findOverlaySupport(IBaseFilter *CaptureFilter, int *Capabilities);
00116 
00117                 bool findVBISupport(IBaseFilter *CaptureFilter, int *Capabilities);
00118 
00119                 bool findTunerRadioSupport(IBaseFilter *CaptureFilter, int *Capabilities);
00120 
00121                 bool isAudioOrVideoDevice(IBaseFilter *CaptureFilter, int *Capabilities);
00122 
00123                 HRESULT addToRot(IUnknown *pUnkGraph, DWORD *pdwRegister);
00124 
00125                 void removeFromRot(DWORD pdwRegister);
00126 
00127                 friend class DS_Device;
00128         };
00129 }
00130 
00131 #endif // DSEVICEDESCRIPTOR_H_

Generated on Mon Nov 30 11:10:30 2009 for avcap-0.1 by  doxygen 1.5.1