The interrupt callback has to be passed in during opening (setting it
after opening isn't enough), since a blocking open couldn't be
interrupted otherwise.
Options are passed down to procotols and also need to be available
during open() in most cases.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Adding _POSIX_C_SOURCE to CPPFLAGS globally produces all sorts of problems
since it causes certain system functions to be hidden on some (BSD) systems.
The solution is to only add the flag on systems that really require it, i.e.
glibc-based ones.
This change makes BSD systems compile out-of-the-box without the need for
adding specific flags manually. It also allows dropping a number of flags
set manually on a file-per-file basis, but were only present to work around
breakage introduced by the presence of _POSIX_C_SOURCE.
Also add _XOPEN_SOURCE to CPPFLAGS for glibc systems. We use XSI extensions
in several places already, so it is preferable to define it globally instead
of littering source files with individual #defines only needed for glibc.
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.
The new function is more flexible than url_exist(), as it allows to
specify which access flags to check, and does not require an explicit
open of the checked resource.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
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>
when writing and pressing q during encoding. Instead, check url_interrupt_cb
at the end.
Note that when a protocol is interrupted by url_interrupt_cb, some data may
be silently discarded: the protocol context is not suitable for anything
anymore.
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 688c22e033)
If this flag is set, the protocol can handle URLs where the
scheme is a nested scheme such as applehttp+file: - the protocol
can handle any URL where the first segment of the nested scheme
belongs to this protocol.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 8f73c06077)
when writing and pressing q during encoding. Instead, check url_interrupt_cb
at the end.
Note that when a protocol is interrupted by url_interrupt_cb, some data may
be silently discarded: the protocol context is not suitable for anything
anymore.
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
If this flag is set, the protocol can handle URLs where the
scheme is a nested scheme such as applehttp+file: - the protocol
can handle any URL where the first segment of the nested scheme
belongs to this protocol.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>