Commit 24c5812d authored by Wim Taymans's avatar Wim Taymans

gst/rtp/: Make sure we configure the clock_rate in the baseclass in the...

gst/rtp/: Make sure we configure the clock_rate in the baseclass in the setcaps function. Fixes #431282.

Original commit message from CVS:
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_set_property):
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_init),
(gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process):
* gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_init),
(gst_rtp_gsm_depay_setcaps):
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps):
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_setcaps):
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_class_init),
(gst_rtp_ilbc_depay_init), (gst_rtp_ilbc_depay_setcaps),
(gst_rtp_ilbc_depay_process), (gst_ilbc_depay_set_property),
(gst_ilbc_depay_get_property):
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_setcaps):
* gst/rtp/gstrtpmp4adepay.c:
* gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_init),
(gst_rtp_pcma_depay_setcaps):
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_init),
(gst_rtp_pcmu_depay_setcaps):
Make sure we configure the clock_rate in the baseclass in the setcaps
function. Fixes #431282.
parent 1beeda3f
2007-04-25 Wim Taymans <wim@fluendo.com>
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_set_property):
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_init),
(gst_rtp_amr_depay_setcaps), (gst_rtp_amr_depay_process):
* gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_init),
(gst_rtp_gsm_depay_setcaps):
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps):
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_setcaps):
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_class_init),
(gst_rtp_ilbc_depay_init), (gst_rtp_ilbc_depay_setcaps),
(gst_rtp_ilbc_depay_process), (gst_ilbc_depay_set_property),
(gst_ilbc_depay_get_property):
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_setcaps):
* gst/rtp/gstrtpmp4adepay.c:
* gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_init),
(gst_rtp_pcma_depay_setcaps):
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_init),
(gst_rtp_pcmu_depay_setcaps):
Make sure we configure the clock_rate in the baseclass in the setcaps
function. Fixes #431282.
2007-04-25 Wim Taymans <wim@fluendo.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_finalize),
......
......@@ -260,6 +260,7 @@ gst_rtp_L16_depay_set_property (GObject * object, guint prop_id,
switch (prop_id) {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
......
......@@ -136,7 +136,6 @@ gst_rtp_amr_depay_init (GstRtpAMRDepay * rtpamrdepay,
depayload = GST_BASE_RTP_DEPAYLOAD (rtpamrdepay);
depayload->clock_rate = 8000;
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
}
......@@ -148,7 +147,7 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
GstRtpAMRDepay *rtpamrdepay;
const gchar *params;
const gchar *str;
gint clock_rate;
gint clock_rate = 8000; /* default */
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
......@@ -195,8 +194,7 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
rtpamrdepay->channels = atoi (params);
}
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = 8000;
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
/* we require 1 channel, 8000 Hz, octet aligned, no CRC,
......
......@@ -103,19 +103,26 @@ static void
gst_rtp_gsm_depay_init (GstRTPGSMDepay * rtpgsmdepay,
GstRTPGSMDepayClass * klass)
{
GST_BASE_RTP_DEPAYLOAD (rtpgsmdepay)->clock_rate = 8000;
}
static gboolean
gst_rtp_gsm_depay_setcaps (GstBaseRTPDepayload * _depayload, GstCaps * caps)
gst_rtp_gsm_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
GstCaps *srccaps;
gboolean ret;
GstStructure *structure;
gint clock_rate = 8000; /* default */
srccaps = gst_static_pad_template_get_caps (&gst_rtp_gsm_depay_src_template);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (_depayload), srccaps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("audio/x-gsm",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
return ret;
}
......
......@@ -142,17 +142,22 @@ gst_rtp_h263p_depay_finalize (GObject * object)
gboolean
gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
{
GstCaps *srccaps;
GstStructure *structure = gst_caps_get_structure (caps, 0);
gint clock_rate = 90000; /* default */
gst_structure_get_int (structure, "clock-rate", &clock_rate);
filter->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("video/x-h263",
"variant", G_TYPE_STRING, "itu",
"h263version", G_TYPE_STRING, "h263p", NULL);
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (filter), srccaps);
gst_caps_unref (srccaps);
return TRUE;
}
static GstBuffer *
gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
......
......@@ -220,8 +220,7 @@ gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
rtph264depay = GST_RTP_H264_DEPAY (depayload);
if (gst_structure_has_field (structure, "clock-rate"))
gst_structure_get_int (structure, "clock-rate", &clock_rate);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("video/x-h264", NULL);
......
......@@ -39,12 +39,15 @@ enum
LAST_SIGNAL
};
#define DEFAULT_MODE GST_ILBC_MODE_30
enum
{
ARG_0,
ARG_MODE
PROP_0,
PROP_MODE
};
/* FIXME, mode should be string because it is a parameter in SDP fmtp */
static GstStaticPadTemplate gst_rtp_ilbc_depay_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
......@@ -119,11 +122,10 @@ gst_rtp_ilbc_depay_class_init (GstRTPiLBCDepayClass * klass)
gobject_class->set_property = gst_ilbc_depay_set_property;
gobject_class->get_property = gst_ilbc_depay_get_property;
g_object_class_install_property (gobject_class, ARG_MODE, g_param_spec_enum ("mode", "Mode", "iLBC frame mode", GST_TYPE_ILBC_MODE, /* enum type */
GST_ILBC_MODE_30, /* default value */
G_PARAM_READWRITE));
parent_class = g_type_class_peek_parent (klass);
/* FIXME, mode is in the caps */
g_object_class_install_property (gobject_class, PROP_MODE,
g_param_spec_enum ("mode", "Mode", "iLBC frame mode",
GST_TYPE_ILBC_MODE, DEFAULT_MODE, G_PARAM_READWRITE));
gstbasertpdepayload_class->process = gst_rtp_ilbc_depay_process;
gstbasertpdepayload_class->set_caps = gst_rtp_ilbc_depay_setcaps;
......@@ -137,10 +139,8 @@ gst_rtp_ilbc_depay_init (GstRTPiLBCDepay * rtpilbcdepay,
depayload = GST_BASE_RTP_DEPAYLOAD (rtpilbcdepay);
depayload->clock_rate = 8000;
/* Set default mode to 30 */
rtpilbcdepay->mode = GST_ILBC_MODE_30;
/* Set default mode */
rtpilbcdepay->mode = DEFAULT_MODE;
}
static gboolean
......@@ -149,26 +149,33 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (depayload);
GstCaps *srccaps;
GstStructure *structure;
gint mode;
gboolean ret;
srccaps = gst_caps_copy (gst_static_pad_template_get_caps
(&gst_rtp_ilbc_depay_src_template));
structure = gst_caps_get_structure (srccaps, 0);
gst_structure_set (structure, "mode", G_TYPE_INT,
rtpilbcdepay->mode == GST_ILBC_MODE_30 ? 30 : 20, NULL);
structure = gst_caps_get_structure (caps, 0);
/* parse mode, if we can */
mode = rtpilbcdepay->mode;
gst_structure_get_int (structure, "mode", &mode);
rtpilbcdepay->mode = mode;
srccaps = gst_caps_new_simple ("audio/x-iLBC",
"mode", G_TYPE_INT, rtpilbcdepay->mode, NULL);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
GST_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret);
gst_caps_unref (srccaps);
/* always fixed clock rate of 8000 */
depayload->clock_rate = 8000;
return ret;
}
static GstBuffer *
gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstBuffer *outbuf = NULL;
GstBuffer *outbuf;
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
GST_BUFFER_SIZE (buf),
......@@ -187,7 +194,7 @@ gst_ilbc_depay_set_property (GObject * object,
GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (object);
switch (prop_id) {
case ARG_MODE:
case PROP_MODE:
rtpilbcdepay->mode = g_value_get_enum (value);
break;
default:
......@@ -203,7 +210,7 @@ gst_ilbc_depay_get_property (GObject * object,
GstRTPiLBCDepay *rtpilbcdepay = GST_RTP_ILBC_DEPAY (object);
switch (prop_id) {
case ARG_MODE:
case PROP_MODE:
g_value_set_enum (value, rtpilbcdepay->mode);
break;
default:
......
......@@ -149,7 +149,7 @@ gst_rtp_mp2t_depay_init (GstRtpMP2TDepay * depayload,
static gboolean
gst_rtp_mp2t_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
GstCaps *srccaps;
GstStructure *structure;
GstRtpMP2TDepay *rtpmp2tdepay;
gint clock_rate = 90000; /* default */
......@@ -157,13 +157,15 @@ gst_rtp_mp2t_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_has_field (structure, "clock-rate")) {
gst_structure_get_int (structure, "clock-rate", &clock_rate);
}
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("video/mpegts",
"packetsize", G_TYPE_INT, 188,
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
return TRUE;
}
......
......@@ -148,7 +148,6 @@ gst_rtp_mp4a_depay_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static gboolean
gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
......
......@@ -112,7 +112,6 @@ gst_rtp_pcma_depay_init (GstRtpPcmaDepay * rtppcmadepay,
depayload = GST_BASE_RTP_DEPAYLOAD (rtppcmadepay);
depayload->clock_rate = 8000;
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
}
......@@ -120,11 +119,17 @@ static gboolean
gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
GstCaps *srccaps;
GstStructure *structure;
gboolean ret;
gint clock_rate = 8000; /* default */
srccaps = gst_caps_new_simple ("audio/x-alaw",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("audio/x-alaw",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
......
......@@ -112,7 +112,6 @@ gst_rtp_pcmu_depay_init (GstRtpPcmuDepay * rtppcmudepay,
depayload = GST_BASE_RTP_DEPAYLOAD (rtppcmudepay);
depayload->clock_rate = 8000;
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
}
......@@ -120,11 +119,17 @@ static gboolean
gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
GstCaps *srccaps;
GstStructure *structure;
gboolean ret;
gint clock_rate = 8000; /* default */
srccaps = gst_caps_new_simple ("audio/x-mulaw",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("audio/x-mulaw",
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment