mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
gst/rtp/gstrtpamrdepay.*: rtpamrdec isn't a subclass of GstBaseRtpDepayload.
Original commit message from CVS: Patch by: Sebastien Cote <sebas642 at yahoo dot ca> * gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_base_init), (gst_rtp_amr_depay_class_init), (gst_rtp_amr_depay_init), (gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process): * gst/rtp/gstrtpamrdepay.h: rtpamrdec isn't a subclass of GstBaseRtpDepayload. Fixes #321191
This commit is contained in:
parent
197d6a6cb0
commit
0d462be70a
3 changed files with 51 additions and 144 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2006-07-14 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
Patch by: Sebastien Cote <sebas642 at yahoo dot ca>
|
||||||
|
|
||||||
|
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_base_init),
|
||||||
|
(gst_rtp_amr_depay_class_init), (gst_rtp_amr_depay_init),
|
||||||
|
(gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process):
|
||||||
|
* gst/rtp/gstrtpamrdepay.h:
|
||||||
|
rtpamrdec isn't a subclass of GstBaseRtpDepayload.
|
||||||
|
Fixes #321191
|
||||||
|
|
||||||
2006-07-14 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
2006-07-14 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||||
|
|
||||||
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get),
|
* sys/ximage/gstximagesrc.c: (gst_ximage_src_ximage_get),
|
||||||
|
|
|
@ -49,8 +49,7 @@ enum
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ARG_0,
|
ARG_0
|
||||||
ARG_FREQUENCY
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* input is an RTP packet
|
/* input is an RTP packet
|
||||||
|
@ -87,50 +86,16 @@ GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
GST_STATIC_CAPS ("audio/AMR, " "channels = (int) 1," "rate = (int) 8000")
|
GST_STATIC_CAPS ("audio/AMR, " "channels = (int) 1," "rate = (int) 8000")
|
||||||
);
|
);
|
||||||
|
|
||||||
static void gst_rtp_amr_depay_class_init (GstRtpAMRDepayClass * klass);
|
static gboolean gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload,
|
||||||
static void gst_rtp_amr_depay_base_init (GstRtpAMRDepayClass * klass);
|
GstCaps * caps);
|
||||||
static void gst_rtp_amr_depay_init (GstRtpAMRDepay * rtpamrdepay);
|
static GstBuffer *gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload,
|
||||||
|
GstBuffer * buf);
|
||||||
|
|
||||||
static gboolean gst_rtp_amr_depay_sink_setcaps (GstPad * pad, GstCaps * caps);
|
GST_BOILERPLATE (GstRtpAMRDepay, gst_rtp_amr_depay, GstBaseRTPDepayload,
|
||||||
static GstFlowReturn gst_rtp_amr_depay_chain (GstPad * pad, GstBuffer * buffer);
|
GST_TYPE_BASE_RTP_DEPAYLOAD);
|
||||||
|
|
||||||
static void gst_rtp_amr_depay_set_property (GObject * object, guint prop_id,
|
|
||||||
const GValue * value, GParamSpec * pspec);
|
|
||||||
static void gst_rtp_amr_depay_get_property (GObject * object, guint prop_id,
|
|
||||||
GValue * value, GParamSpec * pspec);
|
|
||||||
|
|
||||||
static GstStateChangeReturn gst_rtp_amr_depay_change_state (GstElement *
|
|
||||||
element, GstStateChange transition);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
|
|
||||||
static GType
|
|
||||||
gst_rtp_amr_depay_get_type (void)
|
|
||||||
{
|
|
||||||
static GType rtpamrdepay_type = 0;
|
|
||||||
|
|
||||||
if (!rtpamrdepay_type) {
|
|
||||||
static const GTypeInfo rtpamrdepay_info = {
|
|
||||||
sizeof (GstRtpAMRDepayClass),
|
|
||||||
(GBaseInitFunc) gst_rtp_amr_depay_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_rtp_amr_depay_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstRtpAMRDepay),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_rtp_amr_depay_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
rtpamrdepay_type =
|
|
||||||
g_type_register_static (GST_TYPE_ELEMENT, "GstRtpAMRDepay",
|
|
||||||
&rtpamrdepay_info, 0);
|
|
||||||
}
|
|
||||||
return rtpamrdepay_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_amr_depay_base_init (GstRtpAMRDepayClass * klass)
|
gst_rtp_amr_depay_base_init (gpointer klass)
|
||||||
{
|
{
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
|
@ -147,45 +112,41 @@ gst_rtp_amr_depay_class_init (GstRtpAMRDepayClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
GstBaseRTPDepayloadClass *gstbasertpdepayload_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
gstelement_class = (GstElementClass *) klass;
|
gstelement_class = (GstElementClass *) klass;
|
||||||
|
gstbasertpdepayload_class = (GstBaseRTPDepayloadClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
parent_class = g_type_class_peek_parent (klass);
|
||||||
|
|
||||||
gobject_class->set_property = gst_rtp_amr_depay_set_property;
|
gstbasertpdepayload_class->process = gst_rtp_amr_depay_process;
|
||||||
gobject_class->get_property = gst_rtp_amr_depay_get_property;
|
gstbasertpdepayload_class->set_caps = gst_rtp_amr_depay_setcaps;
|
||||||
|
|
||||||
gstelement_class->change_state = gst_rtp_amr_depay_change_state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_amr_depay_init (GstRtpAMRDepay * rtpamrdepay)
|
gst_rtp_amr_depay_init (GstRtpAMRDepay * rtpamrdepay,
|
||||||
|
GstRtpAMRDepayClass * klass)
|
||||||
{
|
{
|
||||||
rtpamrdepay->srcpad =
|
GstBaseRTPDepayload *depayload;
|
||||||
gst_pad_new_from_static_template (&gst_rtp_amr_depay_src_template, "src");
|
|
||||||
|
|
||||||
gst_element_add_pad (GST_ELEMENT (rtpamrdepay), rtpamrdepay->srcpad);
|
depayload = GST_BASE_RTP_DEPAYLOAD (rtpamrdepay);
|
||||||
|
|
||||||
rtpamrdepay->sinkpad =
|
depayload->clock_rate = 8000;
|
||||||
gst_pad_new_from_static_template (&gst_rtp_amr_depay_sink_template,
|
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
|
||||||
"sink");
|
|
||||||
gst_pad_set_setcaps_function (rtpamrdepay->sinkpad,
|
|
||||||
gst_rtp_amr_depay_sink_setcaps);
|
|
||||||
gst_pad_set_chain_function (rtpamrdepay->sinkpad, gst_rtp_amr_depay_chain);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (rtpamrdepay), rtpamrdepay->sinkpad);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_amr_depay_sink_setcaps (GstPad * pad, GstCaps * caps)
|
gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstRtpAMRDepay *rtpamrdepay;
|
GstRtpAMRDepay *rtpamrdepay;
|
||||||
const gchar *params;
|
const gchar *params;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
|
gint clock_rate;
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (GST_OBJECT_PARENT (pad));
|
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
|
@ -230,14 +191,14 @@ gst_rtp_amr_depay_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
rtpamrdepay->channels = atoi (params);
|
rtpamrdepay->channels = atoi (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_structure_get_int (structure, "clock-rate", &rtpamrdepay->rate))
|
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||||
rtpamrdepay->rate = 8000;
|
clock_rate = 8000;
|
||||||
|
|
||||||
/* we require 1 channel, 8000 Hz, octet aligned, no CRC,
|
/* we require 1 channel, 8000 Hz, octet aligned, no CRC,
|
||||||
* no robust sorting, no interleaving for now */
|
* no robust sorting, no interleaving for now */
|
||||||
if (rtpamrdepay->channels != 1)
|
if (rtpamrdepay->channels != 1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (rtpamrdepay->rate != 8000)
|
if (clock_rate != 8000)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (rtpamrdepay->octet_align != TRUE)
|
if (rtpamrdepay->octet_align != TRUE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -248,8 +209,8 @@ gst_rtp_amr_depay_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/AMR",
|
srccaps = gst_caps_new_simple ("audio/AMR",
|
||||||
"channels", G_TYPE_INT, rtpamrdepay->channels,
|
"channels", G_TYPE_INT, rtpamrdepay->channels,
|
||||||
"rate", G_TYPE_INT, rtpamrdepay->rate, NULL);
|
"rate", G_TYPE_INT, clock_rate, NULL);
|
||||||
gst_pad_set_caps (rtpamrdepay->srcpad, srccaps);
|
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
rtpamrdepay->negotiated = TRUE;
|
rtpamrdepay->negotiated = TRUE;
|
||||||
|
@ -263,14 +224,13 @@ static gint frame_size[16] = {
|
||||||
5, -1, -1, -1, -1, -1, -1, 0
|
5, -1, -1, -1, -1, -1, -1, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstBuffer *
|
||||||
gst_rtp_amr_depay_chain (GstPad * pad, GstBuffer * buf)
|
gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstRtpAMRDepay *rtpamrdepay;
|
GstRtpAMRDepay *rtpamrdepay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf = NULL;
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (GST_OBJECT_PARENT (pad));
|
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
|
||||||
|
|
||||||
if (!rtpamrdepay->negotiated)
|
if (!rtpamrdepay->negotiated)
|
||||||
goto not_negotiated;
|
goto not_negotiated;
|
||||||
|
@ -389,7 +349,8 @@ gst_rtp_amr_depay_chain (GstPad * pad, GstBuffer * buf)
|
||||||
|
|
||||||
outbuf = gst_buffer_new_and_alloc (payload_len);
|
outbuf = gst_buffer_new_and_alloc (payload_len);
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) =
|
GST_BUFFER_TIMESTAMP (outbuf) =
|
||||||
gst_util_uint64_scale_int (timestamp, GST_SECOND, rtpamrdepay->rate);
|
gst_util_uint64_scale_int (timestamp, GST_SECOND,
|
||||||
|
depayload->clock_rate);
|
||||||
|
|
||||||
/* point to destination */
|
/* point to destination */
|
||||||
p = GST_BUFFER_DATA (outbuf);
|
p = GST_BUFFER_DATA (outbuf);
|
||||||
|
@ -415,91 +376,29 @@ gst_rtp_amr_depay_chain (GstPad * pad, GstBuffer * buf)
|
||||||
dp += fr_size;
|
dp += fr_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (rtpamrdepay->srcpad));
|
gst_buffer_set_caps (outbuf,
|
||||||
|
GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload)));
|
||||||
|
|
||||||
GST_DEBUG ("gst_rtp_amr_depay_chain: pushing buffer of size %d",
|
GST_DEBUG ("gst_rtp_amr_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
ret = gst_pad_push (rtpamrdepay->srcpad, outbuf);
|
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
not_negotiated:
|
not_negotiated:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (rtpamrdepay, STREAM, NOT_IMPLEMENTED,
|
GST_ELEMENT_ERROR (rtpamrdepay, STREAM, NOT_IMPLEMENTED,
|
||||||
(NULL), ("not negotiated"));
|
(NULL), ("not negotiated"));
|
||||||
gst_buffer_unref (buf);
|
return NULL;
|
||||||
return GST_FLOW_NOT_NEGOTIATED;
|
|
||||||
}
|
}
|
||||||
bad_packet:
|
bad_packet:
|
||||||
{
|
{
|
||||||
gst_buffer_unref (buf);
|
|
||||||
/* no fatal error */
|
/* no fatal error */
|
||||||
return GST_FLOW_OK;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_rtp_amr_depay_set_property (GObject * object, guint prop_id,
|
|
||||||
const GValue * value, GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstRtpAMRDepay *rtpamrdepay;
|
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_rtp_amr_depay_get_property (GObject * object, guint prop_id, GValue * value,
|
|
||||||
GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstRtpAMRDepay *rtpamrdepay;
|
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_rtp_amr_depay_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstRtpAMRDepay *rtpamrdepay;
|
|
||||||
GstStateChangeReturn ret;
|
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_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
|
gboolean
|
||||||
gst_rtp_amr_depay_plugin_init (GstPlugin * plugin)
|
gst_rtp_amr_depay_plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#define __GST_RTP_AMR_DEPAY_H__
|
#define __GST_RTP_AMR_DEPAY_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
#include <gst/rtp/gstbasertpdepayload.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -40,10 +41,7 @@ typedef struct _GstRtpAMRDepayClass GstRtpAMRDepayClass;
|
||||||
|
|
||||||
struct _GstRtpAMRDepay
|
struct _GstRtpAMRDepay
|
||||||
{
|
{
|
||||||
GstElement element;
|
GstBaseRTPDepayload depayload;
|
||||||
|
|
||||||
GstPad *sinkpad;
|
|
||||||
GstPad *srcpad;
|
|
||||||
|
|
||||||
gboolean negotiated;
|
gboolean negotiated;
|
||||||
|
|
||||||
|
@ -57,12 +55,11 @@ struct _GstRtpAMRDepay
|
||||||
gboolean interleaving;
|
gboolean interleaving;
|
||||||
gint ptime;
|
gint ptime;
|
||||||
gint channels;
|
gint channels;
|
||||||
gint rate;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRtpAMRDepayClass
|
struct _GstRtpAMRDepayClass
|
||||||
{
|
{
|
||||||
GstElementClass parent_class;
|
GstBaseRTPDepayloadClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
gboolean gst_rtp_amr_depay_plugin_init (GstPlugin * plugin);
|
gboolean gst_rtp_amr_depay_plugin_init (GstPlugin * plugin);
|
||||||
|
|
Loading…
Reference in a new issue