video4linux: support greyscale pixel format (eg. IR cameras)

This commit is contained in:
rdb 2018-03-11 16:32:33 +01:00
parent 5f14d9c48f
commit 2563b65249
2 changed files with 6 additions and 0 deletions

View File

@ -247,6 +247,10 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) {
_num_components = 4;
break;
case V4L2_PIX_FMT_GREY:
_num_components = 1;
break;
default:
vision_cat.error() << "Unsupported pixel format " << src->get_pixel_format() << "!\n";
_ready = false;
@ -484,6 +488,7 @@ fetch_buffer() {
case V4L2_PIX_FMT_BGR24:
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_GREY:
// Simplest case: copying every row verbatim.
nassertr(old_bpl == new_bpl, NULL);

View File

@ -174,6 +174,7 @@ void find_all_webcams_v4l() {
case V4L2_PIX_FMT_BGR32:
case V4L2_PIX_FMT_RGB24:
case V4L2_PIX_FMT_RGB32:
case V4L2_PIX_FMT_GREY:
break;
default: