Commit 2428a1ca authored by Wim Taymans's avatar Wim Taymans

gst/rtp/gstrtpL16depay.c: Check if clock-rate and channels are valid.

Original commit message from CVS:
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_setcaps),
(gst_rtp_L16_depay_process):
Check if clock-rate and channels are valid.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpL16pay.c: (gst_rtp_L16_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpac3depay.c: (gst_rtp_ac3_depay_setcaps),
(gst_rtp_ac3_depay_process):
Don't ignore the return value of set_caps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_setcaps),
(gst_rtp_amr_depay_process):
* gst/rtp/gstrtpamrdepay.h:
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set output caps on the buffers, the base class does that for
us.
The subclass will make sure we are negotiated.
* gst/rtp/gstrtpdvdepay.c: (gst_rtp_dv_depay_setcaps),
(gst_rtp_dv_depay_process), (gst_rtp_dv_depay_reset):
* gst/rtp/gstrtpdvdepay.h:
Clean up caps negotiation.
The subclass will make sure we are negotiated.
* gst/rtp/gstrtpg726depay.c: (gst_rtp_g726_depay_setcaps),
(gst_rtp_g726_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpg729depay.c: (gst_rtp_g729_depay_init),
(gst_rtp_g729_depay_setcaps), (gst_rtp_g729_depay_process):
* gst/rtp/gstrtpg729depay.h:
The subclass will make sure we are negotiated.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_setcaps),
(gst_rtp_gsm_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpgsmpay.c: (gst_rtp_gsm_pay_setcaps):
Clean up caps negotiation.
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtph263depay.c: (gst_rtp_h263_depay_setcaps),
(gst_rtp_h263_depay_process):
Clean up caps negotiation.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph263pay.c: (gst_rtp_h263_pay_setcaps),
(gst_rtp_h263_pay_flush), (gst_rtp_h263_pay_handle_buffer):
* gst/rtp/gstrtph263pay.h:
Don't ignore the return value of set_outcaps.
Do some more timestamps.
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps),
(gst_rtp_h263p_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph263ppay.c: (gst_rtp_h263p_pay_class_init),
(gst_rtp_h263p_pay_setcaps), (gst_rtp_h263p_pay_flush),
(gst_rtp_h263p_pay_handle_buffer):
* gst/rtp/gstrtph263ppay.h:
Don't ignore the return value of set_outcaps.
Do some more timestamps.
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_setcaps),
(gst_rtp_h264_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
Fix possible caps leak.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph264pay.c: (gst_rtp_h264_pay_setcaps):
Add some more debug info.
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_setcaps),
(gst_rtp_ilbc_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_sink_setcaps):
Clean up caps negotiation.
* gst/rtp/gstrtpmp1sdepay.c: (gst_rtp_mp1s_depay_setcaps),
(gst_rtp_mp1s_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_setcaps),
(gst_rtp_mp2t_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4adepay.c: (gst_rtp_mp4a_depay_setcaps),
(gst_rtp_mp4a_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpmp4apay.c: (gst_rtp_mp4a_pay_new_caps),
(gst_rtp_mp4a_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_setcaps),
(gst_rtp_mp4g_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize),
(gst_rtp_mp4g_pay_new_caps), (gst_rtp_mp4g_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmp4vdepay.c: (gst_rtp_mp4v_depay_setcaps),
(gst_rtp_mp4v_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_new_caps),
(gst_rtp_mp4v_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_setcaps),
(gst_rtp_mpa_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpmpapay.c: (gst_rtp_mpa_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmpvdepay.c: (gst_rtp_mpv_depay_setcaps),
(gst_rtp_mpv_depay_process):
Clean up caps negotiation.
Actually set output caps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpmpvpay.c: (gst_rtp_mpv_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_setcaps),
(gst_rtp_pcma_depay_process):
Clean up caps negotiation.
Set output buffer duration because we can.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtppcmapay.c: (gst_rtp_pcma_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_setcaps),
(gst_rtp_pcmu_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtppcmupay.c: (gst_rtp_pcmu_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpspeexdepay.c: (gst_rtp_speex_depay_init),
(gst_rtp_speex_depay_setcaps), (gst_rtp_speex_depay_process):
Clean up caps negotiation.
Set output caps on the pad and header buffers.
Set duration on output buffers because we can.
* gst/rtp/gstrtpspeexpay.c: (gst_rtp_speex_pay_parse_ident):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpsv3vdepay.c: (gst_rtp_sv3v_depay_setcaps),
(gst_rtp_sv3v_depay_process):
Clean up caps negotiation.
No need to validate the buffer, the base class does that for us.
No need to set caps out output buffers, subclass does that.
* gst/rtp/gstrtptheoradepay.c: (gst_rtp_theora_depay_setcaps),
(gst_rtp_theora_depay_process):
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtptheorapay.c: (gst_rtp_theora_pay_class_init),
(gst_rtp_theora_pay_flush_packet), (encode_base64),
(gst_rtp_theora_pay_finish_headers), (gst_rtp_theora_pay_parse_id),
(gst_rtp_theora_pay_handle_buffer):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpvorbisdepay.c: (gst_rtp_vorbis_depay_setcaps),
(gst_rtp_vorbis_depay_process):
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpvorbispay.c: (gst_rtp_vorbis_pay_finish_headers):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpvrawdepay.c: (gst_rtp_vraw_depay_setcaps):
Clean up caps negotiation, don't ignore setcaps return.
* gst/rtp/gstrtpvrawpay.c: (gst_rtp_vraw_pay_setcaps):
Don't ignore the return value of set_outcaps.
parent 99eb36ea
2008-10-27 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/rtp/gstrtpL16depay.c: (gst_rtp_L16_depay_setcaps),
(gst_rtp_L16_depay_process):
Check if clock-rate and channels are valid.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpL16pay.c: (gst_rtp_L16_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpac3depay.c: (gst_rtp_ac3_depay_setcaps),
(gst_rtp_ac3_depay_process):
Don't ignore the return value of set_caps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_setcaps),
(gst_rtp_amr_depay_process):
* gst/rtp/gstrtpamrdepay.h:
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set output caps on the buffers, the base class does that for
us.
The subclass will make sure we are negotiated.
* gst/rtp/gstrtpdvdepay.c: (gst_rtp_dv_depay_setcaps),
(gst_rtp_dv_depay_process), (gst_rtp_dv_depay_reset):
* gst/rtp/gstrtpdvdepay.h:
Clean up caps negotiation.
The subclass will make sure we are negotiated.
* gst/rtp/gstrtpg726depay.c: (gst_rtp_g726_depay_setcaps),
(gst_rtp_g726_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpg729depay.c: (gst_rtp_g729_depay_init),
(gst_rtp_g729_depay_setcaps), (gst_rtp_g729_depay_process):
* gst/rtp/gstrtpg729depay.h:
The subclass will make sure we are negotiated.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpgsmdepay.c: (gst_rtp_gsm_depay_setcaps),
(gst_rtp_gsm_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpgsmpay.c: (gst_rtp_gsm_pay_setcaps):
Clean up caps negotiation.
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtph263depay.c: (gst_rtp_h263_depay_setcaps),
(gst_rtp_h263_depay_process):
Clean up caps negotiation.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph263pay.c: (gst_rtp_h263_pay_setcaps),
(gst_rtp_h263_pay_flush), (gst_rtp_h263_pay_handle_buffer):
* gst/rtp/gstrtph263pay.h:
Don't ignore the return value of set_outcaps.
Do some more timestamps.
* gst/rtp/gstrtph263pdepay.c: (gst_rtp_h263p_depay_setcaps),
(gst_rtp_h263p_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph263ppay.c: (gst_rtp_h263p_pay_class_init),
(gst_rtp_h263p_pay_setcaps), (gst_rtp_h263p_pay_flush),
(gst_rtp_h263p_pay_handle_buffer):
* gst/rtp/gstrtph263ppay.h:
Don't ignore the return value of set_outcaps.
Do some more timestamps.
* gst/rtp/gstrtph264depay.c: (gst_rtp_h264_depay_setcaps),
(gst_rtp_h264_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
Fix possible caps leak.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtph264pay.c: (gst_rtp_h264_pay_setcaps):
Add some more debug info.
* gst/rtp/gstrtpilbcdepay.c: (gst_rtp_ilbc_depay_setcaps),
(gst_rtp_ilbc_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpilbcpay.c: (gst_rtpilbcpay_sink_setcaps):
Clean up caps negotiation.
* gst/rtp/gstrtpmp1sdepay.c: (gst_rtp_mp1s_depay_setcaps),
(gst_rtp_mp1s_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp2tdepay.c: (gst_rtp_mp2t_depay_setcaps),
(gst_rtp_mp2t_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4adepay.c: (gst_rtp_mp4a_depay_setcaps),
(gst_rtp_mp4a_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpmp4apay.c: (gst_rtp_mp4a_pay_new_caps),
(gst_rtp_mp4a_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmp4gdepay.c: (gst_rtp_mp4g_depay_setcaps),
(gst_rtp_mp4g_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4gpay.c: (gst_rtp_mp4g_pay_finalize),
(gst_rtp_mp4g_pay_new_caps), (gst_rtp_mp4g_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmp4vdepay.c: (gst_rtp_mp4v_depay_setcaps),
(gst_rtp_mp4v_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
No need to set caps on buffers, subclass does that for us.
* gst/rtp/gstrtpmp4vpay.c: (gst_rtp_mp4v_pay_new_caps),
(gst_rtp_mp4v_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmpadepay.c: (gst_rtp_mpa_depay_setcaps),
(gst_rtp_mpa_depay_process):
Clean up caps negotiation.
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtpmpapay.c: (gst_rtp_mpa_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpmpvdepay.c: (gst_rtp_mpv_depay_setcaps),
(gst_rtp_mpv_depay_process):
Clean up caps negotiation.
Actually set output caps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpmpvpay.c: (gst_rtp_mpv_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtppcmadepay.c: (gst_rtp_pcma_depay_setcaps),
(gst_rtp_pcma_depay_process):
Clean up caps negotiation.
Set output buffer duration because we can.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtppcmapay.c: (gst_rtp_pcma_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtppcmudepay.c: (gst_rtp_pcmu_depay_setcaps),
(gst_rtp_pcmu_depay_process):
Clean up caps negotiation.
Use the marker bit to set the DISCONT flag on outgoing buffers.
* gst/rtp/gstrtppcmupay.c: (gst_rtp_pcmu_pay_setcaps):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpspeexdepay.c: (gst_rtp_speex_depay_init),
(gst_rtp_speex_depay_setcaps), (gst_rtp_speex_depay_process):
Clean up caps negotiation.
Set output caps on the pad and header buffers.
Set duration on output buffers because we can.
* gst/rtp/gstrtpspeexpay.c: (gst_rtp_speex_pay_parse_ident):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpsv3vdepay.c: (gst_rtp_sv3v_depay_setcaps),
(gst_rtp_sv3v_depay_process):
Clean up caps negotiation.
No need to validate the buffer, the base class does that for us.
No need to set caps out output buffers, subclass does that.
* gst/rtp/gstrtptheoradepay.c: (gst_rtp_theora_depay_setcaps),
(gst_rtp_theora_depay_process):
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtptheorapay.c: (gst_rtp_theora_pay_class_init),
(gst_rtp_theora_pay_flush_packet), (encode_base64),
(gst_rtp_theora_pay_finish_headers), (gst_rtp_theora_pay_parse_id),
(gst_rtp_theora_pay_handle_buffer):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpvorbisdepay.c: (gst_rtp_vorbis_depay_setcaps),
(gst_rtp_vorbis_depay_process):
Don't ignore the return value of setcaps.
No need to validate the buffer, the base class does that for us.
* gst/rtp/gstrtpvorbispay.c: (gst_rtp_vorbis_pay_finish_headers):
Don't ignore the return value of set_outcaps.
* gst/rtp/gstrtpvrawdepay.c: (gst_rtp_vraw_depay_setcaps):
Clean up caps negotiation, don't ignore setcaps return.
* gst/rtp/gstrtpvrawpay.c: (gst_rtp_vraw_pay_setcaps):
Don't ignore the return value of set_outcaps.
2008-10-27 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/matroska/matroska-demux.c:
......
......@@ -145,6 +145,7 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
gint clock_rate, payload;
gint channels;
GstCaps *srccaps;
gboolean res;
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
......@@ -170,7 +171,12 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
/* caps can overwrite defaults */
clock_rate =
gst_rtp_L16_depay_parse_int (structure, "clock-rate", clock_rate);
if (clock_rate == 0)
goto no_clockrate;
channels = gst_rtp_L16_depay_parse_int (structure, "channels", channels);
if (channels == 0)
goto no_channels;
depayload->clock_rate = clock_rate;
rtpL16depay->rate = clock_rate;
......@@ -183,10 +189,22 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
"depth", G_TYPE_INT, 16,
"rate", G_TYPE_INT, clock_rate, "channels", G_TYPE_INT, channels, NULL);
gst_pad_set_caps (depayload->srcpad, srccaps);
res = gst_pad_set_caps (depayload->srcpad, srccaps);
gst_caps_unref (srccaps);
return TRUE;
return res;
/* ERRORS */
no_clockrate:
{
GST_ERROR_OBJECT (depayload, "no clock-rate specified");
return FALSE;
}
no_channels:
{
GST_ERROR_OBJECT (depayload, "no channels specified");
return FALSE;
}
}
static GstBuffer *
......@@ -194,34 +212,29 @@ gst_rtp_L16_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstRtpL16Depay *rtpL16depay;
GstBuffer *outbuf;
gint payload_len;
gboolean marker;
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
if (!gst_rtp_buffer_validate (buf))
goto bad_packet;
{
gint payload_len;
payload_len = gst_rtp_buffer_get_payload_len (buf);
payload_len = gst_rtp_buffer_get_payload_len (buf);
if (payload_len <= 0)
goto empty_packet;
if (payload_len <= 0)
goto empty_packet;
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
marker = gst_rtp_buffer_get_marker (buf);
return outbuf;
if (marker) {
/* mark talk spurt with DISCONT */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
return NULL;
bad_packet:
{
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
("Packet did not validate."), (NULL));
return NULL;
}
return outbuf;
/* ERRORS */
empty_packet:
{
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
......
......@@ -163,6 +163,7 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
GstRtpL16Pay *rtpL16pay;
GstStructure *structure;
gint channels, rate;
gboolean res;
rtpL16pay = GST_RTP_L16_PAY (basepayload);
......@@ -176,13 +177,13 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
goto no_channels;
gst_basertppayload_set_options (basepayload, "audio", TRUE, "L16", rate);
gst_basertppayload_set_outcaps (basepayload,
res = gst_basertppayload_set_outcaps (basepayload,
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL);
rtpL16pay->rate = rate;
rtpL16pay->channels = channels;
return TRUE;
return res;
/* ERRORS */
no_rate:
......
......@@ -110,16 +110,23 @@ gst_rtp_ac3_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
{
GstStructure *structure;
GstRtpAC3Depay *rtpac3depay;
gint clock_rate = 90000; /* default */
gint clock_rate;
GstCaps *srccaps;
gboolean res;
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = 90000; /* default */
depayload->clock_rate = clock_rate;
return TRUE;
srccaps = gst_caps_new_simple ("audio/ac3", NULL);
res = gst_pad_set_caps (depayload->srcpad, srccaps);
gst_caps_unref (srccaps);
return res;
}
struct frmsize_s
......@@ -177,9 +184,6 @@ gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
if (!gst_rtp_buffer_validate (buf))
goto bad_packet;
{
gint payload_len;
guint8 *payload;
......@@ -218,20 +222,7 @@ gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
return NULL;
bad_packet:
{
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
("Packet did not validate."), (NULL));
return NULL;
}
#if 0
bad_payload:
{
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
("Unexpected payload type."), (NULL));
return NULL;
}
#endif
/* ERRORS */
empty_packet:
{
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
......
......@@ -174,6 +174,7 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
const gchar *params;
const gchar *str, *type;
gint clock_rate, need_clock_rate;
gboolean res;
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
......@@ -183,11 +184,11 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
if ((str = gst_structure_get_string (structure, "encoding-name"))) {
if (strcmp (str, "AMR") == 0) {
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_NB;
clock_rate = need_clock_rate = 8000;
need_clock_rate = 8000;
type = "audio/AMR";
} else if (strcmp (str, "AMR-WB") == 0) {
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_WB;
clock_rate = need_clock_rate = 16000;
need_clock_rate = 16000;
type = "audio/AMR-WB";
} else
goto invalid_mode;
......@@ -235,7 +236,8 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
rtpamrdepay->channels = atoi (params);
}
gst_structure_get_int (structure, "clock-rate", &clock_rate);
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = need_clock_rate;
depayload->clock_rate = clock_rate;
/* we require 1 channel, 8000 Hz, octet aligned, no CRC,
......@@ -254,13 +256,10 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
srccaps = gst_caps_new_simple (type,
"channels", G_TYPE_INT, rtpamrdepay->channels,
"rate", G_TYPE_INT, clock_rate, NULL);
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
rtpamrdepay->negotiated = TRUE;
return TRUE;
return res;
/* ERRORS */
invalid_mode:
......@@ -290,12 +289,6 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
if (!rtpamrdepay->negotiated)
goto not_negotiated;
if (!gst_rtp_buffer_validate (buf))
goto invalid_packet;
/* setup frame size pointer */
if (rtpamrdepay->mode == GST_RTP_AMR_DP_MODE_NB)
frame_size = nb_frame_size;
......@@ -421,33 +414,18 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
GST_BUFFER_DURATION (outbuf) = num_packets * 20 * GST_MSECOND;
if (marker) {
/* marker bit marks a discont buffer */
/* marker bit marks a discont buffer after a talkspurt. */
GST_DEBUG_OBJECT (depayload, "marker bit was set");
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
marker = FALSE;
}
gst_buffer_set_caps (outbuf,
GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload)));
GST_DEBUG_OBJECT (depayload, "pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
}
return outbuf;
/* ERRORS */
invalid_packet:
{
GST_ELEMENT_WARNING (rtpamrdepay, STREAM, DECODE,
(NULL), ("AMR RTP packet did not validate"));
goto bad_packet;
}
not_negotiated:
{
GST_ELEMENT_ERROR (rtpamrdepay, STREAM, NOT_IMPLEMENTED,
(NULL), ("not negotiated"));
return NULL;
}
too_small:
{
GST_ELEMENT_WARNING (rtpamrdepay, STREAM, DECODE,
......
......@@ -49,7 +49,6 @@ struct _GstRtpAMRDepay
{
GstBaseRTPDepayload depayload;
gboolean negotiated;
GstRtpAMRDepayMode mode;
gboolean octet_align;
......
......@@ -173,7 +173,7 @@ gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
GstStructure *structure;
GstRTPDVDepay *rtpdvdepay;
GstCaps *srccaps;
gint clock_rate = 90000; /* default */
gint clock_rate;
gboolean systemstream, ret;
const gchar *encode, *media;
......@@ -181,8 +181,9 @@ gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
structure = gst_caps_get_structure (caps, 0);
if (gst_structure_has_field (structure, "clock-rate"))
gst_structure_get_int (structure, "clock-rate", &clock_rate);
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = 90000; /* default */
depayload->clock_rate = clock_rate;
/* we really need the encode property to figure out the frame size, it's also
* required by the spec */
......@@ -230,9 +231,6 @@ gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
ret = gst_pad_set_caps (depayload->srcpad, srccaps);
gst_caps_unref (srccaps);
depayload->clock_rate = clock_rate;
rtpdvdepay->negotiated = TRUE;
return ret;
/* ERRORS */
......@@ -307,9 +305,6 @@ gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, GstBuffer * in)
GstRTPDVDepay *dvdepay = GST_RTP_DV_DEPAY (base);
gboolean marker;
if (!dvdepay->negotiated)
goto not_negotiated;
marker = gst_rtp_buffer_get_marker (in);
/* Check if the received packet contains (the start of) a new frame, we do
......@@ -361,14 +356,6 @@ gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, GstBuffer * in)
dvdepay->prev_ts = rtp_ts;
}
return out;
/* ERRORS */
not_negotiated:
{
GST_ELEMENT_ERROR (dvdepay, STREAM, NOT_IMPLEMENTED,
(NULL), ("not negotiated"));
return NULL;
}
}
static void
......@@ -381,7 +368,6 @@ gst_rtp_dv_depay_reset (GstRTPDVDepay * depay)
depay->prev_ts = -1;
depay->have_header = FALSE;
depay->frame_nr = 0;
depay->negotiated = FALSE;
}
static GstStateChangeReturn
......
......@@ -51,7 +51,6 @@ struct _GstRTPDVDepay
gint width, height;
gint rate_num, rate_denom;
gboolean negotiated;
};
struct _GstRTPDVDepayClass
......
......@@ -130,13 +130,14 @@ gst_rtp_g726_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
GstCaps *srccaps;
GstStructure *structure;
gboolean ret;
gint clock_rate = 8000; /* default */
gint clock_rate;
const gchar *encoding_name;
gint bitrate;
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = 8000; /* default */
depayload->clock_rate = clock_rate;
encoding_name = gst_structure_get_string (structure, "encoding-name");
......@@ -175,27 +176,22 @@ done:
static GstBuffer *
gst_rtp_g726_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
{
GstCaps *srccaps;
GstBuffer *outbuf = NULL;
gboolean marker;
marker = gst_rtp_buffer_get_marker (buf);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
GST_BUFFER_SIZE (buf),
gst_rtp_buffer_get_marker (buf),
GST_BUFFER_SIZE (buf), marker,
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
srccaps = GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
if (!srccaps) {
/* Set the default caps */
srccaps = gst_caps_new_simple ("audio/x-adpcm",
"channels", G_TYPE_INT, 1,
"rate", G_TYPE_INT, SAMPLE_RATE,
"bitrate", G_TYPE_INT, DEFAULT_BIT_RATE,
"layout", G_TYPE_STRING, LAYOUT_G726, NULL);
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
}
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
if (marker) {
/* mark start of talkspurt with discont */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
return outbuf;
}
......
......@@ -120,7 +120,6 @@ gst_rtp_g729_depay_init (GstRtpG729Depay * rtpg729depay,
depayload = GST_BASE_RTP_DEPAYLOAD (rtpg729depay);
depayload->clock_rate = 8000;
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
}
......@@ -153,13 +152,13 @@ gst_rtp_g729_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
if (clock_rate != 8000)
goto wrong_clock_rate;
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("audio/G729",
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, clock_rate, NULL);
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
gst_caps_unref (srccaps);
rtpg729depay->negotiated = ret;
return ret;
/* ERRORS */
......@@ -184,18 +183,10 @@ gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
GstRtpG729Depay *rtpg729depay;
GstBuffer *outbuf = NULL;
gint payload_len;
gboolean marker;
rtpg729depay = GST_RTP_G729_DEPAY (depayload);
if (!rtpg729depay->negotiated)
goto not_negotiated;
if (!gst_rtp_buffer_validate (buf)) {
GST_ELEMENT_WARNING (rtpg729depay, STREAM, DECODE,
(NULL), ("G729 RTP packet did not validate"));
goto bad_packet;
}
payload_len = gst_rtp_buffer_get_payload_len (buf);
/* At least 2 bytes (CNG from G729 Annex B) */
......@@ -212,6 +203,12 @@ gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
}
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
marker = gst_rtp_buffer_get_marker (buf);
if (marker) {
/* marker bit starts talkspurt */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
GST_DEBUG ("gst_rtp_g729_depay_chain: pushing buffer of size %d",
GST_BUFFER_SIZE (outbuf));
......@@ -219,12 +216,6 @@ gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
return outbuf;
/* ERRORS */
not_negotiated:
{
GST_ELEMENT_ERROR (rtpg729depay, STREAM, NOT_IMPLEMENTED,
(NULL), ("not negotiated"));
return NULL;
}
bad_packet:
{
/* no fatal error */
......
......@@ -46,8 +46,6 @@ struct _GstRtpG729Depay
{
GstBaseRTPDepayload depayload;
gboolean negotiated;
gint channels;
};
......
......@@ -118,11 +118,12 @@ gst_rtp_gsm_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
GstCaps *srccaps;
gboolean ret;
GstStructure *structure;
gint clock_rate = 8000; /* default */
gint clock_rate;
structure = gst_caps_get_structure (caps, 0);
gst_structure_get_int (structure, "clock-rate", &clock_rate);
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
clock_rate = 8000; /* default */
depayload->clock_rate = clock_rate;
srccaps = gst_caps_new_simple ("audio/x-gsm",
......@@ -137,14 +138,21 @@ static GstBuffer *
gst_rtp_gsm_depay_process (GstBaseRTPDepayload * _depayload, GstBuffer * buf)
{
GstBuffer *outbuf = NULL;
gboolean marker;
marker = gst_rtp_buffer_get_marker (buf);
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
GST_BUFFER_SIZE (buf),
gst_rtp_buffer_get_marker (buf),
GST_BUFFER_SIZE (buf), marker,
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
if (marker) {
/* mark start of talkspurt with DISCONT */
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
}
return outbuf;
}
......
......@@ -111,20 +111,26 @@ gst_rtp_gsm_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
{
const char *stname;