[cheese] camera: don't use hardcoded format



commit 07c140b5dfebf5860c6e34108fa718417fbed09d
Author: Wim Taymans <wtaymans redhat com>
Date:   Wed Feb 1 17:17:47 2017 +0100

    camera: don't use hardcoded format
    
    Use gst_caps_fixate() to select the best format instead of trying to
    filter out a hardcoded format. Some cameras might not produce this
    format and thus fail to work.

 libcheese/cheese-camera.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/libcheese/cheese-camera.c b/libcheese/cheese-camera.c
index 49ac1c0..811bb1d 100644
--- a/libcheese/cheese-camera.c
+++ b/libcheese/cheese-camera.c
@@ -733,7 +733,7 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
 {
   CheeseCameraPrivate *priv;
   CheeseCameraDevice *device;
-  GstCaps *caps, *i420_caps, *video_caps;
+  GstCaps *caps;
   gchar *caps_desc;
   int width, height;
 
@@ -761,13 +761,10 @@ cheese_camera_set_new_caps (CheeseCamera *camera)
                   "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);
+    caps = gst_caps_fixate (caps);
+
+    g_object_set (priv->camerabin, "video-capture-caps", 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]