client: emit signal when closing
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 12 Jan 2011 14:35:51 +0000 (15:35 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 12 Jan 2011 14:35:51 +0000 (15:35 +0100)
gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-client.h

index b829ffa..8e9b026 100644 (file)
@@ -50,9 +50,17 @@ enum
   PROP_LAST
 };
 
+enum
+{
+  SIGNAL_CLOSED,
+  SIGNAL_LAST
+};
+
 GST_DEBUG_CATEGORY_STATIC (rtsp_client_debug);
 #define GST_CAT_DEFAULT rtsp_client_debug
 
+static guint gst_rtsp_client_signals[SIGNAL_LAST] = { 0 };
+
 static void gst_rtsp_client_get_property (GObject * object, guint propid,
     GValue * value, GParamSpec * pspec);
 static void gst_rtsp_client_set_property (GObject * object, guint propid,
@@ -89,6 +97,11 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
           GST_TYPE_RTSP_MEDIA_MAPPING,
           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
+  gst_rtsp_client_signals[SIGNAL_CLOSED] =
+      g_signal_new ("closed", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
+      G_STRUCT_OFFSET (GstRTSPClientClass, closed), NULL, NULL,
+      g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE);
+
   tunnels =
       g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
   tunnels_lock = g_mutex_new ();
@@ -1882,6 +1895,7 @@ client_watch_notify (GstRTSPClient * client)
   GST_INFO ("client %p: watch destroyed", client);
   client->watchid = 0;
   client->watch = NULL;
+  g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_CLOSED], 0, NULL);
   g_object_unref (client);
 }
 
index 710a7b3..dc2c79c 100644 (file)
@@ -107,6 +107,9 @@ struct _GstRTSPClient {
 
 struct _GstRTSPClientClass {
   GObjectClass  parent_class;
+
+  /* signals */
+  void     (*closed)        (GstRTSPClient *client);
 };
 
 GType                 gst_rtsp_client_get_type          (void);