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.
This commit is contained in:
Wim Taymans 2007-07-27 11:21:20 +00:00
parent 1364d7b0b1
commit a8ee445da6
4 changed files with 60 additions and 29 deletions

View file

@ -1,3 +1,16 @@
2007-07-27 Wim Taymans <wim.taymans@gmail.com>
* 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 <thaytan@mad.scientist.com>
* ext/gconf/gconf.c: (gst_gconf_render_bin_with_default):

View file

@ -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);
}
}

View file

@ -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__ */

View file

@ -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.