Commit Graph

137 Commits

Author SHA1 Message Date
Limin Wang
d782c746a0 avformat/rtspdec: get rid of the hardcoded max size for sdp
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-12-04 08:26:30 +08:00
Andreas Rheinhardt
1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt
bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
Aman Karmani
98b76bb11f avformat/rtsp: add support for satip://
The SAT>IP protocol[1] is similar to RTSP. However SAT>IP servers
are assumed to speak only MP2T, so DESCRIBE is not used in the same
way. When no streams are active, DESCRIBE will return 404 according
to the spec (see section 3.5.7). When streams are active, DESCRIBE
will return a list of all current streams along with information
about their signal strengths.

Previously, attemping to use ffmpeg with a rtsp:// url that points
to a SAT>IP server would work with some devices, but fail due to 404
response on others. Further, if the SAT>IP server was already
streaming, ffmpeg would incorrectly consume the DESCRIBE SDP response
and join an existing tuner instead of requesting a new session with
the URL provided by the user. These issues have been noted by many
users across the internet[2][3][4].

This commit adds proper spec-compliant support for SAT>IP, including:

- support for the satip:// psuedo-protocol[5]
- avoiding the use of DESCRIBE
- parsing and consuming the com.ses.streamID response header
- using "Transport: RTP/AVP;unicast" because the optional "/UDP"
  suffix confuses some servers

This patch has been validated against multiple SAT>IP vendor devices:

