- Fix cheese crashing on tvcards which report they can capture 0x0 as minimum resolution (rhbz#850505)
74 lines
2.2 KiB
Diff
74 lines
2.2 KiB
Diff
From 121fd6f5355b5e56fa21004f030fe02eb1de7ae7 Mon Sep 17 00:00:00 2001
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Wed, 22 Aug 2012 10:58:57 +0200
|
|
Subject: [PATCH 4/4] Ensure width is a multiple of 8, and height a multiple
|
|
of 2
|
|
|
|
We ask Gstreamer to us an YUV format in the pipeline, by setting the
|
|
camera-bins "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 don't 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 file 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);
|
|
|
|
--
|
|
1.7.11.4
|
|
|