client: emit signal when closing

This commit is contained in:
Wim Taymans 2011-01-12 15:35:51 +01:00
parent 7797023fda
commit 4a4a15077b
2 changed files with 17 additions and 0 deletions

View file

@ -50,9 +50,17 @@ enum
PROP_LAST PROP_LAST
}; };
enum
{
SIGNAL_CLOSED,
SIGNAL_LAST
};
GST_DEBUG_CATEGORY_STATIC (rtsp_client_debug); GST_DEBUG_CATEGORY_STATIC (rtsp_client_debug);
#define GST_CAT_DEFAULT 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, static void gst_rtsp_client_get_property (GObject * object, guint propid,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void gst_rtsp_client_set_property (GObject * object, guint propid, 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, GST_TYPE_RTSP_MEDIA_MAPPING,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 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 = tunnels =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
tunnels_lock = g_mutex_new (); tunnels_lock = g_mutex_new ();
@ -1882,6 +1895,7 @@ client_watch_notify (GstRTSPClient * client)
GST_INFO ("client %p: watch destroyed", client); GST_INFO ("client %p: watch destroyed", client);
client->watchid = 0; client->watchid = 0;
client->watch = NULL; client->watch = NULL;
g_signal_emit (client, gst_rtsp_client_signals[SIGNAL_CLOSED], 0, NULL);
g_object_unref (client); g_object_unref (client);
} }

View file

@ -107,6 +107,9 @@ struct _GstRTSPClient {
struct _GstRTSPClientClass { struct _GstRTSPClientClass {
GObjectClass parent_class; GObjectClass parent_class;
/* signals */
void (*closed) (GstRTSPClient *client);
}; };
GType gst_rtsp_client_get_type (void); GType gst_rtsp_client_get_type (void);