2007-07-25 Wim Taymans <wim.taymans@gmail.com>
+ * gst-libs/gst/interfaces/Makefile.am:
+ * gst-libs/gst/interfaces/rtspextension.c:
+ (gst_rtsp_extension_get_type), (gst_rtsp_extension_iface_init),
+ (gst_rtsp_extension_detect_server),
+ (gst_rtsp_extension_before_send), (gst_rtsp_extension_after_send),
+ (gst_rtsp_extension_parse_sdp), (gst_rtsp_extension_setup_media),
+ (gst_rtsp_extension_configure_stream),
+ (gst_rtsp_extension_get_transports),
+ (gst_rtsp_extension_stream_select), (gst_rtsp_extension_send):
+ * gst-libs/gst/interfaces/rtspextension.h:
+ Move interface for RTSP extensions from -good to here.
+ Added helper methods to invoke interface methods.
+
+2007-07-25 Wim Taymans <wim.taymans@gmail.com>
+
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtsp/gstrtspdefs.h:
* gst-libs/gst/rtsp/gstrtspmessage.c: (key_value_foreach),
--- /dev/null
+/* GStreamer RTSP extension
+ * Copyright (C) 2007 Wim Taymans <wim.taymans@gmail.com>
+ *
+ * rtspextension.c: RTSP extension mechanism
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
+ * SECTION:gstrtspextension
+ * @short_description: Interface for extending RTSP protocols
+ *
+ * <refsect2>
+ * <para>
+ * </para>
+ * </refsect2>
+ *
+ * Last reviewed on 2007-07-25 (0.10.14)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "rtspextension.h"
+
+static void gst_rtsp_extension_iface_init (GstRTSPExtension * iface);
+
+enum
+{
+ SIGNAL_SEND,
+ LAST_SIGNAL
+};
+
+static guint gst_rtsp_extension_signals[LAST_SIGNAL] = { 0 };
+
+GType
+gst_rtsp_extension_get_type (void)
+{
+ static GType gst_rtsp_extension_type = 0;
+
+ if (!gst_rtsp_extension_type) {
+ static const GTypeInfo gst_rtsp_extension_info = {
+ sizeof (GstRTSPExtensionInterface),
+ (GBaseInitFunc) gst_rtsp_extension_iface_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ };
+
+ gst_rtsp_extension_type = g_type_register_static (G_TYPE_INTERFACE,
+ "GstRTSPExtension", &gst_rtsp_extension_info, 0);
+ }
+ return gst_rtsp_extension_type;
+}
+
+static void
+gst_rtsp_extension_iface_init (GstRTSPExtension * iface)
+{
+ static gboolean initialized = FALSE;
+
+ if (!initialized) {
+ gst_rtsp_extension_signals[SIGNAL_SEND] =
+ g_signal_new ("send", G_TYPE_FROM_CLASS (iface),
+ G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (GstRTSPExtensionInterface,
+ send), NULL, NULL, g_cclosure_marshal_VOID__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+ initialized = TRUE;
+ }
+}
+
+gboolean
+gst_rtsp_extension_detect_server (GstRTSPExtension * ext, GstRTSPMessage * resp)
+{
+ GstRTSPExtensionInterface *iface;
+ gboolean res = TRUE;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->detect_server)
+ res = iface->detect_server (ext, resp);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_before_send (GstRTSPExtension * ext, GstRTSPMessage * req)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->before_send)
+ res = iface->before_send (ext, req);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_after_send (GstRTSPExtension * ext, GstRTSPMessage * req,
+ GstRTSPMessage * resp)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->after_send)
+ res = iface->after_send (ext, req, resp);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_parse_sdp (GstRTSPExtension * ext, GstSDPMessage * sdp,
+ GstStructure * s)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->parse_sdp)
+ res = iface->parse_sdp (ext, sdp, s);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_setup_media (GstRTSPExtension * ext, GstSDPMedia * media)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->setup_media)
+ res = iface->setup_media (ext, media);
+
+ return res;
+}
+
+gboolean
+gst_rtsp_extension_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
+{
+ GstRTSPExtensionInterface *iface;
+ gboolean res = TRUE;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->configure_stream)
+ res = iface->configure_stream (ext, caps);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_get_transports (GstRTSPExtension * ext,
+ GstRTSPLowerTrans protocols, gchar ** transport)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->get_transports)
+ res = iface->get_transports (ext, protocols, transport);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_stream_select (GstRTSPExtension * ext)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+ if (iface->stream_select)
+ res = iface->stream_select (ext);
+
+ return res;
+}
+
+GstRTSPResult
+gst_rtsp_extension_send (GstRTSPExtension * ext, GstRTSPMessage * req,
+ GstRTSPMessage * resp)
+{
+ GstRTSPExtensionInterface *iface;
+ GstRTSPResult res = GST_RTSP_OK;
+
+ iface = GST_RTSP_EXTENSION_GET_IFACE (ext);
+
+ g_signal_emit (G_OBJECT (iface), gst_rtsp_extension_signals[SIGNAL_SEND], 0,
+ req, resp);
+
+ return res;
+}
--- /dev/null
+/* GStreamer RTSP Extension
+ * Copyright (C) 2007 Wim Taymans <wim@fluendo.com>
+ *
+ * rtspextension.h: RTSP Extension interface.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_RTSP_EXTENSION_H__
+#define __GST_RTSP_EXTENSION_H__
+
+#include <gst/gst.h>
+
+#include <gst/sdp/gstsdpmessage.h>
+#include <gst/rtsp/gstrtsptransport.h>
+#include <gst/rtsp/gstrtspmessage.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_RTSP_EXTENSION \
+ (gst_rtsp_extension_get_type ())
+#define GST_RTSP_EXTENSION(obj) \
+ (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_EXTENSION, GstRTSPExtension))
+#define GST_IS_RTSP_EXTENSION(obj) \
+ (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_EXTENSION))
+#define GST_RTSP_EXTENSION_GET_IFACE(inst) \
+ (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GST_TYPE_RTSP_EXTENSION, GstRTSPExtensionInterface))
+
+typedef struct _GstRTSPExtension GstRTSPExtension;
+typedef struct _GstRTSPExtensionInterface GstRTSPExtensionInterface;
+
+struct _GstRTSPExtensionInterface {
+ GTypeInterface parent;
+
+ /* vfunctions */
+ gboolean (*detect_server) (GstRTSPExtension *ext, GstRTSPMessage *resp);
+
+ GstRTSPResult (*before_send) (GstRTSPExtension *ext, GstRTSPMessage *req);
+ GstRTSPResult (*after_send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp);
+
+ GstRTSPResult (*parse_sdp) (GstRTSPExtension *ext, GstSDPMessage *sdp, GstStructure *s);
+ GstRTSPResult (*setup_media) (GstRTSPExtension *ext, GstSDPMedia *media);
+
+ gboolean (*configure_stream) (GstRTSPExtension *ext, GstCaps *caps);
+
+ GstRTSPResult (*get_transports) (GstRTSPExtension *ext, GstRTSPLowerTrans protocols, gchar **transport);
+
+ GstRTSPResult (*stream_select) (GstRTSPExtension *ext);
+
+ /* signals */
+ GstRTSPResult (*send) (GstRTSPExtension *ext, GstRTSPMessage *req, GstRTSPMessage *resp);
+
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING];
+};
+
+GType gst_rtsp_extension_get_type (void);
+
+/* invoke vfunction on interface */
+gboolean gst_rtsp_extension_detect_server (GstRTSPExtension *ext, GstRTSPMessage *resp);
+
+GstRTSPResult gst_rtsp_extension_before_send (GstRTSPExtension *ext, GstRTSPMessage *req);
+GstRTSPResult gst_rtsp_extension_after_send (GstRTSPExtension *ext, GstRTSPMessage *req,
+ GstRTSPMessage *resp);
+GstRTSPResult gst_rtsp_extension_parse_sdp (GstRTSPExtension *ext, GstSDPMessage *sdp,
+ GstStructure *s);
+GstRTSPResult gst_rtsp_extension_setup_media (GstRTSPExtension *ext, GstSDPMedia *media);
+gboolean gst_rtsp_extension_configure_stream (GstRTSPExtension *ext, GstCaps *caps);
+GstRTSPResult gst_rtsp_extension_get_transports (GstRTSPExtension *ext, GstRTSPLowerTrans protocols,
+ gchar **transport);
+GstRTSPResult gst_rtsp_extension_stream_select (GstRTSPExtension *ext);
+
+/* signal emision */
+GstRTSPResult gst_rtsp_extension_send (GstRTSPExtension *ext, GstRTSPMessage *req,
+ GstRTSPMessage *resp);
+
+G_END_DECLS
+
+#endif /* __GST_RTSP_EXTENSION_H__ */