[cogl/wip/cogl-gst-1.x: 41/41] gst-video-sink: add pixel-aspect-ratio property



commit 6c2a80fb167f11a750d343e7eab8edac0f922912
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Thu Mar 14 12:33:46 2013 +0000

    gst-video-sink: add pixel-aspect-ratio property

 cogl-gst/cogl-gst-video-sink.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 8b97ef6..fa2faad 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -70,7 +70,8 @@ G_DEFINE_TYPE (CoglGstVideoSink, cogl_gst_video_sink, GST_TYPE_BASE_SINK);
 enum
 {
   PROP_0,
-  PROP_UPDATE_PRIORITY
+  PROP_UPDATE_PRIORITY,
+  PROP_PAR
 };
 
 enum
@@ -731,12 +732,21 @@ cogl_gst_video_sink_parse_caps (GstCaps *caps,
 
   if (save)
     {
+      gboolean notify_par = FALSE;
+
+      if (priv->info.par_n != vinfo.par_n ||
+          priv->info.par_d != vinfo.par_d)
+        notify_par = TRUE;
+
       priv->info = vinfo;
 
       priv->format = format;
       priv->bgr = bgr;
 
       priv->renderer = renderer;
+
+      if (notify_par)
+        g_object_notify (G_OBJECT (sink), "pixel-aspect-ratio");
     }
 
   return TRUE;
@@ -1009,6 +1019,9 @@ cogl_gst_video_sink_get_property (GObject *object,
     case PROP_UPDATE_PRIORITY:
       g_value_set_int (value, g_source_get_priority ((GSource *) priv->source));
       break;
+    case PROP_PAR:
+      gst_value_set_fraction (value, priv->info.par_n, priv->info.par_d);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -1076,6 +1089,14 @@ cogl_gst_video_sink_class_init (CoglGstVideoSinkClass *klass)
 
   g_object_class_install_property (go_class, PROP_UPDATE_PRIORITY, pspec);
 
+  pspec = gst_param_spec_fraction ("pixel-aspect-ratio",
+                                   "Pixel Aspect Ratio",
+                                   "Pixel aspect ratio of incoming frames",
+                                   1, 100, 100, 1, 1, 1,
+                                   COGL_GST_PARAM_READABLE);
+
+  g_object_class_install_property (go_class, PROP_PAR, pspec);
+
   video_sink_signals[PIPELINE_READY_SIGNAL] =
     g_signal_new ("pipeline-ready",
                   COGL_GST_TYPE_VIDEO_SINK,


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