diff options
Diffstat (limited to 'video-ps3eye/wrapper.cxx')
-rw-r--r-- | video-ps3eye/wrapper.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/video-ps3eye/wrapper.cxx b/video-ps3eye/wrapper.cxx index 2ebdc2e1..0f9344eb 100644 --- a/video-ps3eye/wrapper.cxx +++ b/video-ps3eye/wrapper.cxx @@ -65,12 +65,16 @@ int main(int argc, char** argv) auto* frame = (uint8_t*)out.data_640x480; decltype(out.timecode) timecode = 0; + constexpr auto fmt = ps3eye::num_channels == 1 + ? ps3eye::format::Gray + : ps3eye::format::BGR; + { int framerate = in.framerate; if (framerate <= 0) framerate = 60; - if (!camera->init(get_mode(in.resolution), framerate, ps3eye::format::Gray)) + if (!camera->init(get_mode(in.resolution), framerate, fmt)) error(out, "camera init failed: %s", camera->error_string()); update_settings(*camera, in); @@ -94,7 +98,7 @@ int main(int argc, char** argv) int framerate = in.framerate; if (framerate <= 0) framerate = 60; - if (!camera->init(get_mode(in.resolution), framerate, ps3eye::format::Gray)) + if (!camera->init(get_mode(in.resolution), framerate, fmt)) error(out, "camera init failed: %s", camera->error_string()); if (!camera->start()) error(out, "can't start camera: %s", camera->error_string()); |