mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-04 22:48:54 +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>
|
2008-10-27 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/matroska/matroska-demux.c:
|
* gst/matroska/matroska-demux.c:
|
||||||
|
|
|
@ -145,6 +145,7 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
gint clock_rate, payload;
|
gint clock_rate, payload;
|
||||||
gint channels;
|
gint channels;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
|
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
|
||||||
|
|
||||||
|
@ -170,7 +171,12 @@ gst_rtp_L16_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
/* caps can overwrite defaults */
|
/* caps can overwrite defaults */
|
||||||
clock_rate =
|
clock_rate =
|
||||||
gst_rtp_L16_depay_parse_int (structure, "clock-rate", 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);
|
channels = gst_rtp_L16_depay_parse_int (structure, "channels", channels);
|
||||||
|
if (channels == 0)
|
||||||
|
goto no_channels;
|
||||||
|
|
||||||
depayload->clock_rate = clock_rate;
|
depayload->clock_rate = clock_rate;
|
||||||
rtpL16depay->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,
|
"depth", G_TYPE_INT, 16,
|
||||||
"rate", G_TYPE_INT, clock_rate, "channels", G_TYPE_INT, channels, NULL);
|
"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);
|
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 *
|
static GstBuffer *
|
||||||
|
@ -194,34 +212,29 @@ gst_rtp_L16_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstRtpL16Depay *rtpL16depay;
|
GstRtpL16Depay *rtpL16depay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
gint payload_len;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
|
rtpL16depay = GST_RTP_L16_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
{
|
if (payload_len <= 0)
|
||||||
gint payload_len;
|
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)
|
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||||
goto empty_packet;
|
marker = gst_rtp_buffer_get_marker (buf);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rtpL16depay, "got payload of %d bytes", payload_len);
|
if (marker) {
|
||||||
|
/* mark talk spurt with DISCONT */
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||||
|
|
||||||
return outbuf;
|
|
||||||
}
|
}
|
||||||
return NULL;
|
|
||||||
|
|
||||||
bad_packet:
|
return outbuf;
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
|
/* ERRORS */
|
||||||
("Packet did not validate."), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpL16depay, STREAM, DECODE,
|
||||||
|
|
|
@ -163,6 +163,7 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
||||||
GstRtpL16Pay *rtpL16pay;
|
GstRtpL16Pay *rtpL16pay;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gint channels, rate;
|
gint channels, rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpL16pay = GST_RTP_L16_PAY (basepayload);
|
rtpL16pay = GST_RTP_L16_PAY (basepayload);
|
||||||
|
|
||||||
|
@ -176,13 +177,13 @@ gst_rtp_L16_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
||||||
goto no_channels;
|
goto no_channels;
|
||||||
|
|
||||||
gst_basertppayload_set_options (basepayload, "audio", TRUE, "L16", rate);
|
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);
|
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, rate, NULL);
|
||||||
|
|
||||||
rtpL16pay->rate = rate;
|
rtpL16pay->rate = rate;
|
||||||
rtpL16pay->channels = channels;
|
rtpL16pay->channels = channels;
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_rate:
|
no_rate:
|
||||||
|
|
|
@ -110,16 +110,23 @@ gst_rtp_ac3_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpAC3Depay *rtpac3depay;
|
GstRtpAC3Depay *rtpac3depay;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
|
GstCaps *srccaps;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
|
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
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
|
struct frmsize_s
|
||||||
|
@ -177,9 +184,6 @@ gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
|
rtpac3depay = GST_RTP_AC3_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
gint payload_len;
|
gint payload_len;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
|
@ -218,20 +222,7 @@ gst_rtp_ac3_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
/* ERRORS */
|
||||||
{
|
|
||||||
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
|
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpac3depay, STREAM, DECODE,
|
||||||
|
|
|
@ -174,6 +174,7 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
const gchar *params;
|
const gchar *params;
|
||||||
const gchar *str, *type;
|
const gchar *str, *type;
|
||||||
gint clock_rate, need_clock_rate;
|
gint clock_rate, need_clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
|
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 ((str = gst_structure_get_string (structure, "encoding-name"))) {
|
||||||
if (strcmp (str, "AMR") == 0) {
|
if (strcmp (str, "AMR") == 0) {
|
||||||
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_NB;
|
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_NB;
|
||||||
clock_rate = need_clock_rate = 8000;
|
need_clock_rate = 8000;
|
||||||
type = "audio/AMR";
|
type = "audio/AMR";
|
||||||
} else if (strcmp (str, "AMR-WB") == 0) {
|
} else if (strcmp (str, "AMR-WB") == 0) {
|
||||||
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_WB;
|
rtpamrdepay->mode = GST_RTP_AMR_DP_MODE_WB;
|
||||||
clock_rate = need_clock_rate = 16000;
|
need_clock_rate = 16000;
|
||||||
type = "audio/AMR-WB";
|
type = "audio/AMR-WB";
|
||||||
} else
|
} else
|
||||||
goto invalid_mode;
|
goto invalid_mode;
|
||||||
|
@ -235,7 +236,8 @@ gst_rtp_amr_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
rtpamrdepay->channels = atoi (params);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
/* we require 1 channel, 8000 Hz, octet aligned, no CRC,
|
/* 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,
|
srccaps = gst_caps_new_simple (type,
|
||||||
"channels", G_TYPE_INT, rtpamrdepay->channels,
|
"channels", G_TYPE_INT, rtpamrdepay->channels,
|
||||||
"rate", G_TYPE_INT, clock_rate, NULL);
|
"rate", G_TYPE_INT, clock_rate, NULL);
|
||||||
|
res = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||||
gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
rtpamrdepay->negotiated = TRUE;
|
return res;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
invalid_mode:
|
invalid_mode:
|
||||||
|
@ -290,12 +289,6 @@ gst_rtp_amr_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpamrdepay = GST_RTP_AMR_DEPAY (depayload);
|
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 */
|
/* setup frame size pointer */
|
||||||
if (rtpamrdepay->mode == GST_RTP_AMR_DP_MODE_NB)
|
if (rtpamrdepay->mode == GST_RTP_AMR_DP_MODE_NB)
|
||||||
frame_size = nb_frame_size;
|
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;
|
GST_BUFFER_DURATION (outbuf) = num_packets * 20 * GST_MSECOND;
|
||||||
|
|
||||||
if (marker) {
|
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_DEBUG_OBJECT (depayload, "marker bit was set");
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
||||||
marker = FALSE;
|
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_DEBUG_OBJECT (depayload, "pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
}
|
}
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
/* 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:
|
too_small:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpamrdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpamrdepay, STREAM, DECODE,
|
||||||
|
|
|
@ -49,7 +49,6 @@ struct _GstRtpAMRDepay
|
||||||
{
|
{
|
||||||
GstBaseRTPDepayload depayload;
|
GstBaseRTPDepayload depayload;
|
||||||
|
|
||||||
gboolean negotiated;
|
|
||||||
GstRtpAMRDepayMode mode;
|
GstRtpAMRDepayMode mode;
|
||||||
|
|
||||||
gboolean octet_align;
|
gboolean octet_align;
|
||||||
|
|
|
@ -173,7 +173,7 @@ gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRTPDVDepay *rtpdvdepay;
|
GstRTPDVDepay *rtpdvdepay;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
gboolean systemstream, ret;
|
gboolean systemstream, ret;
|
||||||
const gchar *encode, *media;
|
const gchar *encode, *media;
|
||||||
|
|
||||||
|
@ -181,8 +181,9 @@ gst_rtp_dv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
if (gst_structure_has_field (structure, "clock-rate"))
|
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||||
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
|
/* we really need the encode property to figure out the frame size, it's also
|
||||||
* required by the spec */
|
* 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);
|
ret = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
depayload->clock_rate = clock_rate;
|
|
||||||
rtpdvdepay->negotiated = TRUE;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -307,9 +305,6 @@ gst_rtp_dv_depay_process (GstBaseRTPDepayload * base, GstBuffer * in)
|
||||||
GstRTPDVDepay *dvdepay = GST_RTP_DV_DEPAY (base);
|
GstRTPDVDepay *dvdepay = GST_RTP_DV_DEPAY (base);
|
||||||
gboolean marker;
|
gboolean marker;
|
||||||
|
|
||||||
if (!dvdepay->negotiated)
|
|
||||||
goto not_negotiated;
|
|
||||||
|
|
||||||
marker = gst_rtp_buffer_get_marker (in);
|
marker = gst_rtp_buffer_get_marker (in);
|
||||||
|
|
||||||
/* Check if the received packet contains (the start of) a new frame, we do
|
/* 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;
|
dvdepay->prev_ts = rtp_ts;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
not_negotiated:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (dvdepay, STREAM, NOT_IMPLEMENTED,
|
|
||||||
(NULL), ("not negotiated"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -381,7 +368,6 @@ gst_rtp_dv_depay_reset (GstRTPDVDepay * depay)
|
||||||
depay->prev_ts = -1;
|
depay->prev_ts = -1;
|
||||||
depay->have_header = FALSE;
|
depay->have_header = FALSE;
|
||||||
depay->frame_nr = 0;
|
depay->frame_nr = 0;
|
||||||
depay->negotiated = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
|
|
@ -51,7 +51,6 @@ struct _GstRTPDVDepay
|
||||||
|
|
||||||
gint width, height;
|
gint width, height;
|
||||||
gint rate_num, rate_denom;
|
gint rate_num, rate_denom;
|
||||||
gboolean negotiated;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRTPDVDepayClass
|
struct _GstRTPDVDepayClass
|
||||||
|
|
|
@ -130,13 +130,14 @@ gst_rtp_g726_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gint clock_rate = 8000; /* default */
|
gint clock_rate;
|
||||||
const gchar *encoding_name;
|
const gchar *encoding_name;
|
||||||
gint bitrate;
|
gint bitrate;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
encoding_name = gst_structure_get_string (structure, "encoding-name");
|
encoding_name = gst_structure_get_string (structure, "encoding-name");
|
||||||
|
@ -175,27 +176,22 @@ done:
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_g726_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_g726_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
|
||||||
GstBuffer *outbuf = NULL;
|
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_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf), marker,
|
||||||
gst_rtp_buffer_get_marker (buf),
|
|
||||||
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
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);
|
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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,6 @@ gst_rtp_g729_depay_init (GstRtpG729Depay * rtpg729depay,
|
||||||
|
|
||||||
depayload = GST_BASE_RTP_DEPAYLOAD (rtpg729depay);
|
depayload = GST_BASE_RTP_DEPAYLOAD (rtpg729depay);
|
||||||
|
|
||||||
depayload->clock_rate = 8000;
|
|
||||||
gst_pad_use_fixed_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
|
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)
|
if (clock_rate != 8000)
|
||||||
goto wrong_clock_rate;
|
goto wrong_clock_rate;
|
||||||
|
|
||||||
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/G729",
|
srccaps = gst_caps_new_simple ("audio/G729",
|
||||||
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, clock_rate, NULL);
|
"channels", G_TYPE_INT, channels, "rate", G_TYPE_INT, clock_rate, NULL);
|
||||||
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
ret = gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload), srccaps);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
rtpg729depay->negotiated = ret;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
|
@ -184,18 +183,10 @@ gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
GstRtpG729Depay *rtpg729depay;
|
GstRtpG729Depay *rtpg729depay;
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
gint payload_len;
|
gint payload_len;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
rtpg729depay = GST_RTP_G729_DEPAY (depayload);
|
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);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
|
|
||||||
/* At least 2 bytes (CNG from G729 Annex B) */
|
/* 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);
|
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_DEBUG ("gst_rtp_g729_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
@ -219,12 +216,6 @@ gst_rtp_g729_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
not_negotiated:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (rtpg729depay, STREAM, NOT_IMPLEMENTED,
|
|
||||||
(NULL), ("not negotiated"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
bad_packet:
|
bad_packet:
|
||||||
{
|
{
|
||||||
/* no fatal error */
|
/* no fatal error */
|
||||||
|
|
|
@ -46,8 +46,6 @@ struct _GstRtpG729Depay
|
||||||
{
|
{
|
||||||
GstBaseRTPDepayload depayload;
|
GstBaseRTPDepayload depayload;
|
||||||
|
|
||||||
gboolean negotiated;
|
|
||||||
|
|
||||||
gint channels;
|
gint channels;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -118,11 +118,12 @@ gst_rtp_gsm_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gint clock_rate = 8000; /* default */
|
gint clock_rate;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/x-gsm",
|
srccaps = gst_caps_new_simple ("audio/x-gsm",
|
||||||
|
@ -137,14 +138,21 @@ static GstBuffer *
|
||||||
gst_rtp_gsm_depay_process (GstBaseRTPDepayload * _depayload, GstBuffer * buf)
|
gst_rtp_gsm_depay_process (GstBaseRTPDepayload * _depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstBuffer *outbuf = NULL;
|
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_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf), marker,
|
||||||
gst_rtp_buffer_get_marker (buf),
|
|
||||||
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
||||||
|
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,20 +111,26 @@ gst_rtp_gsm_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
const char *stname;
|
const char *stname;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
stname = gst_structure_get_name (structure);
|
stname = gst_structure_get_name (structure);
|
||||||
|
|
||||||
if (0 == strcmp ("audio/x-gsm", stname)) {
|
if (strcmp ("audio/x-gsm", stname))
|
||||||
gst_basertppayload_set_options (payload, "audio", FALSE, "GSM", 8000);
|
goto invalid_type;
|
||||||
} else {
|
|
||||||
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
|
|
@ -147,9 +147,10 @@ gst_rtp_h263_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
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;
|
filter->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/x-h263",
|
srccaps = gst_caps_new_simple ("video/x-h263",
|
||||||
|
@ -164,22 +165,17 @@ gst_rtp_h263_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_h263_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_h263_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstRtpH263Depay *rtph263depay;
|
GstRtpH263Depay *rtph263depay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
gint payload_len;
|
gint payload_len;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
guint header_len;
|
guint header_len;
|
||||||
|
|
||||||
guint SBIT, EBIT;
|
guint SBIT, EBIT;
|
||||||
gboolean F, P, M;
|
gboolean F, P, M;
|
||||||
gboolean I;
|
gboolean I;
|
||||||
|
|
||||||
rtph263depay = GST_RTP_H263_DEPAY (depayload);
|
rtph263depay = GST_RTP_H263_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
GST_LOG_OBJECT (depayload, "Discont buffer, flushing adapter");
|
GST_LOG_OBJECT (depayload, "Discont buffer, flushing adapter");
|
||||||
|
@ -326,13 +322,6 @@ gst_rtp_h263_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtph263depay, STREAM, DECODE,
|
|
||||||
("Packet did not validate"), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
|
|
@ -263,11 +263,12 @@ gst_rtp_h263_pay_finalize (GObject * object)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_h263_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
gst_rtp_h263_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
payload->pt = GST_RTP_PAYLOAD_H263;
|
gboolean res;
|
||||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263", 90000);
|
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
gst_basertppayload_set_options (payload, "video", TRUE, "H263", 90000);
|
||||||
|
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
static guint
|
||||||
|
@ -350,7 +351,8 @@ gst_rtp_h263_pay_flush (GstRtpH263Pay * rtph263pay)
|
||||||
|
|
||||||
memcpy (payload, data + curpos, payload_len);
|
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);
|
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);
|
rtph263pay = GST_RTP_H263_PAY (payload);
|
||||||
|
|
||||||
size = GST_BUFFER_SIZE (buffer);
|
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 */
|
/* we always encode and flush a full picture */
|
||||||
gst_adapter_push (rtph263pay->adapter, buffer);
|
gst_adapter_push (rtph263pay->adapter, buffer);
|
||||||
|
|
|
@ -45,7 +45,8 @@ struct _GstRtpH263Pay
|
||||||
GstBaseRTPPayload payload;
|
GstBaseRTPPayload payload;
|
||||||
|
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
GstClockTime first_ts;
|
GstClockTime first_timestamp;
|
||||||
|
GstClockTime first_duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstRtpH263PayClass
|
struct _GstRtpH263PayClass
|
||||||
|
|
|
@ -156,10 +156,12 @@ gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps = NULL;
|
GstCaps *srccaps = NULL;
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
const gchar *encoding_name = NULL;
|
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;
|
filter->clock_rate = clock_rate;
|
||||||
|
|
||||||
encoding_name = gst_structure_get_string (structure, "encoding-name");
|
encoding_name = gst_structure_get_string (structure, "encoding-name");
|
||||||
|
@ -216,10 +218,10 @@ gst_rtp_h263p_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||||
if (!srccaps)
|
if (!srccaps)
|
||||||
goto no_caps;
|
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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_encoding_name:
|
no_encoding_name:
|
||||||
|
@ -237,15 +239,11 @@ no_caps:
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstRtpH263PDepay *rtph263pdepay;
|
GstRtpH263PDepay *rtph263pdepay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
|
||||||
rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
|
rtph263pdepay = GST_RTP_H263P_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
|
GST_LOG_OBJECT (depayload, "DISCONT, flushing adapter");
|
||||||
|
@ -266,7 +264,7 @@ gst_rtp_h263p_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
header_len = 2;
|
header_len = 2;
|
||||||
|
|
||||||
if (payload_len < header_len)
|
if (payload_len < header_len)
|
||||||
goto bad_packet;
|
goto too_small;
|
||||||
|
|
||||||
M = gst_rtp_buffer_get_marker (buf);
|
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))
|
if ((!P && payload_len < header_len) || (P && payload_len < header_len - 2))
|
||||||
goto bad_packet;
|
goto too_small;
|
||||||
|
|
||||||
if (P) {
|
if (P) {
|
||||||
/* FIXME, have to make the packet writable hear. Better to reset these
|
/* 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;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
|
|
||||||
("Packet did not validate"), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
too_small:
|
too_small:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtph263pdepay, STREAM, DECODE,
|
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",
|
GST_DEBUG_CATEGORY_INIT (rtph263ppay_debug, "rtph263ppay",
|
||||||
0, "rtph263ppay (RFC 4629)");
|
0, "rtph263ppay (RFC 4629)");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -195,10 +194,12 @@ gst_rtp_h263p_pay_finalize (GObject * object)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
gst_rtp_h263p_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
gst_basertppayload_set_options (payload, "video", TRUE, "H263-1998", 90000);
|
gboolean res;
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
gst_basertppayload_set_options (payload, "video", TRUE, "H263-1998", 90000);
|
||||||
|
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -237,8 +238,6 @@ gst_rtp_h263p_pay_get_property (GObject * object, guint prop_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_rtp_h263p_pay_flush (GstRtpH263PPay * rtph263ppay)
|
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[0] = (fragmented && !found_gob) ? 0x00 : 0x04;
|
||||||
payload[1] = 0;
|
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);
|
gst_adapter_flush (rtph263ppay->adapter, towrite);
|
||||||
|
|
||||||
ret = gst_basertppayload_push (GST_BASE_RTP_PAYLOAD (rtph263ppay), outbuf);
|
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);
|
rtph263ppay = GST_RTP_H263P_PAY (payload);
|
||||||
|
|
||||||
size = GST_BUFFER_SIZE (buffer);
|
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 */
|
/* we always encode and flush a full picture */
|
||||||
gst_adapter_push (rtph263ppay->adapter, buffer);
|
gst_adapter_push (rtph263ppay->adapter, buffer);
|
||||||
|
|
|
@ -51,7 +51,8 @@ struct _GstRtpH263PPay
|
||||||
GstBaseRTPPayload payload;
|
GstBaseRTPPayload payload;
|
||||||
|
|
||||||
GstAdapter *adapter;
|
GstAdapter *adapter;
|
||||||
GstClockTime first_ts;
|
GstClockTime first_timestamp;
|
||||||
|
GstClockTime first_duration;
|
||||||
GstFragmentationMode fragmentation_mode;
|
GstFragmentationMode fragmentation_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -253,17 +253,19 @@ decode_base64 (gchar * in, guint8 * out)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
gst_rtp_h264_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps = NULL;
|
GstCaps *srccaps;
|
||||||
gint clock_rate = 90000;
|
gint clock_rate;
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||||
GstRtpH264Depay *rtph264depay;
|
GstRtpH264Depay *rtph264depay;
|
||||||
const gchar *ps, *profile;
|
const gchar *ps, *profile;
|
||||||
GstBuffer *codec_data;
|
GstBuffer *codec_data;
|
||||||
guint8 *b64;
|
guint8 *b64;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtph264depay = GST_RTP_H264_DEPAY (depayload);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/x-h264", NULL);
|
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);
|
"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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
incomplete_caps:
|
incomplete_caps:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (depayload, "we have incomplete caps");
|
GST_DEBUG_OBJECT (depayload, "we have incomplete caps");
|
||||||
|
gst_caps_unref (srccaps);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,9 +422,6 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtph264depay = GST_RTP_H264_DEPAY (depayload);
|
rtph264depay = GST_RTP_H264_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
gst_adapter_clear (rtph264depay->adapter);
|
gst_adapter_clear (rtph264depay->adapter);
|
||||||
|
@ -668,12 +668,6 @@ gst_rtp_h264_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
undefined_type:
|
undefined_type:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtph264depay, STREAM, DECODE,
|
||||||
|
|
|
@ -304,6 +304,8 @@ gst_rtp_h264_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
||||||
data += 2;
|
data += 2;
|
||||||
size -= 2;
|
size -= 2;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (rtph264pay, "SPS %d size %d", i, nal_size);
|
||||||
|
|
||||||
if (size < nal_size)
|
if (size < nal_size)
|
||||||
goto avcc_error;
|
goto avcc_error;
|
||||||
|
|
||||||
|
@ -335,6 +337,8 @@ gst_rtp_h264_pay_setcaps (GstBaseRTPPayload * basepayload, GstCaps * caps)
|
||||||
data += 2;
|
data += 2;
|
||||||
size -= 2;
|
size -= 2;
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (rtph264pay, "PPS %d size %d", i, nal_size);
|
||||||
|
|
||||||
if (size < nal_size)
|
if (size < nal_size)
|
||||||
goto avcc_error;
|
goto avcc_error;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
static const GstElementDetails gst_rtp_ilbc_depay_details =
|
static const GstElementDetails gst_rtp_ilbc_depay_details =
|
||||||
GST_ELEMENT_DETAILS ("RTP iLBC packet depayloader",
|
GST_ELEMENT_DETAILS ("RTP iLBC packet depayloader",
|
||||||
"Codec/Depayloader/Network",
|
"Codec/Depayloader/Network",
|
||||||
"Extracts iLBC audio from RTP packets",
|
"Extracts iLBC audio from RTP packets (RFC 3952)",
|
||||||
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>");
|
"Philippe Kalaf <philippe.kalaf@collabora.co.uk>");
|
||||||
|
|
||||||
/* RtpiLBCDepay signals and args */
|
/* RtpiLBCDepay signals and args */
|
||||||
|
@ -152,13 +152,17 @@ gst_rtp_ilbc_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const gchar *mode_str = NULL;
|
const gchar *mode_str = NULL;
|
||||||
gint mode;
|
gint mode, clock_rate;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
mode = rtpilbcdepay->mode;
|
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 */
|
/* parse mode, if we can */
|
||||||
mode_str = gst_structure_get_string (structure, "mode");
|
mode_str = gst_structure_get_string (structure, "mode");
|
||||||
if (mode_str) {
|
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_DEBUG ("set caps on source: %" GST_PTR_FORMAT " (ret=%d)", srccaps, ret);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
/* always fixed clock rate of 8000 */
|
|
||||||
depayload->clock_rate = 8000;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,14 +187,21 @@ static GstBuffer *
|
||||||
gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_ilbc_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
|
marker = gst_rtp_buffer_get_marker (buf);
|
||||||
|
|
||||||
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf), marker,
|
||||||
gst_rtp_buffer_get_marker (buf),
|
|
||||||
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
||||||
|
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -131,20 +131,21 @@ gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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);
|
payload_name = gst_structure_get_name (structure);
|
||||||
if (g_ascii_strcasecmp ("audio/x-iLBC", payload_name))
|
if (g_ascii_strcasecmp ("audio/x-iLBC", payload_name))
|
||||||
goto wrong_caps;
|
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);
|
gst_basertppayload_set_options (basertppayload, "audio", TRUE, "ILBC", 8000);
|
||||||
/* set options for this frame based audio codec */
|
/* set options for this frame based audio codec */
|
||||||
gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload,
|
gst_base_rtp_audio_payload_set_frame_options (basertpaudiopayload,
|
||||||
mode, mode == 30 ? 50 : 38);
|
mode, mode == 30 ? 50 : 38);
|
||||||
|
|
||||||
|
|
||||||
mode_str = g_strdup_printf ("%d", mode);
|
mode_str = g_strdup_printf ("%d", mode);
|
||||||
ret =
|
ret =
|
||||||
gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_STRING,
|
gst_basertppayload_set_outcaps (basertppayload, "mode", G_TYPE_STRING,
|
||||||
|
@ -159,17 +160,22 @@ gst_rtpilbcpay_sink_setcaps (GstBaseRTPPayload * basertppayload, GstCaps * caps)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
wrong_mode:
|
|
||||||
{
|
|
||||||
GST_ERROR_OBJECT (rtpilbcpay, "mode must be 20 or 30, received %d", mode);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
wrong_caps:
|
wrong_caps:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (rtpilbcpay, "expected audio/x-iLBC, received %s",
|
GST_ERROR_OBJECT (rtpilbcpay, "expected audio/x-iLBC, received %s",
|
||||||
payload_name);
|
payload_name);
|
||||||
return FALSE;
|
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:
|
mode_changed:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (rtpilbcpay, "Mode has changed from %d to %d! "
|
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;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpMP1SDepay *rtpmp1sdepay;
|
GstRtpMP1SDepay *rtpmp1sdepay;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp1sdepay = GST_RTP_MP1S_DEPAY (depayload);
|
rtpmp1sdepay = GST_RTP_MP1S_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/mpeg",
|
srccaps = gst_caps_new_simple ("video/mpeg",
|
||||||
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
"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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
|
@ -155,30 +157,15 @@ gst_rtp_mp1s_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstRtpMP1SDepay *rtpmp1sdepay;
|
GstRtpMP1SDepay *rtpmp1sdepay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
gint payload_len;
|
|
||||||
|
|
||||||
rtpmp1sdepay = GST_RTP_MP1S_DEPAY (depayload);
|
rtpmp1sdepay = GST_RTP_MP1S_DEPAY (depayload);
|
||||||
|
|
||||||
if (G_UNLIKELY (!gst_rtp_buffer_validate (buf)))
|
outbuf = gst_rtp_buffer_get_payload_buffer (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));
|
|
||||||
|
|
||||||
GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %d",
|
GST_DEBUG ("gst_rtp_mp1s_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmp1sdepay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -148,21 +148,23 @@ gst_rtp_mp2t_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpMP2TDepay *rtpmp2tdepay;
|
GstRtpMP2TDepay *rtpmp2tdepay;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/mpegts",
|
srccaps = gst_caps_new_simple ("video/mpegts",
|
||||||
"packetsize", G_TYPE_INT, 188,
|
"packetsize", G_TYPE_INT, 188,
|
||||||
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
|
"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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
|
@ -174,9 +176,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmp2tdepay = GST_RTP_MP2T_DEPAY (depayload);
|
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);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
|
|
||||||
if (G_UNLIKELY (payload_len <= rtpmp2tdepay->skip_first_bytes))
|
if (G_UNLIKELY (payload_len <= rtpmp2tdepay->skip_first_bytes))
|
||||||
|
@ -185,7 +184,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
outbuf =
|
outbuf =
|
||||||
gst_rtp_buffer_get_payload_subbuffer (buf, rtpmp2tdepay->skip_first_bytes,
|
gst_rtp_buffer_get_payload_subbuffer (buf, rtpmp2tdepay->skip_first_bytes,
|
||||||
-1);
|
-1);
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (depayload->srcpad));
|
|
||||||
|
|
||||||
GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %d",
|
GST_DEBUG ("gst_rtp_mp2t_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
@ -193,12 +191,6 @@ gst_rtp_mp2t_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return outbuf;
|
return outbuf;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpmp2tdepay, STREAM, DECODE,
|
||||||
|
|
|
@ -138,20 +138,21 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstRtpMP4ADepay *rtpmp4adepay;
|
GstRtpMP4ADepay *rtpmp4adepay;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
gint object_type = 2; /* AAC LC default */
|
gint object_type;
|
||||||
gint channels = 2; /* default */
|
gint channels = 2; /* default */
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
|
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
if (gst_structure_has_field (structure, "clock-rate"))
|
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||||
gst_structure_get_int (structure, "clock-rate", &clock_rate);
|
clock_rate = 90000; /* default */
|
||||||
depayload->clock_rate = clock_rate;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
if (gst_structure_has_field (structure, "object"))
|
if (!gst_structure_get_int (structure, "object", &object_type))
|
||||||
gst_structure_get_int (structure, "object", &object_type);
|
object_type = 2; /* AAC LC default */
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/mpeg",
|
srccaps = gst_caps_new_simple ("audio/mpeg",
|
||||||
"mpegversion", G_TYPE_INT, 4,
|
"mpegversion", G_TYPE_INT, 4,
|
||||||
|
@ -219,10 +220,10 @@ gst_rtp_mp4a_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bad_config:
|
bad_config:
|
||||||
gst_pad_set_caps (depayload->srcpad, srccaps);
|
res = gst_pad_set_caps (depayload->srcpad, srccaps);
|
||||||
gst_caps_unref (srccaps);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
|
@ -233,9 +234,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
|
rtpmp4adepay = GST_RTP_MP4A_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
gst_adapter_clear (rtpmp4adepay->adapter);
|
gst_adapter_clear (rtpmp4adepay->adapter);
|
||||||
|
@ -322,12 +320,6 @@ gst_rtp_mp4a_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmp4adepay, STREAM, DECODE,
|
|
||||||
("Packet did not validate"), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
wrong_size:
|
wrong_size:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpmp4adepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpmp4adepay, STREAM, DECODE,
|
||||||
|
|
|
@ -254,21 +254,24 @@ wrong_channels:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_rtp_mp4a_pay_new_caps (GstRtpMP4APay * rtpmp4apay)
|
gst_rtp_mp4a_pay_new_caps (GstRtpMP4APay * rtpmp4apay)
|
||||||
{
|
{
|
||||||
gchar *config;
|
gchar *config;
|
||||||
GValue v = { 0 };
|
GValue v = { 0 };
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
g_value_init (&v, GST_TYPE_BUFFER);
|
g_value_init (&v, GST_TYPE_BUFFER);
|
||||||
gst_value_set_buffer (&v, rtpmp4apay->config);
|
gst_value_set_buffer (&v, rtpmp4apay->config);
|
||||||
config = gst_value_serialize (&v);
|
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);
|
"cpresent", G_TYPE_STRING, "0", "config", G_TYPE_STRING, config, NULL);
|
||||||
|
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
g_free (config);
|
g_free (config);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -277,6 +280,7 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
GstRtpMP4APay *rtpmp4apay;
|
GstRtpMP4APay *rtpmp4apay;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const GValue *codec_data;
|
const GValue *codec_data;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4apay = GST_RTP_MP4A_PAY (payload);
|
rtpmp4apay = GST_RTP_MP4A_PAY (payload);
|
||||||
|
|
||||||
|
@ -290,7 +294,6 @@ gst_rtp_mp4a_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
guint8 *config;
|
guint8 *config;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
guint size, i;
|
guint size, i;
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
buffer = gst_value_get_buffer (codec_data);
|
buffer = gst_value_get_buffer (codec_data);
|
||||||
GST_LOG_OBJECT (rtpmp4apay, "configuring 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",
|
gst_basertppayload_set_options (payload, "audio", TRUE, "MP4A-LATM",
|
||||||
rtpmp4apay->rate);
|
rtpmp4apay->rate);
|
||||||
|
|
||||||
gst_rtp_mp4a_pay_new_caps (rtpmp4apay);
|
res = gst_rtp_mp4a_pay_new_caps (rtpmp4apay);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
config_failed:
|
config_failed:
|
||||||
|
|
|
@ -225,19 +225,20 @@ gst_rtp_mp4g_depay_parse_int (GstStructure * structure, const gchar * field,
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
gst_rtp_mp4g_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpMP4GDepay *rtpmp4gdepay;
|
GstRtpMP4GDepay *rtpmp4gdepay;
|
||||||
GstCaps *srccaps = NULL;
|
GstCaps *srccaps = NULL;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
gint someint;
|
gint someint;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
|
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
if ((str = gst_structure_get_string (structure, "media"))) {
|
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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unknown_media:
|
unknown_media:
|
||||||
|
@ -424,9 +425,6 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
|
rtpmp4gdepay = GST_RTP_MP4G_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf)) {
|
if (GST_BUFFER_IS_DISCONT (buf)) {
|
||||||
GST_DEBUG_OBJECT (rtpmp4gdepay, "received DISCONT");
|
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);
|
avail = gst_adapter_available (rtpmp4gdepay->adapter);
|
||||||
|
|
||||||
outbuf = gst_adapter_take_buffer (rtpmp4gdepay->adapter, avail);
|
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_DEBUG ("gst_rtp_mp4g_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
@ -640,12 +637,6 @@ gst_rtp_mp4g_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
|
|
||||||
("Packet did not validate."), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
short_payload:
|
short_payload:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpmp4gdepay, STREAM, DECODE,
|
||||||
|
|
|
@ -172,6 +172,7 @@ gst_rtp_mp4g_pay_finalize (GObject * object)
|
||||||
|
|
||||||
g_object_unref (rtpmp4gpay->adapter);
|
g_object_unref (rtpmp4gpay->adapter);
|
||||||
rtpmp4gpay->adapter = NULL;
|
rtpmp4gpay->adapter = NULL;
|
||||||
|
|
||||||
g_free (rtpmp4gpay->params);
|
g_free (rtpmp4gpay->params);
|
||||||
rtpmp4gpay->params = NULL;
|
rtpmp4gpay->params = NULL;
|
||||||
|
|
||||||
|
@ -326,11 +327,12 @@ too_short:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
||||||
{
|
{
|
||||||
gchar *config;
|
gchar *config;
|
||||||
GValue v = { 0 };
|
GValue v = { 0 };
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
#define MP4GCAPS \
|
#define MP4GCAPS \
|
||||||
"streamtype", G_TYPE_STRING, rtpmp4gpay->streamtype, \
|
"streamtype", G_TYPE_STRING, rtpmp4gpay->streamtype, \
|
||||||
|
@ -348,10 +350,10 @@ gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
||||||
|
|
||||||
/* hmm, silly */
|
/* hmm, silly */
|
||||||
if (rtpmp4gpay->params) {
|
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);
|
"encoding-params", G_TYPE_STRING, rtpmp4gpay->params, MP4GCAPS);
|
||||||
} else {
|
} else {
|
||||||
gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
res = gst_basertppayload_set_outcaps (GST_BASE_RTP_PAYLOAD (rtpmp4gpay),
|
||||||
MP4GCAPS);
|
MP4GCAPS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,6 +361,7 @@ gst_rtp_mp4g_pay_new_caps (GstRtpMP4GPay * rtpmp4gpay)
|
||||||
g_free (config);
|
g_free (config);
|
||||||
|
|
||||||
#undef MP4GCAPS
|
#undef MP4GCAPS
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -368,6 +371,7 @@ gst_rtp_mp4g_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const GValue *codec_data;
|
const GValue *codec_data;
|
||||||
gchar *media_type = NULL;
|
gchar *media_type = NULL;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4gpay = GST_RTP_MP4G_PAY (payload);
|
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) {
|
if (G_VALUE_TYPE (codec_data) == GST_TYPE_BUFFER) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
const gchar *name;
|
const gchar *name;
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
buffer = gst_value_get_buffer (codec_data);
|
buffer = gst_value_get_buffer (codec_data);
|
||||||
GST_LOG_OBJECT (rtpmp4gpay, "configuring 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",
|
gst_basertppayload_set_options (payload, media_type, TRUE, "MPEG4-GENERIC",
|
||||||
rtpmp4gpay->rate);
|
rtpmp4gpay->rate);
|
||||||
|
|
||||||
gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
|
res = gst_rtp_mp4g_pay_new_caps (rtpmp4gpay);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
config_failed:
|
config_failed:
|
||||||
|
|
|
@ -136,14 +136,15 @@ gst_rtp_mp4v_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstRtpMP4VDepay *rtpmp4vdepay;
|
GstRtpMP4VDepay *rtpmp4vdepay;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
const gchar *str;
|
const gchar *str;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
|
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
if (gst_structure_has_field (structure, "clock-rate"))
|
if (!gst_structure_get_int (structure, "clock-rate", &clock_rate))
|
||||||
gst_structure_get_int (structure, "clock-rate", &clock_rate);
|
clock_rate = 90000; /* default */
|
||||||
depayload->clock_rate = clock_rate;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("video/mpeg",
|
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");
|
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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
|
@ -181,9 +182,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
|
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush remaining data on discont */
|
/* flush remaining data on discont */
|
||||||
if (GST_BUFFER_IS_DISCONT (buf))
|
if (GST_BUFFER_IS_DISCONT (buf))
|
||||||
gst_adapter_clear (rtpmp4vdepay->adapter);
|
gst_adapter_clear (rtpmp4vdepay->adapter);
|
||||||
|
@ -198,7 +196,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
avail = gst_adapter_available (rtpmp4vdepay->adapter);
|
avail = gst_adapter_available (rtpmp4vdepay->adapter);
|
||||||
|
|
||||||
outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail);
|
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_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
@ -206,13 +203,6 @@ gst_rtp_mp4v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmp4vdepay, STREAM, DECODE,
|
|
||||||
("Packet did not validate"), (NULL));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
|
|
@ -192,18 +192,19 @@ gst_rtp_mp4v_pay_finalize (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static gboolean
|
||||||
gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
|
gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
|
||||||
{
|
{
|
||||||
gchar *profile, *config;
|
gchar *profile, *config;
|
||||||
GValue v = { 0 };
|
GValue v = { 0 };
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
profile = g_strdup_printf ("%d", rtpmp4vpay->profile);
|
profile = g_strdup_printf ("%d", rtpmp4vpay->profile);
|
||||||
g_value_init (&v, GST_TYPE_BUFFER);
|
g_value_init (&v, GST_TYPE_BUFFER);
|
||||||
gst_value_set_buffer (&v, rtpmp4vpay->config);
|
gst_value_set_buffer (&v, rtpmp4vpay->config);
|
||||||
config = gst_value_serialize (&v);
|
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,
|
"profile-level-id", G_TYPE_STRING, profile,
|
||||||
"config", G_TYPE_STRING, config, NULL);
|
"config", G_TYPE_STRING, config, NULL);
|
||||||
|
|
||||||
|
@ -211,6 +212,8 @@ gst_rtp_mp4v_pay_new_caps (GstRtpMP4VPay * rtpmp4vpay)
|
||||||
|
|
||||||
g_free (profile);
|
g_free (profile);
|
||||||
g_free (config);
|
g_free (config);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -219,12 +222,15 @@ gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
GstRtpMP4VPay *rtpmp4vpay;
|
GstRtpMP4VPay *rtpmp4vpay;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
const GValue *codec_data;
|
const GValue *codec_data;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmp4vpay = GST_RTP_MP4V_PAY (payload);
|
rtpmp4vpay = GST_RTP_MP4V_PAY (payload);
|
||||||
|
|
||||||
gst_basertppayload_set_options (payload, "video", TRUE, "MP4V-ES",
|
gst_basertppayload_set_options (payload, "video", TRUE, "MP4V-ES",
|
||||||
rtpmp4vpay->rate);
|
rtpmp4vpay->rate);
|
||||||
|
|
||||||
|
res = TRUE;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
codec_data = gst_structure_get_value (structure, "codec_data");
|
codec_data = gst_structure_get_value (structure, "codec_data");
|
||||||
if (codec_data) {
|
if (codec_data) {
|
||||||
|
@ -249,12 +255,12 @@ gst_rtp_mp4v_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
if (rtpmp4vpay->config)
|
if (rtpmp4vpay->config)
|
||||||
gst_buffer_unref (rtpmp4vpay->config);
|
gst_buffer_unref (rtpmp4vpay->config);
|
||||||
rtpmp4vpay->config = gst_buffer_copy (buffer);
|
rtpmp4vpay->config = gst_buffer_copy (buffer);
|
||||||
gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
|
res = gst_rtp_mp4v_pay_new_caps (rtpmp4vpay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
return TRUE;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -115,16 +115,23 @@ gst_rtp_mpa_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpMPADepay *rtpmpadepay;
|
GstRtpMPADepay *rtpmpadepay;
|
||||||
gint clock_rate = 90000; /* default */
|
GstCaps *outcaps;
|
||||||
|
gint clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
|
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
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 *
|
static GstBuffer *
|
||||||
|
@ -135,20 +142,18 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
|
rtpmpadepay = GST_RTP_MPA_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
gint payload_len;
|
gint payload_len;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
guint16 frag_offset;
|
guint16 frag_offset;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
payload = gst_rtp_buffer_get_payload (buf);
|
|
||||||
|
|
||||||
if (payload_len <= 4)
|
if (payload_len <= 4)
|
||||||
goto empty_packet;
|
goto empty_packet;
|
||||||
|
|
||||||
|
payload = gst_rtp_buffer_get_payload (buf);
|
||||||
/* strip off header
|
/* strip off header
|
||||||
*
|
*
|
||||||
* 0 1 2 3
|
* 0 1 2 3
|
||||||
|
@ -161,7 +166,12 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
/* subbuffer skipping the 4 header bytes */
|
/* subbuffer skipping the 4 header bytes */
|
||||||
outbuf = gst_rtp_buffer_get_payload_subbuffer (buf, 4, -1);
|
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_DEBUG_OBJECT (rtpmpadepay,
|
||||||
"gst_rtp_mpa_depay_chain: pushing buffer of size %d",
|
"gst_rtp_mpa_depay_chain: pushing buffer of size %d",
|
||||||
GST_BUFFER_SIZE (outbuf));
|
GST_BUFFER_SIZE (outbuf));
|
||||||
|
@ -173,20 +183,7 @@ gst_rtp_mpa_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
/* ERRORS */
|
||||||
{
|
|
||||||
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
|
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpmpadepay, STREAM, DECODE,
|
||||||
|
|
|
@ -146,10 +146,12 @@ gst_rtp_mpa_pay_finalize (GObject * object)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
gst_rtp_mpa_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
gst_basertppayload_set_options (payload, "audio", TRUE, "MPA", 90000);
|
gboolean res;
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
|
||||||
|
|
||||||
return TRUE;
|
gst_basertppayload_set_options (payload, "audio", TRUE, "MPA", 90000);
|
||||||
|
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
|
|
|
@ -118,16 +118,25 @@ gst_rtp_mpv_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpMPVDepay *rtpmpvdepay;
|
GstRtpMPVDepay *rtpmpvdepay;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
|
GstCaps *outcaps;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
|
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
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 *
|
static GstBuffer *
|
||||||
|
@ -138,9 +147,6 @@ gst_rtp_mpv_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
|
rtpmpvdepay = GST_RTP_MPV_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
gint payload_len, payload_header;
|
gint payload_len, payload_header;
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
|
@ -197,12 +203,7 @@ gst_rtp_mpv_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
bad_packet:
|
/* ERRORS */
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate."));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
empty_packet:
|
empty_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpmpvdepay, STREAM, DECODE,
|
||||||
|
|
|
@ -118,15 +118,16 @@ gst_rtp_mpv_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
const char *stname;
|
const char *stname;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
|
||||||
stname = gst_structure_get_name (structure);
|
stname = gst_structure_get_name (structure);
|
||||||
|
|
||||||
gst_basertppayload_set_options (payload, "video", FALSE, "MPV", 90000);
|
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
|
static GstFlowReturn
|
||||||
|
|
|
@ -121,11 +121,12 @@ gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gint clock_rate = 8000; /* default */
|
gint clock_rate;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/x-alaw",
|
srccaps = gst_caps_new_simple ("audio/x-alaw",
|
||||||
|
@ -139,25 +140,27 @@ gst_rtp_pcma_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_pcma_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_pcma_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
|
||||||
GstBuffer *outbuf = NULL;
|
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_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf), marker,
|
||||||
gst_rtp_buffer_get_marker (buf),
|
|
||||||
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
||||||
|
|
||||||
srccaps = GST_PAD_CAPS (GST_BASE_RTP_DEPAYLOAD_SRCPAD (depayload));
|
len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,14 @@ gst_rtp_pcma_pay_init (GstRtpPmcaPay * rtppcmapay, GstRtpPmcaPayClass * klass)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
gst_rtp_pcma_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
payload->pt = GST_RTP_PAYLOAD_PCMA;
|
payload->pt = GST_RTP_PAYLOAD_PCMA;
|
||||||
|
|
||||||
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMA", 8000);
|
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMA", 8000);
|
||||||
|
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||||
|
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
return res;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
@ -121,11 +121,12 @@ gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
gint clock_rate = 8000; /* default */
|
gint clock_rate;
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
srccaps = gst_caps_new_simple ("audio/x-mulaw",
|
srccaps = gst_caps_new_simple ("audio/x-mulaw",
|
||||||
|
@ -139,30 +140,27 @@ gst_rtp_pcmu_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_pcmu_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstCaps *srccaps;
|
|
||||||
GstBuffer *outbuf = NULL;
|
GstBuffer *outbuf = NULL;
|
||||||
guint len;
|
guint len;
|
||||||
|
gboolean marker;
|
||||||
|
|
||||||
|
marker = gst_rtp_buffer_get_marker (buf);
|
||||||
|
|
||||||
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
GST_DEBUG ("process : got %d bytes, mark %d ts %u seqn %d",
|
||||||
GST_BUFFER_SIZE (buf),
|
GST_BUFFER_SIZE (buf), marker,
|
||||||
gst_rtp_buffer_get_marker (buf),
|
|
||||||
gst_rtp_buffer_get_timestamp (buf), gst_rtp_buffer_get_seq (buf));
|
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);
|
len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||||
|
|
||||||
GST_BUFFER_DURATION (outbuf) =
|
GST_BUFFER_DURATION (outbuf) =
|
||||||
gst_util_uint64_scale_int (len, GST_SECOND, depayload->clock_rate);
|
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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,14 @@ gst_rtp_pcmu_pay_init (GstRtpPcmuPay * rtppcmupay, GstRtpPcmuPayClass * klass)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
gst_rtp_pcmu_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
payload->pt = GST_RTP_PAYLOAD_PCMU;
|
payload->pt = GST_RTP_PAYLOAD_PCMU;
|
||||||
|
|
||||||
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMU", 8000);
|
gst_basertppayload_set_options (payload, "audio", FALSE, "PCMU", 8000);
|
||||||
|
res = gst_basertppayload_set_outcaps (payload, NULL);
|
||||||
|
|
||||||
gst_basertppayload_set_outcaps (payload, NULL);
|
return res;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|
|
@ -104,7 +104,6 @@ static void
|
||||||
gst_rtp_speex_depay_init (GstRtpSPEEXDepay * rtpspeexdepay,
|
gst_rtp_speex_depay_init (GstRtpSPEEXDepay * rtpspeexdepay,
|
||||||
GstRtpSPEEXDepayClass * klass)
|
GstRtpSPEEXDepayClass * klass)
|
||||||
{
|
{
|
||||||
GST_BASE_RTP_DEPAYLOAD (rtpspeexdepay)->clock_rate = 8000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
|
@ -134,12 +133,15 @@ gst_rtp_speex_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
const gchar *params;
|
const gchar *params;
|
||||||
|
GstCaps *srccaps;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpspeexdepay = GST_RTP_SPEEX_DEPAY (depayload);
|
rtpspeexdepay = GST_RTP_SPEEX_DEPAY (depayload);
|
||||||
|
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
if (!(params = gst_structure_get_string (structure, "encoding-params")))
|
if (!(params = gst_structure_get_string (structure, "encoding-params")))
|
||||||
|
@ -181,15 +183,28 @@ gst_rtp_speex_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
data += 4;
|
data += 4;
|
||||||
GST_WRITE_UINT32_LE (data, 0); /* reserved2 */
|
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);
|
gst_base_rtp_depayload_push (GST_BASE_RTP_DEPAYLOAD (rtpspeexdepay), buf);
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (sizeof (gst_rtp_speex_comment));
|
buf = gst_buffer_new_and_alloc (sizeof (gst_rtp_speex_comment));
|
||||||
memcpy (GST_BUFFER_DATA (buf), gst_rtp_speex_comment,
|
memcpy (GST_BUFFER_DATA (buf), gst_rtp_speex_comment,
|
||||||
sizeof (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);
|
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 *
|
static GstBuffer *
|
||||||
|
@ -205,6 +220,8 @@ gst_rtp_speex_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
/* nothing special to be done */
|
/* nothing special to be done */
|
||||||
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
outbuf = gst_rtp_buffer_get_payload_buffer (buf);
|
||||||
|
|
||||||
|
GST_BUFFER_DURATION (outbuf) = 20 * GST_MSECOND;
|
||||||
|
|
||||||
return outbuf;
|
return outbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ gst_rtp_speex_pay_parse_ident (GstRtpSPEEXPay * rtpspeexpay,
|
||||||
guint32 version, header_size, rate, mode, nb_channels;
|
guint32 version, header_size, rate, mode, nb_channels;
|
||||||
GstBaseRTPPayload *payload;
|
GstBaseRTPPayload *payload;
|
||||||
gchar *cstr;
|
gchar *cstr;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
/* we need the header string (8), the version string (20), the version
|
/* we need the header string (8), the version string (20), the version
|
||||||
* and the header length. */
|
* 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);
|
gst_basertppayload_set_options (payload, "audio", FALSE, "SPEEX", rate);
|
||||||
cstr = g_strdup_printf ("%d", nb_channels);
|
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_TYPE_STRING, cstr, NULL);
|
||||||
g_free (cstr);
|
g_free (cstr);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
too_small:
|
too_small:
|
||||||
|
|
|
@ -123,32 +123,27 @@ gst_rtp_sv3v_depay_finalize (GObject * object)
|
||||||
gboolean
|
gboolean
|
||||||
gst_rtp_sv3v_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
gst_rtp_sv3v_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
||||||
gint clock_rate = 90000; // default
|
gint clock_rate;
|
||||||
|
|
||||||
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
|
||||||
filter->clock_rate = clock_rate;
|
filter->clock_rate = clock_rate;
|
||||||
|
|
||||||
|
/* will set caps later */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstRtpSV3VDepay *rtpsv3vdepay;
|
GstRtpSV3VDepay *rtpsv3vdepay;
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
guint16 seq;
|
guint16 seq;
|
||||||
|
|
||||||
rtpsv3vdepay = GST_RTP_SV3V_DEPAY (depayload);
|
rtpsv3vdepay = GST_RTP_SV3V_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
/* flush on sequence number gaps */
|
/* flush on sequence number gaps */
|
||||||
seq = gst_rtp_buffer_get_seq (buf);
|
seq = gst_rtp_buffer_get_seq (buf);
|
||||||
if (seq != rtpsv3vdepay->nextseq) {
|
if (seq != rtpsv3vdepay->nextseq) {
|
||||||
|
@ -236,9 +231,6 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
avail = gst_adapter_available (rtpsv3vdepay->adapter);
|
avail = gst_adapter_available (rtpsv3vdepay->adapter);
|
||||||
outbuf = gst_adapter_take_buffer (rtpsv3vdepay->adapter, avail);
|
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;
|
return outbuf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -248,7 +240,7 @@ gst_rtp_sv3v_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
bad_packet:
|
bad_packet:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpsv3vdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpsv3vdepay, STREAM, DECODE,
|
||||||
("Packet did not validate"), (NULL));
|
(NULL), ("Packet was too short"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,6 +331,7 @@ gst_rtp_theora_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
const gchar *delivery_method;
|
const gchar *delivery_method;
|
||||||
const gchar *configuration;
|
const gchar *configuration;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload);
|
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 */
|
/* set caps on pad and on header */
|
||||||
srccaps = gst_caps_new_simple ("video/x-theora", NULL);
|
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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
/* Clock rate is always 90000 according to draft-barbato-avt-rtp-theora-01 */
|
/* Clock rate is always 90000 according to draft-barbato-avt-rtp-theora-01 */
|
||||||
depayload->clock_rate = 90000;
|
depayload->clock_rate = 90000;
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unsupported_delivery_method:
|
unsupported_delivery_method:
|
||||||
|
@ -444,9 +445,6 @@ gst_rtp_theora_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload);
|
rtptheoradepay = GST_RTP_THEORA_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
|
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
|
||||||
|
@ -614,12 +612,6 @@ no_output:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* ERORRS */
|
/* ERORRS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtptheoradepay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
switch_failed:
|
switch_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (rtptheoradepay, STREAM, DECODE,
|
GST_ELEMENT_ERROR (rtptheoradepay, STREAM, DECODE,
|
||||||
|
|
|
@ -102,9 +102,7 @@ static void
|
||||||
gst_rtp_theora_pay_class_init (GstRtpTheoraPayClass * klass)
|
gst_rtp_theora_pay_class_init (GstRtpTheoraPayClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
|
||||||
GstElementClass *gstelement_class;
|
GstElementClass *gstelement_class;
|
||||||
|
|
||||||
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
GstBaseRTPPayloadClass *gstbasertppayload_class;
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
|
@ -191,9 +189,7 @@ static GstFlowReturn
|
||||||
gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay)
|
gst_rtp_theora_pay_flush_packet (GstRtpTheoraPay * rtptheorapay)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
guint8 *payload;
|
guint8 *payload;
|
||||||
|
|
||||||
guint hlen;
|
guint hlen;
|
||||||
|
|
||||||
/* check for empty packet */
|
/* check for empty packet */
|
||||||
|
@ -241,7 +237,6 @@ static gchar *
|
||||||
encode_base64 (const guint8 * in, guint size, guint * len)
|
encode_base64 (const guint8 * in, guint size, guint * len)
|
||||||
{
|
{
|
||||||
gchar *ret, *d;
|
gchar *ret, *d;
|
||||||
|
|
||||||
static const gchar *v =
|
static const gchar *v =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
|
||||||
|
@ -267,16 +262,12 @@ static gboolean
|
||||||
gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
||||||
{
|
{
|
||||||
GstRtpTheoraPay *rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
GstRtpTheoraPay *rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||||
|
|
||||||
GList *walk;
|
GList *walk;
|
||||||
|
|
||||||
guint length, size, n_headers, configlen;
|
guint length, size, n_headers, configlen;
|
||||||
|
|
||||||
gchar *wstr, *hstr, *configuration;
|
gchar *wstr, *hstr, *configuration;
|
||||||
|
|
||||||
guint8 *data, *config;
|
guint8 *data, *config;
|
||||||
|
|
||||||
guint32 ident;
|
guint32 ident;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rtptheorapay, "finish headers");
|
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);
|
wstr = g_strdup_printf ("%d", rtptheorapay->width);
|
||||||
hstr = g_strdup_printf ("%d", rtptheorapay->height);
|
hstr = g_strdup_printf ("%d", rtptheorapay->height);
|
||||||
gst_basertppayload_set_options (basepayload, "video", TRUE, "THEORA", 90000);
|
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",
|
"sampling", G_TYPE_STRING, "YCbCr-4:2:0",
|
||||||
"width", G_TYPE_STRING, wstr,
|
"width", G_TYPE_STRING, wstr,
|
||||||
"height", G_TYPE_STRING, hstr,
|
"height", G_TYPE_STRING, hstr,
|
||||||
|
@ -441,7 +432,7 @@ gst_rtp_theora_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
||||||
g_free (hstr);
|
g_free (hstr);
|
||||||
g_free (configuration);
|
g_free (configuration);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_headers:
|
no_headers:
|
||||||
|
@ -456,7 +447,6 @@ gst_rtp_theora_pay_parse_id (GstBaseRTPPayload * basepayload, guint8 * data,
|
||||||
guint size)
|
guint size)
|
||||||
{
|
{
|
||||||
GstRtpTheoraPay *rtptheorapay;
|
GstRtpTheoraPay *rtptheorapay;
|
||||||
|
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
|
||||||
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||||
|
@ -514,25 +504,15 @@ gst_rtp_theora_pay_handle_buffer (GstBaseRTPPayload * basepayload,
|
||||||
GstBuffer * buffer)
|
GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstRtpTheoraPay *rtptheorapay;
|
GstRtpTheoraPay *rtptheorapay;
|
||||||
|
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
guint size, newsize;
|
guint size, newsize;
|
||||||
|
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
guint packet_len;
|
guint packet_len;
|
||||||
|
|
||||||
GstClockTime duration, newduration, timestamp;
|
GstClockTime duration, newduration, timestamp;
|
||||||
|
|
||||||
gboolean flush;
|
gboolean flush;
|
||||||
|
|
||||||
guint8 TDT;
|
guint8 TDT;
|
||||||
|
|
||||||
guint plen;
|
guint plen;
|
||||||
|
|
||||||
guint8 *ppos, *payload;
|
guint8 *ppos, *payload;
|
||||||
|
|
||||||
gboolean fragmented;
|
gboolean fragmented;
|
||||||
|
|
||||||
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
rtptheorapay = GST_RTP_THEORA_PAY (basepayload);
|
||||||
|
|
|
@ -327,6 +327,7 @@ gst_rtp_vorbis_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
const gchar *configuration;
|
const gchar *configuration;
|
||||||
gint clock_rate;
|
gint clock_rate;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
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 */
|
/* set caps on pad and on header */
|
||||||
srccaps = gst_caps_new_simple ("audio/x-vorbis", NULL);
|
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);
|
gst_caps_unref (srccaps);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
invalid_configuration:
|
invalid_configuration:
|
||||||
|
@ -420,9 +421,6 @@ gst_rtp_vorbis_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
|
||||||
|
|
||||||
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
rtpvorbisdepay = GST_RTP_VORBIS_DEPAY (depayload);
|
||||||
|
|
||||||
if (!gst_rtp_buffer_validate (buf))
|
|
||||||
goto bad_packet;
|
|
||||||
|
|
||||||
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
payload_len = gst_rtp_buffer_get_payload_len (buf);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
|
GST_DEBUG_OBJECT (depayload, "got RTP packet of size %d", payload_len);
|
||||||
|
@ -593,12 +591,6 @@ no_output:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* ERORRS */
|
/* ERORRS */
|
||||||
bad_packet:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
|
||||||
(NULL), ("Packet did not validate"));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
switch_failed:
|
switch_failed:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
GST_ELEMENT_WARNING (rtpvorbisdepay, STREAM, DECODE,
|
||||||
|
|
|
@ -257,6 +257,7 @@ gst_rtp_vorbis_pay_finish_headers (GstBaseRTPPayload * basepayload)
|
||||||
gchar *cstr, *configuration;
|
gchar *cstr, *configuration;
|
||||||
guint8 *data, *config;
|
guint8 *data, *config;
|
||||||
guint32 ident;
|
guint32 ident;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (rtpvorbispay, "finish headers");
|
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);
|
cstr = g_strdup_printf ("%d", rtpvorbispay->channels);
|
||||||
gst_basertppayload_set_options (basepayload, "audio", TRUE, "VORBIS",
|
gst_basertppayload_set_options (basepayload, "audio", TRUE, "VORBIS",
|
||||||
rtpvorbispay->rate);
|
rtpvorbispay->rate);
|
||||||
gst_basertppayload_set_outcaps (basepayload, "encoding-params", G_TYPE_STRING,
|
res =
|
||||||
cstr, "configuration", G_TYPE_STRING, configuration, NULL);
|
gst_basertppayload_set_outcaps (basepayload, "encoding-params",
|
||||||
|
G_TYPE_STRING, cstr, "configuration", G_TYPE_STRING, configuration, NULL);
|
||||||
g_free (cstr);
|
g_free (cstr);
|
||||||
g_free (configuration);
|
g_free (configuration);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_headers:
|
no_headers:
|
||||||
|
|
|
@ -112,12 +112,13 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
{
|
{
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
GstRtpVRawDepay *rtpvrawdepay;
|
GstRtpVRawDepay *rtpvrawdepay;
|
||||||
gint clock_rate = 90000; /* default */
|
gint clock_rate;
|
||||||
const gchar *str, *type;
|
const gchar *str, *type;
|
||||||
gint format, width, height, pgroup, xinc, yinc;
|
gint format, width, height, pgroup, xinc, yinc;
|
||||||
guint ystride, uvstride, yp, up, vp, outsize;
|
guint ystride, uvstride, yp, up, vp, outsize;
|
||||||
GstCaps *srccaps;
|
GstCaps *srccaps;
|
||||||
guint32 fourcc = 0;
|
guint32 fourcc = 0;
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload);
|
rtpvrawdepay = GST_RTP_VRAW_DEPAY (depayload);
|
||||||
|
|
||||||
|
@ -126,7 +127,8 @@ gst_rtp_vraw_depay_setcaps (GstBaseRTPDepayload * depayload, GstCaps * caps)
|
||||||
yp = up = vp = uvstride = 0;
|
yp = up = vp = uvstride = 0;
|
||||||
xinc = yinc = 1;
|
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;
|
depayload->clock_rate = clock_rate;
|
||||||
|
|
||||||
if (!(str = gst_structure_get_string (structure, "width")))
|
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,
|
"format", GST_TYPE_FOURCC, fourcc,
|
||||||
"framerate", GST_TYPE_FRACTION, 0, 1, NULL);
|
"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_caps_unref (srccaps);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (depayload, "width %d, height %d, format %d", width, height,
|
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);
|
ystride, uvstride);
|
||||||
GST_DEBUG_OBJECT (depayload, "outsize %u", outsize);
|
GST_DEBUG_OBJECT (depayload, "outsize %u", outsize);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
no_width:
|
no_width:
|
||||||
|
|
|
@ -333,14 +333,14 @@ gst_rtp_vraw_pay_setcaps (GstBaseRTPPayload * payload, GstCaps * caps)
|
||||||
hstr = g_strdup_printf ("%d", rtpvrawpay->height);
|
hstr = g_strdup_printf ("%d", rtpvrawpay->height);
|
||||||
|
|
||||||
gst_basertppayload_set_options (payload, "video", TRUE, "RAW", 90000);
|
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,
|
samplingstr, "depth", G_TYPE_STRING, depthstr, "width", G_TYPE_STRING,
|
||||||
wstr, "height", G_TYPE_STRING, hstr, "colorimetry", G_TYPE_STRING,
|
wstr, "height", G_TYPE_STRING, hstr, "colorimetry", G_TYPE_STRING,
|
||||||
colorimetrystr, NULL);
|
colorimetrystr, NULL);
|
||||||
g_free (wstr);
|
g_free (wstr);
|
||||||
g_free (hstr);
|
g_free (hstr);
|
||||||
|
|
||||||
return TRUE;
|
return res;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
unknown_mask:
|
unknown_mask:
|
||||||
|
|
Loading…
Reference in a new issue