Commit Graph

69 Commits

Author SHA1 Message Date
Luca Barbato ebb6b27ad9 tcp: make connect() timeout properly
The connect() timeout can take minutes, gets misreported as EIO and
isn't interruptible.
2011-05-27 09:42:14 +02:00
Martin Storsjö c60112f268 libavformat: Make protocols pass URLContext as log context where available
Since the libavformat major bump, URLContext contains an AVClass,
making it a usable log context.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-04-20 14:59:45 +03:00
Anton Khirnov f35ff97f2e lavf: use designated initializers for all protocols
This is more readable and makes it easier to reorder URLProtocol
members.
2011-04-08 11:08:26 +02:00
Anton Khirnov 5cec897105 avio: move extern url_interrupt_cb declaration from avio.h to url.h 2011-04-07 18:11:24 +02:00
Anton Khirnov f87b1b373a avio: AVIO_ prefixes for URL_ open flags. 2011-04-07 18:07:16 +02:00
Luca Barbato 3d42d4937b proto: introduce listen option in tcp
This way is possible to have simple micro-server act like

ffmpeg -i file.nut -vcodec copy -acodec copy -f nut tcp://foo:1234?listen
2011-04-07 02:54:30 +02:00
Luca Barbato ebba2b3e2a proto: factor ff_network_wait_fd and use it on udp
Support the URL_FLAG_NONBLOCK semantic and uniform the protocol.
The quick retry loop is already part of retry_transfer_wrapper.

The polling routine is common to the network protocols:
udp, tcp and, once merged, sctp.
2011-04-07 02:53:55 +02: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
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
Nicolas George ad3cffb68f Non-blocking protocol: TCP
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-05 20:31:38 -05:00
Nicolas George 51b317d2e9 TCP: factor the poll() call
Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-03 20:58:32 -05: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
Diego Elio Pettenò c6610a216e Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
2011-01-26 22:10:09 +00:00
Thomas Guillem 1aa58c6405 tcp: Check url_interrupt_cb if connect was interrupted by a signal
This makes it possible to abort a blocking connect call.

Patch by Thomas Guillem, thomas dot guillem at gmail

Originally committed as revision 26014 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-12-14 23:03:05 +00:00
Ronald S. Bultje 37e9cc4ec7 Remove two instances of AVERROR(ff_neterrno()), because ff_neterrno() itself
already does AVERROR().

Originally committed as revision 25671 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-11-04 13:53:16 +00:00
Martin Storsjö b416267622 tcp: Check both wfds and efds when waiting for the result from connect
On windows, a connection failure doesn't trigger wfds as it does on unix.

This fixes issue 2237, based on code by yeyingxian.

Originally committed as revision 25154 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-09-21 20:17:34 +00:00
Ronald S. Bultje 63638a3c4a Print error messages in case of connection failure or name resolution failure
in tcp.c.

Originally committed as revision 24796 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-14 20:34:51 +00:00
Måns Rullgård f3bfe388b5 Make ff_url_split() public
ff_url_split() is retained as an alias, as it was used by ffserver,
to avoid breaking ABI compatibility with it.

Originally committed as revision 23822 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-27 14:16:46 +00:00
Martin Storsjö 27241cbffe Declare the url_write buffer parameter as const
Originally committed as revision 23401 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-01 07:46:23 +00:00
Martin Storsjö cae9a15c98 Don't report EINTR from select as an error, retry select instead
Originally committed as revision 22694 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-26 16:04:38 +00:00
Aurelien Jacobs e4a9e3cc7c move ff_url_split() and ff_url_join() declarations to internal.h
those functions are not part of the public API

Originally committed as revision 22534 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-14 23:59:48 +00:00
Martin Storsjö c5c6e67c28 Rename url_split to ff_url_split
Since this function isn't in the public API, it should have an ff_ prefix.

Originally committed as revision 22321 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-08 09:03:25 +00:00
Martin Storsjö 814c56413d Don't explicitly initialize networking in the tcp and udp protocols
Networking is always initialized when opening protocols.

Originally committed as revision 22227 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-05 22:38:48 +00:00
Ronald S. Bultje 88248b76af Fix BSD compile (PF_UNSPEC is not a standard define, AF_UNSPEC is).
Originally committed as revision 21490 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-27 22:31:13 +00:00
Martin Storsjö fdcdd5396e Use getaddrinfo() instead of resolve_host(). Patch by Martin Storsjö
<$firstname()$firstname,st>.

Originally committed as revision 21147 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-11 17:32:40 +00:00
Martin Storsjö 73c1326809 Use ff_neterrno instead of errno in tcp.c.
If ff_neterrno() is checked instead of errno, that's probably what should be
used in the return value.
As a sideeffect, this gives better compatibility with Windows (CE), where
network errors aren't visible in errno.)
patch by Martin Storsjö, martin martin st

Originally committed as revision 19433 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-07-15 05:52:49 +00:00
Ronald S. Bultje f0a8039464 Add url_get_file_handle(), which is used to get the file descriptor
associated with the I/O handle (e.g. the fd returned by open()). See
"[RFC] rtsp.c EOF support" thread.

