[cheese] Ensure width is a multiple of 8, and height of 2



commit d5521392affde56404c4123a27e432ff9f3efa6c
Author: Hans de Goede <hdegoede redhat com>
Date:   Wed Aug 22 10:58:57 2012 +0200

    Ensure width is a multiple of 8, and height of 2
    
    We ask GStreamer to use an YUV format in the pipeline, by setting the
    camerabin's "filter-caps" to "video/x-raw-yuv", and GStreamer demands of
    YUV format frames that their width is a multiple of 8, and their height
    a multiple of 2.
    
    Previous to this patch my bttv tvcard lists the following resolutions in
    Cheese:
    924x576 (*)
    920x576
    640x480
    462x288 (*)
    460x288 (*)
    320x240
    231x144 (*)
    230x144 (*)
    160x120
    
    Where all the ones marked with an asterisk do not work.
    
    After this patch the list is:
    920x576
    640x480
    456x288
    320x240
    224x144
    160x120
    
    And all work.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 libcheese/cheese-camera-device.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/libcheese/cheese-camera-device.c b/libcheese/cheese-camera-device.c
index 653cba9..370abff 100644
--- a/libcheese/cheese-camera-device.c
+++ b/libcheese/cheese-camera-device.c
@@ -313,8 +313,10 @@ cheese_camera_device_update_format_table (CheeseCameraDevice *device)
       {
         CheeseVideoFormat *format = g_slice_new0 (CheeseVideoFormat);
 
-        format->width  = cur_width;
-        format->height = cur_height;
+        /* Gstreamer wants resolutions for YUV formats where the width is
+         * a multiple of 8, and the height is a multiple of 2 */
+        format->width  = cur_width & ~7;
+        format->height = cur_height & ~1;
 
         cheese_camera_device_add_format (device, format);
 
@@ -328,8 +330,10 @@ cheese_camera_device_update_format_table (CheeseCameraDevice *device)
       {
         CheeseVideoFormat *format = g_slice_new0 (CheeseVideoFormat);
 
-        format->width  = cur_width;
-        format->height = cur_height;
+        /* Gstreamer wants resolutions for YUV formats where the width is
+         * a multiple of 8, and the height is a multiple of 2 */
+        format->width  = cur_width & ~7;
+        format->height = cur_height & ~1;
 
         cheese_camera_device_add_format (device, format);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]