2013-01-10 12:38:13 +00:00
|
|
|
/* GStreamer RTP SBC payloader
|
2008-01-23 13:14:02 +00:00
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
2010-01-02 01:08:17 +00:00
|
|
|
* Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
|
2008-01-23 13:14:02 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2015-08-04 17:59:17 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2008-01-23 13:14:02 +00:00
|
|
|
#include "gstrtpsbcpay.h"
|
|
|
|
#include <math.h>
|
|
|
|
#include <string.h>
|
2015-08-04 17:59:17 +00:00
|
|
|
#include "gstrtputils.h"
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
#define RTP_SBC_PAYLOAD_HEADER_SIZE 1
|
|
|
|
#define DEFAULT_MIN_FRAMES 0
|
|
|
|
#define RTP_SBC_HEADER_TOTAL (12 + RTP_SBC_PAYLOAD_HEADER_SIZE)
|
|
|
|
|
2016-02-24 23:47:51 +00:00
|
|
|
/* BEGIN: Packing for rtp_payload */
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
#endif
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2016-02-24 23:47:51 +00:00
|
|
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
2013-01-10 12:38:13 +00:00
|
|
|
/* FIXME: this seems all a bit over the top for a single byte.. */
|
2008-01-23 13:14:02 +00:00
|
|
|
struct rtp_payload
|
|
|
|
{
|
|
|
|
guint8 frame_count:4;
|
|
|
|
guint8 rfa0:1;
|
|
|
|
guint8 is_last_fragment:1;
|
|
|
|
guint8 is_first_fragment:1;
|
|
|
|
guint8 is_fragmented:1;
|
2016-02-24 23:47:51 +00:00
|
|
|
}
|
2013-01-10 12:38:13 +00:00
|
|
|
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
2008-01-23 13:14:02 +00:00
|
|
|
struct rtp_payload
|
|
|
|
{
|
|
|
|
guint8 is_fragmented:1;
|
|
|
|
guint8 is_first_fragment:1;
|
|
|
|
guint8 is_last_fragment:1;
|
|
|
|
guint8 rfa0:1;
|
|
|
|
guint8 frame_count:4;
|
2016-02-24 23:47:51 +00:00
|
|
|
}
|
2008-01-23 13:14:02 +00:00
|
|
|
#else
|
|
|
|
#error "Unknown byte order"
|
|
|
|
#endif
|
|
|
|
|
2016-02-24 23:47:51 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
;
|
|
|
|
#pragma pack(pop)
|
|
|
|
#else
|
|
|
|
__attribute__ ((packed));
|
|
|
|
#endif
|
|
|
|
/* END: Packing for rtp_payload */
|
|
|
|
|
2008-01-23 13:14:02 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_MIN_FRAMES
|
|
|
|
};
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_rtp_sbc_pay_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_rtp_sbc_pay_debug
|
|
|
|
|
2013-01-10 12:38:13 +00:00
|
|
|
#define parent_class gst_rtp_sbc_pay_parent_class
|
|
|
|
G_DEFINE_TYPE (GstRtpSBCPay, gst_rtp_sbc_pay, GST_TYPE_RTP_BASE_PAYLOAD);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_rtp_sbc_pay_sink_factory =
|
2008-02-20 13:37:00 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
|
2008-01-30 14:21:43 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-sbc, "
|
2008-01-23 13:14:02 +00:00
|
|
|
"rate = (int) { 16000, 32000, 44100, 48000 }, "
|
|
|
|
"channels = (int) [ 1, 2 ], "
|
2013-01-16 10:19:36 +00:00
|
|
|
"channel-mode = (string) { mono, dual, stereo, joint }, "
|
2008-01-23 13:14:02 +00:00
|
|
|
"blocks = (int) { 4, 8, 12, 16 }, "
|
|
|
|
"subbands = (int) { 4, 8 }, "
|
2013-01-16 10:19:36 +00:00
|
|
|
"allocation-method = (string) { snr, loudness }, "
|
|
|
|
"bitpool = (int) [ 2, 64 ]")
|
2008-01-23 13:14:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_rtp_sbc_pay_src_factory =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
|
2008-01-30 14:21:43 +00:00
|
|
|
GST_STATIC_CAPS ("application/x-rtp, "
|
2013-01-10 12:38:13 +00:00
|
|
|
"media = (string) audio,"
|
2008-01-30 14:21:43 +00:00
|
|
|
"payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
|
|
|
|
"clock-rate = (int) { 16000, 32000, 44100, 48000 },"
|
2013-01-10 12:38:13 +00:00
|
|
|
"encoding-name = (string) SBC")
|
2008-01-23 13:14:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static void gst_rtp_sbc_pay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_rtp_sbc_pay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
|
|
|
static gint
|
|
|
|
gst_rtp_sbc_pay_get_frame_len (gint subbands, gint channels,
|
|
|
|
gint blocks, gint bitpool, const gchar * channel_mode)
|
|
|
|
{
|
|
|
|
gint len;
|
|
|
|
gint join;
|
|
|
|
|
|
|
|
len = 4 + (4 * subbands * channels) / 8;
|
|
|
|
|
|
|
|
if (strcmp (channel_mode, "mono") == 0 || strcmp (channel_mode, "dual") == 0)
|
|
|
|
len += ((blocks * channels * bitpool) + 7) / 8;
|
|
|
|
else {
|
|
|
|
join = strcmp (channel_mode, "joint") == 0 ? 1 : 0;
|
|
|
|
len += ((join * subbands + blocks * bitpool) + 7) / 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-01-10 12:38:13 +00:00
|
|
|
gst_rtp_sbc_pay_set_caps (GstRTPBasePayload * payload, GstCaps * caps)
|
2008-01-23 13:14:02 +00:00
|
|
|
{
|
|
|
|
GstRtpSBCPay *sbcpay;
|
|
|
|
gint rate, subbands, channels, blocks, bitpool;
|
|
|
|
gint frame_len;
|
|
|
|
const gchar *channel_mode;
|
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
sbcpay = GST_RTP_SBC_PAY (payload);
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
if (!gst_structure_get_int (structure, "rate", &rate))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (structure, "channels", &channels))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (structure, "blocks", &blocks))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (structure, "bitpool", &bitpool))
|
|
|
|
return FALSE;
|
|
|
|
if (!gst_structure_get_int (structure, "subbands", &subbands))
|
|
|
|
return FALSE;
|
|
|
|
|
2013-01-16 10:19:36 +00:00
|
|
|
channel_mode = gst_structure_get_string (structure, "channel-mode");
|
2008-01-23 13:14:02 +00:00
|
|
|
if (!channel_mode)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
frame_len = gst_rtp_sbc_pay_get_frame_len (subbands, channels, blocks,
|
|
|
|
bitpool, channel_mode);
|
|
|
|
|
|
|
|
sbcpay->frame_length = frame_len;
|
2016-09-24 17:52:01 +00:00
|
|
|
sbcpay->frame_duration = ((blocks * subbands) * GST_SECOND) / rate;
|
|
|
|
sbcpay->last_timestamp = GST_CLOCK_TIME_NONE;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2013-01-10 12:38:13 +00:00
|
|
|
gst_rtp_base_payload_set_options (payload, "audio", TRUE, "SBC", rate);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (payload, "calculated frame length: %d ", frame_len);
|
|
|
|
|
2013-01-10 12:38:13 +00:00
|
|
|
return gst_rtp_base_payload_set_outcaps (payload, NULL);
|
2008-01-23 13:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_rtp_sbc_pay_flush_buffers (GstRtpSBCPay * sbcpay)
|
|
|
|
{
|
2013-03-27 22:18:34 +00:00
|
|
|
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
|
2008-01-23 13:14:02 +00:00
|
|
|
guint available;
|
|
|
|
guint max_payload;
|
2015-07-03 11:07:20 +00:00
|
|
|
GstBuffer *outbuf, *paybuf;
|
2008-01-23 13:14:02 +00:00
|
|
|
guint8 *payload_data;
|
2008-01-24 14:25:29 +00:00
|
|
|
guint frame_count;
|
|
|
|
guint payload_length;
|
2008-01-23 13:14:02 +00:00
|
|
|
struct rtp_payload *payload;
|
2017-08-14 10:36:56 +00:00
|
|
|
GstFlowReturn res;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
if (sbcpay->frame_length == 0) {
|
|
|
|
GST_ERROR_OBJECT (sbcpay, "Frame length is 0");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
do {
|
|
|
|
available = gst_adapter_available (sbcpay->adapter);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
max_payload =
|
|
|
|
gst_rtp_buffer_calc_payload_len (GST_RTP_BASE_PAYLOAD_MTU (sbcpay) -
|
|
|
|
RTP_SBC_PAYLOAD_HEADER_SIZE, 0, 0);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
max_payload = MIN (max_payload, available);
|
|
|
|
frame_count = max_payload / sbcpay->frame_length;
|
|
|
|
payload_length = frame_count * sbcpay->frame_length;
|
|
|
|
if (payload_length == 0) /* Nothing to send */
|
|
|
|
return GST_FLOW_OK;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
outbuf = gst_rtp_buffer_new_allocate (RTP_SBC_PAYLOAD_HEADER_SIZE, 0, 0);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
/* get payload */
|
|
|
|
gst_rtp_buffer_map (outbuf, GST_MAP_WRITE, &rtp);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
gst_rtp_buffer_set_payload_type (&rtp, GST_RTP_BASE_PAYLOAD_PT (sbcpay));
|
2013-01-10 12:38:13 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
/* write header and copy data into payload */
|
|
|
|
payload_data = gst_rtp_buffer_get_payload (&rtp);
|
|
|
|
payload = (struct rtp_payload *) payload_data;
|
|
|
|
memset (payload, 0, sizeof (struct rtp_payload));
|
|
|
|
payload->frame_count = frame_count;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
gst_rtp_buffer_unmap (&rtp);
|
2013-01-10 12:38:13 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
paybuf = gst_adapter_take_buffer_fast (sbcpay->adapter, payload_length);
|
|
|
|
gst_rtp_copy_audio_meta (sbcpay, outbuf, paybuf);
|
|
|
|
outbuf = gst_buffer_append (outbuf, paybuf);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
GST_BUFFER_PTS (outbuf) = sbcpay->last_timestamp;
|
|
|
|
GST_BUFFER_DURATION (outbuf) = frame_count * sbcpay->frame_duration;
|
|
|
|
GST_DEBUG_OBJECT (sbcpay, "Pushing %d bytes: %" GST_TIME_FORMAT,
|
|
|
|
payload_length, GST_TIME_ARGS (GST_BUFFER_PTS (outbuf)));
|
2016-09-24 17:52:01 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
sbcpay->last_timestamp += frame_count * sbcpay->frame_duration;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2017-08-14 10:36:56 +00:00
|
|
|
res = gst_rtp_base_payload_push (GST_RTP_BASE_PAYLOAD (sbcpay), outbuf);
|
|
|
|
|
|
|
|
/* try to send another RTP buffer if available data exceeds MTU size */
|
2017-08-14 12:09:15 +00:00
|
|
|
} while (res == GST_FLOW_OK);
|
2017-08-14 10:36:56 +00:00
|
|
|
|
|
|
|
return res;
|
2008-01-23 13:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
2013-01-10 12:38:13 +00:00
|
|
|
gst_rtp_sbc_pay_handle_buffer (GstRTPBasePayload * payload, GstBuffer * buffer)
|
2008-01-23 13:14:02 +00:00
|
|
|
{
|
|
|
|
GstRtpSBCPay *sbcpay;
|
|
|
|
guint available;
|
|
|
|
|
2008-01-30 14:21:43 +00:00
|
|
|
/* FIXME check for negotiation */
|
|
|
|
|
2008-01-23 13:14:02 +00:00
|
|
|
sbcpay = GST_RTP_SBC_PAY (payload);
|
2016-09-24 17:52:01 +00:00
|
|
|
|
|
|
|
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
|
|
|
/* Try to flush whatever's left */
|
|
|
|
gst_rtp_sbc_pay_flush_buffers (sbcpay);
|
|
|
|
/* Drop the rest */
|
|
|
|
gst_adapter_flush (sbcpay->adapter,
|
|
|
|
gst_adapter_available (sbcpay->adapter));
|
|
|
|
/* Reset timestamps */
|
|
|
|
sbcpay->last_timestamp = GST_CLOCK_TIME_NONE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sbcpay->last_timestamp == GST_CLOCK_TIME_NONE)
|
|
|
|
sbcpay->last_timestamp = GST_BUFFER_PTS (buffer);
|
2008-02-19 19:49:24 +00:00
|
|
|
|
2008-02-28 19:38:53 +00:00
|
|
|
gst_adapter_push (sbcpay->adapter, buffer);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
available = gst_adapter_available (sbcpay->adapter);
|
|
|
|
if (available + RTP_SBC_HEADER_TOTAL >=
|
2013-01-10 12:38:13 +00:00
|
|
|
GST_RTP_BASE_PAYLOAD_MTU (sbcpay) ||
|
2009-01-29 23:31:15 +00:00
|
|
|
(available > (sbcpay->min_frames * sbcpay->frame_length)))
|
2008-01-23 13:14:02 +00:00
|
|
|
return gst_rtp_sbc_pay_flush_buffers (sbcpay);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-01-10 12:38:13 +00:00
|
|
|
gst_rtp_sbc_pay_sink_event (GstRTPBasePayload * payload, GstEvent * event)
|
2008-01-23 13:14:02 +00:00
|
|
|
{
|
2013-01-10 12:38:13 +00:00
|
|
|
GstRtpSBCPay *sbcpay = GST_RTP_SBC_PAY (payload);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
|
|
|
gst_rtp_sbc_pay_flush_buffers (sbcpay);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-10 12:38:13 +00:00
|
|
|
return GST_RTP_BASE_PAYLOAD_CLASS (parent_class)->sink_event (payload, event);
|
2008-01-23 13:14:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_sbc_pay_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstRtpSBCPay *sbcpay = GST_RTP_SBC_PAY (object);
|
2013-01-10 12:38:13 +00:00
|
|
|
|
2008-01-23 13:14:02 +00:00
|
|
|
g_object_unref (sbcpay->adapter);
|
|
|
|
|
|
|
|
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_sbc_pay_class_init (GstRtpSBCPayClass * klass)
|
|
|
|
{
|
2013-01-10 12:38:13 +00:00
|
|
|
GstRTPBasePayloadClass *payload_class = GST_RTP_BASE_PAYLOAD_CLASS (klass);
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
2013-01-10 12:38:13 +00:00
|
|
|
gobject_class->finalize = gst_rtp_sbc_pay_finalize;
|
|
|
|
gobject_class->set_property = gst_rtp_sbc_pay_set_property;
|
|
|
|
gobject_class->get_property = gst_rtp_sbc_pay_get_property;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
payload_class->set_caps = GST_DEBUG_FUNCPTR (gst_rtp_sbc_pay_set_caps);
|
|
|
|
payload_class->handle_buffer =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_rtp_sbc_pay_handle_buffer);
|
2013-01-10 12:38:13 +00:00
|
|
|
payload_class->sink_event = GST_DEBUG_FUNCPTR (gst_rtp_sbc_pay_sink_event);
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
/* properties */
|
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
|
|
|
PROP_MIN_FRAMES,
|
|
|
|
g_param_spec_int ("min-frames", "minimum frame number",
|
|
|
|
"Minimum quantity of frames to send in one packet "
|
|
|
|
"(-1 for maximum allowed by the mtu)",
|
|
|
|
-1, G_MAXINT, DEFAULT_MIN_FRAMES, G_PARAM_READWRITE));
|
|
|
|
|
2016-03-04 01:30:12 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&gst_rtp_sbc_pay_sink_factory);
|
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&gst_rtp_sbc_pay_src_factory);
|
2013-01-10 12:38:13 +00:00
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (element_class, "RTP packet payloader",
|
|
|
|
"Codec/Payloader/Network", "Payload SBC audio as RTP packets",
|
|
|
|
"Thiago Sousa Santos <thiagoss@lcc.ufcg.edu.br>");
|
|
|
|
|
2008-01-23 13:14:02 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_rtp_sbc_pay_debug, "rtpsbcpay", 0,
|
|
|
|
"RTP SBC payloader");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_sbc_pay_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRtpSBCPay *sbcpay;
|
|
|
|
|
|
|
|
sbcpay = GST_RTP_SBC_PAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_MIN_FRAMES:
|
|
|
|
sbcpay->min_frames = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_sbc_pay_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstRtpSBCPay *sbcpay;
|
|
|
|
|
|
|
|
sbcpay = GST_RTP_SBC_PAY (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case PROP_MIN_FRAMES:
|
|
|
|
g_value_set_int (value, sbcpay->min_frames);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-01-10 12:38:13 +00:00
|
|
|
gst_rtp_sbc_pay_init (GstRtpSBCPay * self)
|
2008-01-23 13:14:02 +00:00
|
|
|
{
|
|
|
|
self->adapter = gst_adapter_new ();
|
|
|
|
self->frame_length = 0;
|
2016-09-24 17:52:01 +00:00
|
|
|
self->last_timestamp = GST_CLOCK_TIME_NONE;
|
2008-01-23 13:14:02 +00:00
|
|
|
|
|
|
|
self->min_frames = DEFAULT_MIN_FRAMES;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_rtp_sbc_pay_plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2008-12-20 19:42:49 +00:00
|
|
|
return gst_element_register (plugin, "rtpsbcpay", GST_RANK_NONE,
|
|
|
|
GST_TYPE_RTP_SBC_PAY);
|
2008-01-23 13:14:02 +00:00
|
|
|
}
|