There were previously some URI-specific implementations of the same idea,
e.g. rtp_get_file_handles() and udp_get_file_handle(). All of these are
deprecated by this patch and will be removed at the next major API bump.

Originally committed as revision 17779 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-03-03 17:04:51 +00:00
Diego Biurrun 406792e7b0 cosmetics: Remove pointless period after copyright statement non-sentences.
Originally committed as revision 16684 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-19 15:46:40 +00:00
Aurelien Jacobs b250f9c66d Change semantic of CONFIG_*, HAVE_* and ARCH_*.
They are now always defined to either 0 or 1.

Originally committed as revision 16590 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-13 23:44:16 +00:00
Baptiste Coudurier 6ad1c9c992 only include sys/select.h if present, fix mingw compilation
Originally committed as revision 15420 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-26 02:12:37 +00:00
Baptiste Coudurier c75a0cce5b include sys/select.h to get select, according to posix 2001,
fix compilation on freebsd 5.5

Originally committed as revision 15406 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-24 22:11:53 +00:00
Ronald S. Bultje f23a9759ce Remove check for @ in tcp.c which removes the authorization data from the
actual hostname. This functionality already exists (and always existed) in
url_split() and is therefore useless. See discussion in "[PATCH] tcp.c/udp.c
memleak?" thread on ffmpeg-devel.

Originally committed as revision 14946 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-24 16:22:40 +00:00
Ronald S. Bultje a3303add3c Cosmetics after previous patches.
Originally committed as revision 14926 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-23 18:52:26 +00:00
Ronald S. Bultje 8b9af28da4 On failure, return directly because the fail: case does nothing. This also
allows easier control of the actual return value.

Originally committed as revision 14925 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-23 18:49:16 +00:00
Ronald S. Bultje 47f944a2ef Move malloc() down until after all initializations, so that the resource is
only allocated if initialization worked. This means that on failure, we
don't have to deallocate it.

Originally committed as revision 14924 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-23 18:46:30 +00:00
Ronald S. Bultje e6c1381982 Fix memleak on some OSes in case network initialization fails. See
"[PATCH] tcp.c/udp.c memleak?" for discussion.

Originally committed as revision 14923 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-23 17:39:56 +00:00
Ronald S. Bultje ad33bfefc7 Remove useless comments. See "[PATCH] tcp.c/udp.c memleak?" for discussion.
Originally committed as revision 14922 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-08-23 17:39:10 +00:00
Diego Biurrun d78d72da66 Set TCP protocol to is_streamed=1 as seeking is not possible.
Björn Axelsson, bjorn.axelsson intinor se

Originally committed as revision 12338 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-03-05 15:29:10 +00:00
Luca Abeni 087b327287 Include os_support.h only when needed
Originally committed as revision 11073 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-11-21 16:33:06 +00:00
Ramiro Polla 1642cb6b2e Add initialization and cleanup functions for Winsock
Originally committed as revision 10040 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-08-09 23:39:05 +00:00
Ramiro Polla 85060fe6b4 MinGW returns EAGAIN instead of EINPROGRESS
Originally committed as revision 9982 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-08-08 12:08:16 +00:00
Panagiotis Issaris 6f3e0b2174 Replace all occurrences of AVERROR_IO with AVERROR(EIO).
Originally committed as revision 9760 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-07-19 15:23:32 +00:00
Alex Beregszaszi ba472aaf01 implement ff_socket_nonblock and use it in networking code
Originally committed as revision 8846 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-27 00:41:50 +00:00
Alex Beregszaszi 8da4034f52 use ff_neterrno() and FF_NETERROR() for networking error handling
Originally committed as revision 8845 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-27 00:35:54 +00:00
Alex Beregszaszi 383eda2348 move resolve_host from tcp.c to os_support.c as it is used widely
Originally committed as revision 8834 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-26 18:04:42 +00:00
Alex Beregszaszi a33cc9511b cosmetics in resolve_host
Originally committed as revision 8833 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-04-26 18:00:28 +00:00
Alex Beregszaszi b5cccea088 change PF_INET to AF_INET to be consistent in the whole project. PF_INET is deprecated, while AF_INET is referred by the POSIX standards
Originally committed as revision 8073 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-02-22 13:34:36 +00:00
François Revol 8fa36ae09d This fixes error handling for BeOS, removing the need for some ifdefs.
AVERROR_ defines are moved to avcodec.h as they are needed in there as well. Feel free to move that to avutil/common.h.
Bumped up avcodec/format version numbers as though it's binary compatible we will want to rebuild apps as error values changed.
Please from now on use return AVERROR(EFOO) instead of the ugly return -EFOO in your code.
This also removes the need for berrno.h.

Originally committed as revision 7965 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-02-13 18:26:14 +00:00
Ramiro Polla 42572ef53f move networking #includes into separate file
patch by Ramiro Polla angustia =a= arrozcru =d= no-ip =d= org

Originally committed as revision 7817 to svn://svn.ffmpeg.org/ffmpeg/trunk
2007-02-04 17:05:44 +00:00