rtspsrc: Expose use-pipeline-clock property
authorYouness Alaoui <youness.alaoui@collabora.co.uk>
Mon, 10 Jun 2013 21:20:14 +0000 (17:20 -0400)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 25 Jun 2013 12:50:33 +0000 (14:50 +0200)
gst/rtsp/gstrtspsrc.c
gst/rtsp/gstrtspsrc.h

index 0420ccffa4884ac629b33dfcebe924658c5975b1..22235117b073cd35896cf85758d447f4b06b1b36 100644 (file)
@@ -183,6 +183,7 @@ gst_rtsp_src_buffer_mode_get_type (void)
 #define DEFAULT_UDP_RECONNECT    TRUE
 #define DEFAULT_MULTICAST_IFACE  NULL
 #define DEFAULT_NTP_SYNC         FALSE
+#define DEFAULT_USE_PIPELINE_CLOCK      FALSE
 
 enum
 {
@@ -213,6 +214,7 @@ enum
   PROP_UDP_RECONNECT,
   PROP_MULTICAST_IFACE,
   PROP_NTP_SYNC,
+  PROP_USE_PIPELINE_CLOCK,
   PROP_LAST
 };
 
@@ -544,6 +546,12 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
           "Synchronize received streams to the NTP clock", DEFAULT_NTP_SYNC,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  g_object_class_install_property (gobject_class, PROP_USE_PIPELINE_CLOCK,
+      g_param_spec_boolean ("use-pipeline-clock", "Use pipeline clock",
+          "Use the pipeline running-time to set the NTP time in the RTCP SR messages",
+          DEFAULT_USE_PIPELINE_CLOCK,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
   /**
    * GstRTSPSrc::handle-request:
    * @rtspsrc: a #GstRTSPSrc
@@ -607,6 +615,7 @@ gst_rtspsrc_init (GstRTSPSrc * src)
   src->udp_reconnect = DEFAULT_UDP_RECONNECT;
   src->multi_iface = g_strdup (DEFAULT_MULTICAST_IFACE);
   src->ntp_sync = DEFAULT_NTP_SYNC;
+  src->use_pipeline_clock = DEFAULT_USE_PIPELINE_CLOCK;
 
   /* get a list of all extensions */
   src->extensions = gst_rtsp_ext_list_get ();
@@ -852,6 +861,9 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
     case PROP_NTP_SYNC:
       rtspsrc->ntp_sync = g_value_get_boolean (value);
       break;
+    case PROP_USE_PIPELINE_CLOCK:
+      rtspsrc->use_pipeline_clock = g_value_get_boolean (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -971,6 +983,9 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value,
     case PROP_NTP_SYNC:
       g_value_set_boolean (value, rtspsrc->ntp_sync);
       break;
+    case PROP_USE_PIPELINE_CLOCK:
+      g_value_set_boolean (value, rtspsrc->use_pipeline_clock);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -2575,6 +2590,11 @@ gst_rtspsrc_stream_configure_manager (GstRTSPSrc * src, GstRTSPStream * stream,
         g_object_set (src->manager, "ntp-sync", src->ntp_sync, NULL);
       }
 
+      if (g_object_class_find_property (klass, "use-pipeline-clock")) {
+        g_object_set (src->manager, "use-pipeline-clock",
+            src->use_pipeline_clock, NULL);
+      }
+
       if (g_object_class_find_property (klass, "drop-on-latency")) {
         g_object_set (src->manager, "drop-on-latency", src->drop_on_latency,
             NULL);
index 3c465dfc1b7133f42a60a9dd8a71a820fec36104..a2c47a5a84a1128141fc5e40e3d8e099c331ab43 100644 (file)
@@ -223,6 +223,7 @@ struct _GstRTSPSrc {
   gboolean          udp_reconnect;
   gchar            *multi_iface;
   gboolean          ntp_sync;
+  gboolean          use_pipeline_clock;
 
   /* state */
   GstRTSPState       state;