- Telestar Digibit R2
  (https://telestar.de/en/produkt/digibit-r1-2/)
- Kathrein EXIP 418
  (https://www.kathrein-ds.com/en/produkte/sat-zf-verteiltechnik/sat-ip/227/exip-418)
- Kathrein EXIP 4124
  (https://www.kathrein-ds.com/en/products/sat-if-signal-distribution/sat-ip/226/exip-4124)
- Megasat MEG-8000
  (https://www.megasat.tv/produkt/sat-ip-server-3/)
- Megasat Twin
  (https://www.megasat.tv/en/produkt/sat-ip-server-twin/)
- Triax TSS 400
  (https://www.conrad.com/p/triax-tss-400-mkii-sat-ip-server-595256)

[1] https://www.satip.info/sites/satip/files/resource/satip_specification_version_1_2_2.pdf
[2] https://stackoverflow.com/questions/61194344/does-ffmpeg-violate-the-satip-specification-describe-syntax
[3] https://github.com/kodi-pvr/pvr.iptvsimple/issues/196
[4] https://forum.kodi.tv/showthread.php?tid=359072&pid=2995884#pid2995884
[5] https://www.satip.info/resources/channel-lists/
2020-12-28 14:08:44 -08:00
Limin Wang
95d12da559 avformat/rtsp: prefer to use MAX_URL_SIZE for url and command buffer
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-12-05 09:00:53 +08:00
Andriy Gelman
f3891430fc avformat/rtspdec: fix potential mem leak in listen mode
Currently a repeating setup request (with the same stream id) will
simply overwrite rtp_handle/transport_priv without freeing the
resources first. This is fixed by closing the previous setup request.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-28 12:27:53 -05:00
Andriy Gelman
b0019b909b avformat/rtspdec: show method request in log
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-28 12:26:59 -05:00
Andriy Gelman
9a70b6f5b8 avformat/rtspdec: cosmetics
Make error check style consistent with rest of function.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-21 10:13:36 -05:00
Andriy Gelman
122fcf1f40 avformat/rtspdec: fix mem leaks in connect mode if init fails
Fixes #6334

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-21 10:13:28 -05:00
Andriy Gelman
38bc4ba142 avformat/rtspdec: fix mem leaks in listen mode if init fails
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-21 10:13:16 -05:00
Andriy Gelman
423d06e0e2 avformat/rtspdec: add network init to listen mode
As per the docs network initialization is required before ff_url_join().
Furthermore, because the ff_network_init() was skipped, this makes
one additional call to ff_network_close() if the stream exits without
errors.

The was forgotten in the origin commit of the listen mode:
a8ad6ffafe

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-11-21 10:11:38 -05:00
Limin Wang
89429cf2f2 avformat/rtspdec: return proper error code
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-11 18:32:56 +08:00
Limin Wang
9e2872bc67 avformat/rtspdec: use SDP_MAX_SIZE for sdp array
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-11 18:32:56 +08:00
Andriy Gelman
b4103e0eb6 avformat/rtspdec: add newline in log message
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-10-08 23:18:18 -04:00
Limin Wang
cb14c6ff8f avformat/rtspdec: av_dict_set() -> av_dict_set_int()
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-06-02 22:25:11 +08:00
Carl Eugen Hoyos
4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Marton Balint
18ac642359 avformat: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Derek Buitenhuis
5ca063799c rtspdec: Fix return error
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2017-07-10 15:02:29 -04:00
Clément Bœsch
03f5e80bdb Merge commit '67351924fa91dea4339109100a4c0689f006581f'
* commit '67351924fa91dea4339109100a4c0689f006581f':
  Drop unreachable break and return statements

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-30 10:26:29 +02:00
Diego Biurrun
67351924fa Drop unreachable break and return statements 2016-11-03 20:17:12 +01:00
Derek Buitenhuis
f8e89d8a29 Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'
* commit 'fab8156b2f30666adabe227b3d7712fd193873b1':
  avio: Copy URLContext generic options into child URLContexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-21 15:55:09 +01:00
Martin Storsjö
fab8156b2f avio: Copy URLContext generic options into child URLContexts
Since all URLContexts have the same AVOptions, such AVOptions
will be applied on the outermost context only and removed from the
dict, while they probably make sense on all contexts.

This makes sure that rw_timeout gets propagated to the innermost
URLContext (to make sure it gets passed to the tcp protocol, when
opening a http connection for instance).

Alternatively, such matching options would be kept in the dict
and only removed after the ffurl_connect call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-03-24 10:34:19 +02:00
Derek Buitenhuis
93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Anton Khirnov
ec4c483976 lavf: add a protocol whitelist/blacklist for file opened internally
Should make the default behaviour safer for careless callers that open
random untrusted files.

Bug-Id: CVE-2016-1897
Bug-Id: CVE-2016-1898
2016-02-22 11:48:30 +01:00
Anton Khirnov
8c0ceafb0f urlprotocol: receive a list of protocols from the caller
This way, the decisions about which protocols are available for use in
any given situations can be delegated to the caller.
2016-02-22 11:45:31 +01:00
Michael Niedermayer
fe3fed0b14 Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 04:16:50 +01:00
Hendrik Leppkes
f62fe535d5 Merge commit '2c17fb61ced2059034856a6c6cd303014aed01fe'
* commit '2c17fb61ced2059034856a6c6cd303014aed01fe':
  rtsp: Log getaddrinfo failures

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-11-29 16:13:24 +01:00
Luca Barbato
2c17fb61ce rtsp: Log getaddrinfo failures
And forward the logging contexts when needed.
2015-11-25 09:01:25 +01:00
wm4
4a006b9eb7 lavf: split tls.c
Move the OpenSSL and GnuTLS implementations to their own files. Other
than the connection code (including options) and some boilerplate, no
code is actually shared.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-27 21:48:47 +02:00
wm4
d8ffb2055f lavf: split tls.c
Move the OpenSSL and GnuTLS implementations to their own files. Other
than the connection code (including options) and some boilerplate, no
code is actually shared.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-05-26 21:48:32 +03:00
Michael Niedermayer
40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Vittorio Giovara
1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Michael Niedermayer
53bf6b155c Merge commit 'e3ec6fe7bb2a622a863e3912181717a659eb1bad'
* commit 'e3ec6fe7bb2a622a863e3912181717a659eb1bad':
  rtsp: Add a buffer_size option

Conflicts:
	libavformat/rtsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-01 21:34:20 +02:00
Luca Barbato
e3ec6fe7bb rtsp: Add a buffer_size option
And forward it to rtp and udp.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-04-01 14:26:35 +02:00
Michael Niedermayer
83f18410bd Merge commit 'cdcc370293a159c321e41af7f0eef141c62d698d'
* commit 'cdcc370293a159c321e41af7f0eef141c62d698d':
  rtsp: punch holes again after pause

See: 22bb5bd7a3
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-23 21:43:18 +01:00
Gilles Chanteperdrix
cdcc370293 rtsp: punch holes again after pause
When a client behind a NAT issues a pause command, and stay paused for a
long time, the router may stop the RTP/RTCP port redirection. Resend the
hole punching packets before each PLAY command to cause the router to
restart the port redirection in that case.

Move the existing code for sending the packets from the SETUP phase
to the PLAY phase.

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-23 16:55:56 +02:00
Gilles Chanteperdrix
22bb5bd7a3 avformat/rtsp: punch holes again after pause
When a client behind a NAT issues a pause command, and stay paused for a
long time, the router may stop the RTP/RTCP port redirection. Resend the
hole punching packets after each PLAY command to cause the router to
restart the port redirection in that case.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-22 14:09:26 +01:00
Michael Niedermayer
0982077be5 Merge commit '9108967513fcaff3d55514a7bca4c9fbba128c71'
* commit '9108967513fcaff3d55514a7bca4c9fbba128c71':
  rtspdec: Consistently use rtsp_hd_out for writing

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-23 12:26:47 +01:00
Martin Storsjö
9108967513 rtspdec: Consistently use rtsp_hd_out for writing
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-01-23 10:33:00 +02:00
Michael Niedermayer
2c5ae57776 Merge commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea'
* commit '6df9d9b55d3f56ee7782639a7678eeeaf77f14ea':
  lavf: Use av_gettime_relative

Conflicts:
	libavformat/hls.c

See: f78bc96b7c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 12:40:36 +02:00
Martin Storsjö
6df9d9b55d lavf: Use av_gettime_relative
The ones left using av_gettime are NTP timestamps (for RTCP,
which is specified to send the actual current realtime clock
in RTCP SR packets), and the NUT muxer timestamper, which is
documented as using wallclock time.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-10-24 09:53:45 +03:00
Andrey Utkin
282c9354f1 avformat/rtsp: Use ff_rtsp_averror()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-21 03:52:27 +02:00
Michael Niedermayer
76d1ffffd0 Merge commit '3df8d52fcdc9036b4074fdc612d487ece8bb5b7f'
* commit '3df8d52fcdc9036b4074fdc612d487ece8bb5b7f':
  rtsp: Add rtsps to the probe

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 21:36:27 +02:00
Michael Niedermayer
7028475f75 Merge commit 'c839b0439f0b01c72a6d253920d2e342b30f8bcb'
* commit 'c839b0439f0b01c72a6d253920d2e342b30f8bcb':
  rtsp: Support tls when in listen mode

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 21:29:10 +02:00
Michael Niedermayer
544f811453 Merge commit 'c27328e749ff3be648411765cd17362fee017341'
* commit 'c27328e749ff3be648411765cd17362fee017341':
  rtsp: Check for command strings without spaces

Conflicts:
	libavformat/rtspdec.c

See: a0568ed254
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-10 21:05:49 +02:00
Luca Barbato
3df8d52fcd rtsp: Add rtsps to the probe 2014-10-10 16:29:06 +02:00
Luca Barbato
c839b0439f rtsp: Support tls when in listen mode 2014-10-10 16:29:06 +02:00
Luca Barbato
c27328e749 rtsp: Check for command strings without spaces
Prevent a NULL-pointer dereference.

CC: libav-stable@libav.org
2014-10-10 16:29:06 +02:00
Michael Niedermayer
fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume
f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00