[longomatch] Fix caps when the src is smaller than the output



commit a9a13a584aa700bd4ae2d0de01b91cc3025f8f82
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sun Dec 14 20:24:03 2014 +0100

    Fix caps when the src is smaller than the output

 libcesarplayer/gst-camera-capturer.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libcesarplayer/gst-camera-capturer.c b/libcesarplayer/gst-camera-capturer.c
index 85af4bb..79af44e 100644
--- a/libcesarplayer/gst-camera-capturer.c
+++ b/libcesarplayer/gst-camera-capturer.c
@@ -1013,14 +1013,11 @@ gst_camera_capturer_have_type_cb (GstElement * typefind, guint prob,
 static GstCaps *
 gst_camera_capturer_find_highest_res (GstCameraCapturer *gcc, GstCaps *caps)
 {
-  gint max_width, max_height, i = 0;
+  gint max_width = 0, max_height = 0, i = 0;
   gint width, height;
   gchar *caps_str;
   GstCaps *rcaps;
 
-  max_width = gcc->priv->output_width;
-  max_height = gcc->priv->output_height;
-
   for (i=0; i < gst_caps_get_size (caps); i++) {
     GstStructure *s = gst_caps_get_structure (caps, i);
     if (gst_structure_get_int (s, "width", &width) &&
@@ -1031,6 +1028,11 @@ gst_camera_capturer_find_highest_res (GstCameraCapturer *gcc, GstCaps *caps)
       }
     }
   }
+  if (max_width == 0 || max_height == 0) {
+    max_width = gcc->priv->output_width;
+    max_height = gcc->priv->output_height;
+  }
+
   caps_str = g_strdup_printf ("video/x-raw-yuv, width=%d, height=%d;"
       "video/x-raw-rgb, width=%d, height=%d;"
       "video/x-dv, systemstream=true, width=%d, height=%d",


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