[cheese] Fix video recording with GStreamer >= 1.1.4



commit f6b6a7c1db07c9a4d2e7547129864b59a952f50e
Author: Hans de Goede <hdegoede redhat com>
Date:   Tue Sep 3 15:56:25 2013 +0200

    Fix video recording with GStreamer >= 1.1.4
    
    GStreamer >= 1.1.4 requires fully specifying the video-capture-source caps,
    otherwise Cheese prints this:
    
    (cheese:22606): cheese-WARNING **: Filter caps do not completely specify the output format: 
gstcapsfilter.c(348): gst_capsfilter_prepare_buf (): 
/GstCameraBin:camerabin/GstCapsFilter:videobin-capsfilter:
    Output caps are unfixed: video/x-raw, framerate=(fraction)30/1, width=(int)640, height=(int)480, 
format=(string){ YUY2, YV12, BGR, RGB, I420 }, pixel-aspect-ratio=(fraction)1/1, 
interlace-mode=(string)progressive
    
    and video-recording is broken. Fixes bug 707391.
    
    Signed-off-by: Hans de Goede <hdegoede redhat com>

 libcheese/cheese-camera.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index a625359..ab5490d 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -743,7 +743,7 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv;
   CheeseCameraDevice *device;
-  GstCaps *caps;
+  GstCaps *caps, *i420_caps, *video_caps;
   gchar *caps_desc;
   int width, height;
 
@@ -768,8 +768,16 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
     g_object_set (gst_bin_get_by_name (GST_BIN (priv->video_source),
                   "video_source_filter"), "caps", caps, NULL);
     g_object_set (priv->camerabin, "viewfinder-caps", caps,
-                  "image-capture-caps", caps, "video-capture-caps", caps,
-                  NULL);
+                  "image-capture-caps", caps, NULL);
+
+    /* GStreamer >= 1.1.4 expects fully-specified video-capture-source caps. */
+    i420_caps = gst_caps_new_simple ("video/x-raw",
+                                     "format", G_TYPE_STRING, "I420", NULL);
+    video_caps = gst_caps_intersect (caps, i420_caps);
+    g_object_set (priv->camerabin, "video-capture-caps", video_caps, NULL);
+
+    gst_caps_unref (i420_caps);
+    gst_caps_unref (video_caps);
     gst_caps_unref (caps);
 
     width = priv->current_format->width;


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