rtpmux: Add signals before stream lock and after unlocking
authorLaurent Glayal <spglegle@yahoo.fr>
Fri, 20 Feb 2009 18:30:49 +0000 (13:30 -0500)
committerTim-Philipp Müller <tim@centricular.net>
Sun, 16 Dec 2012 16:33:17 +0000 (16:33 +0000)
gst/rtpmanager/gstrtpdtmfmux.c
gst/rtpmanager/gstrtpdtmfmux.h

index 4e0a86f..6ad5baa 100644 (file)
@@ -80,6 +80,15 @@ GST_ELEMENT_DETAILS ("RTP muxer",
     "mixes RTP DTMF streams into other RTP streams",
     "Zeeshan Ali <first.last@nokia.com>");
 
+enum
+{
+  SIGNAL_LOCKING_STREAM,
+  SIGNAL_UNLOCKED_STREAM,
+  LAST_SIGNAL
+};
+
+static guint gst_rtpdtmfmux_signals[LAST_SIGNAL] = { 0 };
+
 static void gst_rtp_dtmf_mux_base_init (gpointer g_class);
 static void gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass);
 static void gst_rtp_dtmf_mux_finalize (GObject * object);
@@ -137,6 +146,16 @@ gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass)
 
   parent_class = g_type_class_peek_parent (klass);
 
+  gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM] =
+    g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+                 G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking),NULL, NULL,
+                 gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
+
+  gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM] =
+    g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+                 G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked),NULL, NULL,
+                 gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
+
   gobject_class->finalize = gst_rtp_dtmf_mux_finalize;
   gstrtpmux_class->chain_func = gst_rtp_dtmf_mux_chain;
   gstrtpmux_class->sink_event_func = gst_rtp_dtmf_mux_sink_event;
@@ -228,6 +247,9 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
   if (!gst_structure_get_boolean (event_structure, "lock", &lock))
     return FALSE;
 
+  if (lock)
+    g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM], 0, pad);
+
   GST_OBJECT_LOCK (mux);
   if (lock)
     gst_rtp_dtmf_mux_lock_stream (mux, pad);
@@ -235,6 +257,9 @@ gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
     gst_rtp_dtmf_mux_unlock_stream (mux, pad);
   GST_OBJECT_UNLOCK (mux);
 
+  if (!lock)
+    g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM], 0, pad);
+
   return TRUE;
 }
 
index 866704c..8a253f1 100644 (file)
@@ -57,6 +57,10 @@ struct _GstRTPDTMFMux
 struct _GstRTPDTMFMuxClass
 {
   GstRTPMuxClass parent_class;
+
+  /* signals */
+  void (*locking) (GstElement *element, GstPad *pad);
+  void (*unlocked) (GstElement *element, GstPad *pad);
 };
 
 GType gst_rtp_dtmf_mux_get_type (void);