mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 06:52:41 +00:00
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.
This commit is contained in:
parent
99eb36eac0
commit
2428a1ca55
48 changed files with 589 additions and 459 deletions
216
ChangeLog
216
ChangeLog
|
@ -1,3 +1,219 @@
|
|||
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;
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
|
||||
{
|
||||
gint payload_len;
|
||||
if (payload_len <= 0)
|
||||
goto empty_packet;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
|
||||
|
||||
if (payload_len <= 0)
|
||||
goto empty_packet;
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||
marker = gst_rtp_buffer_get_marker (buf);
|
||||
|
||||
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
|
||||
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (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;
|
||||
GstStructure *structure;
|
||||
gboolean res;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
stname = gst_structure_get_name (structure);
|
||||
|
||||
if (0 == strcmp ("audio/x-gsm", stname)) {
|
||||
gst_basertppayload_set_options (payload, "audio", FALSE, "GSM", 8000);
|
||||
} else {
|
||||
if (strcmp ("audio/x-gsm", stname))
|
||||
goto invalid_type;
|
||||
|
||||
gst_basertppayload_set_options (payload, "audio", FALSE, "GSM", 8000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
invalid_type:
|
||||
{
|
||||
GST_WARNING_OBJECT (payload, "invalid media type received");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -147,9 +147,10 @@ gst_rtp_h263_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
|||
{
|
||||
GstCaps *srccaps;
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint 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 */
|
||||
filter->clock_rate = clock_rate;
|
||||
|
||||
srccaps = gst_caps_new_simple ("video/x-h263",
|
||||
|
@ -164,22 +165,17 @@ gst_rtp_h263_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
|||
static GstBuffer *
|
||||
gst_rtp_h263_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
|
||||
GstRtpH263Depay *rtph263depay;
|
||||
GstBuffer *outbuf;
|
||||
gint payload_len;
|
||||
guint8 *payload;
|
||||
guint header_len;
|
||||
|
||||
guint SBIT, EBIT;
|
||||
gboolean F, P, M;
|
||||
gboolean I;
|
||||
|
||||
rtph263depay = GST_RTP_H263_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||
GST_LOG_OBJECT (depayload, "Discont buffer, flushing adapter");
|
||||
|
@ -326,13 +322,6 @@ gst_rtp_h263_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtph263depay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -263,11 +263,12 @@ gst_rtp_h263_pay_finalize (GObject * object)
|
|||
static gboolean
|
||||
gst_rtp_h263_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||
{
|
||||
payload->pt = GST_RTP_PAYLOAD_H263;
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263", 90000);
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
gboolean res;
|
||||
|
||||
return TRUE;
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263", 90000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static guint
|
||||
|
@ -350,7 +351,8 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
|
|||
|
||||
memcpy (payload, data + curpos, payload_len);
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = rtph263pay->first_ts;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = rtph263pay->first_timestamp;
|
||||
GST_BUFFER_DURATION (outbuf) = rtph263pay->first_duration;
|
||||
|
||||
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtph263pay), outbuf);
|
||||
|
||||
|
@ -373,7 +375,8 @@ gst_rtp_h263_pay_handle_buffer (GstBaseRTPPayload * payload, GstBuffer * buffer)
|
|||
rtph263pay = GST_RTP_H263_PAY (payload);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
rtph263pay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtph263pay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtph263pay->first_duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
/* we always encode and flush a full picture */
|
||||
gst_adapter_push (rtph263pay->adapter, buffer);
|
||||
|
|
|
@ -45,7 +45,8 @@ struct _GstRtpH263Pay
|
|||
GstBaseRTPPayload payload;
|
||||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime first_timestamp;
|
||||
GstClockTime first_duration;
|
||||
};
|
||||
|
||||
struct _GstRtpH263PayClass
|
||||
|
|
|
@ -156,10 +156,12 @@ gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
|||
{
|
||||
GstCaps *srccaps = NULL;
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
const gchar *encoding_name = NULL;
|
||||
gboolean res;
|
||||
|
||||
gst_structure_get_int (structure, "clock-rate", &clock_rate);
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 90000; /* default */
|
||||
filter->clock_rate = clock_rate;
|
||||
|
||||
encoding_name = gst_structure_get_string (structure, "encoding-name");
|
||||
|
@ -216,10 +218,10 @@ gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
|||
if (!srccaps)
|
||||
goto no_caps;
|
||||
|
||||
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (filter), srccaps);
|
||||
res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (filter), srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
no_encoding_name:
|
||||
|
@ -237,15 +239,11 @@ no_caps:
|
|||
static GstBuffer *
|
||||
gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
|
||||
GstRtpH263PDepay *rtph263pdepay;
|
||||
GstBuffer *outbuf;
|
||||
|
||||
rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||
GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
|
||||
|
@ -266,7 +264,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
header_len = 2;
|
||||
|
||||
if (payload_len < header_len)
|
||||
goto bad_packet;
|
||||
goto too_small;
|
||||
|
||||
M = gst_rtp_buffer_get_marker (buf);
|
||||
|
||||
|
@ -292,7 +290,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
}
|
||||
|
||||
if ((!P && payload_len < header_len) || (P && payload_len < header_len - 2))
|
||||
goto bad_packet;
|
||||
goto too_small;
|
||||
|
||||
if (P) {
|
||||
/* FIXME, have to make the packet writable hear. Better to reset these
|
||||
|
@ -353,12 +351,6 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
}
|
||||
return NULL;
|
||||
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
too_small:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
|
||||
|
|
|
@ -168,7 +168,6 @@ gst_rtp_h263p_pay_class_init (GstRtpH263PPayClass * klass)
|
|||
|
||||
GST_DEBUG_CATEGORY_INIT (rtph263ppay_debug, "rtph263ppay",
|
||||
0, "rtph263ppay (RFC 4629)");
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -195,10 +194,12 @@ gst_rtp_h263p_pay_finalize (GObject * object)
|
|||
static gboolean
|
||||
gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||
{
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263-1998", 90000);
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
gboolean res;
|
||||
|
||||
return TRUE;
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263-1998", 90000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -237,8 +238,6 @@ gst_rtp_h263p_pay_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static GstFlowReturn
|
||||
gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
|
||||
{
|
||||
|
@ -332,7 +331,9 @@ gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
|
|||
payload[0] = (fragmented && !found_gob) ? 0x00 : 0x04;
|
||||
payload[1] = 0;
|
||||
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = rtph263ppay->first_ts;
|
||||
GST_BUFFER_TIMESTAMP (outbuf) = rtph263ppay->first_timestamp;
|
||||
GST_BUFFER_DURATION (outbuf) = rtph263ppay->first_duration;
|
||||
|
||||
gst_adapter_flush (rtph263ppay->adapter, towrite);
|
||||
|
||||
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtph263ppay), outbuf);
|
||||
|
@ -355,7 +356,8 @@ gst_rtp_h263p_pay_handle_buffer (GstBaseRTPPayload * payload,
|
|||
rtph263ppay = GST_RTP_H263P_PAY (payload);
|
||||
|
||||
size = GST_BUFFER_SIZE (buffer);
|
||||
rtph263ppay->first_ts = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtph263ppay->first_timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
||||
rtph263ppay->first_duration = GST_BUFFER_DURATION (buffer);
|
||||
|
||||
/* we always encode and flush a full picture */
|
||||
gst_adapter_push (rtph263ppay->adapter, buffer);
|
||||
|
|
|
@ -51,7 +51,8 @@ struct _GstRtpH263PPay
|
|||
GstBaseRTPPayload payload;
|
||||
|
||||
GstAdapter *adapter;
|
||||
GstClockTime first_ts;
|
||||
GstClockTime first_timestamp;
|
||||
GstClockTime first_duration;
|
||||
GstFragmentationMode fragmentation_mode;
|
||||
};
|
||||
|
||||
|
|
|
@ -253,17 +253,19 @@ decode_base64 (gchar * in, guint8 * out)
|
|||
static gboolean
|
||||
gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||
{
|
||||
GstCaps *srccaps = NULL;
|
||||
gint clock_rate = 90000;
|
||||
GstCaps *srccaps;
|
||||
gint clock_rate;
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
GstRtpH264Depay *rtph264depay;
|
||||
const gchar *ps, *profile;
|
||||
GstBuffer *codec_data;
|
||||
guint8 *b64;
|
||||
gboolean res;
|
||||
|
||||
rtph264depay = GST_RTP_H264_DEPAY (depayload);
|
||||
|
||||
gst_structure_get_int (structure, "clock-rate", &clock_rate);
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 90000;
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
srccaps = gst_caps_new_simple ("video/x-h264", NULL);
|
||||
|
@ -395,15 +397,16 @@ gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
"codec_data", GST_TYPE_BUFFER, codec_data, 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 */
|
||||
incomplete_caps:
|
||||
{
|
||||
GST_DEBUG_OBJECT (depayload, "we have incomplete caps");
|
||||
gst_caps_unref (srccaps);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -419,9 +422,6 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtph264depay = GST_RTP_H264_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||
gst_adapter_clear (rtph264depay->adapter);
|
||||
|
@ -668,12 +668,6 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
return NULL;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
undefined_type:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
|
||||
|
|
|
@ -304,6 +304,8 @@ gst_rtp_h264_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
|||
data += 2;
|
||||
size -= 2;
|
||||
|
||||
GST_LOG_OBJECT (rtph264pay, "SPS %d size %d", i, nal_size);
|
||||
|
||||
if (size < nal_size)
|
||||
goto avcc_error;
|
||||
|
||||
|
@ -335,6 +337,8 @@ gst_rtp_h264_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
|||
data += 2;
|
||||
size -= 2;
|
||||
|
||||
GST_LOG_OBJECT (rtph264pay, "PPS %d size %d", i, nal_size);
|
||||
|
||||
if (size < nal_size)
|
||||
goto avcc_error;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
static const GstElementDetails gst_rtp_ilbc_depay_details =
|
||||
GST_ELEMENT_DETAILS ("RTP iLBC packet depayloader",
|
||||
"Codec/Depayloader/Network",
|
||||
"Extracts iLBC audio from RTP packets",
|
||||
"Extracts iLBC audio from RTP packets (RFC 3952)",
|
||||
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>");
|
||||
|
||||
/* RtpiLBCDepay signals and args */
|
||||
|
@ -152,13 +152,17 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
const gchar *mode_str = NULL;
|
||||
gint mode;
|
||||
gint mode, clock_rate;
|
||||
gboolean ret;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
mode = rtpilbcdepay->mode;
|
||||
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 8000;
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
/* parse mode, if we can */
|
||||
mode_str = gst_structure_get_string (structure, "mode");
|
||||
if (mode_str) {
|
||||
|
@ -176,9 +180,6 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -186,14 +187,21 @@ static GstBuffer *
|
|||
gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
GstBuffer *outbuf;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -131,20 +131,21 @@ gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
|
|||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
gst_structure_get_int (structure, "mode", &mode);
|
||||
if (mode != 20 && mode != 30)
|
||||
goto wrong_mode;
|
||||
|
||||
payload_name = gst_structure_get_name (structure);
|
||||
if (g_ascii_strcasecmp ("audio/x-iLBC", payload_name))
|
||||
goto wrong_caps;
|
||||
|
||||
if (!gst_structure_get_int (structure, "mode", &mode))
|
||||
goto no_mode;
|
||||
|
||||
if (mode != 20 && mode != 30)
|
||||
goto wrong_mode;
|
||||
|
||||
gst_basertppayload_set_options (basertppayload, "audio", TRUE, "ILBC", 8000);
|
||||
/* set options for this frame based audio codec */
|
||||
gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload,
|
||||
mode, mode == 30 ? 50 : 38);
|
||||
|
||||
|
||||
mode_str = g_strdup_printf ("%d", mode);
|
||||
ret =
|
||||
gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_STRING,
|
||||
|
@ -159,17 +160,22 @@ gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
|
|||
return ret;
|
||||
|
||||
/* ERRORS */
|
||||
wrong_mode:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpilbcpay, "mode must be 20 or 30, received %d", mode);
|
||||
return FALSE;
|
||||
}
|
||||
wrong_caps:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpilbcpay, "expected audio/x-iLBC, received %s",
|
||||
payload_name);
|
||||
return FALSE;
|
||||
}
|
||||
no_mode:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpilbcpay, "did not receive a mode");
|
||||
return FALSE;
|
||||
}
|
||||
wrong_mode:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpilbcpay, "mode must be 20 or 30, received %d", mode);
|
||||
return FALSE;
|
||||
}
|
||||
mode_changed:
|
||||
{
|
||||
GST_ERROR_OBJECT (rtpilbcpay, "Mode has changed from %d to %d! "
|
||||
|
|
|
@ -134,20 +134,22 @@ gst_rtp_mp1s_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
GstRtpMP1SDepay *rtpmp1sdepay;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
gboolean res;
|
||||
|
||||
rtpmp1sdepay = GST_RTP_MP1S_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;
|
||||
|
||||
srccaps = gst_caps_new_simple ("video/mpeg",
|
||||
"systemstream", G_TYPE_BOOLEAN, TRUE, 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);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -155,30 +157,15 @@ gst_rtp_mp1s_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
{
|
||||
GstRtpMP1SDepay *rtpmp1sdepay;
|
||||
GstBuffer *outbuf;
|
||||
gint payload_len;
|
||||
|
||||
rtpmp1sdepay = GST_RTP_MP1S_DEPAY (depayload);
|
||||
|
||||
if (G_UNLIKELY (!gst_rtp_buffer_validate (buf)))
|
||||
goto bad_packet;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
|
||||
outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 0, -1);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||
|
||||
GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %d",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
|
||||
return outbuf;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp1sdepay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -148,21 +148,23 @@ gst_rtp_mp2t_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
GstRtpMP2TDepay *rtpmp2tdepay;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
gboolean res;
|
||||
|
||||
rtpmp2tdepay = GST_RTP_MP2T_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;
|
||||
|
||||
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);
|
||||
res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -174,9 +176,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
||||
|
||||
if (G_UNLIKELY (!gst_rtp_buffer_validate (buf)))
|
||||
goto bad_packet;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
|
||||
if (G_UNLIKELY (payload_len <= rtpmp2tdepay->skip_first_bytes))
|
||||
|
@ -185,7 +184,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
outbuf =
|
||||
gst_rtp_buffer_get_payload_subbuffer (buf, rtpmp2tdepay->skip_first_bytes,
|
||||
-1);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
|
||||
GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %d",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
|
@ -193,12 +191,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
return outbuf;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
empty_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
||||
|
|
|
@ -138,20 +138,21 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstRtpMP4ADepay *rtpmp4adepay;
|
||||
GstCaps *srccaps;
|
||||
const gchar *str;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint object_type = 2; /* AAC LC default */
|
||||
gint clock_rate;
|
||||
gint object_type;
|
||||
gint channels = 2; /* default */
|
||||
gboolean res;
|
||||
|
||||
rtpmp4adepay = GST_RTP_MP4A_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);
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 90000; /* default */
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
if (gst_structure_has_field (structure, "object"))
|
||||
gst_structure_get_int (structure, "object", &object_type);
|
||||
if (!gst_structure_get_int (structure, "object", &object_type))
|
||||
object_type = 2; /* AAC LC default */
|
||||
|
||||
srccaps = gst_caps_new_simple ("audio/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 4,
|
||||
|
@ -219,10 +220,10 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
}
|
||||
}
|
||||
bad_config:
|
||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -233,9 +234,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||
gst_adapter_clear (rtpmp4adepay->adapter);
|
||||
|
@ -322,12 +320,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
return NULL;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp4adepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
wrong_size:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp4adepay, STREAM, DECODE,
|
||||
|
|
|
@ -254,21 +254,24 @@ wrong_channels:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_rtp_mp4a_pay_new_caps (GstRtpMP4APay * rtpmp4apay)
|
||||
{
|
||||
gchar *config;
|
||||
GValue v = { 0 };
|
||||
gboolean res;
|
||||
|
||||
g_value_init (&v, GST_TYPE_BUFFER);
|
||||
gst_value_set_buffer (&v, rtpmp4apay->config);
|
||||
config = gst_value_serialize (&v);
|
||||
|
||||
gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4apay),
|
||||
res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4apay),
|
||||
"cpresent", G_TYPE_STRING, "0", "config", G_TYPE_STRING, config, NULL);
|
||||
|
||||
g_value_unset (&v);
|
||||
g_free (config);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -277,6 +280,7 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
GstRtpMP4APay *rtpmp4apay;
|
||||
GstStructure *structure;
|
||||
const GValue *codec_data;
|
||||
gboolean res;
|
||||
|
||||
rtpmp4apay = GST_RTP_MP4A_PAY (payload);
|
||||
|
||||
|
@ -290,7 +294,6 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
guint8 *config;
|
||||
guint8 *data;
|
||||
guint size, i;
|
||||
gboolean res;
|
||||
|
||||
buffer = gst_value_get_buffer (codec_data);
|
||||
GST_LOG_OBJECT (rtpmp4apay, "configuring codec_data");
|
||||
|
@ -339,9 +342,9 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
gst_basertppayload_set_options (payload, "audio", TRUE, "MP4A-LATM",
|
||||
rtpmp4apay->rate);
|
||||
|
||||
gst_rtp_mp4a_pay_new_caps (rtpmp4apay);
|
||||
res = gst_rtp_mp4a_pay_new_caps (rtpmp4apay);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
config_failed:
|
||||
|
|
|
@ -225,19 +225,20 @@ gst_rtp_mp4g_depay_parse_int (GstStructure * structure, const gchar * field,
|
|||
static gboolean
|
||||
gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||
{
|
||||
|
||||
GstStructure *structure;
|
||||
GstRtpMP4GDepay *rtpmp4gdepay;
|
||||
GstCaps *srccaps = NULL;
|
||||
const gchar *str;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
gint someint;
|
||||
gboolean res;
|
||||
|
||||
rtpmp4gdepay = GST_RTP_MP4G_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;
|
||||
|
||||
if ((str = gst_structure_get_string (structure, "media"))) {
|
||||
|
@ -299,10 +300,10 @@ gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
}
|
||||
}
|
||||
|
||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
unknown_media:
|
||||
|
@ -424,9 +425,6 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||
GST_DEBUG_OBJECT (rtpmp4gdepay, "received DISCONT");
|
||||
|
@ -628,7 +626,6 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
avail = gst_adapter_available (rtpmp4gdepay->adapter);
|
||||
|
||||
outbuf = gst_adapter_take_buffer (rtpmp4gdepay->adapter, avail);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
|
||||
GST_DEBUG ("gst_rtp_mp4g_depay_chain: pushing buffer of size %d",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
|
@ -640,12 +637,6 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
return NULL;
|
||||
|
||||
/* ERRORS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
|
||||
("Packet did not validate."), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
short_payload:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
|
||||
|
|
|
@ -172,6 +172,7 @@ gst_rtp_mp4g_pay_finalize (GObject * object)
|
|||
|
||||
g_object_unref (rtpmp4gpay->adapter);
|
||||
rtpmp4gpay->adapter = NULL;
|
||||
|
||||
g_free (rtpmp4gpay->params);
|
||||
rtpmp4gpay->params = NULL;
|
||||
|
||||
|
@ -326,11 +327,12 @@ too_short:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
||||
{
|
||||
gchar *config;
|
||||
GValue v = { 0 };
|
||||
gboolean res;
|
||||
|
||||
#define MP4GCAPS \
|
||||
"streamtype", G_TYPE_STRING, rtpmp4gpay->streamtype, \
|
||||
|
@ -348,10 +350,10 @@ gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
|||
|
||||
/* hmm, silly */
|
||||
if (rtpmp4gpay->params) {
|
||||
gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
||||
res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
||||
"encoding-params", G_TYPE_STRING, rtpmp4gpay->params, MP4GCAPS);
|
||||
} else {
|
||||
gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
||||
res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
||||
MP4GCAPS);
|
||||
}
|
||||
|
||||
|
@ -359,6 +361,7 @@ gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
|||
g_free (config);
|
||||
|
||||
#undef MP4GCAPS
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -368,6 +371,7 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
GstStructure *structure;
|
||||
const GValue *codec_data;
|
||||
gchar *media_type = NULL;
|
||||
gboolean res;
|
||||
|
||||
rtpmp4gpay = GST_RTP_MP4G_PAY (payload);
|
||||
|
||||
|
@ -379,7 +383,6 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
|
||||
GstBuffer *buffer;
|
||||
const gchar *name;
|
||||
gboolean res;
|
||||
|
||||
buffer = gst_value_get_buffer (codec_data);
|
||||
GST_LOG_OBJECT (rtpmp4gpay, "configuring codec_data");
|
||||
|
@ -412,9 +415,9 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
gst_basertppayload_set_options (payload, media_type, TRUE, "MPEG4-GENERIC",
|
||||
rtpmp4gpay->rate);
|
||||
|
||||
gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
|
||||
res = gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
config_failed:
|
||||
|
|
|
@ -136,14 +136,15 @@ gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstRtpMP4VDepay *rtpmp4vdepay;
|
||||
GstCaps *srccaps;
|
||||
const gchar *str;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
gboolean res;
|
||||
|
||||
rtpmp4vdepay = GST_RTP_MP4V_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);
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 90000; /* default */
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
srccaps = gst_caps_new_simple ("video/mpeg",
|
||||
|
@ -167,10 +168,10 @@ gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
g_warning ("cannot convert config to buffer");
|
||||
}
|
||||
}
|
||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -181,9 +182,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush remaining data on discont */
|
||||
if (GST_BUFFER_IS_DISCONT (buf))
|
||||
gst_adapter_clear (rtpmp4vdepay->adapter);
|
||||
|
@ -198,7 +196,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
avail = gst_adapter_available (rtpmp4vdepay->adapter);
|
||||
|
||||
outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail);
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
|
||||
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %d",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
|
@ -206,13 +203,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
return outbuf;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmp4vdepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static GstStateChangeReturn
|
||||
|
|
|
@ -192,18 +192,19 @@ gst_rtp_mp4v_pay_finalize (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
|
||||
{
|
||||
gchar *profile, *config;
|
||||
GValue v = { 0 };
|
||||
gboolean res;
|
||||
|
||||
profile = g_strdup_printf ("%d", rtpmp4vpay->profile);
|
||||
g_value_init (&v, GST_TYPE_BUFFER);
|
||||
gst_value_set_buffer (&v, rtpmp4vpay->config);
|
||||
config = gst_value_serialize (&v);
|
||||
|
||||
gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4vpay),
|
||||
res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4vpay),
|
||||
"profile-level-id", G_TYPE_STRING, profile,
|
||||
"config", G_TYPE_STRING, config, NULL);
|
||||
|
||||
|
@ -211,6 +212,8 @@ gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
|
|||
|
||||
g_free (profile);
|
||||
g_free (config);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -219,12 +222,15 @@ gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
GstRtpMP4VPay *rtpmp4vpay;
|
||||
GstStructure *structure;
|
||||
const GValue *codec_data;
|
||||
gboolean res;
|
||||
|
||||
rtpmp4vpay = GST_RTP_MP4V_PAY (payload);
|
||||
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "MP4V-ES",
|
||||
rtpmp4vpay->rate);
|
||||
|
||||
res = TRUE;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
codec_data = gst_structure_get_value (structure, "codec_data");
|
||||
if (codec_data) {
|
||||
|
@ -249,12 +255,12 @@ gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
if (rtpmp4vpay->config)
|
||||
gst_buffer_unref (rtpmp4vpay->config);
|
||||
rtpmp4vpay->config = gst_buffer_copy (buffer);
|
||||
gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
|
||||
res = gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -115,16 +115,23 @@ gst_rtp_mpa_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
{
|
||||
GstStructure *structure;
|
||||
GstRtpMPADepay *rtpmpadepay;
|
||||
gint clock_rate = 90000; /* default */
|
||||
GstCaps *outcaps;
|
||||
gint clock_rate;
|
||||
gboolean res;
|
||||
|
||||
rtpmpadepay = GST_RTP_MPA_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;
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
return TRUE;
|
||||
outcaps = gst_caps_new_simple ("audio/mpeg", NULL);
|
||||
res = gst_pad_set_caps (depayload->srcpad, outcaps);
|
||||
gst_caps_unref (outcaps);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -135,20 +142,18 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
{
|
||||
gint payload_len;
|
||||
guint8 *payload;
|
||||
guint16 frag_offset;
|
||||
gboolean marker;
|
||||
|
||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||
payload = gst_rtp_buffer_get_payload (buf);
|
||||
|
||||
if (payload_len <= 4)
|
||||
goto empty_packet;
|
||||
|
||||
payload = gst_rtp_buffer_get_payload (buf);
|
||||
/* strip off header
|
||||
*
|
||||
* 0 1 2 3
|
||||
|
@ -161,7 +166,12 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
/* subbuffer skipping the 4 header bytes */
|
||||
outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 4, -1);
|
||||
marker = gst_rtp_buffer_get_marker (buf);
|
||||
|
||||
if (marker) {
|
||||
/* mark start of talkspurt with discont */
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
GST_DEBUG_OBJECT (rtpmpadepay,
|
||||
"gst_rtp_mpa_depay_chain: pushing buffer of size %d",
|
||||
GST_BUFFER_SIZE (outbuf));
|
||||
|
@ -173,20 +183,7 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
return NULL;
|
||||
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
|
||||
("Packet did not validate."), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
#if 0
|
||||
bad_payload:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
|
||||
("Unexpected payload type."), (NULL));
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
/* ERRORS */
|
||||
empty_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
|
||||
|
|
|
@ -146,10 +146,12 @@ gst_rtp_mpa_pay_finalize (GObject * object)
|
|||
static gboolean
|
||||
gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||
{
|
||||
gst_basertppayload_set_options (payload, "audio", TRUE, "MPA", 90000);
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
gboolean res;
|
||||
|
||||
return TRUE;
|
||||
gst_basertppayload_set_options (payload, "audio", TRUE, "MPA", 90000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -118,16 +118,25 @@ gst_rtp_mpv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
{
|
||||
GstStructure *structure;
|
||||
GstRtpMPVDepay *rtpmpvdepay;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
GstCaps *outcaps;
|
||||
gboolean res;
|
||||
|
||||
rtpmpvdepay = GST_RTP_MPV_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;
|
||||
outcaps = gst_caps_new_simple ("video/mpeg",
|
||||
"mpegversion", G_TYPE_INT, 2,
|
||||
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
|
||||
res = gst_pad_set_caps (depayload->srcpad, outcaps);
|
||||
gst_caps_unref (outcaps);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -138,9 +147,6 @@ gst_rtp_mpv_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
{
|
||||
gint payload_len, payload_header;
|
||||
guint8 *payload;
|
||||
|
@ -197,12 +203,7 @@ gst_rtp_mpv_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
return NULL;
|
||||
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate."));
|
||||
return NULL;
|
||||
}
|
||||
/* ERRORS */
|
||||
empty_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
|
||||
|
|
|
@ -118,15 +118,16 @@ gst_rtp_mpv_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
{
|
||||
const char *stname;
|
||||
GstStructure *structure;
|
||||
gboolean res;
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
|
||||
stname = gst_structure_get_name (structure);
|
||||
|
||||
gst_basertppayload_set_options (payload, "video", FALSE, "MPV", 90000);
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -121,11 +121,12 @@ gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
gboolean ret;
|
||||
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-alaw",
|
||||
|
@ -139,25 +140,27 @@ gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
static GstBuffer *
|
||||
gst_rtp_pcma_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
GstCaps *srccaps;
|
||||
GstBuffer *outbuf = NULL;
|
||||
gboolean marker;
|
||||
guint len;
|
||||
|
||||
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-alaw",
|
||||
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
|
||||
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
}
|
||||
|
||||
len = gst_rtp_buffer_get_payload_len (buf);
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||
|
||||
GST_BUFFER_DURATION (outbuf) =
|
||||
gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate);
|
||||
|
||||
if (marker) {
|
||||
/* mark start of talkspurt with DISCONT */
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,12 +110,14 @@ gst_rtp_pcma_pay_init (GstRtpPmcaPay * rtppcmapay, GstRtpPmcaPayClass * klass)
|
|||
static gboolean
|
||||
gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
payload->pt = GST_RTP_PAYLOAD_PCMA;
|
||||
|
||||
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMA", 8000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -121,11 +121,12 @@ gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
GstStructure *structure;
|
||||
gboolean ret;
|
||||
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-mulaw",
|
||||
|
@ -139,30 +140,27 @@ gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
static GstBuffer *
|
||||
gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
GstCaps *srccaps;
|
||||
GstBuffer *outbuf = NULL;
|
||||
guint len;
|
||||
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-mulaw",
|
||||
"channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, 8000, NULL);
|
||||
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
}
|
||||
|
||||
len = gst_rtp_buffer_get_payload_len (buf);
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||
|
||||
GST_BUFFER_DURATION (outbuf) =
|
||||
gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate);
|
||||
|
||||
if (marker) {
|
||||
/* mark start of talkspurt with DISCONT */
|
||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||
}
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,12 +110,14 @@ gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass)
|
|||
static gboolean
|
||||
gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||
{
|
||||
gboolean res;
|
||||
|
||||
payload->pt = GST_RTP_PAYLOAD_PCMU;
|
||||
|
||||
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMU", 8000);
|
||||
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
gst_basertppayload_set_outcaps (payload, NULL);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
|
|
@ -104,7 +104,6 @@ static void
|
|||
gst_rtp_speex_depay_init (GstRtpSPEEXDepay * rtpspeexdepay,
|
||||
GstRtpSPEEXDepayClass * klass)
|
||||
{
|
||||
GST_BASE_RTP_DEPAYLOAD (rtpspeexdepay)->clock_rate = 8000;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -134,12 +133,15 @@ gst_rtp_speex_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstBuffer *buf;
|
||||
guint8 *data;
|
||||
const gchar *params;
|
||||
GstCaps *srccaps;
|
||||
gboolean res;
|
||||
|
||||
rtpspeexdepay = GST_RTP_SPEEX_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))
|
||||
goto no_clockrate;
|
||||
depayload->clock_rate = clock_rate;
|
||||
|
||||
if (!(params = gst_structure_get_string (structure, "encoding-params")))
|
||||
|
@ -181,15 +183,28 @@ gst_rtp_speex_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
data += 4;
|
||||
GST_WRITE_UINT32_LE (data, 0); /* reserved2 */
|
||||
|
||||
srccaps = gst_caps_new_simple ("audio/x-speex", NULL);
|
||||
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (depayload->srcpad));
|
||||
gst_base_rtp_depayload_push (GST_BASE_RTP_DEPAYLOAD (rtpspeexdepay), buf);
|
||||
|
||||
buf = gst_buffer_new_and_alloc (sizeof (gst_rtp_speex_comment));
|
||||
memcpy (GST_BUFFER_DATA (buf), gst_rtp_speex_comment,
|
||||
sizeof (gst_rtp_speex_comment));
|
||||
|
||||
gst_buffer_set_caps (buf, GST_PAD_CAPS (depayload->srcpad));
|
||||
gst_base_rtp_depayload_push (GST_BASE_RTP_DEPAYLOAD (rtpspeexdepay), buf);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
no_clockrate:
|
||||
{
|
||||
GST_DEBUG_OBJECT (depayload, "no clock-rate specified");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GstBuffer *
|
||||
|
@ -205,6 +220,8 @@ gst_rtp_speex_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
/* nothing special to be done */
|
||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||
|
||||
GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND;
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ gst_rtp_speex_pay_parse_ident (GstRtpSPEEXPay * rtpspeexpay,
|
|||
guint32 version, header_size, rate, mode, nb_channels;
|
||||
GstBaseRTPPayload *payload;
|
||||
gchar *cstr;
|
||||
gboolean res;
|
||||
|
||||
/* we need the header string (8), the version string (20), the version
|
||||
* and the header length. */
|
||||
|
@ -190,11 +191,11 @@ gst_rtp_speex_pay_parse_ident (GstRtpSPEEXPay * rtpspeexpay,
|
|||
|
||||
gst_basertppayload_set_options (payload, "audio", FALSE, "SPEEX", rate);
|
||||
cstr = g_strdup_printf ("%d", nb_channels);
|
||||
gst_basertppayload_set_outcaps (payload, "encoding-params",
|
||||
res = gst_basertppayload_set_outcaps (payload, "encoding-params",
|
||||
G_TYPE_STRING, cstr, NULL);
|
||||
g_free (cstr);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
too_small:
|
||||
|
|
|
@ -123,32 +123,27 @@ gst_rtp_sv3v_depay_finalize (GObject * object)
|
|||
gboolean
|
||||
gst_rtp_sv3v_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||
{
|
||||
|
||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||
gint clock_rate = 90000; // default
|
||||
|
||||
if (gst_structure_has_field (structure, "clock-rate"))
|
||||
gst_structure_get_int (structure, "clock-rate", &clock_rate);
|
||||
gint clock_rate;
|
||||
|
||||
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||
clock_rate = 90000; // default
|
||||
filter->clock_rate = clock_rate;
|
||||
|
||||
/* will set caps later */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static GstBuffer *
|
||||
gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||
{
|
||||
|
||||
GstRtpSV3VDepay *rtpsv3vdepay;
|
||||
GstBuffer *outbuf;
|
||||
guint16 seq;
|
||||
|
||||
rtpsv3vdepay = GST_RTP_SV3V_DEPAY (depayload);
|
||||
|
||||
if (!gst_rtp_buffer_validate (buf))
|
||||
goto bad_packet;
|
||||
|
||||
/* flush on sequence number gaps */
|
||||
seq = gst_rtp_buffer_get_seq (buf);
|
||||
if (seq != rtpsv3vdepay->nextseq) {
|
||||
|
@ -236,9 +231,6 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
avail = gst_adapter_available (rtpsv3vdepay->adapter);
|
||||
outbuf = gst_adapter_take_buffer (rtpsv3vdepay->adapter, avail);
|
||||
|
||||
/* timestamp for complete buffer is that of last buffer as well */
|
||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
||||
|
||||
return outbuf;
|
||||
}
|
||||
}
|
||||
|
@ -248,7 +240,7 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpsv3vdepay, STREAM, DECODE,
|
||||
("Packet did not validate"), (NULL));
|
||||
(NULL), ("Packet was too short"));
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -331,6 +331,7 @@ gst_rtp_theora_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
const gchar *delivery_method;
|
||||
const gchar *configuration;
|
||||
gboolean res;
|
||||
|
||||
rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload);
|
||||
|
||||
|
@ -362,13 +363,13 @@ gst_rtp_theora_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
|
||||
/* set caps on pad and on header */
|
||||
srccaps = gst_caps_new_simple ("video/x-theora", NULL);
|
||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||
gst_caps_unref (srccaps);
|
||||
|
||||
/* Clock rate is always 90000 according to draft-barbato-avt-rtp-theora-01 */
|
||||
depayload->clock_rate = 90000;
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
unsupported_delivery_method:
|
||||
|
@ -444,9 +445,6 @@ gst_rtp_theora_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
rtptheoradepay = GST_RTP_THEORA_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);
|
||||
|
@ -614,12 +612,6 @@ no_output:
|
|||
return NULL;
|
||||
}
|
||||
/* ERORRS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtptheoradepay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
switch_failed:
|
||||
{
|
||||
GST_ELEMENT_ERROR (rtptheoradepay, STREAM, DECODE,
|
||||
|
|
|
@ -102,9 +102,7 @@ static void
|
|||
gst_rtp_theora_pay_class_init (GstRtpTheoraPayClass * klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
GstElementClass *gstelement_class;
|
||||
|
||||
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
||||
|
||||
gobject_class = (GObjectClass *) klass;
|
||||
|
@ -191,9 +189,7 @@ static GstFlowReturn
|
|||
gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay)
|
||||
{
|
||||
GstFlowReturn ret;
|
||||
|
||||
guint8 *payload;
|
||||
|
||||
guint hlen;
|
||||
|
||||
/* check for empty packet */
|
||||
|
@ -241,7 +237,6 @@ static gchar *
|
|||
encode_base64 (const guint8 * in, guint size, guint * len)
|
||||
{
|
||||
gchar *ret, *d;
|
||||
|
||||
static const gchar *v =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
|
@ -267,16 +262,12 @@ static gboolean
|
|||
gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
||||
{
|
||||
GstRtpTheoraPay *rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||
|
||||
GList *walk;
|
||||
|
||||
guint length, size, n_headers, configlen;
|
||||
|
||||
gchar *wstr, *hstr, *configuration;
|
||||
|
||||
guint8 *data, *config;
|
||||
|
||||
guint32 ident;
|
||||
gboolean res;
|
||||
|
||||
GST_DEBUG_OBJECT (rtptheorapay, "finish headers");
|
||||
|
||||
|
@ -428,7 +419,7 @@ gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||
wstr = g_strdup_printf ("%d", rtptheorapay->width);
|
||||
hstr = g_strdup_printf ("%d", rtptheorapay->height);
|
||||
gst_basertppayload_set_options (basepayload, "video", TRUE, "THEORA", 90000);
|
||||
gst_basertppayload_set_outcaps (basepayload,
|
||||
res = gst_basertppayload_set_outcaps (basepayload,
|
||||
"sampling", G_TYPE_STRING, "YCbCr-4:2:0",
|
||||
"width", G_TYPE_STRING, wstr,
|
||||
"height", G_TYPE_STRING, hstr,
|
||||
|
@ -441,7 +432,7 @@ gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||
g_free (hstr);
|
||||
g_free (configuration);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
no_headers:
|
||||
|
@ -456,7 +447,6 @@ gst_rtp_theora_pay_parse_id (GstBaseRTPPayload * basepayload, guint8 * data,
|
|||
guint size)
|
||||
{
|
||||
GstRtpTheoraPay *rtptheorapay;
|
||||
|
||||
gint width, height;
|
||||
|
||||
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||
|
@ -514,25 +504,15 @@ gst_rtp_theora_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
|||
GstBuffer * buffer)
|
||||
{
|
||||
GstRtpTheoraPay *rtptheorapay;
|
||||
|
||||
GstFlowReturn ret;
|
||||
|
||||
guint size, newsize;
|
||||
|
||||
guint8 *data;
|
||||
|
||||
guint packet_len;
|
||||
|
||||
GstClockTime duration, newduration, timestamp;
|
||||
|
||||
gboolean flush;
|
||||
|
||||
guint8 TDT;
|
||||
|
||||
guint plen;
|
||||
|
||||
guint8 *ppos, *payload;
|
||||
|
||||
gboolean fragmented;
|
||||
|
||||
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||
|
|
|
@ -327,6 +327,7 @@ gst_rtp_vorbis_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
GstCaps *srccaps;
|
||||
const gchar *configuration;
|
||||
gint clock_rate;
|
||||
gboolean res;
|
||||
|
||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
||||
|
||||
|
@ -351,10 +352,10 @@ gst_rtp_vorbis_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
|
||||
/* set caps on pad and on header */
|
||||
srccaps = gst_caps_new_simple ("audio/x-vorbis", 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 */
|
||||
invalid_configuration:
|
||||
|
@ -420,9 +421,6 @@ gst_rtp_vorbis_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
|||
|
||||
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);
|
||||
|
@ -593,12 +591,6 @@ no_output:
|
|||
return NULL;
|
||||
}
|
||||
/* ERORRS */
|
||||
bad_packet:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||
(NULL), ("Packet did not validate"));
|
||||
return NULL;
|
||||
}
|
||||
switch_failed:
|
||||
{
|
||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||
|
|
|
@ -257,6 +257,7 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||
gchar *cstr, *configuration;
|
||||
guint8 *data, *config;
|
||||
guint32 ident;
|
||||
gboolean res;
|
||||
|
||||
GST_DEBUG_OBJECT (rtpvorbispay, "finish headers");
|
||||
|
||||
|
@ -404,12 +405,13 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
|||
cstr = g_strdup_printf ("%d", rtpvorbispay->channels);
|
||||
gst_basertppayload_set_options (basepayload, "audio", TRUE, "VORBIS",
|
||||
rtpvorbispay->rate);
|
||||
gst_basertppayload_set_outcaps (basepayload, "encoding-params", G_TYPE_STRING,
|
||||
cstr, "configuration", G_TYPE_STRING, configuration, NULL);
|
||||
res =
|
||||
gst_basertppayload_set_outcaps (basepayload, "encoding-params",
|
||||
G_TYPE_STRING, cstr, "configuration", G_TYPE_STRING, configuration, NULL);
|
||||
g_free (cstr);
|
||||
g_free (configuration);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
no_headers:
|
||||
|
|
|
@ -112,12 +112,13 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
{
|
||||
GstStructure *structure;
|
||||
GstRtpVRawDepay *rtpvrawdepay;
|
||||
gint clock_rate = 90000; /* default */
|
||||
gint clock_rate;
|
||||
const gchar *str, *type;
|
||||
gint format, width, height, pgroup, xinc, yinc;
|
||||
guint ystride, uvstride, yp, up, vp, outsize;
|
||||
GstCaps *srccaps;
|
||||
guint32 fourcc = 0;
|
||||
gboolean res;
|
||||
|
||||
rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload);
|
||||
|
||||
|
@ -126,7 +127,8 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
yp = up = vp = uvstride = 0;
|
||||
xinc = yinc = 1;
|
||||
|
||||
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;
|
||||
|
||||
if (!(str = gst_structure_get_string (structure, "width")))
|
||||
|
@ -223,7 +225,7 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
"format", GST_TYPE_FOURCC, fourcc,
|
||||
"framerate", GST_TYPE_FRACTION, 0, 1, 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);
|
||||
|
||||
GST_DEBUG_OBJECT (depayload, "width %d, height %d, format %d", width, height,
|
||||
|
@ -233,7 +235,7 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
|||
ystride, uvstride);
|
||||
GST_DEBUG_OBJECT (depayload, "outsize %u", outsize);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
no_width:
|
||||
|
|
|
@ -333,14 +333,14 @@ gst_rtp_vraw_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
|||
hstr = g_strdup_printf ("%d", rtpvrawpay->height);
|
||||
|
||||
gst_basertppayload_set_options (payload, "video", TRUE, "RAW", 90000);
|
||||
gst_basertppayload_set_outcaps (payload, "sampling", G_TYPE_STRING,
|
||||
res = gst_basertppayload_set_outcaps (payload, "sampling", G_TYPE_STRING,
|
||||
samplingstr, "depth", G_TYPE_STRING, depthstr, "width", G_TYPE_STRING,
|
||||
wstr, "height", G_TYPE_STRING, hstr, "colorimetry", G_TYPE_STRING,
|
||||
colorimetrystr, NULL);
|
||||
g_free (wstr);
|
||||
g_free (hstr);
|
||||
|
||||
return TRUE;
|
||||
return res;
|
||||
|
||||
/* ERRORS */
|
||||
unknown_mask:
|
||||
|
|
Loading…
Reference in a new issue