1 /* GStreamer RTSP extension
2 * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
4 * gstrtspextension.c: RTSP extension mechanism
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * SECTION:gstrtspextension
24 * @short_description: Interface for extending RTSP protocols
28 * This interface is implemented e.g. by the Windows Media Streaming RTSP
29 * exentension (rtspwms) and the RealMedia RTSP extension (rtspreal).
33 * Last reviewed on 2007-07-25 (0.10.14)
40 #include "gstrtsp-marshal.h"
41 #include "gstrtsp-enumtypes.h"
42 #include "gstrtspextension.h"
44 static void gst_rtsp_extension_iface_init (GstRTSPExtension * iface);
52 static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
55 gst_rtsp_extension_get_type (void)
57 static volatile gsize gst_rtsp_extension_type = 0;
58 static const GTypeInfo gst_rtsp_extension_info = {
59 sizeof (GstRTSPExtensionInterface),
60 (GBaseInitFunc) gst_rtsp_extension_iface_init,
70 if (g_once_init_enter (&gst_rtsp_extension_type)) {
71 GType tmp = g_type_register_static (G_TYPE_INTERFACE,
72 "GstRTSPExtension", &gst_rtsp_extension_info, 0);
73 g_once_init_leave (&gst_rtsp_extension_type, tmp);
75 return (GType) gst_rtsp_extension_type;
79 gst_rtsp_extension_iface_init (GstRTSPExtension * iface)
81 static gboolean initialized = FALSE;
84 gst_rtsp_extension_signals[SIGNAL_SEND] =
85 g_signal_new ("send", G_TYPE_FROM_CLASS (iface),
86 G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPExtensionInterface,
87 send), NULL, NULL, __gst_rtsp_marshal_ENUM__POINTER_POINTER,
88 GST_TYPE_RTSP_RESULT, 2, G_TYPE_POINTER, G_TYPE_POINTER);
94 gst_rtsp_extension_detect_server (GstRTSPExtension * ext, GstRTSPMessage * resp)
96 GstRTSPExtensionInterface *iface;
99 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
100 if (iface->detect_server)
101 res = iface->detect_server (ext, resp);
107 gst_rtsp_extension_before_send (GstRTSPExtension * ext, GstRTSPMessage * req)
109 GstRTSPExtensionInterface *iface;
110 GstRTSPResult res = GST_RTSP_OK;
112 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
113 if (iface->before_send)
114 res = iface->before_send (ext, req);
120 gst_rtsp_extension_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
121 GstRTSPMessage * resp)
123 GstRTSPExtensionInterface *iface;
124 GstRTSPResult res = GST_RTSP_OK;
126 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
127 if (iface->after_send)
128 res = iface->after_send (ext, req, resp);
134 gst_rtsp_extension_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
137 GstRTSPExtensionInterface *iface;
138 GstRTSPResult res = GST_RTSP_OK;
140 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
141 if (iface->parse_sdp)
142 res = iface->parse_sdp (ext, sdp, s);
148 gst_rtsp_extension_setup_media (GstRTSPExtension * ext, GstSDPMedia * media)
150 GstRTSPExtensionInterface *iface;
151 GstRTSPResult res = GST_RTSP_OK;
153 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
154 if (iface->setup_media)
155 res = iface->setup_media (ext, media);
161 gst_rtsp_extension_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
163 GstRTSPExtensionInterface *iface;
166 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
167 if (iface->configure_stream)
168 res = iface->configure_stream (ext, caps);
174 gst_rtsp_extension_get_transports (GstRTSPExtension * ext,
175 GstRTSPLowerTrans protocols, gchar ** transport)
177 GstRTSPExtensionInterface *iface;
178 GstRTSPResult res = GST_RTSP_OK;
180 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
181 if (iface->get_transports)
182 res = iface->get_transports (ext, protocols, transport);
188 gst_rtsp_extension_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
190 GstRTSPExtensionInterface *iface;
191 GstRTSPResult res = GST_RTSP_OK;
193 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
194 if (iface->stream_select)
195 res = iface->stream_select (ext, url);
201 gst_rtsp_extension_receive_request (GstRTSPExtension * ext,
202 GstRTSPMessage * msg)
204 GstRTSPExtensionInterface *iface;
205 GstRTSPResult res = GST_RTSP_ENOTIMPL;
207 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
208 if (iface->receive_request)
209 res = iface->receive_request (ext, msg);
215 gst_rtsp_extension_send (GstRTSPExtension * ext, GstRTSPMessage * req,
216 GstRTSPMessage * resp)
218 GstRTSPResult res = GST_RTSP_OK;
220 g_signal_emit (ext, gst_rtsp_extension_signals[SIGNAL_SEND], 0,