2009-08-02 11:42:12 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2009> Edward Hervey <bilboed@bilboed.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
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2009-08-02 11:42:12 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gst/rtp/gstrtpbuffer.h>
|
|
|
|
#include "gstrtpqdmdepay.h"
|
|
|
|
|
2009-08-03 19:21:39 +00:00
|
|
|
GST_DEBUG_CATEGORY (rtpqdm2depay_debug);
|
|
|
|
#define GST_CAT_DEFAULT rtpqdm2depay_debug
|
|
|
|
|
2009-08-02 11:42:12 +00:00
|
|
|
static GstStaticPadTemplate gst_rtp_qdm2_depay_src_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-qdm2")
|
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate gst_rtp_qdm2_depay_sink_template =
|
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("application/x-rtp, "
|
|
|
|
"media = (string) \"audio\", "
|
|
|
|
"payload = (int) " GST_RTP_PAYLOAD_DYNAMIC_STRING ", "
|
|
|
|
"encoding-name = (string)\"X-QDM\"")
|
|
|
|
);
|
|
|
|
|
2011-07-10 19:50:19 +00:00
|
|
|
#define gst_rtp_qdm2_depay_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE (GstRtpQDM2Depay, gst_rtp_qdm2_depay,
|
2011-11-11 11:25:01 +00:00
|
|
|
GST_TYPE_RTP_BASE_DEPAYLOAD);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
static const guint8 headheader[20] = {
|
|
|
|
0x0, 0x0, 0x0, 0xc, 0x66, 0x72, 0x6d, 0x61,
|
|
|
|
0x51, 0x44, 0x4d, 0x32, 0x0, 0x0, 0x0, 0x24,
|
|
|
|
0x51, 0x44, 0x43, 0x41
|
|
|
|
};
|
2009-12-23 12:09:54 +00:00
|
|
|
|
2009-08-02 11:42:12 +00:00
|
|
|
static void gst_rtp_qdm2_depay_finalize (GObject * object);
|
|
|
|
|
|
|
|
static GstStateChangeReturn gst_rtp_qdm2_depay_change_state (GstElement *
|
|
|
|
element, GstStateChange transition);
|
|
|
|
|
2011-11-11 11:25:01 +00:00
|
|
|
static GstBuffer *gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload,
|
2009-08-02 11:42:12 +00:00
|
|
|
GstBuffer * buf);
|
2011-11-11 11:25:01 +00:00
|
|
|
gboolean gst_rtp_qdm2_depay_setcaps (GstRTPBaseDepayload * filter,
|
2009-08-02 11:42:12 +00:00
|
|
|
GstCaps * caps);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_qdm2_depay_class_init (GstRtpQDM2DepayClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2011-11-11 11:25:01 +00:00
|
|
|
GstRTPBaseDepayloadClass *gstrtpbasedepayload_class;
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2011-11-11 11:25:01 +00:00
|
|
|
gstrtpbasedepayload_class = (GstRTPBaseDepayloadClass *) klass;
|
2009-08-02 11:42:12 +00:00
|
|
|
|
2011-11-11 11:25:01 +00:00
|
|
|
gstrtpbasedepayload_class->process = gst_rtp_qdm2_depay_process;
|
|
|
|
gstrtpbasedepayload_class->set_caps = gst_rtp_qdm2_depay_setcaps;
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
gobject_class->finalize = gst_rtp_qdm2_depay_finalize;
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_rtp_qdm2_depay_change_state;
|
2011-07-10 19:50:19 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&gst_rtp_qdm2_depay_src_template));
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&gst_rtp_qdm2_depay_sink_template));
|
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2011-07-10 19:50:19 +00:00
|
|
|
"RTP QDM2 depayloader",
|
|
|
|
"Codec/Depayloader/Network/RTP",
|
|
|
|
"Extracts QDM2 audio from RTP packets (no RFC)",
|
|
|
|
"Edward Hervey <bilboed@bilboed.com>");
|
2009-08-02 11:42:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-07-10 19:50:19 +00:00
|
|
|
gst_rtp_qdm2_depay_init (GstRtpQDM2Depay * rtpqdm2depay)
|
2009-08-02 11:42:12 +00:00
|
|
|
{
|
|
|
|
rtpqdm2depay->adapter = gst_adapter_new ();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_rtp_qdm2_depay_finalize (GObject * object)
|
|
|
|
{
|
|
|
|
GstRtpQDM2Depay *rtpqdm2depay;
|
|
|
|
|
|
|
|
rtpqdm2depay = GST_RTP_QDM2_DEPAY (object);
|
|
|
|
|
|
|
|
g_object_unref (rtpqdm2depay->adapter);
|
|
|
|
rtpqdm2depay->adapter = NULL;
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
2012-09-10 12:31:02 +00:00
|
|
|
/* only on the sink */
|
2009-08-02 11:42:12 +00:00
|
|
|
gboolean
|
2011-11-11 11:25:01 +00:00
|
|
|
gst_rtp_qdm2_depay_setcaps (GstRTPBaseDepayload * filter, GstCaps * caps)
|
2009-08-02 11:42:12 +00:00
|
|
|
{
|
|
|
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
|
|
|
gint clock_rate;
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
2012-09-10 12:31:02 +00:00
|
|
|
clock_rate = 44100; /* default */
|
2009-08-02 11:42:12 +00:00
|
|
|
filter->clock_rate = clock_rate;
|
|
|
|
|
|
|
|
/* will set caps later */
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
flush_data (GstRtpQDM2Depay * depay)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
guint avail;
|
|
|
|
|
|
|
|
if ((avail = gst_adapter_available (depay->adapter)))
|
|
|
|
gst_adapter_flush (depay->adapter, avail);
|
|
|
|
|
|
|
|
GST_DEBUG ("Flushing %d packets", depay->nbpackets);
|
|
|
|
|
|
|
|
for (i = 0; depay->packets[i]; i++) {
|
|
|
|
QDM2Packet *pack = depay->packets[i];
|
2009-08-03 17:01:07 +00:00
|
|
|
guint32 crc = 0;
|
|
|
|
int i = 0;
|
2009-08-02 11:42:12 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
guint8 *data;
|
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
/* CRC is the sum of everything (including first bytes) */
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
data = pack->data;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (data == NULL))
|
|
|
|
continue;
|
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
/* If the packet size is bigger than 0xff, we need 2 bytes to store the size */
|
2009-08-02 11:42:12 +00:00
|
|
|
if (depay->packetsize > 0xff) {
|
2009-08-03 17:01:07 +00:00
|
|
|
/* Expanded size 0x02 | 0x80 */
|
|
|
|
data[0] = 0x82;
|
2009-08-02 11:42:12 +00:00
|
|
|
GST_WRITE_UINT16_BE (data + 1, depay->packetsize - 3);
|
|
|
|
} else {
|
2009-08-03 17:01:07 +00:00
|
|
|
data[0] = 0x2;
|
2009-08-02 11:42:12 +00:00
|
|
|
data[1] = depay->packetsize - 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calculate CRC */
|
|
|
|
for (; i < depay->packetsize; i++)
|
|
|
|
crc += data[i];
|
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
GST_DEBUG ("CRC is 0x%x", crc);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
/* Write CRC */
|
2009-08-02 11:42:12 +00:00
|
|
|
if (depay->packetsize > 0xff)
|
|
|
|
GST_WRITE_UINT16_BE (data + 3, crc);
|
|
|
|
else
|
|
|
|
GST_WRITE_UINT16_BE (data + 2, crc);
|
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
GST_MEMDUMP ("Extracted packet", data, depay->packetsize);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
buf = gst_buffer_new ();
|
2012-03-30 16:13:08 +00:00
|
|
|
gst_buffer_append_memory (buf,
|
2012-02-22 01:06:17 +00:00
|
|
|
gst_memory_new_wrapped (0, data, depay->packetsize, 0,
|
|
|
|
depay->packetsize, data, g_free));
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
gst_adapter_push (depay->adapter, buf);
|
|
|
|
|
|
|
|
if (pack->data) {
|
|
|
|
pack->data = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_packet (GstRtpQDM2Depay * depay, guint32 pid, guint32 len, guint8 * data)
|
|
|
|
{
|
|
|
|
QDM2Packet *packet;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!depay->configured))
|
|
|
|
return;
|
|
|
|
|
|
|
|
GST_DEBUG ("pid:%d, len:%d, data:%p", pid, len, data);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (depay->packets[pid] == NULL)) {
|
|
|
|
depay->packets[pid] = g_malloc0 (sizeof (QDM2Packet));
|
|
|
|
depay->nbpackets = MAX (depay->nbpackets, pid + 1);
|
|
|
|
}
|
|
|
|
packet = depay->packets[pid];
|
|
|
|
|
|
|
|
GST_DEBUG ("packet:%p", packet);
|
|
|
|
GST_DEBUG ("packet->data:%p", packet->data);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (packet->data == NULL)) {
|
|
|
|
packet->data = g_malloc0 (depay->packetsize);
|
|
|
|
/* We leave space for the header/crc */
|
|
|
|
if (depay->packetsize > 0xff)
|
|
|
|
packet->offs = 5;
|
|
|
|
else
|
|
|
|
packet->offs = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finally copy the data over */
|
|
|
|
memcpy (packet->data + packet->offs, data, len);
|
|
|
|
packet->offs += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
2011-11-11 11:25:01 +00:00
|
|
|
gst_rtp_qdm2_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
|
2009-08-02 11:42:12 +00:00
|
|
|
{
|
|
|
|
GstRtpQDM2Depay *rtpqdm2depay;
|
2011-07-10 19:50:19 +00:00
|
|
|
GstBuffer *outbuf = NULL;
|
2009-08-03 19:22:48 +00:00
|
|
|
guint16 seq;
|
2011-12-05 17:39:59 +00:00
|
|
|
GstRTPBuffer rtp = { NULL };
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
rtpqdm2depay = GST_RTP_QDM2_DEPAY (depayload);
|
|
|
|
|
|
|
|
{
|
|
|
|
gint payload_len;
|
|
|
|
guint8 *payload;
|
|
|
|
guint avail;
|
|
|
|
guint pos = 0;
|
|
|
|
|
2011-07-10 19:50:19 +00:00
|
|
|
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
|
|
|
|
payload_len = gst_rtp_buffer_get_payload_len (&rtp);
|
2009-08-02 11:42:12 +00:00
|
|
|
if (payload_len < 3)
|
|
|
|
goto bad_packet;
|
|
|
|
|
2011-07-10 19:50:19 +00:00
|
|
|
payload = gst_rtp_buffer_get_payload (&rtp);
|
|
|
|
seq = gst_rtp_buffer_get_seq (&rtp);
|
2009-08-03 19:22:48 +00:00
|
|
|
if (G_UNLIKELY (seq != rtpqdm2depay->nextseq)) {
|
|
|
|
GST_DEBUG ("GAP in sequence number, Resetting data !");
|
|
|
|
/* Flush previous data */
|
|
|
|
flush_data (rtpqdm2depay);
|
|
|
|
/* And store new timestamp */
|
|
|
|
rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp;
|
|
|
|
rtpqdm2depay->timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
/* And that previous data will be pushed at the bottom */
|
|
|
|
}
|
|
|
|
rtpqdm2depay->nextseq = seq + 1;
|
2009-08-02 11:42:12 +00:00
|
|
|
|
2009-08-03 19:22:48 +00:00
|
|
|
GST_DEBUG ("Payload size %d 0x%x sequence:%d", payload_len, payload_len,
|
|
|
|
seq);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
GST_MEMDUMP ("Incoming payload", payload, payload_len);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
while (pos < payload_len) {
|
|
|
|
switch (payload[pos]) {
|
|
|
|
case 0x80:{
|
|
|
|
GST_DEBUG ("Unrecognized 0x80 marker, skipping 12 bytes");
|
|
|
|
pos += 12;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0xff:
|
|
|
|
/* HEADERS */
|
|
|
|
GST_DEBUG ("Headers");
|
|
|
|
/* Store the incoming timestamp */
|
|
|
|
rtpqdm2depay->ptimestamp = rtpqdm2depay->timestamp;
|
|
|
|
rtpqdm2depay->timestamp = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
/* flush the internal data if needed */
|
|
|
|
flush_data (rtpqdm2depay);
|
|
|
|
if (G_UNLIKELY (!rtpqdm2depay->configured)) {
|
|
|
|
guint8 *ourdata;
|
|
|
|
GstBuffer *codecdata;
|
2012-01-23 16:25:37 +00:00
|
|
|
GstMapInfo cmap;
|
2009-08-02 11:42:12 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
/* First bytes are unknown */
|
2009-08-03 17:01:07 +00:00
|
|
|
GST_MEMDUMP ("Header", payload + pos, 32);
|
2009-08-02 11:42:12 +00:00
|
|
|
ourdata = payload + pos + 10;
|
|
|
|
pos += 10;
|
|
|
|
rtpqdm2depay->channs = GST_READ_UINT32_BE (payload + pos + 4);
|
|
|
|
rtpqdm2depay->samplerate = GST_READ_UINT32_BE (payload + pos + 8);
|
|
|
|
rtpqdm2depay->bitrate = GST_READ_UINT32_BE (payload + pos + 12);
|
|
|
|
rtpqdm2depay->blocksize = GST_READ_UINT32_BE (payload + pos + 16);
|
|
|
|
rtpqdm2depay->framesize = GST_READ_UINT32_BE (payload + pos + 20);
|
|
|
|
rtpqdm2depay->packetsize = GST_READ_UINT32_BE (payload + pos + 24);
|
|
|
|
/* 16 bit empty block (0x02 0x00) */
|
|
|
|
pos += 30;
|
|
|
|
GST_DEBUG
|
|
|
|
("channs:%d, samplerate:%d, bitrate:%d, blocksize:%d, framesize:%d, packetsize:%d",
|
|
|
|
rtpqdm2depay->channs, rtpqdm2depay->samplerate,
|
|
|
|
rtpqdm2depay->bitrate, rtpqdm2depay->blocksize,
|
|
|
|
rtpqdm2depay->framesize, rtpqdm2depay->packetsize);
|
2009-08-03 17:01:07 +00:00
|
|
|
|
|
|
|
/* Caps */
|
2009-08-02 11:42:12 +00:00
|
|
|
codecdata = gst_buffer_new_and_alloc (48);
|
2012-01-23 16:25:37 +00:00
|
|
|
gst_buffer_map (codecdata, &cmap, GST_MAP_WRITE);
|
|
|
|
memcpy (cmap.data, headheader, 20);
|
|
|
|
memcpy (cmap.data + 20, ourdata, 28);
|
|
|
|
gst_buffer_unmap (codecdata, &cmap);
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/x-qdm2",
|
|
|
|
"samplesize", G_TYPE_INT, 16,
|
|
|
|
"rate", G_TYPE_INT, rtpqdm2depay->samplerate,
|
|
|
|
"channels", G_TYPE_INT, rtpqdm2depay->channs,
|
|
|
|
"codec_data", GST_TYPE_BUFFER, codecdata, NULL);
|
2011-11-11 11:25:01 +00:00
|
|
|
gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depayload), caps);
|
2009-08-02 11:42:12 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
rtpqdm2depay->configured = TRUE;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Already configured, skipping headers");
|
|
|
|
pos += 40;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:{
|
|
|
|
/* Shuffled packet contents */
|
|
|
|
guint packetid = payload[pos++];
|
|
|
|
guint packettype = payload[pos++];
|
|
|
|
guint packlen = payload[pos++];
|
|
|
|
guint hsize = 2;
|
|
|
|
|
|
|
|
GST_DEBUG ("Packet id:%d, type:0x%x, len:%d",
|
|
|
|
packetid, packettype, packlen);
|
|
|
|
|
|
|
|
/* Packets bigger than 0xff bytes have a type with the high bit set */
|
|
|
|
if (G_UNLIKELY (packettype & 0x80)) {
|
|
|
|
packettype &= 0x7f;
|
|
|
|
packlen <<= 8;
|
|
|
|
packlen |= payload[pos++];
|
|
|
|
hsize = 3;
|
|
|
|
GST_DEBUG ("Packet id:%d, type:0x%x, len:%d",
|
|
|
|
packetid, packettype, packlen);
|
|
|
|
}
|
|
|
|
|
2009-08-03 17:01:07 +00:00
|
|
|
if (packettype > 0x7f) {
|
2009-08-02 11:42:12 +00:00
|
|
|
GST_ERROR ("HOUSTON WE HAVE A PROBLEM !!!!");
|
|
|
|
}
|
|
|
|
add_packet (rtpqdm2depay, packetid, packlen + hsize,
|
|
|
|
payload + pos - hsize);
|
|
|
|
pos += packlen;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("final pos %d", pos);
|
|
|
|
|
|
|
|
avail = gst_adapter_available (rtpqdm2depay->adapter);
|
|
|
|
if (G_UNLIKELY (avail)) {
|
2009-08-04 09:17:17 +00:00
|
|
|
GST_DEBUG ("Pushing out %d bytes of collected data", avail);
|
2009-08-02 11:42:12 +00:00
|
|
|
outbuf = gst_adapter_take_buffer (rtpqdm2depay->adapter, avail);
|
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = rtpqdm2depay->ptimestamp;
|
2009-08-03 19:22:48 +00:00
|
|
|
GST_DEBUG ("Outgoing buffer timestamp %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (rtpqdm2depay->ptimestamp));
|
2009-08-02 11:42:12 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-10 19:50:19 +00:00
|
|
|
|
|
|
|
gst_rtp_buffer_unmap (&rtp);
|
|
|
|
return outbuf;
|
2009-08-02 11:42:12 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
bad_packet:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_WARNING (rtpqdm2depay, STREAM, DECODE,
|
|
|
|
(NULL), ("Packet was too short"));
|
2011-07-10 19:50:19 +00:00
|
|
|
gst_rtp_buffer_unmap (&rtp);
|
2009-08-02 11:42:12 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_rtp_qdm2_depay_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstRtpQDM2Depay *rtpqdm2depay;
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
rtpqdm2depay = GST_RTP_QDM2_DEPAY (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
|
|
|
gst_adapter_clear (rtpqdm2depay->adapter);
|
|
|
|
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_qdm2_depay_plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2009-08-03 19:21:39 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (rtpqdm2depay_debug, "rtpqdm2depay", 0,
|
|
|
|
"RTP QDM2 depayloader");
|
|
|
|
|
2009-08-02 11:42:12 +00:00
|
|
|
return gst_element_register (plugin, "rtpqdm2depay",
|
2010-12-21 15:49:28 +00:00
|
|
|
GST_RANK_SECONDARY, GST_TYPE_RTP_QDM2_DEPAY);
|
2009-08-02 11:42:12 +00:00
|
|
|
}
|