| 54 | class CameraDevice : boost::noncopyable { |
| 55 | public: |
| 56 | CameraDevice(OSVR_PluginRegContext ctx, int cameraNum = 0, int channel = 0) |
| 57 | : m_camera(cameraNum), m_channel(channel) { |
| 58 | |
| 59 | /// Create the initialization options |
| 60 | OSVR_DeviceInitOptions opts = osvrDeviceCreateInitOptions(ctx); |
| 61 | |
| 62 | /// Configure an imaging interface (with the default number of sensors, |
| 63 | /// 1) |
| 64 | m_imaging = osvr::pluginkit::ImagingInterface(opts); |
| 65 | |
| 66 | /// Come up with a device name |
| 67 | std::ostringstream os; |
| 68 | os << "Camera" << cameraNum << "_" << m_channel; |
| 69 | |
| 70 | /// Create an asynchronous (threaded) device |
| 71 | m_dev.initAsync(ctx, os.str(), opts); |
| 72 | // Puts an object in m_dev that knows it's a |
| 73 | // threaded device so osvrDeviceSendData knows |
| 74 | // that it needs to get a connection lock first. |
| 75 | |
| 76 | /// Send the JSON. |
| 77 | m_dev.sendJsonDescriptor( |
| 78 | osvr::util::makeString(com_osvr_VideoCapture_OpenCV_json)); |
| 79 | |
| 80 | /// Sets the update callback |
| 81 | m_dev.registerUpdateCallback(this); |
| 82 | } |
| 83 | |
| 84 | OSVR_ReturnCode update() { |
| 85 | if (!m_camera.isOpened()) { |
nothing calls this directly
no test coverage detected