changeset 1316:d584d375f928 libavformat

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
author gpoirier
date Fri, 15 Sep 2006 11:17:41 +0000
parents af1ced65c24c
children 132206560fe6
files grab.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/grab.c	Fri Sep 15 09:42:51 2006 +0000
+++ b/grab.c	Fri Sep 15 11:17:41 2006 +0000
@@ -173,7 +173,11 @@
                 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 @@
         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;
     }