14#pragma comment(lib, "strmiids")
18#define _CRT_SECURE_NO_WARNINGS
38#include "devices/directshow/SampleGrabber.h"
43#include "irdirectsdk_defs.h"
50#define MAXLONGLONG 0x7FFFFFFFFFFFFFFF
53#ifndef MAX_DEVICE_NAME
54#define MAX_DEVICE_NAME 80
58#define BITS_PER_PIXEL 16
65#define SAFE_DS_RELEASE(x) { if (x) x->Release(); x = NULL; }
74 friend class CallbackHandler;
95 static bool findSerial(
unsigned long &query,
unsigned int skipNResults = 0);
139 virtual IRDeviceError
getFrame(
unsigned char* buffer,
double* timestamp = NULL,
int timeoutMilliseconds = -1);
147 static IRDeviceDS* createVideoGraph(
unsigned long serial,
int videoFormatIndex,
unsigned short bufferQueueSize);
149 static void removeDownstream(IBaseFilter *pf, IFilterGraph2* pFg);
151 static HRESULT findCaptureDevice(
IRDeviceDS ** device,
unsigned long serial,
unsigned short bufferQueueSize);
153 HRESULT initializeGraph();
155 void onRawFrame(
unsigned char* data,
int len);
157 static unsigned long determineSerialNumber(
wchar_t* deviceName);
159 static void deleteMediaType(AM_MEDIA_TYPE *pmt);
165 IBaseFilter* _sourceFilter;
167 IBaseFilter* _sampleGrabberFilter;
169 IBaseFilter* _nullRenderer;
171 IEvoSampleGrabber* _sampleGrabber;
173 ICaptureGraphBuilder2* _builder;
175 IMediaControl* _control;
177 IFilterGraph2* _graph;
179 CallbackHandler* _callbackHandler;
181 IMediaEventEx* _eventEx;
183 unsigned char** _rawBuffer;
185 double* _rawBufferTimestamps;
187 byte _rawBufferIndexWrite;
189 byte _rawBufferIndexRead;
193 CRITICAL_SECTION _critSec;
203 const unsigned short _bufferQueueSize = 4;
DirectShow device interface (Windows platforms)
Definition: IRDeviceDS.h:73
static bool findSerial(unsigned long &query, unsigned int skipNResults=0)
Determine serial number of attached device(s)
const char * getFriendlyName()
Get readable name of attached device.
int stopStreaming()
Stop video streaming.
virtual IRDeviceError getFrame(unsigned char *buffer, double *timestamp=NULL, int timeoutMilliseconds=-1)
Acquire one frame.
virtual void exit()
Exit blocking run method, if previously called.
int startStreaming()
Start video streaming.
static IRDeviceDS * createInstance(IRDeviceParams ¶ms)
Factory method.
virtual void run()
Run device, i.e., treat main thread in blocking mode.
bool isOpen()
Check if device was already opened.
Time measurement class.
Definition: Timer.h:27
Structure containing device parameters.
Definition: IRDeviceParams.h:125