diff options
Diffstat (limited to 'gst/rtpmanager/gstrtpbin.c')
-rw-r--r-- | gst/rtpmanager/gstrtpbin.c | 279 |
1 files changed, 279 insertions, 0 deletions
diff --git a/gst/rtpmanager/gstrtpbin.c b/gst/rtpmanager/gstrtpbin.c new file mode 100644 index 00000000..629f098d --- /dev/null +++ b/gst/rtpmanager/gstrtpbin.c @@ -0,0 +1,279 @@ +/* GStreamer + * Copyright (C) <2007> Wim Taymans <wim@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-rtpbin + * @short_description: handle media from one RTP bin + * @see_also: rtpjitterbuffer, rtpclient, rtpsession + * + * <refsect2> + * <para> + * </para> + * <title>Example pipelines</title> + * <para> + * <programlisting> + * gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! alsasink + * </programlisting> + * </para> + * </refsect2> + * + * Last reviewed on 2007-04-02 (0.10.6) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <string.h> + +#include "gstrtpbin.h" + +/* elementfactory information */ +static const GstElementDetails rtpbin_details = GST_ELEMENT_DETAILS ("RTP Bin", + "Filter/Editor/Video", + "Implement an RTP bin", + "Wim Taymans <wim@fluendo.com>"); + +/* sink pads */ +static GstStaticPadTemplate rtpbin_recv_rtp_sink_template = +GST_STATIC_PAD_TEMPLATE ("recv_rtp_sink_%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS ("application/x-rtp") + ); + +static GstStaticPadTemplate rtpbin_recv_rtcp_sink_template = +GST_STATIC_PAD_TEMPLATE ("recv_rtcp_sink_%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS ("application/x-rtcp") + ); + +static GstStaticPadTemplate rtpbin_send_rtp_sink_template = +GST_STATIC_PAD_TEMPLATE ("send_rtp_sink_%d", + GST_PAD_SINK, + GST_PAD_REQUEST, + GST_STATIC_CAPS ("application/x-rtp") + ); + +/* src pads */ +static GstStaticPadTemplate rtpbin_recv_rtp_src_template = +GST_STATIC_PAD_TEMPLATE ("recv_rtp_src_%d_%d_%d", + GST_PAD_SRC, + GST_PAD_SOMETIMES, + GST_STATIC_CAPS ("application/x-rtp") + ); + +static GstStaticPadTemplate rtpbin_send_rtcp_src_template = +GST_STATIC_PAD_TEMPLATE ("send_rtcp_src_%d", + GST_PAD_SRC, + GST_PAD_REQUEST, + GST_STATIC_CAPS ("application/x-rtcp") + ); + +static GstStaticPadTemplate rtpbin_send_rtp_src_template = +GST_STATIC_PAD_TEMPLATE ("send_rtp_src_%d", + GST_PAD_SRC, + GST_PAD_SOMETIMES, + GST_STATIC_CAPS ("application/x-rtp") + ); + +#define GST_RTP_BIN_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_RTP_BIN, GstRTPBinPrivate)) + +struct _GstRTPBinPrivate +{ +}; + +/* signals and args */ +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + PROP_0 +}; + +/* GObject vmethods */ +static void gst_rtp_bin_finalize (GObject * object); +static void gst_rtp_bin_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec); +static void gst_rtp_bin_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec); + +/* GstElement vmethods */ +static GstStateChangeReturn gst_rtp_bin_change_state (GstElement * element, + GstStateChange transition); +static GstPad *gst_rtp_bin_request_new_pad (GstElement * element, + GstPadTemplate * templ, const gchar * name); +static void gst_rtp_bin_release_pad (GstElement * element, GstPad * pad); + +/*static guint gst_rtp_bin_signals[LAST_SIGNAL] = { 0 }; */ + +GST_BOILERPLATE (GstRTPBin, gst_rtp_bin, GstBin, GST_TYPE_BIN); + +static void +gst_rtp_bin_base_init (gpointer klass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + /* sink pads */ + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_recv_rtp_sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_recv_rtcp_sink_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_send_rtp_sink_template)); + + /* src pads */ + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_recv_rtp_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_send_rtcp_src_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&rtpbin_send_rtp_src_template)); + + gst_element_class_set_details (element_class, &rtpbin_details); +} + +static void +gst_rtp_bin_class_init (GstRTPBinClass * klass) +{ + GObjectClass *gobject_class; + GstElementClass *gstelement_class; + + gobject_class = (GObjectClass *) klass; + gstelement_class = (GstElementClass *) klass; + + g_type_class_add_private (klass, sizeof (GstRTPBinPrivate)); + + gobject_class->finalize = gst_rtp_bin_finalize; + gobject_class->set_property = gst_rtp_bin_set_property; + gobject_class->get_property = gst_rtp_bin_get_property; + + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_rtp_bin_change_state); + gstelement_class->request_new_pad = + GST_DEBUG_FUNCPTR (gst_rtp_bin_request_new_pad); + gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_rtp_bin_release_pad); +} + +static void +gst_rtp_bin_init (GstRTPBin * rtpbin, GstRTPBinClass * klass) +{ + rtpbin->priv = GST_RTP_BIN_GET_PRIVATE (rtpbin); +} + +static void +gst_rtp_bin_finalize (GObject * object) +{ + GstRTPBin *rtpbin; + + rtpbin = GST_RTP_BIN (object); + + G_OBJECT_CLASS (parent_class)->finalize (object); +} + +static void +gst_rtp_bin_set_property (GObject * object, guint prop_id, + const GValue * value, GParamSpec * pspec) +{ + GstRTPBin *rtpbin; + + rtpbin = GST_RTP_BIN (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gst_rtp_bin_get_property (GObject * object, guint prop_id, + GValue * value, GParamSpec * pspec) +{ + GstRTPBin *rtpbin; + + rtpbin = GST_RTP_BIN (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GstStateChangeReturn +gst_rtp_bin_change_state (GstElement * element, GstStateChange transition) +{ + GstStateChangeReturn res; + GstRTPBin *rtpbin; + + rtpbin = GST_RTP_BIN (element); + + switch (transition) { + case GST_STATE_CHANGE_NULL_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_PLAYING: + break; + default: + break; + } + + res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition); + + switch (transition) { + case GST_STATE_CHANGE_PLAYING_TO_PAUSED: + break; + case GST_STATE_CHANGE_PAUSED_TO_READY: + break; + case GST_STATE_CHANGE_READY_TO_NULL: + break; + default: + break; + } + return res; +} + +/* + */ +static GstPad * +gst_rtp_bin_request_new_pad (GstElement * element, + GstPadTemplate * templ, const gchar * name) +{ + GstRTPBin *rtpbin; + GstElementClass *klass; + + g_return_val_if_fail (templ != NULL, NULL); + g_return_val_if_fail (GST_IS_RTP_BIN (element), NULL); + + rtpbin = GST_RTP_BIN (element); + klass = GST_ELEMENT_GET_CLASS (element); + + return NULL; +} + +static void +gst_rtp_bin_release_pad (GstElement * element, GstPad * pad) +{ +} |