mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
gst/rtp/: Small cleanups.
Original commit message from CVS: * gst/rtp/gstrtpL16depay.c: (gst_rtp_L16depay_change_state): * gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_class_init): Small cleanups. * gst/rtp/Makefile.am: * gst/rtp/gstrtp.c: (plugin_init): * gst/rtp/gstrtpvorbisdepay.c: (gst_rtp_vorbis_depay_base_init), (gst_rtp_vorbis_depay_class_init), (gst_rtp_vorbis_depay_init), (gst_rtp_vorbis_depay_finalize), (gst_rtp_vorbis_depay_setcaps), (gst_rtp_vorbis_depay_process), (gst_rtp_vorbis_depay_set_property), (gst_rtp_vorbis_depay_get_property), (gst_rtp_vorbis_depay_change_state), (gst_rtp_vorbis_depay_plugin_init): * gst/rtp/gstrtpvorbisdepay.h: * gst/rtp/gstrtpvorbispay.c: (gst_rtp_vorbis_pay_base_init), (gst_rtp_vorbis_pay_class_init), (gst_rtp_vorbis_pay_init), (gst_rtp_vorbis_pay_setcaps), (gst_rtp_vorbis_pay_init_packet), (gst_rtp_vorbis_pay_flush_packet), (gst_rtp_vorbis_pay_append_buffer), (gst_rtp_vorbis_pay_handle_buffer), (gst_rtp_vorbis_pay_plugin_init): * gst/rtp/gstrtpvorbispay.h: Add experimental vorbis pay and depayloaders.
This commit is contained in:
parent
3b5584f8d1
commit
8dbf033420
9 changed files with 951 additions and 11 deletions
27
ChangeLog
27
ChangeLog
|
@ -1,3 +1,30 @@
|
|||
2006-09-22 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16depay_change_state):
|
||||
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_class_init):
|
||||
Small cleanups.
|
||||
|
||||
* gst/rtp/Makefile.am:
|
||||
* gst/rtp/gstrtp.c: (plugin_init):
|
||||
* gst/rtp/gstrtpvorbisdepay.c: (gst_rtp_vorbis_depay_base_init),
|
||||
(gst_rtp_vorbis_depay_class_init), (gst_rtp_vorbis_depay_init),
|
||||
(gst_rtp_vorbis_depay_finalize), (gst_rtp_vorbis_depay_setcaps),
|
||||
(gst_rtp_vorbis_depay_process),
|
||||
(gst_rtp_vorbis_depay_set_property),
|
||||
(gst_rtp_vorbis_depay_get_property),
|
||||
(gst_rtp_vorbis_depay_change_state),
|
||||
(gst_rtp_vorbis_depay_plugin_init):
|
||||
* gst/rtp/gstrtpvorbisdepay.h:
|
||||
* gst/rtp/gstrtpvorbispay.c: (gst_rtp_vorbis_pay_base_init),
|
||||
(gst_rtp_vorbis_pay_class_init), (gst_rtp_vorbis_pay_init),
|
||||
(gst_rtp_vorbis_pay_setcaps), (gst_rtp_vorbis_pay_init_packet),
|
||||
(gst_rtp_vorbis_pay_flush_packet),
|
||||
(gst_rtp_vorbis_pay_append_buffer),
|
||||
(gst_rtp_vorbis_pay_handle_buffer),
|
||||
(gst_rtp_vorbis_pay_plugin_init):
|
||||
* gst/rtp/gstrtpvorbispay.h:
|
||||
Add experimental vorbis pay and depayloaders.
|
||||
|
||||
2006-09-21 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_parse_audio_config):
|
||||
|
|
|
@ -26,7 +26,9 @@ libgstrtp_la_SOURCES = \
|
|||
gstrtpmp4gpay.c \
|
||||
gstrtpspeexdepay.c \
|
||||
gstrtpspeexpay.c \
|
||||
gstrtpsv3vdepay.c
|
||||
gstrtpsv3vdepay.c \
|
||||
gstrtpvorbisdepay.c \
|
||||
gstrtpvorbispay.c
|
||||
|
||||
#gstrtpL16pay.c gstrtpL16depay.c
|
||||
|
||||
|
@ -68,4 +70,6 @@ noinst_HEADERS = \
|
|||
gstasteriskh263.h \
|
||||
gstrtpspeexdepay.h \
|
||||
gstrtpspeexpay.h \
|
||||
gstrtpsv3vdepay.h
|
||||
gstrtpsv3vdepay.h \
|
||||
gstrtpvorbisdepay.h \
|
||||
gstrtpvorbispay.h
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#include "gstrtpspeexpay.h"
|
||||
#include "gstrtpspeexdepay.h"
|
||||
#include "gstrtpsv3vdepay.h"
|
||||
#include "gstrtpvorbisdepay.h"
|
||||
#include "gstrtpvorbispay.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
|
@ -125,6 +127,12 @@ plugin_init (GstPlugin * plugin)
|
|||
if (!gst_rtp_sv3v_depay_plugin_init (plugin))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_rtp_vorbis_depay_plugin_init (plugin))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_rtp_vorbis_pay_plugin_init (plugin))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -318,28 +318,30 @@ static GstStateChangeReturn
|
|||
gst_rtp_L16depay_change_state (GstElement * element, GstStateChange transition)
|
||||
{
|
||||
GstRtpL16Depay *rtpL16depay;
|
||||
|
||||
g_return_val_if_fail (GST_IS_RTP_L16_DEPAY (element),
|
||||
GST_STATE_CHANGE_FAILURE);
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
rtpL16depay = GST_RTP_L16_DEPAY (element);
|
||||
|
||||
GST_DEBUG ("state pending %d\n", GST_STATE_PENDING (element));
|
||||
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* if we haven't failed already, give the parent class a chance to ;-) */
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* if we haven't failed already, give the parent class a chance to ;-) */
|
||||
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
||||
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
return GST_STATE_CHANGE_SUCCESS;
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -128,7 +128,6 @@ gst_rtp_mp4g_depay_class_init (GstRtpMP4GDepayClass * klass)
|
|||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
|
||||
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
|
440
gst/rtp/gstrtpvorbisdepay.c
Normal file
440
gst/rtp/gstrtpvorbisdepay.c
Normal file
|
@ -0,0 +1,440 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/rtp/gstrtpbuffer.h>
|
||||
|
||||
#include <string.h>
|
||||
#include "gstrtpvorbisdepay.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtpvorbisdepay_debug);
|
||||
#define GST_CAT_DEFAULT (rtpvorbisdepay_debug)
|
||||
|
||||
/* elementfactory information */
|
||||
static const GstElementDetails gst_rtp_vorbis_depay_details =
|
||||
GST_ELEMENT_DETAILS ("RTP packet parser",
|
||||
"Codec/Depay/Network",
|
||||
"Extracts Vorbis Audio from RTP packets (draft-01 of RFC XXXX)",
|
||||
"Wim Taymans <wim@fluendo.com>");
|
||||
|
||||
/* RtpVorbisDepay signals and args */
|
||||
enum
|
||||
{
|
||||
/* FILL ME */
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ARG_0,
|
||||
};
|
||||
|
||||
static GstStaticPadTemplate gst_rtp_vorbis_depay_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("application/x-rtp, "
|
||||
"media = (string) \"audio\", "
|
||||
"clock-rate = (int) [1, MAX ], " "encoding-name = (string) \"vorbis\""
|
||||
/* All required parameters
|
||||
*
|
||||
* "encoding-params = (string) <num channels>"
|
||||
* "delivery-method = (string) { inline, in_band, out_band/<specific_name> } "
|
||||
* "configuration = (string) ANY"
|
||||
*/
|
||||
/* All optional parameters
|
||||
*
|
||||
* "configuration-uri ="
|
||||
*/
|
||||
)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtp_vorbis_depay_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-vorbis")
|
||||
);
|
||||
|
||||
GST_BOILERPLATE (GstRtpVorbisDepay, gst_rtp_vorbis_depay, GstBaseRTPDepayload,
|
||||
GST_TYPE_BASE_RTP_DEPAYLOAD);
|
||||
|
||||
static gboolean gst_rtp_vorbis_depay_setcaps (GstBaseRTPDepayload * depayload,
|
||||
GstCaps * caps);
|
||||
static GstBuffer *gst_rtp_vorbis_depay_process (GstBaseRTPDepayload * depayload,
|
||||
GstBuffer * buf);
|
||||
|
||||
static void gst_rtp_vorbis_depay_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec);
|
||||
static void gst_rtp_vorbis_depay_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec);
|
||||
static void gst_rtp_vorbis_depay_finalize (GObject * object);
|
||||
|
||||
static GstStateChangeReturn gst_rtp_vorbis_depay_change_state (GstElement *
|
||||
element, GstStateChange transition);
|
||||
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_depay_base_init (gpointer klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_rtp_vorbis_depay_sink_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_rtp_vorbis_depay_src_template));
|
||||
|
||||
gst_element_class_set_details (element_class, &gst_rtp_vorbis_depay_details);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_depay_class_init (GstRtpVorbisDepayClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
|
||||
|
||||
gobject_class->set_property = gst_rtp_vorbis_depay_set_property;
|
||||
gobject_class->get_property = gst_rtp_vorbis_depay_get_property;
|
||||
gobject_class->finalize = gst_rtp_vorbis_depay_finalize;
|
||||
|
||||
gstelement_class->change_state = gst_rtp_vorbis_depay_change_state;
|
||||
|
||||
gstbasertpdepayload_class->process = gst_rtp_vorbis_depay_process;
|
||||
gstbasertpdepayload_class->set_caps = gst_rtp_vorbis_depay_setcaps;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (rtpvorbisdepay_debug, "rtpvorbisdepay", 0,
|
||||
"Vorbis RTP Depayloader");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_depay_init (GstRtpVorbisDepay * rtpvorbisdepay,
|
||||
GstRtpVorbisDepayClass * klass)
|
||||
{
|
||||
rtpvorbisdepay->adapter = gst_adapter_new ();
|
||||
}
|
||||
static void
|
||||
gst_rtp_vorbis_depay_finalize (GObject * object)
|
||||
{
|
||||
GstRtpVorbisDepay *rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (object);
|
||||
|
||||
g_object_unref (rtpvorbisdepay->adapter);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_rtp_vorbis_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||
{
|
||||
GstStructure *structure;
|
||||
GstRtpVorbisDepay *rtpvorbisdepay;
|
||||
GstCaps *srccaps;
|
||||
gint clock_rate;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
goto no_rate;
|
||||
|
||||
/* caps seem good, configure element */
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
/* set caps on pad and on header */
|
||||
srccaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
|
||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
|
||||
no_rate:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpvorbisdepay, "no clock-rate specified");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
gst_rtp_vorbis_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
GstRtpVorbisDepay *rtpvorbisdepay;
|
||||
GstBuffer *outbuf;
|
||||
GstFlowReturn ret;
|
||||
gint payload_len;
|
||||
guint8 *payload, *to_free = NULL;
|
||||
guint32 timestamp;
|
||||
guint32 header, ident;
|
||||
guint8 F, VDT, packets;
|
||||
gboolean free_payload;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
|
||||
|
||||
/* we need at least 4 bytes for the packet header */
|
||||
if (payload_len < 4)
|
||||
goto packet_short;
|
||||
|
||||
payload = gst_rtp_buffer_get_payload (buf);
|
||||
free_payload = FALSE;
|
||||
|
||||
header = GST_READ_UINT32_BE (payload);
|
||||
/*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Ident | F |VDT|# pkts.|
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
* F: Fragment type (0=none, 1=start, 2=cont, 3=end)
|
||||
* VDT: Vorbis data type (0=vorbis, 1=config, 2=comment, 3=reserved)
|
||||
* pkts: number of packets.
|
||||
*/
|
||||
VDT = (header & 0x30) >> 4;
|
||||
if (VDT == 3)
|
||||
goto ignore_reserved;
|
||||
|
||||
ident = (header >> 8) & 0xffffff;
|
||||
F = (header & 0xc0) >> 6;
|
||||
packets = (header & 0xf);
|
||||
|
||||
if (VDT == 0) {
|
||||
/* FIXME, if we have a raw payload, we need the codebook for the ident */
|
||||
}
|
||||
|
||||
/* skip header */
|
||||
payload += 4;
|
||||
payload_len -= 4;
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "ident: %u, F: %d, packets: %d", ident, F,
|
||||
packets);
|
||||
|
||||
/* fragmented packets, assemble */
|
||||
if (F != 0) {
|
||||
GstBuffer *vdata;
|
||||
guint headerskip;
|
||||
|
||||
if (F == 1) {
|
||||
/* if we start a packet, clear adapter and start assembling. */
|
||||
gst_adapter_clear (rtpvorbisdepay->adapter);
|
||||
GST_DEBUG_OBJECT (depayload, "start assemble");
|
||||
rtpvorbisdepay->assembling = TRUE;
|
||||
}
|
||||
|
||||
if (!rtpvorbisdepay->assembling)
|
||||
goto no_output;
|
||||
|
||||
/* first assembled packet, reuse 2 bytes to store the length */
|
||||
headerskip = (F == 1 ? 4 : 6);
|
||||
/* skip header and length. */
|
||||
vdata = gst_rtp_buffer_get_payload_subbuffer (buf, headerskip, -1);
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "assemble vorbis packet");
|
||||
gst_adapter_push (rtpvorbisdepay->adapter, vdata);
|
||||
|
||||
/* packet is not complete, we are done */
|
||||
if (F != 3)
|
||||
goto no_output;
|
||||
|
||||
/* construct assembled buffer */
|
||||
payload_len = gst_adapter_available (rtpvorbisdepay->adapter);
|
||||
payload = gst_adapter_take (rtpvorbisdepay->adapter, payload_len);
|
||||
payload[0] = ((payload_len - 2) >> 8) & 0xff;
|
||||
payload[1] = (payload_len - 2) & 0xff;
|
||||
to_free = payload;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "assemble done");
|
||||
|
||||
/* we not assembling anymore now */
|
||||
rtpvorbisdepay->assembling = FALSE;
|
||||
gst_adapter_clear (rtpvorbisdepay->adapter);
|
||||
|
||||
/* payload now points to a length with that many vorbis data bytes.
|
||||
* Iterate over the packets and send them out.
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | length | vorbis data ..
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* .. vorbis data |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | length | next vorbis packet data ..
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* .. vorbis data |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*
|
||||
*/
|
||||
timestamp = gst_rtp_buffer_get_timestamp (buf);
|
||||
|
||||
while (payload_len > 2) {
|
||||
guint16 length;
|
||||
|
||||
length = GST_READ_UINT16_BE (payload);
|
||||
payload += 2;
|
||||
payload_len -= 2;
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "read length %u, avail: %d", length,
|
||||
payload_len);
|
||||
|
||||
/* skip packet if something odd happens */
|
||||
if (length > payload_len)
|
||||
goto length_short;
|
||||
|
||||
/* create buffer for packet */
|
||||
if (to_free) {
|
||||
outbuf = gst_buffer_new ();
|
||||
GST_BUFFER_DATA (outbuf) = payload;
|
||||
GST_BUFFER_MALLOCDATA (outbuf) = to_free;
|
||||
GST_BUFFER_SIZE (outbuf) = length;
|
||||
to_free = NULL;
|
||||
} else {
|
||||
outbuf = gst_buffer_new_and_alloc (length);
|
||||
memcpy (GST_BUFFER_DATA (outbuf), payload, length);
|
||||
}
|
||||
|
||||
payload += length;
|
||||
payload_len -= length;
|
||||
|
||||
if (timestamp != -1)
|
||||
/* push with timestamp of the last packet, which is the same timestamp that
|
||||
* should apply to the first assembled packet. */
|
||||
ret = gst_base_rtp_depayload_push_ts (depayload, timestamp, outbuf);
|
||||
else
|
||||
ret = gst_base_rtp_depayload_push (depayload, outbuf);
|
||||
|
||||
if (ret != GST_FLOW_OK)
|
||||
break;
|
||||
|
||||
/* make sure we don't set a timestamp on next buffers */
|
||||
timestamp = -1;
|
||||
}
|
||||
|
||||
g_free (to_free);
|
||||
|
||||
return NULL;
|
||||
|
||||
no_output:
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
/* ERORRS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
packet_short:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||
("Packet was too short (%d < 4)", payload_len), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
ignore_reserved:
|
||||
{
|
||||
GST_WARNING_OBJECT (rtpvorbisdepay, "reserved VDT ignored");
|
||||
return NULL;
|
||||
}
|
||||
length_short:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||
("Packet contains invalid data"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_depay_set_property (GObject * object, guint prop_id,
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstRtpVorbisDepay *rtpvorbisdepay;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_depay_get_property (GObject * object, guint prop_id,
|
||||
GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstRtpVorbisDepay *rtpvorbisdepay;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
gst_rtp_vorbis_depay_change_state (GstElement * element,
|
||||
GstStateChange transition)
|
||||
{
|
||||
GstRtpVorbisDepay *rtpvorbisdepay;
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (element);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_rtp_vorbis_depay_plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "rtpvorbisdepay",
|
||||
GST_RANK_NONE, GST_TYPE_RTP_VORBIS_DEPAY);
|
||||
}
|
60
gst/rtp/gstrtpvorbisdepay.h
Normal file
60
gst/rtp/gstrtpvorbisdepay.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_RTP_VORBIS_DEPAY_H__
|
||||
#define __GST_RTP_VORBIS_DEPAY_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
#include <gst/rtp/gstbasertpdepayload.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RTP_VORBIS_DEPAY \
|
||||
(gst_rtp_vorbis_depay_get_type())
|
||||
#define GST_RTP_VORBIS_DEPAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_VORBIS_DEPAY,GstRtpVorbisDepay))
|
||||
#define GST_RTP_VORBIS_DEPAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_VORBIS_DEPAY,GstRtpVorbisDepayClass))
|
||||
#define GST_IS_RTP_VORBIS_DEPAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_VORBIS_DEPAY))
|
||||
#define GST_IS_RTP_VORBIS_DEPAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_VORBIS_DEPAY))
|
||||
|
||||
typedef struct _GstRtpVorbisDepay GstRtpVorbisDepay;
|
||||
typedef struct _GstRtpVorbisDepayClass GstRtpVorbisDepayClass;
|
||||
|
||||
struct _GstRtpVorbisDepay
|
||||
{
|
||||
GstBaseRTPDepayload parent;
|
||||
|
||||
GstAdapter *adapter;
|
||||
gboolean assembling;
|
||||
};
|
||||
|
||||
struct _GstRtpVorbisDepayClass
|
||||
{
|
||||
GstBaseRTPDepayloadClass parent_class;
|
||||
};
|
||||
|
||||
gboolean gst_rtp_vorbis_depay_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RTP_VORBIS_DEPAY_H__ */
|
333
gst/rtp/gstrtpvorbispay.c
Normal file
333
gst/rtp/gstrtpvorbispay.c
Normal file
|
@ -0,0 +1,333 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2006> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <gst/rtp/gstrtpbuffer.h>
|
||||
|
||||
#include "gstrtpvorbispay.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (rtpvorbispay_debug);
|
||||
#define GST_CAT_DEFAULT (rtpvorbispay_debug)
|
||||
|
||||
/* references:
|
||||
* http://svn.xiph.org/trunk/vorbis/doc/draft-ietf-avt-rtp-vorbis-01.txt
|
||||
*/
|
||||
|
||||
/* elementfactory information */
|
||||
static const GstElementDetails gst_rtp_vorbispay_details =
|
||||
GST_ELEMENT_DETAILS ("RTP packet parser",
|
||||
"Codec/Payloader/Network",
|
||||
"Payload-encode Vorbis audio into RTP packets (draft-01 RFC XXXX)",
|
||||
"Wim Taymans <wim@fluendo.com>");
|
||||
|
||||
static GstStaticPadTemplate gst_rtp_vorbis_pay_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("application/x-rtp, "
|
||||
"media = (string) \"audio\", "
|
||||
"payload = (int) [ 96, 127 ], "
|
||||
"clock-rate = (int) [1, MAX ], " "encoding-name = (string) \"vorbis\""
|
||||
/* All required parameters
|
||||
*
|
||||
* "encoding-params = (string) <num channels>"
|
||||
* "delivery-method = (string) { inline, in_band, out_band/<specific_name> } "
|
||||
* "configuration = (string) ANY"
|
||||
*/
|
||||
/* All optional parameters
|
||||
*
|
||||
* "configuration-uri ="
|
||||
*/
|
||||
)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_rtp_vorbis_pay_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-vorbis")
|
||||
);
|
||||
|
||||
GST_BOILERPLATE (GstRtpVorbisPay, gst_rtp_vorbis_pay, GstBaseRTPPayload,
|
||||
GST_TYPE_BASE_RTP_PAYLOAD);
|
||||
|
||||
static gboolean gst_rtp_vorbis_pay_setcaps (GstBaseRTPPayload * basepayload,
|
||||
GstCaps * caps);
|
||||
static GstFlowReturn gst_rtp_vorbis_pay_handle_buffer (GstBaseRTPPayload * pad,
|
||||
GstBuffer * buffer);
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_pay_base_init (gpointer klass)
|
||||
{
|
||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_rtp_vorbis_pay_src_template));
|
||||
gst_element_class_add_pad_template (element_class,
|
||||
gst_static_pad_template_get (&gst_rtp_vorbis_pay_sink_template));
|
||||
|
||||
gst_element_class_set_details (element_class, &gst_rtp_vorbispay_details);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_pay_class_init (GstRtpVorbisPayClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GstElementClass *gstelement_class;
|
||||
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
gstelement_class = (GstElementClass *) klass;
|
||||
gstbasertppayload_class = (GstBaseRTPPayloadClass *) klass;
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
gstbasertppayload_class->set_caps = gst_rtp_vorbis_pay_setcaps;
|
||||
gstbasertppayload_class->handle_buffer = gst_rtp_vorbis_pay_handle_buffer;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (rtpvorbispay_debug, "rtpvorbispay", 0,
|
||||
"Vorbis RTP Payloader");
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_pay_init (GstRtpVorbisPay * rtpvorbispay,
|
||||
GstRtpVorbisPayClass * klass)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_rtp_vorbis_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
||||
{
|
||||
GstRtpVorbisPay *rtpvorbispay;
|
||||
|
||||
rtpvorbispay = GST_RTP_VORBIS_PAY (basepayload);
|
||||
|
||||
gst_basertppayload_set_options (basepayload, "audio", TRUE, "vorbis", 8000);
|
||||
gst_basertppayload_set_outcaps (basepayload,
|
||||
"encoding-params", G_TYPE_STRING, "1",
|
||||
/* don't set the defaults
|
||||
*/
|
||||
NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_rtp_vorbis_pay_init_packet (GstRtpVorbisPay * rtpvorbispay)
|
||||
{
|
||||
guint payload_len;
|
||||
|
||||
if (rtpvorbispay->packet)
|
||||
gst_buffer_unref (rtpvorbispay->packet);
|
||||
|
||||
GST_DEBUG_OBJECT (rtpvorbispay, "starting new packet");
|
||||
|
||||
/* new packet allocate max packet size */
|
||||
rtpvorbispay->packet =
|
||||
gst_rtp_buffer_new_allocate_len (GST_BASE_RTP_PAYLOAD_MTU
|
||||
(rtpvorbispay), 0, 0);
|
||||
rtpvorbispay->payload_pos = 4;
|
||||
payload_len = gst_rtp_buffer_get_payload_len (rtpvorbispay->packet);
|
||||
rtpvorbispay->payload_left = payload_len - 4;
|
||||
rtpvorbispay->payload_duration = 0;
|
||||
rtpvorbispay->payload_ident = 0;
|
||||
rtpvorbispay->payload_F = 0;
|
||||
rtpvorbispay->payload_VDT = 0;
|
||||
rtpvorbispay->payload_pkts = 0;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_rtp_vorbis_pay_flush_packet (GstRtpVorbisPay * rtpvorbispay)
|
||||
{
|
||||
GstFlowReturn ret;
|
||||
guint8 *payload;
|
||||
guint hlen;
|
||||
|
||||
/* check for empty packet */
|
||||
if (!rtpvorbispay || rtpvorbispay->payload_pos <= 4)
|
||||
return GST_FLOW_OK;
|
||||
|
||||
GST_DEBUG_OBJECT (rtpvorbispay, "flushing packet");
|
||||
|
||||
/* fix header */
|
||||
payload = gst_rtp_buffer_get_payload (rtpvorbispay->packet);
|
||||
/*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | Ident | F |VDT|# pkts.|
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*
|
||||
* F: Fragment type (0=none, 1=start, 2=cont, 3=end)
|
||||
* VDT: Vorbis data type (0=vorbis, 1=config, 2=comment, 3=reserved)
|
||||
* pkts: number of packets.
|
||||
*/
|
||||
payload[0] = (rtpvorbispay->payload_ident >> 16) & 0xff;
|
||||
payload[1] = (rtpvorbispay->payload_ident >> 8) & 0xff;
|
||||
payload[2] = (rtpvorbispay->payload_ident) & 0xff;
|
||||
payload[3] = (rtpvorbispay->payload_F & 0x3) << 6 |
|
||||
(rtpvorbispay->payload_VDT & 0x3) << 4 |
|
||||
(rtpvorbispay->payload_pkts & 0xf);
|
||||
|
||||
/* shrink the buffer size to the last written byte */
|
||||
hlen = gst_rtp_buffer_calc_header_len (0);
|
||||
GST_BUFFER_SIZE (rtpvorbispay->packet) = hlen + rtpvorbispay->payload_pos;
|
||||
|
||||
/* push, this gives away our ref to the packet, so clear it. */
|
||||
ret =
|
||||
gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtpvorbispay),
|
||||
rtpvorbispay->packet);
|
||||
rtpvorbispay->packet = NULL;
|
||||
|
||||
/* prepare new packet */
|
||||
gst_rtp_vorbis_pay_init_packet (rtpvorbispay);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_rtp_vorbis_pay_append_buffer (GstRtpVorbisPay * rtpvorbispay,
|
||||
GstBuffer * buffer)
|
||||
{
|
||||
GstFlowReturn res;
|
||||
guint size;
|
||||
GstClockTime duration;
|
||||
guint plen;
|
||||
guint8 *ppos, *payload, *data;
|
||||
gboolean fragmented;
|
||||
|
||||
res = GST_FLOW_OK;
|
||||
|
||||
if (rtpvorbispay->payload_left < 2)
|
||||
return res;
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
/* skip packets that are too big */
|
||||
if (size > 0xffff)
|
||||
return res;
|
||||
|
||||
data = GST_BUFFER_DATA (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
payload = gst_rtp_buffer_get_payload (rtpvorbispay->packet);
|
||||
ppos = payload + rtpvorbispay->payload_pos;
|
||||
fragmented = FALSE;
|
||||
|
||||
while (size) {
|
||||
plen = MIN (rtpvorbispay->payload_left - 2, size);
|
||||
|
||||
GST_DEBUG_OBJECT (rtpvorbispay, "append %u bytes", plen);
|
||||
|
||||
ppos[0] = (plen >> 8) & 0xff;
|
||||
ppos[1] = (plen & 0xff);
|
||||
memcpy (&ppos[2], data, plen);
|
||||
|
||||
size -= plen;
|
||||
data += plen;
|
||||
|
||||
rtpvorbispay->payload_pos += plen + 2;
|
||||
rtpvorbispay->payload_left -= plen + 2;
|
||||
|
||||
if (fragmented) {
|
||||
if (size == 0)
|
||||
/* last fragment, set F to 0x3. */
|
||||
rtpvorbispay->payload_F = 0x3;
|
||||
else
|
||||
/* fragment continues, set F to 0x2. */
|
||||
rtpvorbispay->payload_F = 0x2;
|
||||
} else {
|
||||
if (size == 0) {
|
||||
/* unfragmented packet, update stats for next packet */
|
||||
rtpvorbispay->payload_pkts++;
|
||||
if (duration != GST_CLOCK_TIME_NONE)
|
||||
rtpvorbispay->payload_duration += duration;
|
||||
} else {
|
||||
/* fragmented packet starts, set F to 0x1, mark ourselves as
|
||||
* fragmented. */
|
||||
rtpvorbispay->payload_F = 0x1;
|
||||
fragmented = TRUE;
|
||||
}
|
||||
}
|
||||
if (fragmented) {
|
||||
/* fragmented packets are always flushed and have ptks of 0 */
|
||||
rtpvorbispay->payload_pkts = 0;
|
||||
res = gst_rtp_vorbis_pay_flush_packet (rtpvorbispay);
|
||||
/* get new pointers */
|
||||
payload = gst_rtp_buffer_get_payload (rtpvorbispay->packet);
|
||||
ppos = payload + rtpvorbispay->payload_pos;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
gst_rtp_vorbis_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
||||
GstBuffer * buffer)
|
||||
{
|
||||
GstRtpVorbisPay *rtpvorbispay;
|
||||
GstFlowReturn ret;
|
||||
guint size, newsize;
|
||||
guint packet_len;
|
||||
GstClockTime duration, newduration;
|
||||
gboolean flush;
|
||||
|
||||
rtpvorbispay = GST_RTP_VORBIS_PAY (basepayload);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
GST_DEBUG_OBJECT (rtpvorbispay, "size %u, duration %" GST_TIME_FORMAT,
|
||||
size, GST_TIME_ARGS (duration));
|
||||
|
||||
if (!rtpvorbispay->packet)
|
||||
gst_rtp_vorbis_pay_init_packet (rtpvorbispay);
|
||||
|
||||
/* size increases with packet length and 2 bytes size eader. */
|
||||
newduration = rtpvorbispay->payload_duration;
|
||||
if (duration != GST_CLOCK_TIME_NONE)
|
||||
newduration += duration;
|
||||
|
||||
newsize = rtpvorbispay->payload_pos + 2 + size;
|
||||
packet_len = gst_rtp_buffer_calc_packet_len (newsize, 0, 0);
|
||||
|
||||
/* check buffer filled against length and max latency */
|
||||
flush = gst_basertppayload_is_filled (basepayload, packet_len, newduration);
|
||||
/* we can store up to 15 vorbis packets in one RTP packet. */
|
||||
flush |= (rtpvorbispay->payload_pkts == 15);
|
||||
|
||||
if (flush)
|
||||
ret = gst_rtp_vorbis_pay_flush_packet (rtpvorbispay);
|
||||
|
||||
/* put buffer in packet */
|
||||
ret = gst_rtp_vorbis_pay_append_buffer (rtpvorbispay, buffer);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_rtp_vorbis_pay_plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
return gst_element_register (plugin, "rtpvorbispay",
|
||||
GST_RANK_NONE, GST_TYPE_RTP_VORBIS_PAY);
|
||||
}
|
67
gst/rtp/gstrtpvorbispay.h
Normal file
67
gst/rtp/gstrtpvorbispay.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_RTP_VORBIS_PAY_H__
|
||||
#define __GST_RTP_VORBIS_PAY_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/rtp/gstbasertppayload.h>
|
||||
#include <gst/base/gstadapter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_RTP_VORBIS_PAY \
|
||||
(gst_rtp_vorbis_pay_get_type())
|
||||
#define GST_RTP_VORBIS_PAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_VORBIS_PAY,GstRtpVorbisPay))
|
||||
#define GST_RTP_VORBIS_PAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_VORBIS_PAY,GstRtpVorbisPayClass))
|
||||
#define GST_IS_RTP_VORBIS_PAY(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_VORBIS_PAY))
|
||||
#define GST_IS_RTP_VORBIS_PAY_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_VORBIS_PAY))
|
||||
|
||||
typedef struct _GstRtpVorbisPay GstRtpVorbisPay;
|
||||
typedef struct _GstRtpVorbisPayClass GstRtpVorbisPayClass;
|
||||
|
||||
struct _GstRtpVorbisPay
|
||||
{
|
||||
GstBaseRTPPayload payload;
|
||||
|
||||
/* queues of buffers along with some stats. */
|
||||
GstBuffer *packet;
|
||||
guint payload_pos;
|
||||
guint payload_left;
|
||||
guint32 payload_ident;
|
||||
guint8 payload_F;
|
||||
guint8 payload_VDT;
|
||||
guint payload_pkts;
|
||||
GstClockTime payload_duration;
|
||||
};
|
||||
|
||||
struct _GstRtpVorbisPayClass
|
||||
{
|
||||
GstBaseRTPPayloadClass parent_class;
|
||||
};
|
||||
|
||||
gboolean gst_rtp_vorbis_pay_plugin_init (GstPlugin * plugin);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_RTP_VORBIS_PAY_H__ */
|
Loading…
Reference in a new issue