#ifndef DSDEVICEDESCRIPTOR_H_
#define DSDEVICEDESCRIPTOR_H_
#include <iostream>
#include <string>
#include <DShow.h>
#include "DeviceDescriptor.h"
#include "avcap-export.h"
class IBaseFilter;
namespace avcap
{
class CaptureDevice;
class DS_Device;
class AVCAP_Export DS_DeviceDescriptor : public DeviceDescriptor
{
public:
unsigned long mRegister;
private:
std::string mName;
std::string mCard;
std::string mInfo;
int mCapabilities;
DEV_HANDLE_T mHandle;
bool mValid;
bool mIsOpen;
DS_Device* mDevice;
public:
DS_DeviceDescriptor(const std::string &card);
virtual ~DS_DeviceDescriptor();
virtual CaptureDevice* getDevice();
int open();
int close();
virtual inline const std::string& getName() const
{ return mName; }
inline const DEV_HANDLE_T getHandle() const
{ return mHandle; }
inline DEV_HANDLE_T getHandle()
{ return mHandle; }
bool isAVDev() const;
bool isVideoCaptureDev() const;
bool isVBIDev() const;
bool isTuner() const;
bool isAudioDev() const;
bool isRadioDev() const;
bool isOverlayDev() const;
bool isVfWDevice() const;
private:
bool queryCapabilities();
void findDevice(std::string &UniqueDeviceID, IBaseFilter **CaptureFilter,
std::string &DeviceName, std::string &DeviceInfo,
bool *IsVideoDevice=NULL, bool *IsAudioDevice=NULL);
bool createCaptureFilterGraph(std::string &UniqueDeviceID,
IBaseFilter *CaptureFilter);
bool getInfosFromDevice(IBaseFilter *CaptureFilter, int *Capabilities,
std::string &Card, std::string &Info);
bool findOverlaySupport(IBaseFilter *CaptureFilter, int *Capabilities);
bool findVBISupport(IBaseFilter *CaptureFilter, int *Capabilities);
bool findTunerRadioSupport(IBaseFilter *CaptureFilter, int *Capabilities);
bool isAudioOrVideoDevice(IBaseFilter *CaptureFilter, int *Capabilities);
HRESULT addToRot(IUnknown *pUnkGraph, DWORD *pdwRegister);
void removeFromRot(DWORD pdwRegister);
friend class DS_Device;
};
}
#endif