client: emit a signal before sending a message
authorWim Taymans <wtaymans@redhat.com>
Thu, 1 May 2014 04:17:06 +0000 (06:17 +0200)
committerWim Taymans <wtaymans@redhat.com>
Thu, 1 May 2014 04:17:06 +0000 (06:17 +0200)
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=728970

gst/rtsp-server/rtsp-client.c

index fc58b16..d42f933 100644 (file)
@@ -114,6 +114,7 @@ enum
   SIGNAL_SET_PARAMETER_REQUEST,
   SIGNAL_GET_PARAMETER_REQUEST,
   SIGNAL_HANDLE_RESPONSE,
+  SIGNAL_SEND_MESSAGE,
   SIGNAL_LAST
 };
 
@@ -247,6 +248,11 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
           handle_response), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
       G_TYPE_NONE, 1, G_TYPE_POINTER);
 
+  gst_rtsp_client_signals[SIGNAL_SEND_MESSAGE] =
+      g_signal_new ("send-message", G_TYPE_FROM_CLASS (klass),
+      G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER,
+      G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
+
   tunnels =
       g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   g_mutex_init (&tunnels_lock);
@@ -473,6 +479,9 @@ send_message (GstRTSPClient * client, GstRTSPContext * ctx,
   if (close)
     gst_rtsp_message_add_header (message, GST_RTSP_HDR_CONNECTION, "close");
 
+  g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_SEND_MESSAGE],
+      0, ctx, message);
+
   g_mutex_lock (&priv->send_lock);
   if (priv->send_func)
     priv->send_func (client, message, close, priv->send_data);