2005-07-14 10:29:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2005> Philippe Khalaf <burger@speedy.org>
|
2006-02-02 00:04:37 +00:00
|
|
|
* Copyright (C) <2005> Nokia Corporation <kai.vehmanen@nokia.com>
|
2005-07-14 10:29:30 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2007-04-21 15:10:25 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstbasertpdepayload
|
|
|
|
* @short_description: Base class for RTP depayloader
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* Provides a base class for RTP depayloaders
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
#include "gstbasertpdepayload.h"
|
|
|
|
|
2006-06-23 09:53:09 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (basertpdepayload_debug);
|
2005-07-14 10:29:30 +00:00
|
|
|
#define GST_CAT_DEFAULT (basertpdepayload_debug)
|
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
#define GST_BASE_RTP_DEPAYLOAD_GET_PRIVATE(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GST_TYPE_BASE_RTP_DEPAYLOAD, GstBaseRTPDepayloadPrivate))
|
|
|
|
|
|
|
|
struct _GstBaseRTPDepayloadPrivate
|
|
|
|
{
|
2007-05-12 16:18:39 +00:00
|
|
|
guint64 clock_base;
|
|
|
|
|
|
|
|
GstClockTime npt_start;
|
|
|
|
GstClockTime npt_stop;
|
|
|
|
gdouble play_speed;
|
|
|
|
gdouble play_scale;
|
2007-03-29 16:23:53 +00:00
|
|
|
};
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
/* Filter signals and args */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
#define DEFAULT_QUEUE_DELAY 0
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
enum
|
|
|
|
{
|
2007-03-29 16:23:53 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_QUEUE_DELAY,
|
2005-07-14 10:29:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static void gst_base_rtp_depayload_finalize (GObject * object);
|
|
|
|
static void gst_base_rtp_depayload_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_base_rtp_depayload_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static gboolean gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
static GstFlowReturn gst_base_rtp_depayload_chain (GstPad * pad,
|
|
|
|
GstBuffer * in);
|
2007-03-29 16:23:53 +00:00
|
|
|
static gboolean gst_base_rtp_depayload_handle_sink_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn gst_base_rtp_depayload_change_state (GstElement *
|
|
|
|
element, GstStateChange transition);
|
2007-03-29 16:23:53 +00:00
|
|
|
|
2005-08-12 13:34:56 +00:00
|
|
|
static GstFlowReturn gst_base_rtp_depayload_add_to_queue (GstBaseRTPDepayload *
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
filter, GstBuffer * in);
|
2007-03-29 16:23:53 +00:00
|
|
|
static GstFlowReturn gst_base_rtp_depayload_process (GstBaseRTPDepayload *
|
|
|
|
filter, GstBuffer * rtp_buf);
|
2005-08-10 20:52:37 +00:00
|
|
|
static void gst_base_rtp_depayload_set_gst_timestamp
|
|
|
|
(GstBaseRTPDepayload * filter, guint32 timestamp, GstBuffer * buf);
|
2007-03-29 16:23:53 +00:00
|
|
|
static void gst_base_rtp_depayload_wait (GstBaseRTPDepayload * filter,
|
|
|
|
GstClockTime time);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
GST_BOILERPLATE (GstBaseRTPDepayload, gst_base_rtp_depayload, GstElement,
|
|
|
|
GST_TYPE_ELEMENT);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
|
|
|
static void
|
2007-03-29 16:23:53 +00:00
|
|
|
gst_base_rtp_depayload_base_init (gpointer klass)
|
2005-07-14 10:29:30 +00:00
|
|
|
{
|
2005-10-26 13:52:42 +00:00
|
|
|
/*GstElementClass *element_class = GST_ELEMENT_CLASS (klass); */
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_class_init (GstBaseRTPDepayloadClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
2005-08-12 13:34:56 +00:00
|
|
|
GstElementClass *gstelement_class;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
2005-08-12 13:34:56 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2005-10-26 20:00:46 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GstBaseRTPDepayloadPrivate));
|
|
|
|
|
|
|
|
gobject_class->finalize = gst_base_rtp_depayload_finalize;
|
2005-07-14 10:29:30 +00:00
|
|
|
gobject_class->set_property = gst_base_rtp_depayload_set_property;
|
|
|
|
gobject_class->get_property = gst_base_rtp_depayload_get_property;
|
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_QUEUE_DELAY,
|
2005-07-14 10:29:30 +00:00
|
|
|
g_param_spec_uint ("queue_delay", "Queue Delay",
|
2007-03-29 16:23:53 +00:00
|
|
|
"Amount of ms to queue/buffer", 0, G_MAXUINT, DEFAULT_QUEUE_DELAY,
|
|
|
|
G_PARAM_READWRITE));
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-08-12 13:34:56 +00:00
|
|
|
gstelement_class->change_state = gst_base_rtp_depayload_change_state;
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
klass->add_to_queue = gst_base_rtp_depayload_add_to_queue;
|
2005-08-10 20:52:37 +00:00
|
|
|
klass->set_gst_timestamp = gst_base_rtp_depayload_set_gst_timestamp;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (basertpdepayload_debug, "basertpdepayload", 0,
|
|
|
|
"Base class for RTP Depayloaders");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-03-29 16:23:53 +00:00
|
|
|
gst_base_rtp_depayload_init (GstBaseRTPDepayload * filter,
|
|
|
|
GstBaseRTPDepayloadClass * klass)
|
2005-07-14 10:29:30 +00:00
|
|
|
{
|
|
|
|
GstPadTemplate *pad_template;
|
2007-03-29 16:23:53 +00:00
|
|
|
GstBaseRTPDepayloadPrivate *priv;
|
|
|
|
|
|
|
|
priv = GST_BASE_RTP_DEPAYLOAD_GET_PRIVATE (filter);
|
|
|
|
filter->priv = priv;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-10-31 15:32:54 +00:00
|
|
|
GST_DEBUG_OBJECT (filter, "init");
|
2005-07-14 10:29:30 +00:00
|
|
|
|
|
|
|
pad_template =
|
2007-03-29 16:23:53 +00:00
|
|
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "sink");
|
2005-07-14 10:29:30 +00:00
|
|
|
g_return_if_fail (pad_template != NULL);
|
|
|
|
filter->sinkpad = gst_pad_new_from_template (pad_template, "sink");
|
|
|
|
gst_pad_set_setcaps_function (filter->sinkpad,
|
|
|
|
gst_base_rtp_depayload_setcaps);
|
|
|
|
gst_pad_set_chain_function (filter->sinkpad, gst_base_rtp_depayload_chain);
|
2005-12-18 00:56:07 +00:00
|
|
|
gst_pad_set_event_function (filter->sinkpad,
|
|
|
|
gst_base_rtp_depayload_handle_sink_event);
|
2005-07-14 10:29:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
|
|
|
|
|
|
|
|
pad_template =
|
2007-03-29 16:23:53 +00:00
|
|
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (klass), "src");
|
2005-07-14 10:29:30 +00:00
|
|
|
g_return_if_fail (pad_template != NULL);
|
|
|
|
filter->srcpad = gst_pad_new_from_template (pad_template, "src");
|
2006-09-27 11:06:54 +00:00
|
|
|
gst_pad_use_fixed_caps (filter->srcpad);
|
2005-07-14 10:29:30 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
|
|
|
|
|
|
|
|
filter->queue = g_queue_new ();
|
2007-03-29 16:23:53 +00:00
|
|
|
filter->queue_delay = DEFAULT_QUEUE_DELAY;
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_finalize (GObject * object)
|
|
|
|
{
|
2006-04-11 17:31:29 +00:00
|
|
|
GstBuffer *buf;
|
2006-09-22 14:13:34 +00:00
|
|
|
GstBaseRTPDepayload *filter = GST_BASE_RTP_DEPAYLOAD (object);
|
2006-04-11 17:31:29 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
while ((buf = g_queue_pop_head (filter->queue)))
|
2006-04-11 17:31:29 +00:00
|
|
|
gst_buffer_unref (buf);
|
2006-09-22 14:13:34 +00:00
|
|
|
g_queue_free (filter->queue);
|
2005-10-25 17:20:55 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_base_rtp_depayload_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter;
|
2006-01-23 10:10:36 +00:00
|
|
|
GstBaseRTPDepayloadClass *bclass;
|
2007-03-29 16:23:53 +00:00
|
|
|
GstBaseRTPDepayloadPrivate *priv;
|
2006-03-07 12:49:03 +00:00
|
|
|
gboolean res;
|
2007-03-29 16:23:53 +00:00
|
|
|
GstStructure *caps_struct;
|
|
|
|
const GValue *value;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
|
|
|
filter = GST_BASE_RTP_DEPAYLOAD (gst_pad_get_parent (pad));
|
2007-03-29 16:23:53 +00:00
|
|
|
priv = filter->priv;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2006-01-23 10:10:36 +00:00
|
|
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
GST_DEBUG_OBJECT (filter, "Set caps");
|
|
|
|
|
|
|
|
caps_struct = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
/* get clock base if any, we need this for the newsegment */
|
|
|
|
value = gst_structure_get_value (caps_struct, "clock-base");
|
|
|
|
if (value && G_VALUE_HOLDS_UINT (value))
|
|
|
|
priv->clock_base = g_value_get_uint (value);
|
|
|
|
else
|
|
|
|
priv->clock_base = -1;
|
|
|
|
|
2007-05-12 16:18:39 +00:00
|
|
|
/* get other values for newsegment */
|
|
|
|
value = gst_structure_get_value (caps_struct, "npt-start");
|
|
|
|
if (value && G_VALUE_HOLDS_UINT64 (value))
|
|
|
|
priv->npt_start = g_value_get_uint64 (value);
|
|
|
|
else
|
|
|
|
priv->npt_start = 0;
|
|
|
|
|
|
|
|
value = gst_structure_get_value (caps_struct, "npt-stop");
|
|
|
|
if (value && G_VALUE_HOLDS_UINT64 (value))
|
|
|
|
priv->npt_stop = g_value_get_uint64 (value);
|
|
|
|
else
|
|
|
|
priv->npt_stop = -1;
|
|
|
|
|
|
|
|
value = gst_structure_get_value (caps_struct, "play-speed");
|
|
|
|
if (value && G_VALUE_HOLDS_DOUBLE (value))
|
|
|
|
priv->play_speed = g_value_get_double (value);
|
|
|
|
else
|
|
|
|
priv->play_speed = 1.0;
|
|
|
|
|
|
|
|
value = gst_structure_get_value (caps_struct, "play-scale");
|
|
|
|
if (value && G_VALUE_HOLDS_DOUBLE (value))
|
|
|
|
priv->play_scale = g_value_get_double (value);
|
|
|
|
else
|
|
|
|
priv->play_scale = 1.0;
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
if (bclass->set_caps)
|
2006-03-07 12:49:03 +00:00
|
|
|
res = bclass->set_caps (filter, caps);
|
2005-07-14 10:29:30 +00:00
|
|
|
else
|
2006-03-07 12:49:03 +00:00
|
|
|
res = TRUE;
|
|
|
|
|
|
|
|
gst_object_unref (filter);
|
2006-09-22 14:13:34 +00:00
|
|
|
|
2006-03-07 12:49:03 +00:00
|
|
|
return res;
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_chain (GstPad * pad, GstBuffer * in)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter;
|
check/pipelines/simple_launch_lines.c: Fix for bus API.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Fix for bus API.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_set_gst_timestamp),
(gst_base_rtp_depayload_queue_release):
Some cleanups.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_setcaps), (gst_basertppayload_set_options),
(gst_basertppayload_set_outcaps), (gst_basertppayload_push),
(gst_basertppayload_get_property),
(gst_basertppayload_change_state):
Added debugging category.
2005-09-19 11:24:46 +00:00
|
|
|
GstBaseRTPDepayloadClass *bclass;
|
2005-07-14 10:29:30 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
filter = GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
|
|
|
|
2007-03-29 16:23:53 +00:00
|
|
|
if (filter->clock_rate == 0)
|
2006-07-19 18:20:43 +00:00
|
|
|
goto not_configured;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
check/pipelines/simple_launch_lines.c: Fix for bus API.
Original commit message from CVS:
* check/pipelines/simple_launch_lines.c: (run_pipeline):
Fix for bus API.
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_set_gst_timestamp),
(gst_base_rtp_depayload_queue_release):
Some cleanups.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_setcaps), (gst_basertppayload_set_options),
(gst_basertppayload_set_outcaps), (gst_basertppayload_push),
(gst_basertppayload_get_property),
(gst_basertppayload_change_state):
Added debugging category.
2005-09-19 11:24:46 +00:00
|
|
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-10-31 15:32:54 +00:00
|
|
|
if (filter->queue_delay == 0) {
|
|
|
|
GST_DEBUG_OBJECT (filter, "Pushing directly!");
|
2006-09-22 14:13:34 +00:00
|
|
|
ret = gst_base_rtp_depayload_process (filter, in);
|
2005-07-14 10:29:30 +00:00
|
|
|
} else {
|
|
|
|
if (bclass->add_to_queue)
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
ret = bclass->add_to_queue (filter, in);
|
2006-09-22 14:13:34 +00:00
|
|
|
else
|
|
|
|
goto no_delay;
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
return ret;
|
2006-07-19 18:20:43 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_configured:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (filter, STREAM, FORMAT,
|
|
|
|
(NULL), ("no clock rate was specified, likely incomplete input caps"));
|
2006-09-22 14:13:34 +00:00
|
|
|
gst_buffer_unref (in);
|
2006-07-19 18:20:43 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
2006-09-22 14:13:34 +00:00
|
|
|
no_delay:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (filter, STREAM, NOT_IMPLEMENTED,
|
|
|
|
(NULL), ("This element cannot operate with delay"));
|
|
|
|
gst_buffer_unref (in);
|
|
|
|
return GST_FLOW_NOT_SUPPORTED;
|
|
|
|
}
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
2005-12-18 00:56:07 +00:00
|
|
|
static gboolean
|
|
|
|
gst_base_rtp_depayload_handle_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter =
|
|
|
|
GST_BASE_RTP_DEPAYLOAD (GST_OBJECT_PARENT (pad));
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_NEWSEGMENT:
|
|
|
|
{
|
2006-02-02 00:04:37 +00:00
|
|
|
/* intercept NEWSEGMENT events only if the packet scheduler thread
|
|
|
|
is active */
|
|
|
|
if (filter->thread) {
|
|
|
|
GST_DEBUG_OBJECT (filter,
|
|
|
|
"Upstream sent a NEWSEGMENT, handle in worker thread.");
|
|
|
|
/* the worker thread will assign a new RTP-TS<->GST-TS mapping
|
|
|
|
* based on the next processed RTP packet */
|
|
|
|
filter->need_newsegment = TRUE;
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
} else {
|
2006-07-27 10:52:52 +00:00
|
|
|
GstFormat format;
|
|
|
|
|
|
|
|
gst_event_parse_new_segment (event, NULL, NULL, &format, NULL, NULL,
|
|
|
|
NULL);
|
|
|
|
if (format != GST_FORMAT_TIME)
|
|
|
|
goto wrong_format;
|
|
|
|
|
2006-02-02 00:04:37 +00:00
|
|
|
GST_DEBUG_OBJECT (filter,
|
|
|
|
"Upstream sent a NEWSEGMENT, passing through.");
|
|
|
|
}
|
|
|
|
/* note: pass through to default if no thread running */
|
2006-07-27 10:52:52 +00:00
|
|
|
}
|
2005-12-18 00:56:07 +00:00
|
|
|
default:
|
|
|
|
/* pass other events forward */
|
|
|
|
res = gst_pad_push_event (filter->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
2006-07-27 10:52:52 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_format:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (filter,
|
|
|
|
"Upstream sent a NEWSEGMENT in wrong format, dropping.");
|
|
|
|
gst_event_unref (event);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2005-12-18 00:56:07 +00:00
|
|
|
}
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_add_to_queue (GstBaseRTPDepayload * filter,
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
GstBuffer * in)
|
2005-07-14 10:29:30 +00:00
|
|
|
{
|
|
|
|
GQueue *queue = filter->queue;
|
2006-01-23 10:10:36 +00:00
|
|
|
int i;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* our first packet, just push it */
|
2005-08-12 13:34:56 +00:00
|
|
|
QUEUE_LOCK (filter);
|
2005-07-14 10:29:30 +00:00
|
|
|
if (g_queue_is_empty (queue)) {
|
|
|
|
g_queue_push_tail (queue, in);
|
2005-10-09 21:32:34 +00:00
|
|
|
QUEUE_UNLOCK (filter);
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
} else {
|
|
|
|
guint16 seqnum, queueseq;
|
|
|
|
guint32 timestamp;
|
|
|
|
|
2005-12-01 14:29:59 +00:00
|
|
|
seqnum = gst_rtp_buffer_get_seq (in);
|
|
|
|
queueseq = gst_rtp_buffer_get_seq (GST_BUFFER (g_queue_peek_head (queue)));
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* look for right place to insert it */
|
2006-01-23 10:10:36 +00:00
|
|
|
i = 0;
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2006-08-02 17:03:29 +00:00
|
|
|
/* Check for seqnum wraparound.
|
|
|
|
* Seqnums in the lowest quadrant of the 0-65535 space are considered to
|
|
|
|
* be greater than seqnums in the highest quadrant of this space. */
|
|
|
|
while (seqnum > queueseq || (seqnum < 16384 && queueseq > 49150)) {
|
2005-10-31 13:29:06 +00:00
|
|
|
gpointer data;
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
i++;
|
2005-10-31 13:29:06 +00:00
|
|
|
data = g_queue_peek_nth (queue, i);
|
|
|
|
if (!data)
|
|
|
|
break;
|
|
|
|
|
2005-12-01 14:29:59 +00:00
|
|
|
queueseq = gst_rtp_buffer_get_seq (GST_BUFFER (data));
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
}
|
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* now insert it at that place */
|
2005-07-14 10:29:30 +00:00
|
|
|
g_queue_push_nth (queue, in, i);
|
2005-10-09 21:32:34 +00:00
|
|
|
QUEUE_UNLOCK (filter);
|
2005-07-14 10:29:30 +00:00
|
|
|
|
2005-12-01 14:29:59 +00:00
|
|
|
timestamp = gst_rtp_buffer_get_timestamp (in);
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
|
2005-10-31 15:32:54 +00:00
|
|
|
GST_DEBUG_OBJECT (filter,
|
|
|
|
"Packet added to queue %d at pos %d timestamp %u sn %d",
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
g_queue_get_length (queue), i, timestamp, seqnum);
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_push_full (GstBaseRTPDepayload * filter,
|
|
|
|
gboolean do_ts, guint32 timestamp, GstBuffer * out_buf)
|
2005-08-10 20:52:37 +00:00
|
|
|
{
|
2006-09-22 14:13:34 +00:00
|
|
|
GstFlowReturn ret;
|
2005-10-26 14:19:21 +00:00
|
|
|
GstCaps *srccaps;
|
2006-09-22 14:13:34 +00:00
|
|
|
GstBaseRTPDepayloadClass *bclass;
|
|
|
|
|
|
|
|
/* set the caps if any */
|
|
|
|
srccaps = GST_PAD_CAPS (filter->srcpad);
|
|
|
|
if (srccaps)
|
|
|
|
gst_buffer_set_caps (out_buf, srccaps);
|
|
|
|
|
|
|
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
|
|
|
|
|
|
|
/* set the timestamp if we must and can */
|
|
|
|
if (bclass->set_gst_timestamp && do_ts)
|
|
|
|
bclass->set_gst_timestamp (filter, timestamp, out_buf);
|
|
|
|
|
|
|
|
/* push it */
|
2006-10-05 15:55:21 +00:00
|
|
|
GST_LOG_OBJECT (filter, "Pushing buffer size %d, timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_BUFFER_SIZE (out_buf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (out_buf)));
|
2006-09-22 14:13:34 +00:00
|
|
|
ret = gst_pad_push (filter->srcpad, out_buf);
|
|
|
|
GST_LOG_OBJECT (filter, "Pushed buffer: %s", gst_flow_get_name (ret));
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_rtp_depayload_push_ts:
|
|
|
|
* @filter: a #GstBaseRTPDepayload
|
|
|
|
* @timestamp: an RTP timestamp to apply
|
|
|
|
* @out_buf: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Push @out_buf to the peer of @filter. This function takes ownership of
|
|
|
|
* @out_buf.
|
|
|
|
*
|
|
|
|
* Unlike gst_base_rtp_depayload_push(), this function will apply @timestamp
|
|
|
|
* on the outgoing buffer, using the configured clock_rate to convert the
|
|
|
|
* timestamp to a valid GStreamer clock time.
|
|
|
|
*
|
2007-03-29 16:23:53 +00:00
|
|
|
* Returns: a #GstFlowReturn.
|
2006-09-22 14:13:34 +00:00
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_push_ts (GstBaseRTPDepayload * filter, guint32 timestamp,
|
|
|
|
GstBuffer * out_buf)
|
|
|
|
{
|
|
|
|
return gst_base_rtp_depayload_push_full (filter, TRUE, timestamp, out_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_rtp_depayload_push:
|
|
|
|
* @filter: a #GstBaseRTPDepayload
|
|
|
|
* @out_buf: a #GstBuffer
|
|
|
|
*
|
|
|
|
* Push @out_buf to the peer of @filter. This function takes ownership of
|
|
|
|
* @out_buf.
|
|
|
|
*
|
|
|
|
* Unlike gst_base_rtp_depayload_push_ts(), this function will not apply
|
|
|
|
* any timestamp on the outgoing buffer.
|
|
|
|
*
|
2007-03-29 16:23:53 +00:00
|
|
|
* Returns: a #GstFlowReturn.
|
2006-09-22 14:13:34 +00:00
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_push (GstBaseRTPDepayload * filter, GstBuffer * out_buf)
|
|
|
|
{
|
|
|
|
return gst_base_rtp_depayload_push_full (filter, FALSE, 0, out_buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_rtp_depayload_process (GstBaseRTPDepayload * filter,
|
|
|
|
GstBuffer * rtp_buf)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayloadClass *bclass;
|
|
|
|
GstBuffer *out_buf;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
2005-08-10 20:52:37 +00:00
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* let's send it out to processing */
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
out_buf = bclass->process (filter, rtp_buf);
|
2005-08-10 20:52:37 +00:00
|
|
|
if (out_buf) {
|
2006-09-22 14:13:34 +00:00
|
|
|
guint32 timestamp = gst_rtp_buffer_get_timestamp (rtp_buf);
|
2005-10-31 12:09:19 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
/* push buffer with timestamp
|
|
|
|
* We are assuming here that the timestamp of the last RTP buffer
|
|
|
|
* is the same as the timestamp wanted on the collector. If this is not a
|
|
|
|
* desired result, the process function should push itself with another
|
|
|
|
* timestamp and return NULL.
|
2005-10-26 13:52:42 +00:00
|
|
|
*/
|
2006-09-22 14:13:34 +00:00
|
|
|
ret = gst_base_rtp_depayload_push_ts (filter, timestamp, out_buf);
|
2005-08-10 20:52:37 +00:00
|
|
|
}
|
2006-04-11 17:31:29 +00:00
|
|
|
gst_buffer_unref (rtp_buf);
|
2006-09-22 14:13:34 +00:00
|
|
|
|
|
|
|
return ret;
|
2005-08-10 20:52:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_set_gst_timestamp (GstBaseRTPDepayload * filter,
|
|
|
|
guint32 timestamp, GstBuffer * buf)
|
2005-07-14 10:29:30 +00:00
|
|
|
{
|
2006-09-22 14:13:34 +00:00
|
|
|
GstClockTime ts, adjusted;
|
2007-05-12 16:18:39 +00:00
|
|
|
GstBaseRTPDepayloadPrivate *priv;
|
2006-09-22 14:13:34 +00:00
|
|
|
|
2007-05-12 16:18:39 +00:00
|
|
|
priv = filter->priv;
|
|
|
|
|
|
|
|
/* no clock-base set, take first timestamp as base */
|
|
|
|
if (priv->clock_base == -1)
|
|
|
|
priv->clock_base = timestamp;
|
2005-08-10 20:52:37 +00:00
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* rtp timestamps are based on the clock_rate
|
2007-05-12 16:18:39 +00:00
|
|
|
* gst timesamps are in nanoseconds */
|
|
|
|
ts = gst_util_uint64_scale_int (timestamp, GST_SECOND, filter->clock_rate);
|
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
GST_DEBUG_OBJECT (filter, "ts : timestamp : %u, clockrate : %u",
|
2005-10-31 15:32:54 +00:00
|
|
|
timestamp, filter->clock_rate);
|
2005-10-26 13:52:42 +00:00
|
|
|
|
2005-12-18 00:41:10 +00:00
|
|
|
/* add delay to timestamp */
|
2006-09-22 14:13:34 +00:00
|
|
|
adjusted = ts + (filter->queue_delay * GST_MSECOND);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (filter, "RTP: %u, GST: %" GST_TIME_FORMAT ", adjusted %"
|
|
|
|
GST_TIME_FORMAT, timestamp, GST_TIME_ARGS (ts), GST_TIME_ARGS (adjusted));
|
2005-12-18 00:41:10 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (buf) = adjusted;
|
2005-08-10 20:52:37 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
/* if this is the first buf send a NEWSEGMENT */
|
2005-11-08 22:34:24 +00:00
|
|
|
if (filter->need_newsegment) {
|
2007-03-29 16:23:53 +00:00
|
|
|
GstEvent *event;
|
2007-05-12 16:18:39 +00:00
|
|
|
GstClockTime start, stop, position;
|
|
|
|
|
|
|
|
start = gst_util_uint64_scale_int (priv->clock_base, GST_SECOND,
|
|
|
|
filter->clock_rate);
|
2007-03-29 16:23:53 +00:00
|
|
|
|
2007-05-12 16:18:39 +00:00
|
|
|
if (priv->npt_stop != -1)
|
|
|
|
stop = priv->npt_stop - priv->npt_start + start;
|
2007-03-29 16:23:53 +00:00
|
|
|
else
|
2007-05-12 16:18:39 +00:00
|
|
|
stop = -1;
|
2007-03-29 16:23:53 +00:00
|
|
|
|
2007-05-12 16:18:39 +00:00
|
|
|
position = priv->npt_start;
|
|
|
|
|
|
|
|
event =
|
|
|
|
gst_event_new_new_segment_full (FALSE, priv->play_speed,
|
|
|
|
priv->play_scale, GST_FORMAT_TIME, start, stop, position);
|
2005-08-10 20:52:37 +00:00
|
|
|
|
|
|
|
gst_pad_push_event (filter->srcpad, event);
|
2007-05-12 16:18:39 +00:00
|
|
|
|
2005-11-08 22:34:24 +00:00
|
|
|
filter->need_newsegment = FALSE;
|
|
|
|
GST_DEBUG_OBJECT (filter, "Pushed newsegment event on this first buffer");
|
2005-08-10 20:52:37 +00:00
|
|
|
}
|
2005-07-14 10:29:30 +00:00
|
|
|
}
|
|
|
|
|
2005-08-12 13:34:56 +00:00
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_queue_release (GstBaseRTPDepayload * filter)
|
|
|
|
{
|
|
|
|
GQueue *queue = filter->queue;
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
guint32 headts, tailts;
|
|
|
|
GstBaseRTPDepayloadClass *bclass;
|
2006-01-23 10:10:36 +00:00
|
|
|
gfloat q_size_secs;
|
|
|
|
guint maxtsunits;
|
2005-08-12 13:34:56 +00:00
|
|
|
|
|
|
|
if (g_queue_is_empty (queue))
|
|
|
|
return;
|
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/* if our queue is getting to big (more than RTP_QUEUEDELAY ms of data)
|
|
|
|
* release heading buffers
|
|
|
|
*/
|
2006-02-02 00:04:37 +00:00
|
|
|
/*GST_DEBUG_OBJECT (filter, "clockrate %d, queue_delay %d", filter->clock_rate,
|
|
|
|
filter->queue_delay); */
|
2006-01-23 10:10:36 +00:00
|
|
|
q_size_secs = (gfloat) filter->queue_delay / 1000;
|
|
|
|
maxtsunits = (gfloat) filter->clock_rate * q_size_secs;
|
2005-08-12 13:34:56 +00:00
|
|
|
|
|
|
|
QUEUE_LOCK (filter);
|
2005-12-01 14:29:59 +00:00
|
|
|
headts =
|
|
|
|
gst_rtp_buffer_get_timestamp (GST_BUFFER (g_queue_peek_head (queue)));
|
|
|
|
tailts =
|
|
|
|
gst_rtp_buffer_get_timestamp (GST_BUFFER (g_queue_peek_tail (queue)));
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
|
|
|
|
bclass = GST_BASE_RTP_DEPAYLOAD_GET_CLASS (filter);
|
|
|
|
|
2005-10-26 13:52:42 +00:00
|
|
|
/*GST_DEBUG("maxtsunit is %u %u %u %u", maxtsunits, headts, tailts, headts - tailts); */
|
gst-libs/gst/rtp/gstbasertpdepayload.*: Fix for RTPBuffer changes.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpdepayload.c:
(gst_base_rtp_depayload_chain),
(gst_base_rtp_depayload_add_to_queue),
(gst_base_rtp_depayload_push),
(gst_base_rtp_depayload_queue_release):
* gst-libs/gst/rtp/gstbasertpdepayload.h:
Fix for RTPBuffer changes.
* gst-libs/gst/rtp/gstrtpbuffer.c: (gst_rtpbuffer_allocate_data),
(gst_rtpbuffer_new_take_data), (gst_rtpbuffer_new_copy_data),
(gst_rtpbuffer_new_allocate), (gst_rtpbuffer_new_allocate_len),
(gst_rtpbuffer_calc_header_len), (gst_rtpbuffer_calc_packet_len),
(gst_rtpbuffer_calc_payload_len), (gst_rtpbuffer_validate_data),
(gst_rtpbuffer_validate), (gst_rtpbuffer_set_packet_len),
(gst_rtpbuffer_get_packet_len), (gst_rtpbuffer_get_version),
(gst_rtpbuffer_set_version), (gst_rtpbuffer_get_padding),
(gst_rtpbuffer_set_padding), (gst_rtpbuffer_pad_to),
(gst_rtpbuffer_get_extension), (gst_rtpbuffer_set_extension),
(gst_rtpbuffer_get_ssrc), (gst_rtpbuffer_set_ssrc),
(gst_rtpbuffer_get_csrc_count), (gst_rtpbuffer_get_csrc),
(gst_rtpbuffer_set_csrc), (gst_rtpbuffer_get_marker),
(gst_rtpbuffer_set_marker), (gst_rtpbuffer_get_payload_type),
(gst_rtpbuffer_set_payload_type), (gst_rtpbuffer_get_seq),
(gst_rtpbuffer_set_seq), (gst_rtpbuffer_get_timestamp),
(gst_rtpbuffer_set_timestamp), (gst_rtpbuffer_get_payload_len),
(gst_rtpbuffer_get_payload):
* gst-libs/gst/rtp/gstrtpbuffer.h:
Don't subclass GstBuffer but add methods and helper functions
to construct and manipulate RTP packets in regular GstBuffers.
2005-08-18 10:23:54 +00:00
|
|
|
while (headts - tailts > maxtsunits) {
|
2005-10-31 15:32:54 +00:00
|
|
|
GST_DEBUG_OBJECT (filter, "Poping packet from queue");
|
2005-08-12 13:34:56 +00:00
|
|
|
if (bclass->process) {
|
2005-11-02 10:23:38 +00:00
|
|
|
GstBuffer *in = g_queue_pop_head (queue);
|
2005-08-12 13:34:56 +00:00
|
|
|
|
2006-09-22 14:13:34 +00:00
|
|
|
gst_base_rtp_depayload_process (filter, in);
|
2005-08-12 13:34:56 +00:00
|
|
|
}
|
2005-11-02 10:23:38 +00:00
|
|
|
headts =
|
2005-12-01 14:29:59 +00:00
|
|
|
gst_rtp_buffer_get_timestamp (GST_BUFFER (g_queue_peek_head (queue)));
|
2005-08-12 13:34:56 +00:00
|
|
|
}
|
|
|
|
QUEUE_UNLOCK (filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gst_base_rtp_depayload_thread (GstBaseRTPDepayload * filter)
|
|
|
|
{
|
|
|
|
while (filter->thread_running) {
|
|
|
|
gst_base_rtp_depayload_queue_release (filter);
|
2005-12-18 00:56:07 +00:00
|
|
|
/* sleep for 5msec (XXX: 5msec is a value that works for audio and video,
|
|
|
|
* should be adjusted based on frequency of incoming packet,
|
|
|
|
* or by data comsumption rate of the sink (depends on how
|
|
|
|
* clock-drift compensation is implemented) */
|
2005-12-05 10:47:55 +00:00
|
|
|
gst_base_rtp_depayload_wait (filter, GST_MSECOND * 5);
|
2005-08-12 13:34:56 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_base_rtp_depayload_start_thread (GstBaseRTPDepayload * filter)
|
|
|
|
{
|
2006-02-02 00:04:37 +00:00
|
|
|
/* only launch the thread if processing is needed */
|
|
|
|
if (filter->queue_delay) {
|
|
|
|
GST_DEBUG_OBJECT (filter, "Starting queue release thread");
|
|
|
|
filter->thread_running = TRUE;
|
|
|
|
filter->thread =
|
|
|
|
g_thread_create ((GThreadFunc) gst_base_rtp_depayload_thread, filter,
|
|
|
|
TRUE, NULL);
|
|
|
|
GST_DEBUG_OBJECT (filter, "Started queue release thread");
|
|
|
|
}
|
2005-08-12 13:34:56 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_base_rtp_depayload_stop_thread (GstBaseRTPDepayload * filter)
|
|
|
|
{
|
|
|
|
filter->thread_running = FALSE;
|
|
|
|
|
|
|
|
if (filter->thread) {
|
|
|
|
g_thread_join (filter->thread);
|
|
|
|
filter->thread = NULL;
|
|
|
|
}
|
|
|
|
QUEUE_LOCK_FREE (filter);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-11-03 22:49:38 +00:00
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_wait (GstBaseRTPDepayload * filter, GstClockTime time)
|
|
|
|
{
|
|
|
|
GstClockID id;
|
2006-07-14 17:56:59 +00:00
|
|
|
GstClock *clock;
|
|
|
|
GstClockTime base;
|
2005-11-03 22:49:38 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GST_CLOCK_TIME_IS_VALID (time));
|
|
|
|
|
2006-07-14 17:56:59 +00:00
|
|
|
GST_OBJECT_LOCK (filter);
|
|
|
|
if ((clock = GST_ELEMENT_CLOCK (filter)) == NULL)
|
|
|
|
goto no_clock;
|
|
|
|
gst_object_ref (clock);
|
|
|
|
GST_OBJECT_UNLOCK (filter);
|
|
|
|
|
|
|
|
base = gst_clock_get_time (clock);
|
|
|
|
id = gst_clock_new_single_shot_id (clock, base + time);
|
|
|
|
|
|
|
|
gst_object_unref (clock);
|
2005-11-03 22:49:38 +00:00
|
|
|
|
|
|
|
gst_clock_id_wait (id, NULL);
|
|
|
|
gst_clock_id_unref (id);
|
2006-07-14 17:56:59 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
no_clock:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (filter, "No clock given yet");
|
|
|
|
GST_OBJECT_UNLOCK (filter);
|
|
|
|
return;
|
|
|
|
}
|
2005-11-03 22:49:38 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:43:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_base_rtp_depayload_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
2005-08-12 13:34:56 +00:00
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter;
|
2006-10-06 13:34:46 +00:00
|
|
|
GstStateChangeReturn ret;
|
2005-08-12 13:34:56 +00:00
|
|
|
|
|
|
|
filter = GST_BASE_RTP_DEPAYLOAD (element);
|
|
|
|
|
|
|
|
/* we disallow changing the state from the thread */
|
|
|
|
if (g_thread_self () == filter->thread)
|
2006-07-14 17:56:59 +00:00
|
|
|
goto wrong_thread;
|
2005-08-12 13:34:56 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
2005-08-12 13:34:56 +00:00
|
|
|
if (!gst_base_rtp_depayload_start_thread (filter))
|
|
|
|
goto start_failed;
|
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2007-03-29 16:23:53 +00:00
|
|
|
/* clock_rate needs to be overwritten by child */
|
|
|
|
filter->clock_rate = 0;
|
|
|
|
filter->priv->clock_base = -1;
|
|
|
|
filter->need_newsegment = TRUE;
|
2005-08-12 13:34:56 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
2005-08-12 13:34:56 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-10-06 13:34:46 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
2005-08-12 13:34:56 +00:00
|
|
|
switch (transition) {
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
2005-08-12 13:34:56 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2005-08-12 13:34:56 +00:00
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2005-08-12 13:34:56 +00:00
|
|
|
gst_base_rtp_depayload_stop_thread (filter);
|
|
|
|
break;
|
2005-09-02 15:43:18 +00:00
|
|
|
default:
|
|
|
|
break;
|
2005-08-12 13:34:56 +00:00
|
|
|
}
|
2006-10-06 13:34:46 +00:00
|
|
|
return ret;
|
2005-08-12 13:34:56 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2006-07-14 17:56:59 +00:00
|
|
|
wrong_thread:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (filter, CORE, STATE_CHANGE,
|
|
|
|
(NULL), ("cannot perform a state change from this thread"));
|
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
|
|
|
}
|
2005-08-12 13:34:56 +00:00
|
|
|
start_failed:
|
|
|
|
{
|
2006-07-14 17:56:59 +00:00
|
|
|
/* start method should have posted an error message */
|
2005-09-02 15:43:18 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2005-08-12 13:34:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-14 10:29:30 +00:00
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter;
|
|
|
|
|
|
|
|
filter = GST_BASE_RTP_DEPAYLOAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-03-29 16:23:53 +00:00
|
|
|
case PROP_QUEUE_DELAY:
|
2005-07-14 10:29:30 +00:00
|
|
|
filter->queue_delay = g_value_get_uint (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_rtp_depayload_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBaseRTPDepayload *filter;
|
|
|
|
|
|
|
|
filter = GST_BASE_RTP_DEPAYLOAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2007-03-29 16:23:53 +00:00
|
|
|
case PROP_QUEUE_DELAY:
|
2005-07-14 10:29:30 +00:00
|
|
|
g_value_set_uint (value, filter->queue_delay);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|