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
31 * Last reviewed on 2007-07-25 (0.10.14)
38 #include "rtsp-marshal.h"
39 #include "gstrtsp-enumtypes.h"
40 #include "gstrtspextension.h"
42 static void gst_rtsp_extension_iface_init (GstRTSPExtension * iface);
50 static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
53 gst_rtsp_extension_get_type (void)
55 static GType gst_rtsp_extension_type = 0;
57 if (!gst_rtsp_extension_type) {
58 static const GTypeInfo gst_rtsp_extension_info = {
59 sizeof (GstRTSPExtensionInterface),
60 (GBaseInitFunc) gst_rtsp_extension_iface_init,
70 gst_rtsp_extension_type = g_type_register_static (G_TYPE_INTERFACE,
71 "GstRTSPExtension", &gst_rtsp_extension_info, 0);
73 return gst_rtsp_extension_type;
77 gst_rtsp_extension_iface_init (GstRTSPExtension * iface)
79 static gboolean initialized = FALSE;
82 gst_rtsp_extension_signals[SIGNAL_SEND] =
83 g_signal_new ("send", G_TYPE_FROM_CLASS (iface),
84 G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPExtensionInterface,
85 send), NULL, NULL, gst_rtsp_marshal_ENUM__POINTER_POINTER,
86 GST_TYPE_RTSP_RESULT, 2, G_TYPE_POINTER, G_TYPE_POINTER);
92 gst_rtsp_extension_detect_server (GstRTSPExtension * ext, GstRTSPMessage * resp)
94 GstRTSPExtensionInterface *iface;
97 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
98 if (iface->detect_server)
99 res = iface->detect_server (ext, resp);
105 gst_rtsp_extension_before_send (GstRTSPExtension * ext, GstRTSPMessage * req)
107 GstRTSPExtensionInterface *iface;
108 GstRTSPResult res = GST_RTSP_OK;
110 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
111 if (iface->before_send)
112 res = iface->before_send (ext, req);
118 gst_rtsp_extension_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
119 GstRTSPMessage * resp)
121 GstRTSPExtensionInterface *iface;
122 GstRTSPResult res = GST_RTSP_OK;
124 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
125 if (iface->after_send)
126 res = iface->after_send (ext, req, resp);
132 gst_rtsp_extension_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
135 GstRTSPExtensionInterface *iface;
136 GstRTSPResult res = GST_RTSP_OK;
138 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
139 if (iface->parse_sdp)
140 res = iface->parse_sdp (ext, sdp, s);
146 gst_rtsp_extension_setup_media (GstRTSPExtension * ext, GstSDPMedia * media)
148 GstRTSPExtensionInterface *iface;
149 GstRTSPResult res = GST_RTSP_OK;
151 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
152 if (iface->setup_media)
153 res = iface->setup_media (ext, media);
159 gst_rtsp_extension_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
161 GstRTSPExtensionInterface *iface;
164 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
165 if (iface->configure_stream)
166 res = iface->configure_stream (ext, caps);
172 gst_rtsp_extension_get_transports (GstRTSPExtension * ext,
173 GstRTSPLowerTrans protocols, gchar ** transport)
175 GstRTSPExtensionInterface *iface;
176 GstRTSPResult res = GST_RTSP_OK;
178 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
179 if (iface->get_transports)
180 res = iface->get_transports (ext, protocols, transport);
186 gst_rtsp_extension_stream_select (GstRTSPExtension * ext, GstRTSPUrl * url)
188 GstRTSPExtensionInterface *iface;
189 GstRTSPResult res = GST_RTSP_OK;
191 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
192 if (iface->stream_select)
193 res = iface->stream_select (ext, url);
199 gst_rtsp_extension_receive_request (GstRTSPExtension * ext,
200 GstRTSPMessage * msg)
202 GstRTSPExtensionInterface *iface;
203 GstRTSPResult res = GST_RTSP_ENOTIMPL;
205 iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
206 if (iface->receive_request)
207 res = iface->receive_request (ext, msg);
213 gst_rtsp_extension_send (GstRTSPExtension * ext, GstRTSPMessage * req,
214 GstRTSPMessage * resp)
216 GstRTSPResult res = GST_RTSP_OK;
218 g_signal_emit (ext, gst_rtsp_extension_signals[SIGNAL_SEND], 0,