aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Benjamin <neuroptik@gmail.com>2006-09-15 11:17:41 +0000
committerGuillaume Poirier <gpoirier@mplayerhq.hu>2006-09-15 11:17:41 +0000
commit1733fc4a6b62d7d0d4311699dec23bfeda025fe3 (patch)
treed8c6a5e973af49476d8118d5ac2c6567eedb8f6e /libavformat
parent3c0ba8703cc8b3a6972aa2e6136e0ed391c4d194 (diff)
downloadffmpeg-1733fc4a6b62d7d0d4311699dec23bfeda025fe3.tar.gz
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 Originally committed as revision 6259 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/grab.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/grab.c b/libavformat/grab.c
index 5b3c49a080..15c1c5d188 100644
--- a/libavformat/grab.c
+++ b/libavformat/grab.c
@@ -173,7 +173,11 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
pict.depth=24;
ret = ioctl(video_fd, VIDIOCSPICT, &pict);
if (ret < 0)
- goto fail1;
+ 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;
}