27 #ifndef INCLUDED_directx_camera_server_h_GUID_9322F126_0DA4_4DB9_11F3_DDBF76A6D9D9 28 #define INCLUDED_directx_camera_server_h_GUID_9322F126_0DA4_4DB9_11F3_DDBF76A6D9D9 47 #define NO_DSHOW_STRSAFE 63 struct ConstructionError : std::runtime_error {
64 ConstructionError(
const char objName[])
66 std::string(
"directx_camera_server: Can't create ") + objName) {}
90 using FilterOperation = std::function<void(IBaseFilter &)>;
94 using BufferType = std::vector<unsigned char>;
97 directx_camera_server(
int which,
unsigned width = 0,
unsigned height = 0);
99 directx_camera_server(std::string
const &pathPrefix,
unsigned width = 0,
100 unsigned height = 0);
104 directx_camera_server(std::string
const &pathPrefix,
105 FilterOperation
const &sourceConfig);
107 virtual ~directx_camera_server(
void);
110 virtual unsigned get_num_colors()
const {
return 3; };
113 virtual bool read_image_to_memory(
unsigned minX = 255,
unsigned maxX = 0,
114 unsigned minY = 255,
unsigned maxY = 0,
115 double exposure_millisecs = 250.0);
118 virtual bool get_pixel_from_memory(
unsigned X,
unsigned Y, vrpn_uint8 &val,
120 virtual bool get_pixel_from_memory(
unsigned X,
unsigned Y, vrpn_uint16 &val,
124 BufferType
const &get_pixel_buffer()
const {
return _buffer; }
127 BufferType &get_pixel_buffer() {
return _buffer; }
136 bool isOpened(
void)
const {
return _started_graph; }
138 std::string
const &getPath()
const {
return devicePath_; }
141 bool start_com_and_graphbuilder();
143 FilterOperation
const &sourceConfig,
144 unsigned width,
unsigned height);
145 virtual void close_device(
void);
148 directx_camera_server();
163 std::unique_ptr<SampleGrabberWrapper> _pSampleGrabberWrapper;
167 bool _started_graph =
false;
174 MediaSampleExchangePtr sampleExchange_;
176 virtual bool open_and_find_parameters(
const int which,
unsigned width,
178 bool open_and_find_parameters(std::string
const &pathPrefix,
179 FilterOperation
const &sourceConfig,
180 unsigned width = 0,
unsigned height = 0);
181 virtual bool read_one_frame(
unsigned minX,
unsigned maxX,
unsigned minY,
182 unsigned maxY,
unsigned exposure_millisecs);
185 void allocate_buffer();
186 std::string devicePath_;
190 #endif // INCLUDED_directx_camera_server_h_GUID_9322F126_0DA4_4DB9_11F3_DDBF76A6D9D9 Header with a template alias for the desired COM smart pointer.
Definition: TypeSafeIdHash.h:44
Header providing RAII-style handling of COM initialization.
Header providing a C++ wrapper around TimeValueC.h.
boost::intrusive_ptr< T > Ptr
Template alias for our desired COM smart pointer.
Definition: ComPtr.h:40
std::unique_ptr< ComInit > ComInstance
unique_ptr for holding the lifetime of a ComInit.
Definition: ComInit.h:42
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
Definition: base_camera_server.h:196