Commit 7b4f963e authored by gpoirier's avatar gpoirier

Add support for 8-bit grayscale to V4L grabber

patch by Michael Benjamin % neuroptik AH gmail.com %
Original thread:
Date: Aug 24, 2006 5:40 PM
Subject: [Ffmpeg-devel] V4L grab.c patch for Grayscale


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6259 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 625115e0
......@@ -172,6 +172,10 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
pict.palette=VIDEO_PALETTE_RGB24;
pict.depth=24;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
if (ret < 0)
pict.palette=VIDEO_PALETTE_GREY;
pict.depth=8;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
if (ret < 0)
goto fail1;
}
......@@ -256,6 +260,10 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
frame_size = width * height * 3;
st->codec->pix_fmt = PIX_FMT_BGR24; /* NOTE: v4l uses BGR24, not RGB24 ! */
break;
case VIDEO_PALETTE_GREY:
frame_size = width * height * 1;
st->codec->pix_fmt = PIX_FMT_GRAY8;
break;
default:
goto fail;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment