From a8ee445da6ff59bbe89b67b5133f1e3aa574bae2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 27 Jul 2007 11:21:20 +0000 Subject: [PATCH] gst/rtsp/: Clean up the interface list. Original commit message from CVS: * gst/rtsp/gstrtspext.c: (gst_rtsp_ext_list_free), (gst_rtsp_ext_list_connect): * gst/rtsp/gstrtspext.h: * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init), (gst_rtspsrc_finalize), (gst_rtspsrc_send_cb): Clean up the interface list. Allow connecting to interface signals for the extensions. Remove old extension code. Free list on cleanup. Allow extensions to send additional RTSP messages. --- ChangeLog | 13 +++++++++++++ gst/rtsp/gstrtspext.c | 27 ++++++++++++++++++++++++++ gst/rtsp/gstrtspext.h | 5 +++++ gst/rtsp/gstrtspsrc.c | 44 +++++++++++++++---------------------------- 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 344f5277fa..c96f5e4477 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-07-27 Wim Taymans + + * gst/rtsp/gstrtspext.c: (gst_rtsp_ext_list_free), + (gst_rtsp_ext_list_connect): + * gst/rtsp/gstrtspext.h: + * gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_init), + (gst_rtspsrc_finalize), (gst_rtspsrc_send_cb): + Clean up the interface list. + Allow connecting to interface signals for the extensions. + Remove old extension code. + Free list on cleanup. + Allow extensions to send additional RTSP messages. + 2007-07-27 Jan Schmidt * ext/gconf/gconf.c: (gst_gconf_render_bin_with_default): diff --git a/gst/rtsp/gstrtspext.c b/gst/rtsp/gstrtspext.c index b9d71bb110..0ad81b5618 100644 --- a/gst/rtsp/gstrtspext.c +++ b/gst/rtsp/gstrtspext.c @@ -105,6 +105,20 @@ gst_rtsp_ext_list_get (void) return result; } +void +gst_rtsp_ext_list_free (GstRTSPExtensionList * ext) +{ + GList *walk; + + for (walk = ext->extensions; walk; walk = g_list_next (walk)) { + GstRTSPExtension *elem = (GstRTSPExtension *) walk->data; + + gst_object_unref (GST_OBJECT_CAST (elem)); + } + g_list_free (ext->extensions); + g_free (ext); +} + gboolean gst_rtsp_ext_list_detect_server (GstRTSPExtensionList * ext, GstRTSPMessage * resp) @@ -220,3 +234,16 @@ gst_rtsp_ext_list_stream_select (GstRTSPExtensionList * ext, GstRTSPUrl * url) } return res; } + +void +gst_rtsp_ext_list_connect (GstRTSPExtensionList * ext, + const gchar * detailed_signal, GCallback c_handler, gpointer data) +{ + GList *walk; + + for (walk = ext->extensions; walk; walk = g_list_next (walk)) { + GstRTSPExtension *elem = (GstRTSPExtension *) walk->data; + + g_signal_connect (elem, detailed_signal, c_handler, data); + } +} diff --git a/gst/rtsp/gstrtspext.h b/gst/rtsp/gstrtspext.h index b02b9bb831..fa7f6892a1 100644 --- a/gst/rtsp/gstrtspext.h +++ b/gst/rtsp/gstrtspext.h @@ -58,6 +58,7 @@ struct _GstRTSPExtensionList void gst_rtsp_ext_list_init (void); GstRTSPExtensionList * gst_rtsp_ext_list_get (void); +void gst_rtsp_ext_list_free (GstRTSPExtensionList *ext); gboolean gst_rtsp_ext_list_detect_server (GstRTSPExtensionList *ext, GstRTSPMessage *resp); @@ -72,6 +73,10 @@ GstRTSPResult gst_rtsp_ext_list_get_transports (GstRTSPExtensionList *ext, Gs gchar **transport); GstRTSPResult gst_rtsp_ext_list_stream_select (GstRTSPExtensionList *ext, GstRTSPUrl *url); +void gst_rtsp_ext_list_connect (GstRTSPExtensionList *ext, + const gchar *detailed_signal, GCallback c_handler, + gpointer data); + G_END_DECLS #endif /* __GST_RTSP_EXT_H__ */ diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 8a0de7bdf0..619c185093 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -97,16 +97,6 @@ #include "gstrtspsrc.h" -/* define for experimental real support */ -#undef WITH_EXT_REAL - -#if 0 -#include "rtspextwms.h" -#ifdef WITH_EXT_REAL -#include "rtspextreal.h" -#endif -#endif - GST_DEBUG_CATEGORY_STATIC (rtspsrc_debug); #define GST_CAT_DEFAULT (rtspsrc_debug) @@ -198,6 +188,9 @@ static GstStateChangeReturn gst_rtspsrc_change_state (GstElement * element, GstStateChange transition); static void gst_rtspsrc_handle_message (GstBin * bin, GstMessage * message); +static GstRTSPResult gst_rtspsrc_send_cb (GstRTSPExtension * ext, + GstRTSPMessage * request, GstRTSPMessage * response, GstRTSPSrc * src); + static gboolean gst_rtspsrc_open (GstRTSPSrc * src); static gboolean gst_rtspsrc_play (GstRTSPSrc * src); static gboolean gst_rtspsrc_pause (GstRTSPSrc * src); @@ -318,15 +311,9 @@ gst_rtspsrc_init (GstRTSPSrc * src, GstRTSPSrcClass * g_class) /* get a list of all extensions */ src->extensions = gst_rtsp_ext_list_get (); -#if 0 -#ifdef WITH_EXT_REAL - src->extension = rtsp_ext_real_get_context (); -#else - /* install WMS extension by default */ - src->extension = rtsp_ext_wms_get_context (); -#endif - src->extension->src = (gpointer) src; -#endif + /* connect to send signal */ + gst_rtsp_ext_list_connect (src->extensions, "send", + (GCallback) gst_rtspsrc_send_cb, src); src->state_rec_lock = g_new (GStaticRecMutex, 1); g_static_rec_mutex_init (src->state_rec_lock); @@ -340,6 +327,7 @@ gst_rtspsrc_finalize (GObject * object) rtspsrc = GST_RTSPSRC (object); + gst_rtsp_ext_list_free (rtspsrc->extensions); g_static_rec_mutex_free (rtspsrc->stream_rec_lock); g_free (rtspsrc->stream_rec_lock); g_free (rtspsrc->location); @@ -349,16 +337,6 @@ gst_rtspsrc_finalize (GObject * object) g_static_rec_mutex_free (rtspsrc->state_rec_lock); g_free (rtspsrc->state_rec_lock); -#if 0 - if (rtspsrc->extension) { -#ifdef WITH_EXT_REAL - rtsp_ext_real_free_context (rtspsrc->extension); -#else - rtsp_ext_wms_free_context (rtspsrc->extension); -#endif - } -#endif - G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -2917,6 +2895,14 @@ error_response: } } +static GstRTSPResult +gst_rtspsrc_send_cb (GstRTSPExtension * ext, GstRTSPMessage * request, + GstRTSPMessage * response, GstRTSPSrc * src) +{ + return gst_rtspsrc_send (src, request, response, NULL); +} + + /* parse the response and collect all the supported methods. We need this * information so that we don't try to send an unsupported request to the * server.