2006-04-13 03:55:12 +00:00
|
|
|
/* GStreamer
|
2007-03-14 21:11:18 +00:00
|
|
|
* Copyright (C) <2006> Philippe Khalaf <philippe.kalaf@collabora.co.uk>
|
2006-04-13 03:55:12 +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.
|
|
|
|
*/
|
|
|
|
|
2006-09-29 23:50:53 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstbasertpaudiopayload
|
|
|
|
* @short_description: Base class for audio RTP payloader
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* Provides a base class for audio RTP payloaders for frame or sample based
|
|
|
|
* audio codecs (constant bitrate)
|
|
|
|
* </para>
|
|
|
|
* <para>
|
|
|
|
* This class derives from GstBaseRTPPayload. It can be used for payloading
|
|
|
|
* audio codecs. It will only work with constant bitrate codecs. It supports
|
|
|
|
* both frame based and sample based codecs. It takes care of packing up the
|
|
|
|
* audio data into RTP packets and filling up the headers accordingly. The
|
|
|
|
* payloading is done based on the maximum MTU (mtu) and the maximum time per
|
|
|
|
* packet (max-ptime). The general idea is to divide large data buffers into
|
|
|
|
* smaller RTP packets. The RTP packet size is the minimum of either the MTU,
|
2007-03-14 21:11:18 +00:00
|
|
|
* max-ptime (if set) or available data. The RTP packet size is always larger or
|
|
|
|
* equal to min-ptime (if set). If min-ptime is not set, any residual data is
|
|
|
|
* sent in a last RTP packet. In the case of frame based codecs, the resulting
|
|
|
|
* RTP packets always contain full frames.
|
2006-09-29 23:50:53 +00:00
|
|
|
* </para>
|
|
|
|
* <title>Usage</title>
|
|
|
|
* <para>
|
|
|
|
* To use this base class, your child element needs to call either
|
2007-05-04 13:10:07 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_frame_based() or
|
|
|
|
* gst_base_rtp_audio_payload_set_sample_based(). This is usually done in the
|
2006-09-29 23:50:53 +00:00
|
|
|
* element's _init() function. Then, the child element must call either
|
2008-03-03 16:11:50 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_frame_options(),
|
|
|
|
* gst_base_rtp_audio_payload_set_sample_options() or
|
|
|
|
* gst_base_rtp_audio_payload_set_samplebits_options. Since
|
|
|
|
* GstBaseRTPAudioPayload derives from GstBaseRTPPayload, the child element
|
|
|
|
* must set any variables or call/override any functions required by that base
|
|
|
|
* class. The child element does not need to override any other functions
|
|
|
|
* specific to GstBaseRTPAudioPayload.
|
2006-09-29 23:50:53 +00:00
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <gst/rtp/gstrtpbuffer.h>
|
2007-03-14 21:11:18 +00:00
|
|
|
#include <gst/base/gstadapter.h>
|
2006-04-13 03:55:12 +00:00
|
|
|
|
|
|
|
#include "gstbasertpaudiopayload.h"
|
|
|
|
|
2006-06-23 09:53:09 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (basertpaudiopayload_debug);
|
2006-04-13 03:55:12 +00:00
|
|
|
#define GST_CAT_DEFAULT (basertpaudiopayload_debug)
|
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
#define DEFAULT_BUFFER_LIST FALSE
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_BUFFER_LIST,
|
|
|
|
PROP_LAST
|
|
|
|
};
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* function to convert bytes to a time */
|
|
|
|
typedef GstClockTime (*GetBytesToTimeFunc) (GstBaseRTPAudioPayload * payload,
|
2009-09-02 11:12:28 +00:00
|
|
|
guint64 bytes);
|
2009-09-03 15:53:47 +00:00
|
|
|
/* function to convert bytes to a RTP time */
|
|
|
|
typedef guint32 (*GetBytesToRTPTimeFunc) (GstBaseRTPAudioPayload * payload,
|
2009-09-02 17:49:57 +00:00
|
|
|
guint64 bytes);
|
2009-09-03 15:53:47 +00:00
|
|
|
/* function to convert time to bytes */
|
|
|
|
typedef guint64 (*GetTimeToBytesFunc) (GstBaseRTPAudioPayload * payload,
|
|
|
|
GstClockTime time);
|
2006-09-27 00:13:29 +00:00
|
|
|
|
|
|
|
struct _GstBaseRTPAudioPayloadPrivate
|
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
GetBytesToTimeFunc bytes_to_time;
|
|
|
|
GetBytesToRTPTimeFunc bytes_to_rtptime;
|
|
|
|
GetTimeToBytesFunc time_to_bytes;
|
2009-09-02 10:24:22 +00:00
|
|
|
|
2007-03-14 21:11:18 +00:00
|
|
|
GstAdapter *adapter;
|
2009-09-02 08:46:30 +00:00
|
|
|
guint fragment_size;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstClockTime frame_duration_ns;
|
2009-09-02 17:49:57 +00:00
|
|
|
gboolean discont;
|
|
|
|
guint64 offset;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstClockTime last_timestamp;
|
|
|
|
guint32 last_rtptime;
|
|
|
|
guint align;
|
|
|
|
|
|
|
|
guint cached_mtu;
|
|
|
|
guint cached_min_ptime;
|
|
|
|
guint cached_max_ptime;
|
2009-12-29 23:45:32 +00:00
|
|
|
guint cached_ptime;
|
2009-09-03 15:53:47 +00:00
|
|
|
guint cached_min_length;
|
|
|
|
guint cached_max_length;
|
2010-01-06 12:39:14 +00:00
|
|
|
|
|
|
|
gboolean buffer_list;
|
2006-09-27 00:13:29 +00:00
|
|
|
};
|
|
|
|
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2006-09-27 00:13:29 +00:00
|
|
|
#define GST_BASE_RTP_AUDIO_PAYLOAD_GET_PRIVATE(o) \
|
2006-10-31 10:49:19 +00:00
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE ((o), GST_TYPE_BASE_RTP_AUDIO_PAYLOAD, \
|
2006-09-27 00:13:29 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate))
|
|
|
|
|
|
|
|
static void gst_base_rtp_audio_payload_finalize (GObject * object);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
static void gst_base_rtp_audio_payload_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_base_rtp_audio_payload_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* bytes to time functions */
|
2009-09-02 10:24:22 +00:00
|
|
|
static GstClockTime
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
|
|
|
|
payload, guint64 bytes);
|
2009-09-02 10:24:22 +00:00
|
|
|
static GstClockTime
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_time (GstBaseRTPAudioPayload *
|
2009-09-02 11:12:28 +00:00
|
|
|
payload, guint64 bytes);
|
2009-09-02 10:24:22 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* bytes to RTP time functions */
|
2009-09-02 17:49:57 +00:00
|
|
|
static guint32
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
|
|
|
payload, guint64 bytes);
|
2009-09-02 17:49:57 +00:00
|
|
|
static guint32
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
2009-09-02 17:49:57 +00:00
|
|
|
payload, guint64 bytes);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* time to bytes functions */
|
|
|
|
static guint64
|
|
|
|
gst_base_rtp_audio_payload_frame_time_to_bytes (GstBaseRTPAudioPayload *
|
|
|
|
payload, GstClockTime time);
|
|
|
|
static guint64
|
|
|
|
gst_base_rtp_audio_payload_sample_time_to_bytes (GstBaseRTPAudioPayload *
|
|
|
|
payload, GstClockTime time);
|
|
|
|
|
2006-09-27 00:13:29 +00:00
|
|
|
static GstFlowReturn gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload
|
|
|
|
* payload, GstBuffer * buffer);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 10:24:22 +00:00
|
|
|
static GstStateChangeReturn gst_base_rtp_payload_audio_change_state (GstElement
|
|
|
|
* element, GstStateChange transition);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 10:24:22 +00:00
|
|
|
static gboolean gst_base_rtp_payload_audio_handle_event (GstPad * pad,
|
|
|
|
GstEvent * event);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2006-09-27 00:13:29 +00:00
|
|
|
GST_BOILERPLATE (GstBaseRTPAudioPayload, gst_base_rtp_audio_payload,
|
2006-04-13 03:55:12 +00:00
|
|
|
GstBaseRTPPayload, GST_TYPE_BASE_RTP_PAYLOAD);
|
|
|
|
|
|
|
|
static void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_base_init (gpointer klass)
|
2006-04-13 03:55:12 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_class_init (GstBaseRTPAudioPayloadClass * klass)
|
2006-04-13 03:55:12 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
|
|
|
|
2006-09-27 00:13:29 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GstBaseRTPAudioPayloadPrivate));
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
|
|
|
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
|
gst-libs/gst/rtp/gstbasertpaudiopayload.c: Some cleanups, remove minptime property as it is now in the parent class.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_class_init),
(gst_base_rtp_audio_payload_init),
(gst_base_rtp_audio_payload_finalize),
(gst_base_rtp_audio_payload_handle_frame_based_buffer),
(gst_base_rtp_audio_payload_handle_sample_based_buffer),
(gst_base_rtp_payload_audio_handle_event):
Some cleanups, remove minptime property as it is now in the parent
class.
Override parent class event function.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_event), (gst_basertppayload_set_property),
(gst_basertppayload_get_property):
* gst-libs/gst/rtp/gstbasertppayload.h:
Add min-ptime property.
Add handle-event vmethod. Fixes #415001.
2007-05-21 09:45:28 +00:00
|
|
|
|
2009-10-28 00:59:35 +00:00
|
|
|
gobject_class->finalize = gst_base_rtp_audio_payload_finalize;
|
2010-01-06 12:39:14 +00:00
|
|
|
gobject_class->set_property = gst_base_rtp_audio_payload_set_property;
|
|
|
|
gobject_class->get_property = gst_base_rtp_audio_payload_get_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_BUFFER_LIST,
|
|
|
|
g_param_spec_boolean ("buffer-list", "Buffer List",
|
|
|
|
"Use Buffer Lists",
|
|
|
|
DEFAULT_BUFFER_LIST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2007-03-14 21:11:18 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_rtp_payload_audio_change_state);
|
|
|
|
|
gst-libs/gst/rtp/gstbasertpaudiopayload.c: Some cleanups, remove minptime property as it is now in the parent class.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_class_init),
(gst_base_rtp_audio_payload_init),
(gst_base_rtp_audio_payload_finalize),
(gst_base_rtp_audio_payload_handle_frame_based_buffer),
(gst_base_rtp_audio_payload_handle_sample_based_buffer),
(gst_base_rtp_payload_audio_handle_event):
Some cleanups, remove minptime property as it is now in the parent
class.
Override parent class event function.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_event), (gst_basertppayload_set_property),
(gst_basertppayload_get_property):
* gst-libs/gst/rtp/gstbasertppayload.h:
Add min-ptime property.
Add handle-event vmethod. Fixes #415001.
2007-05-21 09:45:28 +00:00
|
|
|
gstbasertppayload_class->handle_buffer =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_rtp_audio_payload_handle_buffer);
|
|
|
|
gstbasertppayload_class->handle_event =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_base_rtp_payload_audio_handle_event);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (basertpaudiopayload_debug, "basertpaudiopayload", 0,
|
|
|
|
"base audio RTP payloader");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_init (GstBaseRTPAudioPayload * payload,
|
2006-04-13 03:55:12 +00:00
|
|
|
GstBaseRTPAudioPayloadClass * klass)
|
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
payload->priv = GST_BASE_RTP_AUDIO_PAYLOAD_GET_PRIVATE (payload);
|
2006-09-27 00:13:29 +00:00
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
/* these need to be set by child object if frame based */
|
2009-09-03 15:53:47 +00:00
|
|
|
payload->frame_size = 0;
|
|
|
|
payload->frame_duration = 0;
|
2006-04-13 03:55:12 +00:00
|
|
|
|
|
|
|
/* these need to be set by child object if sample based */
|
2009-09-03 15:53:47 +00:00
|
|
|
payload->sample_size = 0;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
payload->priv->adapter = gst_adapter_new ();
|
2010-01-06 12:39:14 +00:00
|
|
|
|
|
|
|
payload->priv->buffer_list = DEFAULT_BUFFER_LIST;
|
2007-03-14 21:11:18 +00:00
|
|
|
}
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
static void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_finalize (GObject * object)
|
2006-04-13 03:55:12 +00:00
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayload *payload;
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
g_object_unref (payload->priv->adapter);
|
gst-libs/gst/rtp/gstbasertpaudiopayload.c: Some cleanups, remove minptime property as it is now in the parent class.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_class_init),
(gst_base_rtp_audio_payload_init),
(gst_base_rtp_audio_payload_finalize),
(gst_base_rtp_audio_payload_handle_frame_based_buffer),
(gst_base_rtp_audio_payload_handle_sample_based_buffer),
(gst_base_rtp_payload_audio_handle_event):
Some cleanups, remove minptime property as it is now in the parent
class.
Override parent class event function.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_event), (gst_basertppayload_set_property),
(gst_basertppayload_get_property):
* gst-libs/gst/rtp/gstbasertppayload.h:
Add min-ptime property.
Add handle-event vmethod. Fixes #415001.
2007-05-21 09:45:28 +00:00
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
|
|
|
}
|
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
static void
|
|
|
|
gst_base_rtp_audio_payload_set_property (GObject * object,
|
|
|
|
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBaseRTPAudioPayload *payload;
|
|
|
|
|
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_BUFFER_LIST:
|
|
|
|
payload->priv->buffer_list = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_base_rtp_audio_payload_get_property (GObject * object,
|
|
|
|
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstBaseRTPAudioPayload *payload;
|
|
|
|
|
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_BUFFER_LIST:
|
|
|
|
g_value_set_boolean (value, payload->priv->buffer_list);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-18 23:00:02 +00:00
|
|
|
/**
|
2006-09-27 00:13:29 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_frame_based:
|
2006-05-18 23:00:02 +00:00
|
|
|
* @basertpaudiopayload: a pointer to the element.
|
|
|
|
*
|
|
|
|
* Tells #GstBaseRTPAudioPayload that the child element is for a frame based
|
|
|
|
* audio codec
|
|
|
|
*/
|
2006-04-13 03:55:12 +00:00
|
|
|
void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_set_frame_based (GstBaseRTPAudioPayload *
|
2006-04-13 03:55:12 +00:00
|
|
|
basertpaudiopayload)
|
|
|
|
{
|
|
|
|
g_return_if_fail (basertpaudiopayload != NULL);
|
2009-09-03 15:53:47 +00:00
|
|
|
g_return_if_fail (basertpaudiopayload->priv->time_to_bytes == NULL);
|
|
|
|
g_return_if_fail (basertpaudiopayload->priv->bytes_to_time == NULL);
|
|
|
|
g_return_if_fail (basertpaudiopayload->priv->bytes_to_rtptime == NULL);
|
|
|
|
|
|
|
|
basertpaudiopayload->priv->bytes_to_time =
|
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_time;
|
|
|
|
basertpaudiopayload->priv->bytes_to_rtptime =
|
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_rtptime;
|
|
|
|
basertpaudiopayload->priv->time_to_bytes =
|
|
|
|
gst_base_rtp_audio_payload_frame_time_to_bytes;
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
|
|
|
|
2006-05-18 23:00:02 +00:00
|
|
|
/**
|
2006-09-27 00:13:29 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_sample_based:
|
2006-05-18 23:00:02 +00:00
|
|
|
* @basertpaudiopayload: a pointer to the element.
|
|
|
|
*
|
|
|
|
* Tells #GstBaseRTPAudioPayload that the child element is for a sample based
|
|
|
|
* audio codec
|
|
|
|
*/
|
2006-04-13 03:55:12 +00:00
|
|
|
void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_set_sample_based (GstBaseRTPAudioPayload *
|
2006-04-13 03:55:12 +00:00
|
|
|
basertpaudiopayload)
|
|
|
|
{
|
|
|
|
g_return_if_fail (basertpaudiopayload != NULL);
|
2009-09-03 15:53:47 +00:00
|
|
|
g_return_if_fail (basertpaudiopayload->priv->time_to_bytes == NULL);
|
|
|
|
g_return_if_fail (basertpaudiopayload->priv->bytes_to_time == NULL);
|
|
|
|
g_return_if_fail (basertpaudiopayload->priv->bytes_to_rtptime == NULL);
|
|
|
|
|
|
|
|
basertpaudiopayload->priv->bytes_to_time =
|
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_time;
|
|
|
|
basertpaudiopayload->priv->bytes_to_rtptime =
|
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_rtptime;
|
|
|
|
basertpaudiopayload->priv->time_to_bytes =
|
|
|
|
gst_base_rtp_audio_payload_sample_time_to_bytes;
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
|
|
|
|
2006-05-18 23:00:02 +00:00
|
|
|
/**
|
2006-09-27 00:13:29 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_frame_options:
|
2006-05-18 23:00:02 +00:00
|
|
|
* @basertpaudiopayload: a pointer to the element.
|
2007-03-14 21:11:18 +00:00
|
|
|
* @frame_duration: The duraction of an audio frame in milliseconds.
|
2006-05-18 23:00:02 +00:00
|
|
|
* @frame_size: The size of an audio frame in bytes.
|
|
|
|
*
|
|
|
|
* Sets the options for frame based audio codecs.
|
|
|
|
*
|
|
|
|
*/
|
2006-04-13 03:55:12 +00:00
|
|
|
void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_set_frame_options (GstBaseRTPAudioPayload
|
2006-04-13 03:55:12 +00:00
|
|
|
* basertpaudiopayload, gint frame_duration, gint frame_size)
|
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
g_return_if_fail (basertpaudiopayload != NULL);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = basertpaudiopayload->priv;
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
basertpaudiopayload->frame_duration = frame_duration;
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->frame_duration_ns = frame_duration * GST_MSECOND;
|
2009-09-03 12:13:44 +00:00
|
|
|
basertpaudiopayload->frame_size = frame_size;
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->align = frame_size;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_adapter_clear (priv->adapter);
|
2009-09-03 12:13:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basertpaudiopayload, "frame set to %d ms and size %d",
|
|
|
|
frame_duration, frame_size);
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
|
|
|
|
2006-05-18 23:00:02 +00:00
|
|
|
/**
|
2006-09-27 00:13:29 +00:00
|
|
|
* gst_base_rtp_audio_payload_set_sample_options:
|
2006-05-18 23:00:02 +00:00
|
|
|
* @basertpaudiopayload: a pointer to the element.
|
|
|
|
* @sample_size: Size per sample in bytes.
|
|
|
|
*
|
|
|
|
* Sets the options for sample based audio codecs.
|
|
|
|
*/
|
2006-04-13 03:55:12 +00:00
|
|
|
void
|
2006-09-27 00:13:29 +00:00
|
|
|
gst_base_rtp_audio_payload_set_sample_options (GstBaseRTPAudioPayload
|
2006-04-13 03:55:12 +00:00
|
|
|
* basertpaudiopayload, gint sample_size)
|
|
|
|
{
|
|
|
|
g_return_if_fail (basertpaudiopayload != NULL);
|
|
|
|
|
2008-03-03 16:11:50 +00:00
|
|
|
/* sample_size is in bits internally */
|
2009-09-02 08:46:30 +00:00
|
|
|
gst_base_rtp_audio_payload_set_samplebits_options (basertpaudiopayload,
|
|
|
|
sample_size * 8);
|
2008-03-03 16:11:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_base_rtp_audio_payload_set_samplebits_options:
|
|
|
|
* @basertpaudiopayload: a pointer to the element.
|
|
|
|
* @sample_size: Size per sample in bits.
|
|
|
|
*
|
|
|
|
* Sets the options for sample based audio codecs.
|
|
|
|
*
|
|
|
|
* Since: 0.10.18
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_base_rtp_audio_payload_set_samplebits_options (GstBaseRTPAudioPayload
|
|
|
|
* basertpaudiopayload, gint sample_size)
|
|
|
|
{
|
2009-09-02 08:46:30 +00:00
|
|
|
guint fragment_size;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
2009-09-02 08:46:30 +00:00
|
|
|
|
2008-03-03 16:11:50 +00:00
|
|
|
g_return_if_fail (basertpaudiopayload != NULL);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = basertpaudiopayload->priv;
|
|
|
|
|
2006-04-13 03:55:12 +00:00
|
|
|
basertpaudiopayload->sample_size = sample_size;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
/* sample_size is in bits and is converted into multiple bytes */
|
|
|
|
fragment_size = sample_size;
|
|
|
|
while ((fragment_size % 8) != 0)
|
|
|
|
fragment_size += fragment_size;
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->fragment_size = fragment_size / 8;
|
|
|
|
priv->align = priv->fragment_size;
|
2009-09-02 08:46:30 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_adapter_clear (priv->adapter);
|
2009-09-03 12:13:44 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (basertpaudiopayload,
|
|
|
|
"Samplebits set to sample size %d bits", sample_size);
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
static void
|
|
|
|
gst_base_rtp_audio_payload_set_meta (GstBaseRTPAudioPayload * payload,
|
|
|
|
GstBuffer * buffer, guint payload_len, GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
GstBaseRTPPayload *basepayload;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
2009-09-02 17:49:57 +00:00
|
|
|
|
|
|
|
basepayload = GST_BASE_RTP_PAYLOAD_CAST (payload);
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = payload->priv;
|
2009-09-02 17:49:57 +00:00
|
|
|
|
|
|
|
/* set payload type */
|
|
|
|
gst_rtp_buffer_set_payload_type (buffer, basepayload->pt);
|
|
|
|
/* set marker bit for disconts */
|
2009-09-03 15:53:47 +00:00
|
|
|
if (priv->discont) {
|
2009-09-02 17:49:57 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "Setting marker and DISCONT");
|
|
|
|
gst_rtp_buffer_set_marker (buffer, TRUE);
|
|
|
|
GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_DISCONT);
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->discont = FALSE;
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
GST_BUFFER_TIMESTAMP (buffer) = timestamp;
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* get the offset in RTP time */
|
|
|
|
GST_BUFFER_OFFSET (buffer) = priv->bytes_to_rtptime (payload, priv->offset);
|
|
|
|
|
|
|
|
priv->offset += payload_len;
|
2009-09-02 17:49:57 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* remember the last rtptime/timestamp pair. We will use this to realign our
|
|
|
|
* RTP timestamp after a buffer discont */
|
|
|
|
priv->last_rtptime = GST_BUFFER_OFFSET (buffer);
|
|
|
|
priv->last_timestamp = timestamp;
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 11:13:54 +00:00
|
|
|
/**
|
|
|
|
* gst_base_rtp_audio_payload_push:
|
|
|
|
* @baseaudiopayload: a #GstBaseRTPPayload
|
|
|
|
* @data: data to set as payload
|
|
|
|
* @payload_len: length of payload
|
|
|
|
* @timestamp: a #GstClockTime
|
|
|
|
*
|
|
|
|
* Create an RTP buffer and store @payload_len bytes of @data as the
|
|
|
|
* payload. Set the timestamp on the new buffer to @timestamp before pushing
|
|
|
|
* the buffer downstream.
|
|
|
|
*
|
|
|
|
* Returns: a #GstFlowReturn
|
|
|
|
*
|
|
|
|
* Since: 0.10.13
|
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_rtp_audio_payload_push (GstBaseRTPAudioPayload * baseaudiopayload,
|
|
|
|
const guint8 * data, guint payload_len, GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
GstBaseRTPPayload *basepayload;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
guint8 *payload;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
|
|
|
payload_len, GST_TIME_ARGS (timestamp));
|
|
|
|
|
|
|
|
/* create buffer to hold the payload */
|
|
|
|
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
|
|
|
|
|
|
|
/* copy payload */
|
|
|
|
payload = gst_rtp_buffer_get_payload (outbuf);
|
|
|
|
memcpy (payload, data, payload_len);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* set metadata */
|
|
|
|
gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
|
|
|
|
timestamp);
|
|
|
|
|
2009-09-02 11:13:54 +00:00
|
|
|
ret = gst_basertppayload_push (basepayload, outbuf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_base_rtp_audio_payload_push_buffer (GstBaseRTPAudioPayload *
|
|
|
|
baseaudiopayload, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstBaseRTPPayload *basepayload;
|
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
GstClockTime timestamp;
|
|
|
|
guint8 *payload;
|
|
|
|
guint payload_len;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
priv = baseaudiopayload->priv;
|
|
|
|
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
|
|
|
|
|
|
|
payload_len = GST_BUFFER_SIZE (buffer);
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
|
|
|
payload_len, GST_TIME_ARGS (timestamp));
|
|
|
|
|
|
|
|
if (priv->buffer_list) {
|
|
|
|
/* create just the RTP header buffer */
|
|
|
|
outbuf = gst_rtp_buffer_new_allocate (0, 0, 0);
|
|
|
|
} else {
|
|
|
|
/* create buffer to hold the payload */
|
|
|
|
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* set metadata */
|
|
|
|
gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
|
|
|
|
timestamp);
|
|
|
|
|
|
|
|
if (priv->buffer_list) {
|
|
|
|
GstBufferList *list;
|
|
|
|
GstBufferListIterator *it;
|
|
|
|
|
|
|
|
list = gst_buffer_list_new ();
|
|
|
|
it = gst_buffer_list_iterate (list);
|
|
|
|
|
|
|
|
/* add both buffers to the buffer list */
|
|
|
|
gst_buffer_list_iterator_add_group (it);
|
|
|
|
gst_buffer_list_iterator_add (it, outbuf);
|
|
|
|
gst_buffer_list_iterator_add (it, buffer);
|
|
|
|
|
|
|
|
gst_buffer_list_iterator_free (it);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing list %p", list);
|
|
|
|
ret = gst_basertppayload_push_list (basepayload, list);
|
|
|
|
} else {
|
|
|
|
/* copy payload */
|
|
|
|
payload = gst_rtp_buffer_get_payload (outbuf);
|
|
|
|
memcpy (payload, GST_BUFFER_DATA (buffer), payload_len);
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing buffer %p", outbuf);
|
|
|
|
ret = gst_basertppayload_push (basepayload, outbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
/**
|
|
|
|
* gst_base_rtp_audio_payload_flush:
|
|
|
|
* @baseaudiopayload: a #GstBaseRTPPayload
|
|
|
|
* @payload_len: length of payload
|
|
|
|
* @timestamp: a #GstClockTime
|
|
|
|
*
|
|
|
|
* Create an RTP buffer and store @payload_len bytes of the adapter as the
|
|
|
|
* payload. Set the timestamp on the new buffer to @timestamp before pushing
|
|
|
|
* the buffer downstream.
|
|
|
|
*
|
2009-09-02 17:49:57 +00:00
|
|
|
* If @payload_len is -1, all pending bytes will be flushed. If @timestamp is
|
|
|
|
* -1, the timestamp will be calculated automatically.
|
|
|
|
*
|
2009-09-02 08:46:30 +00:00
|
|
|
* Returns: a #GstFlowReturn
|
|
|
|
*
|
|
|
|
* Since: 0.10.25
|
|
|
|
*/
|
|
|
|
GstFlowReturn
|
|
|
|
gst_base_rtp_audio_payload_flush (GstBaseRTPAudioPayload * baseaudiopayload,
|
|
|
|
guint payload_len, GstClockTime timestamp)
|
|
|
|
{
|
|
|
|
GstBaseRTPPayload *basepayload;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
2009-09-02 08:46:30 +00:00
|
|
|
GstBuffer *outbuf;
|
|
|
|
guint8 *payload;
|
|
|
|
GstFlowReturn ret;
|
2009-09-02 17:49:57 +00:00
|
|
|
GstAdapter *adapter;
|
|
|
|
guint64 distance;
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = baseaudiopayload->priv;
|
|
|
|
adapter = priv->adapter;
|
2009-09-02 08:46:30 +00:00
|
|
|
|
|
|
|
basepayload = GST_BASE_RTP_PAYLOAD (baseaudiopayload);
|
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
if (payload_len == -1)
|
|
|
|
payload_len = gst_adapter_available (adapter);
|
|
|
|
|
|
|
|
/* nothing to do, just return */
|
|
|
|
if (payload_len == 0)
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
if (timestamp == -1) {
|
|
|
|
/* calculate the timestamp */
|
|
|
|
timestamp = gst_adapter_prev_timestamp (adapter, &distance);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (baseaudiopayload,
|
|
|
|
"last timestamp %" GST_TIME_FORMAT ", distance %" G_GUINT64_FORMAT,
|
|
|
|
GST_TIME_ARGS (timestamp), distance);
|
|
|
|
|
|
|
|
if (GST_CLOCK_TIME_IS_VALID (timestamp) && distance > 0) {
|
|
|
|
/* convert the number of bytes since the last timestamp to time and add to
|
|
|
|
* the last seen timestamp */
|
2009-09-03 15:53:47 +00:00
|
|
|
timestamp += priv->bytes_to_time (baseaudiopayload, distance);
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
GST_DEBUG_OBJECT (baseaudiopayload, "Pushing %d bytes ts %" GST_TIME_FORMAT,
|
|
|
|
payload_len, GST_TIME_ARGS (timestamp));
|
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
if (priv->buffer_list && gst_adapter_available_fast (adapter) >= payload_len) {
|
|
|
|
GstBuffer *buffer;
|
|
|
|
/* we can quickly take a buffer out of the adapter without having to copy
|
|
|
|
* anything. */
|
|
|
|
buffer = gst_adapter_take_buffer (adapter, payload_len);
|
2009-09-02 08:46:30 +00:00
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
ret = gst_base_rtp_audio_payload_push_buffer (baseaudiopayload, buffer);
|
|
|
|
} else {
|
|
|
|
/* create buffer to hold the payload */
|
|
|
|
outbuf = gst_rtp_buffer_new_allocate (payload_len, 0, 0);
|
2009-09-02 08:46:30 +00:00
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
/* copy payload */
|
|
|
|
payload = gst_rtp_buffer_get_payload (outbuf);
|
|
|
|
gst_adapter_copy (adapter, payload, 0, payload_len);
|
|
|
|
gst_adapter_flush (adapter, payload_len);
|
2009-09-03 15:53:47 +00:00
|
|
|
|
2010-01-06 12:39:14 +00:00
|
|
|
/* set metadata */
|
|
|
|
gst_base_rtp_audio_payload_set_meta (baseaudiopayload, outbuf, payload_len,
|
|
|
|
timestamp);
|
|
|
|
|
|
|
|
ret = gst_basertppayload_push (basepayload, outbuf);
|
|
|
|
}
|
2009-09-02 08:46:30 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
#define ALIGN_DOWN(val,len) ((val) - ((val) % (len)))
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* calculate the min and max length of a packet. This depends on the configured
|
|
|
|
* mtu and min/max_ptime values. We cache those so that we don't have to redo
|
|
|
|
* all the calculations */
|
2009-09-02 10:03:27 +00:00
|
|
|
static gboolean
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_get_lengths (GstBaseRTPPayload *
|
2009-09-02 10:03:27 +00:00
|
|
|
basepayload, guint * min_payload_len, guint * max_payload_len,
|
|
|
|
guint * align)
|
2006-04-13 03:55:12 +00:00
|
|
|
{
|
2009-09-02 10:03:27 +00:00
|
|
|
GstBaseRTPAudioPayload *payload;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
|
|
|
guint max_mtu, mtu;
|
2009-09-02 10:03:27 +00:00
|
|
|
guint maxptime_octets;
|
|
|
|
guint minptime_octets;
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload);
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = payload->priv;
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
if (priv->align == 0)
|
2009-09-02 10:03:27 +00:00
|
|
|
return FALSE;
|
2009-09-01 16:26:52 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
*align = priv->align;
|
|
|
|
|
|
|
|
mtu = GST_BASE_RTP_PAYLOAD_MTU (payload);
|
|
|
|
|
|
|
|
/* check cached values */
|
|
|
|
if (G_LIKELY (priv->cached_mtu == mtu
|
2009-12-29 23:45:32 +00:00
|
|
|
&& priv->cached_ptime == basepayload->abidata.ABI.ptime
|
2009-09-03 15:53:47 +00:00
|
|
|
&& priv->cached_max_ptime == basepayload->max_ptime
|
|
|
|
&& priv->cached_min_ptime == basepayload->min_ptime)) {
|
|
|
|
/* if nothing changed, return cached values */
|
|
|
|
*min_payload_len = priv->cached_min_length;
|
|
|
|
*max_payload_len = priv->cached_max_length;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* ptime max */
|
2006-04-13 03:55:12 +00:00
|
|
|
if (basepayload->max_ptime != -1) {
|
2009-09-03 15:53:47 +00:00
|
|
|
maxptime_octets = priv->time_to_bytes (payload, basepayload->max_ptime);
|
2009-09-02 10:03:27 +00:00
|
|
|
} else {
|
|
|
|
maxptime_octets = G_MAXUINT;
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
2009-09-01 16:26:52 +00:00
|
|
|
/* MTU max */
|
2009-09-03 15:53:47 +00:00
|
|
|
max_mtu = gst_rtp_buffer_calc_payload_len (mtu, 0, 0);
|
|
|
|
/* round down to alignment */
|
|
|
|
max_mtu = ALIGN_DOWN (max_mtu, *align);
|
|
|
|
|
|
|
|
/* combine max ptime and max payload length */
|
|
|
|
*max_payload_len = MIN (max_mtu, maxptime_octets);
|
|
|
|
|
|
|
|
/* min number of bytes based on a given ptime */
|
|
|
|
minptime_octets = priv->time_to_bytes (payload, basepayload->min_ptime);
|
|
|
|
/* must be at least one frame size */
|
|
|
|
*min_payload_len = MAX (minptime_octets, *align);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
if (*min_payload_len > *max_payload_len)
|
|
|
|
*min_payload_len = *max_payload_len;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-12-29 23:45:32 +00:00
|
|
|
/* If the ptime is specified in the caps, tried to adhere to it exactly */
|
|
|
|
if (basepayload->abidata.ABI.ptime) {
|
|
|
|
guint ptime_in_bytes = priv->time_to_bytes (payload,
|
|
|
|
basepayload->abidata.ABI.ptime);
|
|
|
|
|
|
|
|
/* clip to computed min and max lengths */
|
|
|
|
ptime_in_bytes = MAX (*min_payload_len, ptime_in_bytes);
|
|
|
|
ptime_in_bytes = MIN (*max_payload_len, ptime_in_bytes);
|
|
|
|
|
|
|
|
*min_payload_len = *max_payload_len = ptime_in_bytes;
|
|
|
|
}
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* cache values */
|
|
|
|
priv->cached_mtu = mtu;
|
2009-12-29 23:45:32 +00:00
|
|
|
priv->cached_ptime = basepayload->abidata.ABI.ptime;
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->cached_min_ptime = basepayload->min_ptime;
|
|
|
|
priv->cached_max_ptime = basepayload->max_ptime;
|
|
|
|
priv->cached_min_length = *min_payload_len;
|
|
|
|
priv->cached_max_length = *max_payload_len;
|
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* frame conversions functions */
|
2009-09-02 10:03:27 +00:00
|
|
|
static GstClockTime
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_time (GstBaseRTPAudioPayload *
|
2009-09-02 11:12:28 +00:00
|
|
|
payload, guint64 bytes)
|
2009-09-02 10:03:27 +00:00
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
return (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
|
2009-09-02 10:03:27 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
static guint32
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_frame_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
|
|
|
payload, guint64 bytes)
|
2009-09-02 17:49:57 +00:00
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
guint64 time;
|
2009-09-03 12:13:44 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
time = (bytes / payload->frame_size) * (payload->priv->frame_duration_ns);
|
2009-09-03 12:13:44 +00:00
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
return gst_util_uint64_scale_int (time,
|
|
|
|
GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
static guint64
|
|
|
|
gst_base_rtp_audio_payload_frame_time_to_bytes (GstBaseRTPAudioPayload *
|
|
|
|
payload, GstClockTime time)
|
2006-04-13 03:55:12 +00:00
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
return gst_util_uint64_scale (time, payload->frame_size,
|
|
|
|
payload->priv->frame_duration_ns);
|
2009-09-02 10:03:27 +00:00
|
|
|
}
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
/* sample conversion functions */
|
2009-09-02 10:03:27 +00:00
|
|
|
static GstClockTime
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_time (GstBaseRTPAudioPayload *
|
2009-09-02 11:12:28 +00:00
|
|
|
payload, guint64 bytes)
|
2009-09-02 10:03:27 +00:00
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
guint64 rtptime;
|
|
|
|
|
|
|
|
/* avoid division when we can */
|
|
|
|
if (G_LIKELY (payload->sample_size != 8))
|
|
|
|
rtptime = gst_util_uint64_scale_int (bytes, 8, payload->sample_size);
|
|
|
|
else
|
|
|
|
rtptime = bytes;
|
|
|
|
|
|
|
|
return gst_util_uint64_scale_int (rtptime, GST_SECOND,
|
|
|
|
GST_BASE_RTP_PAYLOAD (payload)->clock_rate);
|
2009-09-02 10:03:27 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
static guint32
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_base_rtp_audio_payload_sample_bytes_to_rtptime (GstBaseRTPAudioPayload *
|
2009-09-02 17:49:57 +00:00
|
|
|
payload, guint64 bytes)
|
|
|
|
{
|
2009-09-03 15:53:47 +00:00
|
|
|
/* avoid division when we can */
|
|
|
|
if (G_LIKELY (payload->sample_size != 8))
|
|
|
|
return gst_util_uint64_scale_int (bytes, 8, payload->sample_size);
|
|
|
|
else
|
|
|
|
return bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint64
|
|
|
|
gst_base_rtp_audio_payload_sample_time_to_bytes (GstBaseRTPAudioPayload *
|
|
|
|
payload, guint64 time)
|
|
|
|
{
|
|
|
|
guint64 samples;
|
|
|
|
|
|
|
|
samples = gst_util_uint64_scale_int (time,
|
|
|
|
GST_BASE_RTP_PAYLOAD (payload)->clock_rate, GST_SECOND);
|
|
|
|
|
|
|
|
/* avoid multiplication when we can */
|
|
|
|
if (G_LIKELY (payload->sample_size != 8))
|
|
|
|
return gst_util_uint64_scale_int (samples, payload->sample_size, 8);
|
|
|
|
else
|
|
|
|
return samples;
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
static GstFlowReturn
|
2009-09-02 10:24:22 +00:00
|
|
|
gst_base_rtp_audio_payload_handle_buffer (GstBaseRTPPayload *
|
2009-09-02 10:03:27 +00:00
|
|
|
basepayload, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstBaseRTPAudioPayload *payload;
|
2009-09-03 15:53:47 +00:00
|
|
|
GstBaseRTPAudioPayloadPrivate *priv;
|
2009-09-02 10:03:27 +00:00
|
|
|
guint payload_len;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
guint available;
|
|
|
|
guint min_payload_len;
|
|
|
|
guint max_payload_len;
|
|
|
|
guint align;
|
|
|
|
guint size;
|
2009-09-02 17:49:57 +00:00
|
|
|
gboolean discont;
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD_CAST (basepayload);
|
2009-09-03 15:53:47 +00:00
|
|
|
priv = payload->priv;
|
2009-09-02 10:24:22 +00:00
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
discont = GST_BUFFER_IS_DISCONT (buffer);
|
|
|
|
if (discont) {
|
2009-09-03 15:53:47 +00:00
|
|
|
GstClockTime timestamp;
|
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "Got DISCONT");
|
|
|
|
/* flush everything out of the adapter, mark DISCONT */
|
|
|
|
ret = gst_base_rtp_audio_payload_flush (payload, -1, -1);
|
2009-09-03 15:53:47 +00:00
|
|
|
priv->discont = TRUE;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
|
|
|
|
/* get the distance between the timestamp gap and produce the same gap in
|
|
|
|
* the RTP timestamps */
|
|
|
|
if (priv->last_timestamp != -1 && timestamp != -1) {
|
|
|
|
/* we had a last timestamp, compare it to the new timestamp and update the
|
|
|
|
* offset counter for RTP timestamps. The effect is that we will produce
|
|
|
|
* output buffers containing the same RTP timestamp gap as the gap
|
|
|
|
* between the GST timestamps. */
|
|
|
|
if (timestamp > priv->last_timestamp) {
|
2009-09-03 16:53:19 +00:00
|
|
|
GstClockTime diff;
|
|
|
|
guint64 bytes;
|
2009-09-03 15:53:47 +00:00
|
|
|
/* we're only going to apply a positive gap, otherwise we let the marker
|
|
|
|
* bit do its thing. simply convert to bytes and add the the current
|
|
|
|
* offset */
|
2009-09-03 16:53:19 +00:00
|
|
|
diff = timestamp - priv->last_timestamp;
|
|
|
|
bytes = priv->time_to_bytes (payload, diff);
|
|
|
|
priv->offset += bytes;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (payload,
|
|
|
|
"elapsed time %" GST_TIME_FORMAT ", bytes %" G_GUINT64_FORMAT
|
|
|
|
", new offset %" G_GUINT64_FORMAT, GST_TIME_ARGS (diff), bytes,
|
|
|
|
priv->offset);
|
2009-09-03 15:53:47 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-02 17:49:57 +00:00
|
|
|
}
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
if (!gst_base_rtp_audio_payload_get_lengths (basepayload, &min_payload_len,
|
2009-09-02 10:24:22 +00:00
|
|
|
&max_payload_len, &align))
|
2009-09-02 10:03:27 +00:00
|
|
|
goto config_error;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
GST_DEBUG_OBJECT (payload,
|
2007-03-14 21:11:18 +00:00
|
|
|
"Calculated min_payload_len %u and max_payload_len %u",
|
|
|
|
min_payload_len, max_payload_len);
|
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
/* shortcut, we don't need to use the adapter when the packet can be pushed
|
|
|
|
* through directly. */
|
2009-09-03 15:53:47 +00:00
|
|
|
available = gst_adapter_available (priv->adapter);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "got buffer size %u, available %u",
|
2009-09-02 08:46:30 +00:00
|
|
|
size, available);
|
2006-12-09 15:12:38 +00:00
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
if (available == 0 && (size >= min_payload_len && size <= max_payload_len)) {
|
|
|
|
/* If buffer fits on an RTP packet, let's just push it through
|
|
|
|
* this will check against max_ptime and max_mtu */
|
2009-09-02 10:03:27 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "Fast packet push");
|
2010-01-06 12:39:14 +00:00
|
|
|
ret = gst_base_rtp_audio_payload_push_buffer (payload, buffer);
|
2009-09-02 08:46:30 +00:00
|
|
|
} else {
|
|
|
|
/* push the buffer in the adapter */
|
2009-09-03 15:53:47 +00:00
|
|
|
gst_adapter_push (priv->adapter, buffer);
|
2009-09-02 08:46:30 +00:00
|
|
|
available += size;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "available now %u", available);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
/* as long as we have full frames */
|
|
|
|
while (available >= min_payload_len) {
|
2009-09-03 15:53:47 +00:00
|
|
|
/* get multiple of alignment */
|
2009-10-21 09:38:59 +00:00
|
|
|
payload_len = MIN (max_payload_len, available);
|
|
|
|
payload_len = ALIGN_DOWN (payload_len, align);
|
2006-04-13 03:55:12 +00:00
|
|
|
|
2009-09-02 17:49:57 +00:00
|
|
|
/* and flush out the bytes from the adapter, automatically set the
|
|
|
|
* timestamp. */
|
|
|
|
ret = gst_base_rtp_audio_payload_flush (payload, payload_len, -1);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 08:46:30 +00:00
|
|
|
available -= payload_len;
|
2009-09-02 10:03:27 +00:00
|
|
|
GST_DEBUG_OBJECT (payload, "available after push %u", available);
|
2007-03-14 21:11:18 +00:00
|
|
|
}
|
|
|
|
}
|
2006-04-13 03:55:12 +00:00
|
|
|
return ret;
|
2009-09-01 16:26:52 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
config_error:
|
|
|
|
{
|
2009-09-02 17:49:57 +00:00
|
|
|
GST_ELEMENT_ERROR (payload, STREAM, NOT_IMPLEMENTED, (NULL),
|
|
|
|
("subclass did not configure us properly"));
|
2009-09-01 16:26:52 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2006-04-13 03:55:12 +00:00
|
|
|
}
|
|
|
|
|
2007-03-14 21:11:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_base_rtp_payload_audio_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstBaseRTPAudioPayload *basertppayload;
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
basertppayload = GST_BASE_RTP_AUDIO_PAYLOAD (element);
|
|
|
|
|
2009-09-03 15:53:47 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
|
|
|
basertppayload->priv->cached_mtu = -1;
|
|
|
|
basertppayload->priv->last_rtptime = -1;
|
|
|
|
basertppayload->priv->last_timestamp = -1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-03-14 21:11:18 +00:00
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2009-09-01 16:08:14 +00:00
|
|
|
gst_adapter_clear (basertppayload->priv->adapter);
|
2007-03-14 21:11:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst-libs/gst/rtp/gstbasertpaudiopayload.c: Some cleanups, remove minptime property as it is now in the parent class.
Original commit message from CVS:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_class_init),
(gst_base_rtp_audio_payload_init),
(gst_base_rtp_audio_payload_finalize),
(gst_base_rtp_audio_payload_handle_frame_based_buffer),
(gst_base_rtp_audio_payload_handle_sample_based_buffer),
(gst_base_rtp_payload_audio_handle_event):
Some cleanups, remove minptime property as it is now in the parent
class.
Override parent class event function.
* gst-libs/gst/rtp/gstbasertppayload.c:
(gst_basertppayload_class_init), (gst_basertppayload_init),
(gst_basertppayload_event), (gst_basertppayload_set_property),
(gst_basertppayload_get_property):
* gst-libs/gst/rtp/gstbasertppayload.h:
Add min-ptime property.
Add handle-event vmethod. Fixes #415001.
2007-05-21 09:45:28 +00:00
|
|
|
gst_base_rtp_payload_audio_handle_event (GstPad * pad, GstEvent * event)
|
2007-03-14 21:11:18 +00:00
|
|
|
{
|
2009-09-02 10:03:27 +00:00
|
|
|
GstBaseRTPAudioPayload *payload;
|
2007-09-04 16:18:48 +00:00
|
|
|
gboolean res = FALSE;
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
payload = GST_BASE_RTP_AUDIO_PAYLOAD (gst_pad_get_parent (pad));
|
2007-03-14 21:11:18 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
2009-09-02 17:49:57 +00:00
|
|
|
/* flush remaining bytes in the adapter */
|
|
|
|
gst_base_rtp_audio_payload_flush (payload, -1, -1);
|
2007-03-14 21:11:18 +00:00
|
|
|
break;
|
|
|
|
case GST_EVENT_FLUSH_STOP:
|
2009-09-02 10:03:27 +00:00
|
|
|
gst_adapter_clear (payload->priv->adapter);
|
2007-03-14 21:11:18 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-09-02 10:03:27 +00:00
|
|
|
gst_object_unref (payload);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
2007-09-04 16:18:48 +00:00
|
|
|
/* return FALSE to let parent handle the remainder of the event */
|
2007-03-14 21:11:18 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
Add RTCP docs.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_get_adapter):
Add RTCP docs.
Fix some more docs.
* gst-libs/gst/rtp/Makefile.am:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_buffer_new_take_data), (gst_rtcp_buffer_new_copy_data),
(gst_rtcp_buffer_validate_data), (gst_rtcp_buffer_validate),
(gst_rtcp_buffer_get_packet_count), (read_packet_header),
(gst_rtcp_buffer_get_first_packet), (gst_rtcp_packet_move_to_next),
(gst_rtcp_buffer_add_packet), (gst_rtcp_packet_remove),
(gst_rtcp_packet_get_padding), (gst_rtcp_packet_get_type),
(gst_rtcp_packet_get_count), (gst_rtcp_packet_get_length),
(gst_rtcp_packet_sr_get_sender_info),
(gst_rtcp_packet_sr_set_sender_info),
(gst_rtcp_packet_rr_get_ssrc), (gst_rtcp_packet_rr_set_ssrc),
(gst_rtcp_packet_get_rb_count), (gst_rtcp_packet_get_rb),
(gst_rtcp_packet_add_rb), (gst_rtcp_packet_set_rb),
(gst_rtcp_packet_sdes_get_chunk_count),
(gst_rtcp_packet_sdes_first_chunk),
(gst_rtcp_packet_sdes_next_chunk), (gst_rtcp_packet_sdes_get_ssrc),
(gst_rtcp_packet_sdes_first_item),
(gst_rtcp_packet_sdes_next_item), (gst_rtcp_packet_sdes_get_item),
(gst_rtcp_packet_bye_get_ssrc_count),
(gst_rtcp_packet_bye_get_nth_ssrc), (gst_rtcp_packet_bye_add_ssrc),
(gst_rtcp_packet_bye_add_ssrcs), (get_reason_offset),
(gst_rtcp_packet_bye_get_reason_len),
(gst_rtcp_packet_bye_get_reason), (gst_rtcp_packet_bye_set_reason):
* gst-libs/gst/rtp/gstrtcpbuffer.h:
Add new helper object for parsing and creating RTCP messages.
2007-03-29 16:20:31 +00:00
|
|
|
/**
|
|
|
|
* gst_base_rtp_audio_payload_get_adapter:
|
|
|
|
* @basertpaudiopayload: a #GstBaseRTPAudioPayload
|
|
|
|
*
|
|
|
|
* Gets the internal adapter used by the depayloader.
|
|
|
|
*
|
|
|
|
* Returns: a #GstAdapter.
|
2007-04-21 15:10:25 +00:00
|
|
|
*
|
|
|
|
* Since: 0.10.13
|
Add RTCP docs.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_get_adapter):
Add RTCP docs.
Fix some more docs.
* gst-libs/gst/rtp/Makefile.am:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_buffer_new_take_data), (gst_rtcp_buffer_new_copy_data),
(gst_rtcp_buffer_validate_data), (gst_rtcp_buffer_validate),
(gst_rtcp_buffer_get_packet_count), (read_packet_header),
(gst_rtcp_buffer_get_first_packet), (gst_rtcp_packet_move_to_next),
(gst_rtcp_buffer_add_packet), (gst_rtcp_packet_remove),
(gst_rtcp_packet_get_padding), (gst_rtcp_packet_get_type),
(gst_rtcp_packet_get_count), (gst_rtcp_packet_get_length),
(gst_rtcp_packet_sr_get_sender_info),
(gst_rtcp_packet_sr_set_sender_info),
(gst_rtcp_packet_rr_get_ssrc), (gst_rtcp_packet_rr_set_ssrc),
(gst_rtcp_packet_get_rb_count), (gst_rtcp_packet_get_rb),
(gst_rtcp_packet_add_rb), (gst_rtcp_packet_set_rb),
(gst_rtcp_packet_sdes_get_chunk_count),
(gst_rtcp_packet_sdes_first_chunk),
(gst_rtcp_packet_sdes_next_chunk), (gst_rtcp_packet_sdes_get_ssrc),
(gst_rtcp_packet_sdes_first_item),
(gst_rtcp_packet_sdes_next_item), (gst_rtcp_packet_sdes_get_item),
(gst_rtcp_packet_bye_get_ssrc_count),
(gst_rtcp_packet_bye_get_nth_ssrc), (gst_rtcp_packet_bye_add_ssrc),
(gst_rtcp_packet_bye_add_ssrcs), (get_reason_offset),
(gst_rtcp_packet_bye_get_reason_len),
(gst_rtcp_packet_bye_get_reason), (gst_rtcp_packet_bye_set_reason):
* gst-libs/gst/rtp/gstrtcpbuffer.h:
Add new helper object for parsing and creating RTCP messages.
2007-03-29 16:20:31 +00:00
|
|
|
*/
|
2007-03-14 21:11:18 +00:00
|
|
|
GstAdapter *
|
|
|
|
gst_base_rtp_audio_payload_get_adapter (GstBaseRTPAudioPayload
|
|
|
|
* basertpaudiopayload)
|
|
|
|
{
|
Add RTCP docs.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_get_adapter):
Add RTCP docs.
Fix some more docs.
* gst-libs/gst/rtp/Makefile.am:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_buffer_new_take_data), (gst_rtcp_buffer_new_copy_data),
(gst_rtcp_buffer_validate_data), (gst_rtcp_buffer_validate),
(gst_rtcp_buffer_get_packet_count), (read_packet_header),
(gst_rtcp_buffer_get_first_packet), (gst_rtcp_packet_move_to_next),
(gst_rtcp_buffer_add_packet), (gst_rtcp_packet_remove),
(gst_rtcp_packet_get_padding), (gst_rtcp_packet_get_type),
(gst_rtcp_packet_get_count), (gst_rtcp_packet_get_length),
(gst_rtcp_packet_sr_get_sender_info),
(gst_rtcp_packet_sr_set_sender_info),
(gst_rtcp_packet_rr_get_ssrc), (gst_rtcp_packet_rr_set_ssrc),
(gst_rtcp_packet_get_rb_count), (gst_rtcp_packet_get_rb),
(gst_rtcp_packet_add_rb), (gst_rtcp_packet_set_rb),
(gst_rtcp_packet_sdes_get_chunk_count),
(gst_rtcp_packet_sdes_first_chunk),
(gst_rtcp_packet_sdes_next_chunk), (gst_rtcp_packet_sdes_get_ssrc),
(gst_rtcp_packet_sdes_first_item),
(gst_rtcp_packet_sdes_next_item), (gst_rtcp_packet_sdes_get_item),
(gst_rtcp_packet_bye_get_ssrc_count),
(gst_rtcp_packet_bye_get_nth_ssrc), (gst_rtcp_packet_bye_add_ssrc),
(gst_rtcp_packet_bye_add_ssrcs), (get_reason_offset),
(gst_rtcp_packet_bye_get_reason_len),
(gst_rtcp_packet_bye_get_reason), (gst_rtcp_packet_bye_set_reason):
* gst-libs/gst/rtp/gstrtcpbuffer.h:
Add new helper object for parsing and creating RTCP messages.
2007-03-29 16:20:31 +00:00
|
|
|
GstAdapter *adapter;
|
|
|
|
|
|
|
|
if ((adapter = basertpaudiopayload->priv->adapter))
|
|
|
|
g_object_ref (adapter);
|
2007-03-14 21:11:18 +00:00
|
|
|
|
Add RTCP docs.
Original commit message from CVS:
* docs/libs/gst-plugins-base-libs-docs.sgml:
* docs/libs/gst-plugins-base-libs-sections.txt:
* gst-libs/gst/rtp/gstbasertpaudiopayload.c:
(gst_base_rtp_audio_payload_get_adapter):
Add RTCP docs.
Fix some more docs.
* gst-libs/gst/rtp/Makefile.am:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_buffer_new_take_data), (gst_rtcp_buffer_new_copy_data),
(gst_rtcp_buffer_validate_data), (gst_rtcp_buffer_validate),
(gst_rtcp_buffer_get_packet_count), (read_packet_header),
(gst_rtcp_buffer_get_first_packet), (gst_rtcp_packet_move_to_next),
(gst_rtcp_buffer_add_packet), (gst_rtcp_packet_remove),
(gst_rtcp_packet_get_padding), (gst_rtcp_packet_get_type),
(gst_rtcp_packet_get_count), (gst_rtcp_packet_get_length),
(gst_rtcp_packet_sr_get_sender_info),
(gst_rtcp_packet_sr_set_sender_info),
(gst_rtcp_packet_rr_get_ssrc), (gst_rtcp_packet_rr_set_ssrc),
(gst_rtcp_packet_get_rb_count), (gst_rtcp_packet_get_rb),
(gst_rtcp_packet_add_rb), (gst_rtcp_packet_set_rb),
(gst_rtcp_packet_sdes_get_chunk_count),
(gst_rtcp_packet_sdes_first_chunk),
(gst_rtcp_packet_sdes_next_chunk), (gst_rtcp_packet_sdes_get_ssrc),
(gst_rtcp_packet_sdes_first_item),
(gst_rtcp_packet_sdes_next_item), (gst_rtcp_packet_sdes_get_item),
(gst_rtcp_packet_bye_get_ssrc_count),
(gst_rtcp_packet_bye_get_nth_ssrc), (gst_rtcp_packet_bye_add_ssrc),
(gst_rtcp_packet_bye_add_ssrcs), (get_reason_offset),
(gst_rtcp_packet_bye_get_reason_len),
(gst_rtcp_packet_bye_get_reason), (gst_rtcp_packet_bye_set_reason):
* gst-libs/gst/rtp/gstrtcpbuffer.h:
Add new helper object for parsing and creating RTCP messages.
2007-03-29 16:20:31 +00:00
|
|
|
return adapter;
|
2007-03-14 21:11:18 +00:00
|
|
|
}
|