Commit Graph

385 Commits

Author SHA1 Message Date
Anton Khirnov 84ad31ff18 lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit.

In many cases, the id is some constant made up number (e.g. 0 for video
and 1 for audio), which is then not used in the demuxer for anything.
Those ids are removed.
2011-10-19 17:02:11 +02:00
Martin Storsjö 51369f2891 rtsp: Expose the flag options via private AVOptions for sdp and rtp, too
This allows setting the filter_src option for these demuxers, too,
which wasn't possible at all before (where the option only was set
via URL parameters for RTSP).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 22:02:31 +03:00
Martin Storsjö 3a6765fb5d rtsp: Make the rtsp flags avoptions set via a define
This helps sharing these options with the sdp and rtp demuxers.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 22:02:30 +03:00
Martin Storsjö 9867aea524 rtsp: Remove the separate filter_source variable
Read it as a flag from the flags field instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 19:57:49 +03:00
Martin Storsjö eca4850c6d rtsp: Accept options via private avoptions instead of URL options
Eventually, the old way of passing options by adding
stuff to the URL can be dropped.

This avoids having to tamper with the user-specified URL to
pass options on the transport mode. This also works better
with redirects, since the options don't need to be parsed out
from the URL.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 19:57:48 +03:00
Martin Storsjö 2c9aa0247d rtsp: Simplify AVOption definitions
Use defines for shortening common parts, omit the .dbl named
initializer (since it's the first element in the union).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 19:57:47 +03:00
Martin Storsjö 17fff881e7 rtsp: Merge the AVOption lists
This eases adding options that are common for both. The
AV_OPT_FLAG_EN/DECODING_PARAM still indicates whether they belong
to the muxer or demuxer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-17 19:57:45 +03:00
Martin Storsjö 76b0d03d82 rtsp: Request that dynamic rate is disabled
DSS enables this automatically if streaming VOD over TCP. If
enabled, the server feeds packets faster than realtime, screwing
up RTCP NTP based timestamps.

Also, DSS doesn't indicate that this was indicated, if it was
enabled automatically (although if it was requested to be enabled,
a header saying that it was enabled is added, but this isn't
added if it is enabled automatically), making it even harder
to detect and work around properly without explicitly asking
for it to be disabled(/enabled, if we were able to support it).

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:47 +03:00
Martin Storsjö 30eae32530 rtsp: Parse the x-Accept-Dynamic-Rate header
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:45 +03:00
Martin Storsjö bfc6db4477 rtpdec: Add ff_ prefix to all nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-10-12 14:48:12 +03:00
Diego Biurrun 76e25dbca6 rtsp: remove disabled code 2011-07-18 18:22:02 +02:00
Anton Khirnov dfc2c4d900 lavf: use designated initialisers for all (de)muxers.
It's more readable and less prone to breakage.
2011-07-17 06:58:37 +02:00
Mans Rullgard 0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Diego Biurrun f75e3da535 RTSP: Doxygen comment cleanup
Do not use Doxygen for comments that apply to specific implementation
details; merge some duplicated Doxygen comment blocks.
2011-07-03 22:33:22 +02:00
Martin Storsjö d840733937 rtsp: Don't pass string pointer as format string to ff_url_join
In this case, the string that was passed couldn't contain
user-defined data and thus there was no risk for injection
bugs, but it's safer this way, if we later change the
content of the options string.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-06-16 17:40:28 +03:00
Anton Khirnov d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Diego Biurrun f190f676bc Replace custom DEBUG preprocessor trickery by the standard one. 2011-06-03 00:44:06 +02:00
Ilya 4515f9b58a rtsp: use strtoul to parse rtptime and seq values.
strtol could return negative values, leading to various error messages,
mainly "non-monotonically increasing dts".

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-05-24 19:11:28 +02:00
Martin Storsjö 0b4949b518 rtsp: Only do keepalive using GET_PARAMETER if the server supports it
This is more like what VLC does. If the server doesn't mention
supporting GET_PARAMETER in response to an OPTIONS request,
VLC doesn't send any keepalive requests at all. After this patch,
libavformat will still send OPTIONS keepalives if GET_PARAMETER
isn't explicitly said to be supported.

Some RTSP cameras don't support GET_PARAMETER, and will
close the connection if this is sent as keepalive request
(but support OPTIONS just fine, but probably don't need any
keepalive at all). Some other cameras don't support using
OPTIONS as keepalive, but require GET_PARAMETER instead.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-05-11 10:42:34 +03:00
Martin Storsjö 9261e6cf3f rtp: Rename the open/close functions to alloc/free
This avoids clashes if we internally want to override the global
open function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-04-24 00:05:37 +03:00
Stefano Sabatini 59d96941f0 avio: remove AVIO_* access symbols in favor of new AVIO_FLAG_* symbols
Make AVIO_FLAG_ access constants work as flags, and in particular fix
the behavior of functions (such as avio_check()) which expect them to
be flags rather than modes.

This breaks API.
2011-04-19 19:47:58 +02:00
Anton Khirnov f87b1b373a avio: AVIO_ prefixes for URL_ open flags. 2011-04-07 18:07:16 +02:00
Anton Khirnov 1869ea03b7 avio: make url_get_file_handle() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov e52a9145c8 avio: make url_close() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 925e908bc7 avio: make url_write() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov dce3756459 avio: make url_read_complete() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov bc371aca46 avio: make url_read() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 0589da0aa5 avio: make url_open() internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 62eaaeacb5 avio: make url_connect internal. 2011-04-04 17:45:20 +02:00
Anton Khirnov 5652bb9471 avio: make url_alloc internal. 2011-04-04 17:45:19 +02:00
Anton Khirnov 6dc7d80de7 avio: avio_ prefix for url_close_dyn_buf 2011-04-03 22:47:05 +02:00
Martin Storsjö 895678f823 rtsp: Specify unicast for TCP interleaved streams, too
According to the RFC, the default is multicast if nothing is
specified, which doesn't make sense for TCP.

According to a bug report, some Axis camera models give a
"400 Bad Request" error if this is omitted.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-03-21 20:58:33 +01:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Nicolas George c76374c6db Use AVERROR_EXIT with url_interrupt_cb.
Functions interrupted by url_interrupt_cb should not be restarted.
Therefore using AVERROR(EINTR) was wrong, as it did not allow to distinguish
when the underlying system call was interrupted and actually needed to be
restarted.

This fixes roundup issues 2657 and 2659 (ffplay not exiting for streamed
content).

Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-15 08:09:19 -04:00
Anton Khirnov 22a3212e32 avio: rename url_fopen/fclose -> avio_open/close.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-23 10:18:55 -05:00
Martin Storsjö 28c4741a66 libavformat: Remove FF_NETERRNO()
Map EAGAIN and EINTR from ff_neterrno to the normal AVERROR()
error codes. Provide fallback definitions of other errno.h network
errors, mapping them to the corresponding winsock errors.

This eases catching these error codes in common code, without having
to distinguish between FF_NETERRNO(EAGAIN) and AVERROR(EAGAIN).

This fixes roundup issue 2614, unbreaking blocking network IO on
windows.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-23 07:21:31 -05:00
Anton Khirnov b7effd4e83 avio: avio_ prefixes for get_* functions
In the name of consistency:
get_byte           -> avio_r8
get_<type>         -> avio_r<type>
get_buffer         -> avio_read

get_partial_buffer will be made private later

get_strz is left out becase I want to change it later to return
something useful.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-21 11:23:22 -05:00
Anton Khirnov e731b8d872 avio: move init_put_byte() to a new private header and rename it
init_put_byte should never be used outside of lavf, since
sizeof(AVIOContext) isn't part of public ABI.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:31 -05:00
Anton Khirnov ae628ec1fd avio: rename ByteIOContext to AVIOContext.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:15 -05:00
Anton Khirnov 9fcae9735e Replace remaining uses of parse_date with av_parse_time.
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-16 23:39:57 +00:00
Martin Storsjö 2c35a6bde9 rtsp: udp_read_packet returning 0 doesn't mean success
If udp_read_packet returns 0, rtsp_st isn't set and we shouldn't
treat it as a successfully received packet (which is counted and
possibly triggers a RTCP receiver report).

This fixes issue 2612.
2011-02-17 00:37:00 +01:00
Martin Storsjö b2dd842d21 rtsp/rdt: Assign the RTSPStream index to AVStream->id
This is used for mapping AVStreams back to their corresponding
RTSPStream. Since d9c0510, the RTSPStream pointer isn't stored in
AVStream->priv_data any longer, breaking this mapping from AVStreams
to RTSPStreams.

Also, we don't need to clear the priv_data in rdt cleanup any longer,
since it isn't set to duplicate pointers.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-11 16:58:19 -05:00
Martin Storsjö b22dbb291d Use avformat_free_context for cleaning up muxers
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-04 11:39:55 -05:00
Martin Storsjö 1338dc0823 libavformat: Use avcodec_copy_context for chained muxers
This avoids having the chained AVStream->codec point to the same
AVCodecContext owned by the outer AVStream. The downside is that
changes to the AVCodecContext made after calling av_write_header
cannot be detected automatically within the chained muxer.

This avoids having to manually unlink the chained AVStream->codec
by setting it to null before freeing the chained muxer via generic
freeing functions.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-04 11:28:07 -05:00
Martin Storsjö ce41c51b0c Free AVStream->info in chained muxers
This fixes memory leaks in the RTSP muxer and RTP hinting in the
mov muxer present since SVN rev 25418.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-02-03 01:03:31 +01:00
Martin Storsjö d9c0510e22 rtsp: Don't store RTSPStream in AVStream->priv_data
For mpegts in RTP, there isn't a direct mapping between RTSPStreams
and AVStreams, and the RTSPStream isn't ever stored in
AVStream->priv_data, which was earlier leaked. The fix for this
leak, in ea7f080749, lead to
double frees for other, normal RTP streams.

This patch avoids storing RTSPStreams in AVStream->priv_data, thus
avoiding the double free. The RTSPStreams are always available via
RTSPState->rtsp_streams anyway.

Tested with MS-RTSP, RealRTSP, DSS and mpegts/RTP.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-02-03 00:49:15 +01:00
Luca Barbato ea7f080749 Free the RTSPStreams in ff_rtsp_close_streams
This plugs a small memory leak

Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
2011-02-01 20:40:16 +01:00
Luca Barbato dfd2a005eb Replace dprintf with av_dlog
dprintf clashes with POSIX.1-2008
2011-01-29 23:55:37 +01:00
Luca Barbato f81c7ac70a rtsp: make ff_sdp_parse return value forwarded
the sdp demuxer did not forward it at all while the rtsp demuxer assumed
a single kind of error
2011-01-28 15:45:19 +01:00
Luca Barbato a8475bbdb6 os: replace select with poll
Select has limitations on the fd values it could accept and silently
breaks when it is reached.
2011-01-28 15:45:19 +01:00