[gst-plugins-farsight/master] Remove rtpmux plugin, moved to -bad
Olivier Crête
olivier.crete at collabora.co.uk
Thu Feb 26 10:02:49 PST 2009
---
configure.ac | 2 -
gst/rtpmux/Makefile.am | 10 -
gst/rtpmux/gstrtpdtmfmux.c | 330 -----------------------
gst/rtpmux/gstrtpdtmfmux.h | 72 -----
gst/rtpmux/gstrtpmux.c | 644 --------------------------------------------
gst/rtpmux/gstrtpmux.h | 82 ------
gst/rtpmux/gstrtpmuxer.c | 48 ----
7 files changed, 0 insertions(+), 1188 deletions(-)
delete mode 100644 gst/rtpmux/Makefile.am
delete mode 100644 gst/rtpmux/gstrtpdtmfmux.c
delete mode 100644 gst/rtpmux/gstrtpdtmfmux.h
delete mode 100644 gst/rtpmux/gstrtpmux.c
delete mode 100644 gst/rtpmux/gstrtpmux.h
delete mode 100644 gst/rtpmux/gstrtpmuxer.c
diff --git a/configure.ac b/configure.ac
index c7b5307..19330a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,6 @@ AC_SUBST(GST_PLUGIN_LDFLAGS)
dnl these are all the gst plug-ins, compilable without additional libs
GST_PLUGINS_ALL="\
-rtpmux \
rtpdemux \
rtpjitterbuffer \
network-simulator \
@@ -352,7 +351,6 @@ ext/gconf/Makefile \
gst/Makefile \
gst/siren/Makefile \
gst/rtppayloads/Makefile \
-gst/rtpmux/Makefile \
gst/rtpdemux/Makefile \
gst/rtpjitterbuffer/Makefile \
gst/network-simulator/Makefile \
diff --git a/gst/rtpmux/Makefile.am b/gst/rtpmux/Makefile.am
deleted file mode 100644
index 908181b..0000000
--- a/gst/rtpmux/Makefile.am
+++ /dev/null
@@ -1,10 +0,0 @@
-plugin_LTLIBRARIES = libgstrtpmuxer.la
-
-libgstrtpmuxer_la_SOURCES = gstrtpmuxer.c gstrtpmux.c gstrtpdtmfmux.c
-
-libgstrtpmuxer_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(ERROR_CFLAGS) -DEXTERN_BUF -DRTP_SUPPORT
-libgstrtpmuxer_la_LIBADD = $(GST_LIBS_LIBS)
-libgstrtpmuxer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstrtp- at GST_MAJORMINOR@
-
-noinst_HEADERS = gstrtpmux.h gstrtpdtmfmux.h
-
diff --git a/gst/rtpmux/gstrtpdtmfmux.c b/gst/rtpmux/gstrtpdtmfmux.c
deleted file mode 100644
index 98039c3..0000000
--- a/gst/rtpmux/gstrtpdtmfmux.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/* RTP DTMF muxer element for GStreamer
- *
- * gstrtpdtmfmux.c:
- *
- * Copyright (C) <2007> Nokia Corporation.
- * Contact: Zeeshan Ali <zeeshan.ali at nokia.com>
- * Copyright (C) 1999,2000 Erik Walthinsen <omega at cse.ogi.edu>
- * 2000,2005 Wim Taymans <wim at fluendo.com>
- *
- * 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:element-rtpdtmfmux
- * @short_description: mixes RTP DTMF streams into other RTP streams
- * <refsect2>
- * <para>
- * The RTPDTMFMuxer mixes/muxes RTP DTMF stream(s) into other RTP
- * streams. It does exactly what it's parent (RTPMuxer) does, except
- * that it allows upstream peer elements to request exclusive access
- * to the stream, which is required by the RTP DTMF standards (see RFC
- * 2833, section 3.2, para 1 for details). The peer upstream element
- * requests the acquisition and release of a stream lock beginning
- * using custom downstream gstreamer events. To request the acquisition
- * of the lock, the peer element must send an event of type
- * GST_EVENT_CUSTOM_DOWNSTREAM_OOB, having a
- * structure of name "stream-lock" with only one boolean field:
- * "lock". If this field is set to TRUE, the request is for the
- * acquisition of the lock, otherwise it is for release of the lock.
- * </para>
- * <para>For example, the following code in an upstream peer element
- * requests the acquisition of the stream lock:
- * </para>
- * <para>
- * <programlisting>
- * GstEvent *event;
- * GstStructure *structure;
- * GstPad *srcpad;
- *
- * ... /\* srcpad initialization goes here \*\/
- *
- * structure = gst_structure_new ("stream-lock",
- * "lock", G_TYPE_BOOLEAN, TRUE, NULL);
- *
- * event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure);
- * gst_pad_push_event (dtmfsrc->srcpad, event);
- * </programlisting>
- * </para>
- * </refsect2>
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gstrtpdtmfmux.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_rtp_dtmf_mux_debug);
-#define GST_CAT_DEFAULT gst_rtp_dtmf_mux_debug
-
-/* elementfactory information */
-static const GstElementDetails gst_rtp_dtmf_mux_details =
-GST_ELEMENT_DETAILS ("RTP muxer",
- "Codec/Muxer",
- "mixes RTP DTMF streams into other RTP streams",
- "Zeeshan Ali <first.last at nokia.com>");
-
-enum
-{
- SIGNAL_LOCKING_STREAM,
- SIGNAL_UNLOCKED_STREAM,
- LAST_SIGNAL
-};
-
-static guint gst_rtpdtmfmux_signals[LAST_SIGNAL] = { 0 };
-
-static void gst_rtp_dtmf_mux_base_init (gpointer g_class);
-static void gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass);
-static void gst_rtp_dtmf_mux_finalize (GObject * object);
-
-static gboolean gst_rtp_dtmf_mux_sink_event (GstPad * pad,
- GstEvent * event);
-static GstFlowReturn gst_rtp_dtmf_mux_chain (GstPad * pad,
- GstBuffer * buffer);
-
-static GstRTPMuxClass *parent_class = NULL;
-
-GType
-gst_rtp_dtmf_mux_get_type (void)
-{
- static GType mux_type = 0;
-
- if (!mux_type) {
- static const GTypeInfo mux_info = {
- sizeof (GstRTPDTMFMuxClass),
- gst_rtp_dtmf_mux_base_init,
- NULL,
- (GClassInitFunc) gst_rtp_dtmf_mux_class_init,
- NULL,
- NULL,
- sizeof (GstRTPDTMFMux),
- 0,
- (GInstanceInitFunc) NULL,
- };
-
- mux_type =
- g_type_register_static (GST_TYPE_RTP_MUX, "GstRTPDTMFMux",
- &mux_info, 0);
- }
- return mux_type;
-}
-
-static void
-gst_rtp_dtmf_mux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details (element_class, &gst_rtp_dtmf_mux_details);
-}
-
-static void
-gst_rtp_dtmf_mux_class_init (GstRTPDTMFMuxClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstRTPMuxClass *gstrtpmux_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstrtpmux_class = (GstRTPMuxClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM] =
- g_signal_new ("locking", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstRTPDTMFMuxClass, locking),NULL, NULL,
- gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
-
- gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM] =
- g_signal_new ("unlocked", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GstRTPDTMFMuxClass, unlocked),NULL, NULL,
- gst_marshal_VOID__OBJECT, G_TYPE_NONE,1,GST_TYPE_PAD);
-
- gobject_class->finalize = gst_rtp_dtmf_mux_finalize;
- gstrtpmux_class->chain_func = gst_rtp_dtmf_mux_chain;
- gstrtpmux_class->sink_event_func = gst_rtp_dtmf_mux_sink_event;
-}
-
-static void
-gst_rtp_dtmf_mux_finalize (GObject * object)
-{
- GstRTPDTMFMux *mux;
-
- mux = GST_RTP_DTMF_MUX (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstFlowReturn
-gst_rtp_dtmf_mux_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstRTPDTMFMux *mux;
- GstFlowReturn ret;
-
- mux = GST_RTP_DTMF_MUX (gst_pad_get_parent (pad));
-
- GST_OBJECT_LOCK (mux);
- if (mux->special_pad != NULL && mux->special_pad != pad) {
- /* Drop the buffer */
- gst_buffer_unref (buffer);
- ret = GST_FLOW_OK;
- GST_OBJECT_UNLOCK (mux);
- }
-
- else {
- GST_OBJECT_UNLOCK (mux);
- if (parent_class->chain_func)
- ret = parent_class->chain_func (pad, buffer);
- else {
- gst_buffer_unref (buffer);
- ret = GST_FLOW_ERROR;
- }
- }
-
- gst_object_unref (mux);
- return ret;
-}
-
-static void
-gst_rtp_dtmf_mux_lock_stream (GstRTPDTMFMux *mux, GstPad * pad)
-{
- if (mux->special_pad != NULL)
- GST_WARNING_OBJECT (mux,
- "Stream lock already acquired by pad %s",
- GST_ELEMENT_NAME (mux->special_pad));
-
- else {
- GST_DEBUG_OBJECT (mux,
- "Stream lock acquired by pad %s",
- GST_ELEMENT_NAME (pad));
- mux->special_pad = gst_object_ref (pad);
- }
-}
-
-static void
-gst_rtp_dtmf_mux_unlock_stream (GstRTPDTMFMux *mux, GstPad * pad)
-{
- if (mux->special_pad == NULL)
- GST_WARNING_OBJECT (mux,
- "Stream lock not acquired, can't release it");
-
- else if (pad != mux->special_pad)
- GST_WARNING_OBJECT (mux,
- "pad %s attempted to release Stream lock"
- " which was acquired by pad %s", GST_ELEMENT_NAME (pad),
- GST_ELEMENT_NAME (mux->special_pad));
- else {
- GST_DEBUG_OBJECT (mux,
- "Stream lock released by pad %s",
- GST_ELEMENT_NAME (mux->special_pad));
- gst_object_unref (mux->special_pad);
- mux->special_pad = NULL;
- }
-}
-
-static gboolean
-gst_rtp_dtmf_mux_handle_stream_lock_event (GstRTPDTMFMux *mux, GstPad * pad,
- const GstStructure * event_structure)
-{
- gboolean lock;
-
- if (!gst_structure_get_boolean (event_structure, "lock", &lock))
- return FALSE;
-
- if (lock)
- g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_LOCKING_STREAM], 0, pad);
-
- GST_OBJECT_LOCK (mux);
- if (lock)
- gst_rtp_dtmf_mux_lock_stream (mux, pad);
- else
- gst_rtp_dtmf_mux_unlock_stream (mux, pad);
- GST_OBJECT_UNLOCK (mux);
-
- if (!lock)
- g_signal_emit (G_OBJECT (mux), gst_rtpdtmfmux_signals[SIGNAL_UNLOCKED_STREAM], 0, pad);
-
- return TRUE;
-}
-
-static gboolean
-gst_rtp_dtmf_mux_handle_downstream_event (GstRTPDTMFMux *mux,
- GstPad * pad, GstEvent * event)
-{
- const GstStructure *structure;
- gboolean ret = FALSE;
-
- structure = gst_event_get_structure (event);
- /* FIXME: is this event generic enough to be given a generic name? */
- if (structure && gst_structure_has_name (structure, "stream-lock"))
- ret = gst_rtp_dtmf_mux_handle_stream_lock_event (mux, pad, structure);
-
- return ret;
-}
-
-static gboolean
-gst_rtp_dtmf_mux_ignore_event (GstPad * pad, GstEvent * event)
-{
- gboolean ret;
-
- if (parent_class->sink_event_func)
- /* Give the parent a chance to handle the event first */
- ret = parent_class->sink_event_func (pad, event);
-
- else
- ret = gst_pad_event_default (pad, event);
-
- return ret;
-}
-
-static gboolean
-gst_rtp_dtmf_mux_sink_event (GstPad * pad, GstEvent * event)
-{
- GstRTPDTMFMux *mux;
- GstEventType type;
- gboolean ret = FALSE;
-
- type = event ? GST_EVENT_TYPE (event) : GST_EVENT_UNKNOWN;
-
- mux = (GstRTPDTMFMux *) gst_pad_get_parent (pad);
-
- switch (type) {
- case GST_EVENT_CUSTOM_DOWNSTREAM_OOB:
- ret = gst_rtp_dtmf_mux_handle_downstream_event (mux, pad, event);
- gst_event_unref (event);
- break;
- default:
- ret = gst_rtp_dtmf_mux_ignore_event (pad, event);
- break;
- }
-
- gst_object_unref (mux);
- return ret;
-}
-
-gboolean
-gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_rtp_dtmf_mux_debug, "rtpdtmfmux", 0,
- "rtp dtmf muxer");
-
- return gst_element_register (plugin, "rtpdtmfmux", GST_RANK_NONE,
- GST_TYPE_RTP_DTMF_MUX);
-}
-
diff --git a/gst/rtpmux/gstrtpdtmfmux.h b/gst/rtpmux/gstrtpdtmfmux.h
deleted file mode 100644
index 1b0c142..0000000
--- a/gst/rtpmux/gstrtpdtmfmux.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* RTP muxer element for GStreamer
- *
- * gstrtpdtmfmux.h:
- *
- * Copyright (C) <2007> Nokia Corporation.
- * Contact: Zeeshan Ali <zeeshan.ali at nokia.com>
- * Copyright (C) 1999,2000 Erik Walthinsen <omega at cse.ogi.edu>
- * 2000,2005 Wim Taymans <wim at fluendo.com>
- *
- * 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_RTP_DTMF_MUX_H__
-#define __GST_RTP_DTMF_MUX_H__
-
-#include <gst/gst.h>
-#include <gstrtpmux.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_RTP_DTMF_MUX (gst_rtp_dtmf_mux_get_type())
-#define GST_RTP_DTMF_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DTMF_MUX, GstRTPDTMFMux))
-#define GST_RTP_DTMF_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DTMF_MUX, GstRTPDTMFMux))
-#define GST_IS_RTP_DTMF_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_MUX))
-#define GST_IS_RTP_DTMF_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_MUX))
-
-typedef struct _GstRTPDTMFMux GstRTPDTMFMux;
-typedef struct _GstRTPDTMFMuxClass GstRTPDTMFMuxClass;
-
-/**
- * GstRTPDTMFMux:
- *
- * The opaque #GstRTPDTMFMux structure.
- */
-struct _GstRTPDTMFMux
-{
- GstRTPMux mux;
-
- /* Protected by object lock */
- /* our special pad */
- GstPad *special_pad;
-};
-
-struct _GstRTPDTMFMuxClass
-{
- GstRTPMuxClass parent_class;
-
- /* signals */
- void (*locking) (GstElement *element, GstPad *pad);
- void (*unlocked) (GstElement *element, GstPad *pad);
-};
-
-GType gst_rtp_dtmf_mux_get_type (void);
-gboolean gst_rtp_dtmf_mux_plugin_init (GstPlugin * plugin);
-
-G_END_DECLS
-
-#endif /* __GST_RTP_DTMF_MUX_H__ */
-
diff --git a/gst/rtpmux/gstrtpmux.c b/gst/rtpmux/gstrtpmux.c
deleted file mode 100644
index 39f2f3d..0000000
--- a/gst/rtpmux/gstrtpmux.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/* RTP muxer element for GStreamer
- *
- * gstrtpmux.c:
- *
- * Copyright (C) <2007> Nokia Corporation.
- * Contact: Zeeshan Ali <zeeshan.ali at nokia.com>
- * Copyright (C) 1999,2000 Erik Walthinsen <omega at cse.ogi.edu>
- * 2000,2005 Wim Taymans <wim at fluendo.com>
- *
- * 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:element-rtpmux
- * @short_description: Muxer that takes one or several RTP streams
- * and muxes them to a single rtp stream.
- *
- * The rtp muxer takes multiple RTP streams having the same clock-rate and
- * muxes into a single stream with a single SSRC.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gst/gst.h>
-#include <gst/rtp/gstrtpbuffer.h>
-#include <gstrtpmux.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY_STATIC (gst_rtp_mux_debug);
-#define GST_CAT_DEFAULT gst_rtp_mux_debug
-
-/* elementfactory information */
-static const GstElementDetails gst_rtp_mux_details =
-GST_ELEMENT_DETAILS ("RTP muxer",
- "Codec/Muxer",
- "multiplex N rtp streams into one",
- "Zeeshan Ali <first.last at nokia.com>");
-
-enum
-{
- ARG_0,
- PROP_TIMESTAMP_OFFSET,
- PROP_SEQNUM_OFFSET,
- PROP_SEQNUM,
- PROP_SSRC
-};
-
-#define DEFAULT_TIMESTAMP_OFFSET -1
-#define DEFAULT_SEQNUM_OFFSET -1
-#define DEFAULT_SSRC -1
-
-typedef struct {
- gboolean have_ts_base;
- guint clock_base;
-} GstRTPMuxPadPrivate;
-
-static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS ("application/x-rtp")
- );
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink_%d",
- GST_PAD_SINK,
- GST_PAD_REQUEST,
- GST_STATIC_CAPS ("application/x-rtp")
- );
-
-static void gst_rtp_mux_base_init (gpointer g_class);
-static void gst_rtp_mux_class_init (GstRTPMuxClass * klass);
-static void gst_rtp_mux_init (GstRTPMux * rtp_mux);
-
-static void gst_rtp_mux_finalize (GObject * object);
-
-static GstPad *gst_rtp_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * name);
-static void gst_rtp_mux_release_pad (GstElement * element, GstPad *pad);
-static GstFlowReturn gst_rtp_mux_chain (GstPad * pad,
- GstBuffer * buffer);
-static gboolean gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps);
-static GstCaps * gst_rtp_mux_getcaps (GstPad *pad);
-
-static GstStateChangeReturn gst_rtp_mux_change_state (GstElement *
- element, GstStateChange transition);
-
-static void gst_rtp_mux_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec);
-static void gst_rtp_mux_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static gboolean gst_rtp_mux_src_event (GstPad * pad, GstEvent * event);
-
-static GstElementClass *parent_class = NULL;
-
-GType
-gst_rtp_mux_get_type (void)
-{
- static GType rtp_mux_type = 0;
-
- if (!rtp_mux_type) {
- static const GTypeInfo rtp_mux_info = {
- sizeof (GstRTPMuxClass),
- gst_rtp_mux_base_init,
- NULL,
- (GClassInitFunc) gst_rtp_mux_class_init,
- NULL,
- NULL,
- sizeof (GstRTPMux),
- 0,
- (GInstanceInitFunc) gst_rtp_mux_init,
- };
-
- rtp_mux_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstRTPMux",
- &rtp_mux_info, 0);
- }
- return rtp_mux_type;
-}
-
-static void
-gst_rtp_mux_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
-
- gst_element_class_set_details (element_class, &gst_rtp_mux_details);
-}
-
-static void
-gst_rtp_mux_class_init (GstRTPMuxClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->finalize = gst_rtp_mux_finalize;
- gobject_class->get_property = gst_rtp_mux_get_property;
- gobject_class->set_property = gst_rtp_mux_set_property;
-
- g_object_class_install_property (G_OBJECT_CLASS (klass),
- PROP_TIMESTAMP_OFFSET, g_param_spec_int ("timestamp-offset",
- "Timestamp Offset",
- "Offset to add to all outgoing timestamps (-1 = random)", -1,
- G_MAXINT, DEFAULT_TIMESTAMP_OFFSET, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM_OFFSET,
- g_param_spec_int ("seqnum-offset", "Sequence number Offset",
- "Offset to add to all outgoing seqnum (-1 = random)", -1, G_MAXINT,
- DEFAULT_SEQNUM_OFFSET, G_PARAM_READWRITE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM,
- g_param_spec_uint ("seqnum", "Sequence number",
- "The RTP sequence number of the last processed packet",
- 0, G_MAXUINT, 0, G_PARAM_READABLE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC,
- g_param_spec_uint ("ssrc", "SSRC",
- "The SSRC of the packets (-1 == random)",
- 0, G_MAXUINT, DEFAULT_SSRC, G_PARAM_READWRITE));
-
- gstelement_class->request_new_pad = gst_rtp_mux_request_new_pad;
- gstelement_class->release_pad = gst_rtp_mux_release_pad;
- gstelement_class->change_state = gst_rtp_mux_change_state;
-
- klass->chain_func = gst_rtp_mux_chain;
-}
-
-static gboolean gst_rtp_mux_src_event (GstPad * pad,
- GstEvent * event)
-{
- GstElement *rtp_mux;
- GstIterator *iter;
- GstPad *sinkpad;
- gboolean result = FALSE;
- gboolean done = FALSE;
-
- rtp_mux = gst_pad_get_parent_element (pad);
- g_return_val_if_fail (rtp_mux != NULL, FALSE);
-
- iter = gst_element_iterate_sink_pads (rtp_mux);
-
- while (!done) {
- switch (gst_iterator_next (iter, (gpointer) &sinkpad)) {
- case GST_ITERATOR_OK:
- gst_event_ref (event);
- result |= gst_pad_push_event (sinkpad, event);
- gst_object_unref (sinkpad);
- break;
- case GST_ITERATOR_RESYNC:
- gst_iterator_resync (iter);
- result = FALSE;
- break;
- case GST_ITERATOR_ERROR:
- GST_WARNING_OBJECT (rtp_mux, "Error iterating sinkpads");
- case GST_ITERATOR_DONE:
- done = TRUE;
- break;
- }
- }
- gst_iterator_free (iter);
- gst_object_unref (rtp_mux);
- gst_event_unref (event);
-
- return result;
-}
-
-static void
-gst_rtp_mux_init (GstRTPMux * rtp_mux)
-{
- GstElementClass *klass = GST_ELEMENT_GET_CLASS (rtp_mux);
-
- rtp_mux->srcpad =
- gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
- "src"), "src");
- gst_pad_set_event_function (rtp_mux->srcpad, gst_rtp_mux_src_event);
- gst_element_add_pad (GST_ELEMENT (rtp_mux), rtp_mux->srcpad);
-
- rtp_mux->ssrc = DEFAULT_SSRC;
- rtp_mux->ts_offset = DEFAULT_TIMESTAMP_OFFSET;
- rtp_mux->seqnum_offset = DEFAULT_SEQNUM_OFFSET;
-}
-
-static void
-gst_rtp_mux_finalize (GObject * object)
-{
- GstRTPMux *rtp_mux;
-
- rtp_mux = GST_RTP_MUX (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static GstPad *
-gst_rtp_mux_create_sinkpad (GstRTPMux * rtp_mux, GstPadTemplate * templ)
-{
- GstPad *newpad = NULL;
- GstPadTemplate * class_templ;
-
- class_templ = gst_element_class_get_pad_template (
- GST_ELEMENT_GET_CLASS (rtp_mux), "sink_%d");
-
- if (templ == class_templ) {
- gchar *name;
-
- /* create new pad with the name */
- name = g_strdup_printf ("sink_%02d", rtp_mux->numpads);
- newpad = gst_pad_new_from_template (templ, name);
- g_free (name);
-
- rtp_mux->numpads++;
- } else {
- GST_WARNING_OBJECT (rtp_mux, "this is not our template!\n");
- }
-
- return newpad;
-}
-
-static void
-gst_rtp_mux_setup_sinkpad (GstRTPMux * rtp_mux, GstPad * sinkpad)
-{
- GstRTPMuxClass *klass;
- GstRTPMuxPadPrivate *padpriv = g_slice_new0 (GstRTPMuxPadPrivate);
-
- klass = GST_RTP_MUX_GET_CLASS (rtp_mux);
-
- /* setup some pad functions */
- gst_pad_set_setcaps_function (sinkpad, gst_rtp_mux_setcaps);
- gst_pad_set_getcaps_function (sinkpad, gst_rtp_mux_getcaps);
- if (klass->chain_func)
- gst_pad_set_chain_function (sinkpad, klass->chain_func);
- if (klass->sink_event_func)
- gst_pad_set_event_function (sinkpad, klass->sink_event_func);
-
- /* This could break with gstreamer 0.10.9 */
- gst_pad_set_active (sinkpad, TRUE);
-
- gst_pad_set_element_private (sinkpad, padpriv);
-
- /* dd the pad to the element */
- gst_element_add_pad (GST_ELEMENT (rtp_mux), sinkpad);
-}
-
-static GstPad *
-gst_rtp_mux_request_new_pad (GstElement * element,
- GstPadTemplate * templ, const gchar * req_name)
-{
- GstRTPMux *rtp_mux;
- GstPad *newpad;
-
- g_return_val_if_fail (templ != NULL, NULL);
- g_return_val_if_fail (GST_IS_RTP_MUX (element), NULL);
-
- rtp_mux = GST_RTP_MUX (element);
-
- if (templ->direction != GST_PAD_SINK) {
- GST_WARNING_OBJECT (rtp_mux, "request pad that is not a SINK pad");
- return NULL;
- }
-
- newpad = gst_rtp_mux_create_sinkpad (rtp_mux, templ);
- if (newpad)
- gst_rtp_mux_setup_sinkpad (rtp_mux, newpad);
- else
- GST_WARNING_OBJECT (rtp_mux, "failed to create request pad");
-
- return newpad;
-}
-
-static void
-gst_rtp_mux_release_pad (GstElement * element, GstPad *pad)
-{
- GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
-
- if (padpriv)
- g_slice_free (GstRTPMuxPadPrivate, padpriv);
- gst_pad_set_element_private (pad, NULL);
-
- gst_element_remove_pad (element, pad);
-}
-
-/* Put our own clock-base on the buffer */
-static void
-gst_rtp_mux_readjust_rtp_timestamp (GstRTPMux * rtp_mux, GstPad * pad,
- GstBuffer * buffer)
-{
- guint32 ts;
- guint32 sink_ts_base = 0;
- GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
-
- if (padpriv->have_ts_base)
- sink_ts_base = padpriv->clock_base;
-
- ts = gst_rtp_buffer_get_timestamp (buffer) - sink_ts_base + rtp_mux->ts_base;
- GST_LOG_OBJECT (rtp_mux, "Re-adjusting RTP ts %u to %u",
- gst_rtp_buffer_get_timestamp (buffer), ts);
- gst_rtp_buffer_set_timestamp (buffer, ts);
-}
-
-static GstFlowReturn
-gst_rtp_mux_chain (GstPad * pad, GstBuffer * buffer)
-{
- GstRTPMux *rtp_mux;
- GstStructure * structure;
- GstFlowReturn ret;
-
- rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
-
- if (!gst_rtp_buffer_validate (buffer)) {
- GST_ERROR_OBJECT (rtp_mux, "Invalid RTP buffer");
- gst_object_unref (rtp_mux);
- return GST_FLOW_ERROR;
- }
-
- buffer = gst_buffer_make_writable(buffer);
-
- GST_OBJECT_LOCK (rtp_mux);
- rtp_mux->seqnum++;
- gst_rtp_buffer_set_seq (buffer, rtp_mux->seqnum);
- GST_OBJECT_UNLOCK (rtp_mux);
- GST_BUFFER_CAPS (buffer) = gst_caps_make_writable(GST_BUFFER_CAPS (buffer));
- structure = gst_caps_get_structure (GST_BUFFER_CAPS (buffer), 0U);
- gst_structure_set (structure, "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
- gst_rtp_buffer_set_ssrc (buffer, rtp_mux->current_ssrc);
- gst_rtp_mux_readjust_rtp_timestamp (rtp_mux, pad, buffer);
- GST_LOG_OBJECT (rtp_mux, "Pushing packet size %d, seq=%d, ts=%u",
- GST_BUFFER_SIZE (buffer), rtp_mux->seqnum,
- gst_rtp_buffer_get_timestamp (buffer));
-
- gst_buffer_set_caps (buffer, GST_PAD_CAPS (rtp_mux->srcpad));
-
- ret = gst_pad_push (rtp_mux->srcpad, buffer);
-
- gst_object_unref (rtp_mux);
- return ret;
-}
-
-static gboolean
-gst_rtp_mux_setcaps (GstPad *pad, GstCaps *caps)
-{
- GstRTPMux *rtp_mux;
- GstStructure *structure;
- gboolean ret = TRUE;
- GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
-
- rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
-
- structure = gst_caps_get_structure (caps, 0);
-
- if (!ret)
- goto out;
-
- if (gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) {
- padpriv->have_ts_base = TRUE;
- }
-
- caps = gst_caps_copy (caps);
-
- gst_caps_set_simple (caps,
- "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
- "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base,
- NULL);
-
- GST_DEBUG_OBJECT (rtp_mux,
- "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
- ret = gst_pad_set_caps (rtp_mux->srcpad, caps);
- gst_caps_unref (caps);
-
- out:
- gst_object_unref (rtp_mux);
-
- return ret;
-}
-
-static void
-clear_caps (GstCaps *caps, gboolean only_clock_rate)
-{
- gint i, j;
-
- /* Lets only match on the clock-rate */
- for (i = 0; i < gst_caps_get_size (caps); i++) {
- GstStructure *s = gst_caps_get_structure (caps, i);
-
- for (j = 0; j < gst_structure_n_fields (s); j++) {
- const gchar *name = gst_structure_nth_field_name (s, j);
-
- if (strcmp (name, "clock-rate") && (only_clock_rate ||
- (strcmp (name, "ssrc")))) {
- gst_structure_remove_field (s, name);
- j--;
- }
- }
- }
-}
-
-static gboolean
-same_clock_rate_fold (gpointer item, GValue *ret, gpointer user_data)
-{
- GstPad *mypad = user_data;
- GstPad *pad = item;
- GstCaps *peercaps;
- GstCaps *othercaps;
- const GstCaps *accumcaps;
- GstCaps *intersect;
-
- if (pad == mypad)
- return TRUE;
-
- peercaps = gst_pad_peer_get_caps (pad);
- if (!peercaps)
- return TRUE;
-
- othercaps = gst_caps_intersect (peercaps,
- gst_pad_get_pad_template_caps (pad));
- gst_caps_unref (peercaps);
-
- accumcaps = gst_value_get_caps (ret);
-
- clear_caps (othercaps, TRUE);
-
- intersect = gst_caps_intersect (accumcaps, othercaps);
-
- g_value_take_boxed (ret, intersect);
-
- gst_caps_unref (othercaps);
-
- return !gst_caps_is_empty (intersect);
-}
-
-static GstCaps *
-gst_rtp_mux_getcaps (GstPad *pad)
-{
- GstRTPMux *mux = GST_RTP_MUX (gst_pad_get_parent (pad));
- GstCaps *caps = NULL;
- GstIterator *iter = NULL;
- GValue v = {0};
- GstIteratorResult res;
- GstCaps *peercaps = gst_pad_peer_get_caps (mux->srcpad);
- GstCaps *othercaps = NULL;
-
- if (peercaps) {
- othercaps = gst_caps_intersect (peercaps,
- gst_pad_get_pad_template_caps (pad));
- gst_caps_unref (peercaps);
- }
- else {
- othercaps = gst_caps_copy (gst_pad_get_pad_template_caps (mux->srcpad));
- }
-
- clear_caps (othercaps, FALSE);
-
- g_value_init (&v, GST_TYPE_CAPS);
-
- iter = gst_element_iterate_sink_pads (GST_ELEMENT (mux));
- do {
- gst_value_set_caps (&v, othercaps);
- res = gst_iterator_fold (iter, same_clock_rate_fold, &v, pad);
- } while (res == GST_ITERATOR_RESYNC);
- gst_iterator_free (iter);
-
- caps = (GstCaps*) gst_value_get_caps (&v);
-
- if (res == GST_ITERATOR_ERROR) {
- gst_caps_unref (caps);
- caps = gst_caps_new_empty ();
- }
-
- if (othercaps)
- gst_caps_unref (othercaps);
- gst_object_unref (mux);
-
- return caps;
-}
-
-
-static void
-gst_rtp_mux_get_property (GObject * object,
- guint prop_id, GValue * value, GParamSpec * pspec)
-{
- GstRTPMux *rtp_mux;
-
- rtp_mux = GST_RTP_MUX (object);
-
- switch (prop_id) {
- case PROP_TIMESTAMP_OFFSET:
- g_value_set_int (value, rtp_mux->ts_offset);
- break;
- case PROP_SEQNUM_OFFSET:
- g_value_set_int (value, rtp_mux->seqnum_offset);
- break;
- case PROP_SEQNUM:
- GST_OBJECT_LOCK (rtp_mux);
- g_value_set_uint (value, rtp_mux->seqnum);
- GST_OBJECT_UNLOCK (rtp_mux);
- break;
- case PROP_SSRC:
- g_value_set_uint (value, rtp_mux->ssrc);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_rtp_mux_set_property (GObject * object,
- guint prop_id, const GValue * value, GParamSpec * pspec)
-{
- GstRTPMux *rtp_mux;
-
- rtp_mux = GST_RTP_MUX (object);
-
- switch (prop_id) {
- case PROP_TIMESTAMP_OFFSET:
- rtp_mux->ts_offset = g_value_get_int (value);
- break;
- case PROP_SEQNUM_OFFSET:
- rtp_mux->seqnum_offset = g_value_get_int (value);
- break;
- case PROP_SSRC:
- rtp_mux->ssrc = g_value_get_uint (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_rtp_mux_ready_to_paused (GstRTPMux * rtp_mux)
-{
- GST_OBJECT_LOCK (rtp_mux);
-
- if (rtp_mux->ssrc == -1)
- rtp_mux->current_ssrc = g_random_int ();
- else
- rtp_mux->current_ssrc = rtp_mux->ssrc;
-
- if (rtp_mux->seqnum_offset == -1)
- rtp_mux->seqnum_base = g_random_int_range (0, G_MAXUINT16);
- else
- rtp_mux->seqnum_base = rtp_mux->seqnum_offset;
- rtp_mux->seqnum = rtp_mux->seqnum_base;
-
- if (rtp_mux->ts_offset == -1)
- rtp_mux->ts_base = g_random_int ();
- else
- rtp_mux->ts_base = rtp_mux->ts_offset;
- GST_DEBUG_OBJECT (rtp_mux, "set clock-base to %u", rtp_mux->ts_base);
-
- GST_OBJECT_UNLOCK (rtp_mux);
-}
-
-static GstStateChangeReturn
-gst_rtp_mux_change_state (GstElement * element, GstStateChange transition)
-{
- GstRTPMux *rtp_mux;
-
- rtp_mux = GST_RTP_MUX (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- gst_rtp_mux_ready_to_paused (rtp_mux);
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- break;
- default:
- break;
- }
-
- return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
-}
-
-gboolean
-gst_rtp_mux_plugin_init (GstPlugin * plugin)
-{
- GST_DEBUG_CATEGORY_INIT (gst_rtp_mux_debug, "rtpmux", 0,
- "rtp muxer");
-
- return gst_element_register (plugin, "rtpmux", GST_RANK_NONE,
- GST_TYPE_RTP_MUX);
-}
-
diff --git a/gst/rtpmux/gstrtpmux.h b/gst/rtpmux/gstrtpmux.h
deleted file mode 100644
index bf66e1e..0000000
--- a/gst/rtpmux/gstrtpmux.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* RTP muxer element for GStreamer
- *
- * gstrtpmux.h:
- *
- * Copyright (C) <2007> Nokia Corporation.
- * Contact: Zeeshan Ali <zeeshan.ali at nokia.com>
- * Copyright (C) 1999,2000 Erik Walthinsen <omega at cse.ogi.edu>
- * 2000,2005 Wim Taymans <wim at fluendo.com>
- *
- * 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_RTP_MUX_H__
-#define __GST_RTP_MUX_H__
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_RTP_MUX (gst_rtp_mux_get_type())
-#define GST_RTP_MUX(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_MUX, GstRTPMux))
-#define GST_RTP_MUX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_MUX, GstRTPMux))
-#define GST_RTP_MUX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_MUX, GstRTPMuxClass))
-#define GST_IS_RTP_MUX(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_MUX))
-#define GST_IS_RTP_MUX_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_MUX))
-
-typedef struct _GstRTPMux GstRTPMux;
-typedef struct _GstRTPMuxClass GstRTPMuxClass;
-
-/**
- * GstRTPMux:
- *
- * The opaque #GstRTPMux structure.
- */
-struct _GstRTPMux
-{
- GstElement element;
-
- /* pad */
- GstPad *srcpad;
-
- /* sinkpads */
- gint numpads;
-
- guint32 ts_base;
- guint16 seqnum_base;
-
- gint32 ts_offset;
- gint16 seqnum_offset;
- guint16 seqnum; /* protected by object lock */
- guint ssrc;
- guint current_ssrc;
-};
-
-struct _GstRTPMuxClass
-{
- GstElementClass parent_class;
-
- GstFlowReturn (* chain_func) (GstPad * pad, GstBuffer * buffer);
- gboolean (* sink_event_func) (GstPad * pad, GstEvent * event);
-};
-
-GType gst_rtp_mux_get_type (void);
-gboolean gst_rtp_mux_plugin_init (GstPlugin * plugin);
-
-G_END_DECLS
-
-#endif /* __GST_RTP_MUX_H__ */
-
diff --git a/gst/rtpmux/gstrtpmuxer.c b/gst/rtpmux/gstrtpmuxer.c
deleted file mode 100644
index a51c540..0000000
--- a/gst/rtpmux/gstrtpmuxer.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* GStreamer RTP Muxer Plugins
- *
- * gstrtpdtmf.c:
- *
- * Copyright (C) <2007> Nokia Corporation.
- * Contact: Zeeshan Ali <zeeshan.ali at nokia.com>
- * Copyright (C) 1999,2000 Erik Walthinsen <omega at cse.ogi.edu>
- * 2000,2005 Wim Taymans <wim at fluendo.com>
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include "gstrtpmux.h"
-#include "gstrtpdtmfmux.h"
-
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- if (!gst_rtp_mux_plugin_init (plugin))
- return FALSE;
- if (!gst_rtp_dtmf_mux_plugin_init (plugin))
- return FALSE;
-
- return TRUE;
-}
-
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "rtpmuxer",
- "RTP Muxer plugins",
- plugin_init, "0.1" , "LGPL", "Farsight", "http://farsight.sf.net");
--
1.5.6.5
More information about the farsight-commits
mailing list