Commit Graph

129 Commits

Author SHA1 Message Date
Carl Eugen Hoyos
1f4bce894a lavf/tcp: Clarify that the -timeout option takes microseconds. 2014-11-12 13:52:56 +01:00
Michael Niedermayer
ae17a0c258 Merge commit '1d4579e38ecad578c86516fad2837a273d11b320'
* commit '1d4579e38ecad578c86516fad2837a273d11b320':
  tcp: Add AVOption support

Conflicts:
	libavformat/tcp.c

See: 2e009c6042
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-11 00:39:01 +02:00
Luca Barbato
1d4579e38e tcp: Add AVOption support 2014-10-10 16:29:07 +02:00
Michael Niedermayer
08a110ca87 Merge commit '6ee1cb5740e7490151db7dcec7e20ceaf8a2fe1f'
* commit '6ee1cb5740e7490151db7dcec7e20ceaf8a2fe1f':
  libavformat: use MSG_NOSIGNAL when applicable

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-25 13:27:21 +02:00
Rémi Denis-Courmont
6ee1cb5740 libavformat: use MSG_NOSIGNAL when applicable
If the remote end of a connection oriented socket hangs up, generating
an EPIPE error is preferable over an unhandled SIGPIPE signal.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-08-25 10:49:14 +03:00
Stefano Sabatini
1b4da43ce0 doc/protocols/tcp,lavf/tcp: apply minor fixes to TCP protocol documentation 2013-12-25 18:42:26 +01:00
Stefano Sabatini
702d9a23b3 lavf/tcp: honor listen option value in a tag
Consistent with what is done in udp.c, allow to explicitly disable listen
with listen=0.
2013-12-25 18:42:20 +01:00
Martin Storsjö
a6a4596e12 tcp: Explicitly convert a pointer to a boolean integer
This fixes warnings about making integers from pointers without
a cast, and avoids the theoretical case where the lower 32 bits of
the pointer would all be zero where the implicit cast wouldn't give
the right result.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-09 23:57:04 +03:00
Michael Niedermayer
22fbc7f8be avformat/tcp: fix pointer to int warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-25 19:44:40 +02:00
Michael Niedermayer
89efaabc99 Merge commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a'
* commit 'abe5268c3328bf0e8fcfb7dc6e231b8920177c3a':
  tcp: Use a different log message and level if there's more addresses to try

Conflicts:
	libavformat/tcp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 17:53:01 +02:00
Michael Niedermayer
2539767206 Merge commit 'bb9378251a167ef0116f263912e57f715c1e02ac'
* commit 'bb9378251a167ef0116f263912e57f715c1e02ac':
  network: Use SOCK_CLOEXEC when available

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 15:40:05 +02:00
Martin Storsjö
abe5268c33 tcp: Use a different log message and level if there's more addresses to try
This lowers the level of warnings printed if trying to connect
to a host name that provides both v6 and v4 addresses but the
service only is available on the v4 address (often occurring for
'localhost', with servers that aren't v6-aware).

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-06 10:39:39 +03:00
Luca Barbato
bb9378251a network: Use SOCK_CLOEXEC when available 2013-08-05 16:13:36 +02:00
Michael Niedermayer
68b7b534be tcp: Use a default timeout of 5 sec for opening a connection but not for receiving packets
This should be closer to how tcp behaved longer ago and should
fix the issue with idle connections timing out.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-06 01:33:19 +02:00
Michael Niedermayer
390aabb2a1 tcp: Fix the default timeout
Fixes Ticket2694

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-06 00:17:31 +02:00
Michael Niedermayer
82070b01b8 Merge commit '9835abb6d63fb07613994ae90e72fef758149408'
* commit '9835abb6d63fb07613994ae90e72fef758149408':
  network: uniform ff_listen_bind and ff_listen_connect

Conflicts:
	libavformat/network.c
	libavformat/tcp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-05 11:56:56 +02:00
Luca Barbato
9835abb6d6 network: uniform ff_listen_bind and ff_listen_connect
Document the functions and have both use a millisecond timeout and
check for interrupt.
2013-06-04 14:56:52 +02:00
Michael Niedermayer
54ddbb477b Merge remote-tracking branch 'qatar/master'
* qatar/master:
  network: factor out connect-listening code

Conflicts:
	libavformat/network.h
	libavformat/tcp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-02 11:02:02 +02:00
Michael Niedermayer
4d4f5911d3 Merge commit '28306e6d620c109ddd672f7243adfbc2bbb3b18f'
* commit '28306e6d620c109ddd672f7243adfbc2bbb3b18f':
  network: factor out bind-listening code
  use my full first name instead of short one in copyrights

Conflicts:
	libavformat/tcp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-02 10:30:35 +02:00
Luca Barbato
f849a77e67 network: factor out connect-listening code
Introduce ff_listen_connect, to be shared with the other
non-tcp network protocols.
2013-06-01 15:29:53 +02:00
Luca Barbato
28306e6d62 network: factor out bind-listening code
Introduce ff_listen_bind, to be shared with the other non-tcp
network protocols.
2013-06-01 15:29:53 +02:00
Michael Niedermayer
9cf788eca8 avformat/avdevice: add missing time.h includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-12 15:28:22 +01:00
Andrey Utkin
2e009c6042 tcp: accept params through avio_open2() options
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-09 17:24:55 +02:00
Andrey Utkin
949acefc11 tcp: use timeout option consistently
Default _connection_ timeout value 5 seconds is left as i/o timeout also

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-09 17:18:43 +02:00
Michael Niedermayer
f7d4e26c6a Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtmp: Add a new option 'rtmp_pageurl'
  doc: Update the description of the rtmp_tcurl option
  rtmp: Make the description of the rtmp_tcurl option more generic
  libfdk-aacenc: add LATM/LOAS encapsulation support
  sctp: add port missing error message
  tcp: add port missing error message
  avfilter: Fix printf format string conversion specifier

Conflicts:
	libavcodec/version.h
	libavfilter/avfilter.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-25 22:00:06 +02:00
Jordi Ortiz
f9a9a14862 tcp: add port missing error message
Without this patch a user a bit absent-minded may not notice that
the connection doesn't work because the port is missing.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-25 20:30:39 +03:00
Michael Niedermayer
f8911b987d Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mss3: use standard zigzag table
  mss3: split DSP functions that are used in MTS2(MSS4) into separate file
  motion-test: do not use getopt()
  tcp: add initial timeout limit for incoming connections
  configure: Change the rdtsc check to a linker check
  avconv: propagate fatal errors from lavfi.
  lavfi: add error handling to filter_samples().
  fate-run: make avconv() properly deal with multiple inputs.
  asplit: don't leak the input buffer.
  af_resample: fix request_frame() behavior.
  af_asyncts: fix request_frame() behavior.
  libx264: support aspect ratio switching
  matroskadec: honor error_recognition when encountering unknown elements.
  lavr: resampling: add support for s32p, fltp, and dblp internal sample formats
  lavr: resampling: add filter type and Kaiser window beta to AVOptions
  lavr: Use AV_SAMPLE_FMT_NONE to auto-select the internal sample format
  lavr: mix: validate internal sample format in ff_audio_mix_init()

Conflicts:
	ffmpeg.c
	ffplay.c
	libavcodec/libx264.c
	libavfilter/audio.c
	libavfilter/split.c
	libavformat/tcp.c
	tests/fate-run.sh

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-09 22:40:12 +02:00
Jordi Ortiz
5427df0186 tcp: add initial timeout limit for incoming connections
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-07-09 17:30:19 +03:00
Michael Niedermayer
87df986dcf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mss1: validate number of changeable palette entries
  mss1: report palette changed when some additional colours were decoded
  x86: fft: replace call to memcpy by a loop
  udp: Support IGMPv3 source specific multicast and source blocking
  dxva2: include dxva.h if found
  libm: Provide fallback definitions for isnan() and isinf()
  tcp: Pass NULL as hostname to getaddrinfo if the string is empty
  tcp: Set AI_PASSIVE when the socket will be used for listening

Conflicts:
	configure
	libavcodec/mss1.c
	libavformat/udp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-28 01:08:52 +02:00
Jordi Ortiz
ef882e464a tcp: Pass NULL as hostname to getaddrinfo if the string is empty
This gives you the proper v4 or v6 version of the "any address",
allowing receiving connections on any address on the machine.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-27 14:04:02 +03:00
Jordi Ortiz
58f3e09ee4 tcp: Set AI_PASSIVE when the socket will be used for listening
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-27 14:04:02 +03:00
Michael Niedermayer
b536e2facf Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avconv: add an assert to silence an uninitialized variable warning.
  avconv: shut up an uninitialized variable warning.
  avfiltergraph: shut up uninitialized variable warning.
  af_join: initialize a variable to shut up gcc warning.
  amix: fix format specifier for AVFilterLink.sample_rate.
  lavfi: make filters less verbose.
  mpc8: read APE tags.
  lavr: x86: fix ff_conv_fltp_to_flt_6ch function prototypes
  libm: provide fallback definition for cbrtf() using powf()
  network: Don't redefine error codes if they already exist in errno.h
  configure: Check for sys/time.h
  network: Include unistd.h from network.h
  avconv: don't include vsrc_buffer.h, which doesn't exist anymore
  lavfi: reorder AVFilterLink fields.
  lavfi: reorder AVFilterContext fields.
  lavfi: reorder AVFilter fields.
  lavfi: reorder AVFilterBufferRef fields.
  lavfi: reorder AVFilterBuffer fields.

Conflicts:
	configure
	libavcodec/v210dec.h
	libavfilter/asrc_anullsrc.c
	libavfilter/avfilter.h
	libavfilter/buffersrc.c
	libavfilter/src_movie.c
	libavfilter/vf_aspect.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawbox.c
	libavfilter/vf_fade.c
	libavfilter/vf_overlay.c
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c
	libavfilter/vsrc_color.c
	libavformat/network.h
	libavutil/libm.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-27 01:58:09 +02:00
Martin Storsjö
39dba5aa1b network: Include unistd.h from network.h
This heaader is required for close() for sockets in network
code. For winsock, the equivalent function is defined in the
winsock2.h header.

This avoids having the HAVE_UNISTD_H in all files dealing with
raw sockets.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-26 17:22:21 +03:00
Michael Niedermayer
4da42ebe44 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  MS Screen 1 decoder
  aacdec: Fix popping channel layouts.
  av_gettime: support Win32 without gettimeofday()
  Use av_gettime() in various places
  Move av_gettime() to libavutil
  dct-test: use emms_c() from libavutil instead of duplicating it
  mov: fix operator precedence bug
  mathematics.h: remove a couple of math defines
  Remove unnecessary inclusions of [sys/]time.h
  lavf: remove unnecessary inclusions of unistd.h
  bfin: libswscale: add const where appropriate to fix warnings
  bfin: libswscale: remove unnecessary #includes
  udp: Properly check for invalid sockets
  tcp: Check the return value from getsockopt
  network: Use av_strerror for getting error messages
  udp: Properly print error from getnameinfo
  mmst: Use AVUNERROR() to convert error codes to the right range for strerror
  network: Pass pointers of the right type to get/setsockopt/ioctlsocket on windows
  rtmp: Reduce the number of idle posts sent by sleeping 50ms

Conflicts:
	Changelog
	configure
	libavcodec/aacdec.c
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/dct-test.c
	libavcodec/version.h
	libavformat/riff.c
	libavformat/udp.c
	libavutil/Makefile
	libswscale/bfin/yuv2rgb_bfin.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-20 20:47:46 +02:00
Mans Rullgard
6501dcfb5e Remove unnecessary inclusions of [sys/]time.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-20 11:46:46 +01:00
Martin Storsjö
bb6c1abb0e tcp: Check the return value from getsockopt
Make sure we actually have an error code in ret, in case
getsockopt failed.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-19 20:25:07 +03:00
Martin Storsjö
a840cdda6c network: Use av_strerror for getting error messages
Also use ff_neterrno() instead of errno directly (which doesn't work
on windows), for getting the error code.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-19 20:24:55 +03:00
Michael Niedermayer
6ca48ad044 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  amr: Cosmetic cleanup
  mov_chan: Fix operator precedence by adding parentheses
  doc: Add missing protocols to list of supported protocols.
  tcp: Check the listen call

Conflicts:
	libavformat/amr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-17 22:28:28 +02:00
Jordi Ortiz
a7cc78cb11 tcp: Check the listen call
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-17 13:22:36 +03:00
Michael Niedermayer
fbc5e0fae1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  http: Add the url_shutdown function for https, too
  http: Simplify code by removing a local variable
  http: Clear the old URLContext pointer when closed
  tcp: Try enabling SO_REUSEADDR when listening
  tcp: Check the return values from bind and accept
  avisynth: Make sure the filename passed to avisynth is in the right code page

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-01 19:59:39 +02:00
Martin Storsjö
2dbb8cc6a3 tcp: Check the return values from bind and accept
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-01 14:25:15 +02:00
Martin Storsjö
b7c3772be8 tcp: Try enabling SO_REUSEADDR when listening
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-01 01:56:22 +03:00
Martin Storsjö
641f4a885f tcp: Check the return values from bind and accept
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-01 01:56:21 +03:00
Michael Niedermayer
d0ad91c258 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  os_support: Define SHUT_RD, SHUT_WR and SHUT_RDWR on OS/2
  http: Add support for reading http POST reply headers
  http: Add http_shutdown() for ending writing of posts
  tcp: Allow signalling end of reading/writing
  avio: Add a function for signalling end of reading/writing
  lavfi: fix comment, audio is supported now.
  lavfi: fix incorrect comment.
  lavfi: remove avfilter_null_* from public API on next bump.
  lavfi: remove avfilter_default_* from public API on next bump.
  lavfi: deprecate default config_props() callback and refactor avfilter_config_links()
  avfiltergraph: smarter sample format selection.
  avconv: rename transcode_audio/video to decode_audio/video.
  asyncts: reset delta to 0 when it's not used.
  x86: lavc: use %if HAVE_AVX guards around AVX functions in yasm code.
  dwt: return errors from ff_slice_buffer_init()

Conflicts:
	ffmpeg.c
	libavfilter/avfilter.c
	libavfilter/avfilter.h
	libavfilter/formats.c
	libavfilter/version.h
	libavfilter/vf_blackframe.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_format.c
	libavfilter/vf_showinfo.c
	libavfilter/video.c
	libavfilter/video.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-23 21:48:31 +02:00
Samuel Pitoiset
4a9ca93556 tcp: Allow signalling end of reading/writing
tcp_shutdown() isn't needed at the moment, but is added for
consistency to explain how the function is supposed to be used.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-22 23:16:42 +03:00
Michael Niedermayer
d40ff29cac Merge remote-tracking branch 'qatar/master'
* qatar/master:
  asf: only set index_read if the index contained entries.
  cabac: add overread protection to BRANCHLESS_GET_CABAC().
  cabac: increment jump locations by one in callers of BRANCHLESS_GET_CABAC().
  cabac: remove unused argument from BRANCHLESS_GET_CABAC_UPDATE().
  cabac: use struct+offset instead of memory operand in BRANCHLESS_GET_CABAC().
  h264: add overread protection to get_cabac_bypass_sign_x86().
  h264: reindent get_cabac_bypass_sign_x86().
  h264: use struct offsets in get_cabac_bypass_sign_x86().
  h264: fix overreads in cabac reader.
  wmall: fix seeking.
  lagarith: fix buffer overreads.
  dvdec: drop unnecessary dv_tablegen.h #include
  build: fix doc generation errors in parallel builds
  Replace memset(0) by zero initializations.
  faandct: Remove FAAN_POSTSCALE define and related code.
  dvenc: print allowed profiles if the video doesn't conform to any of them.
  avcodec_encode_{audio,video}: only reallocate output packet when it has non-zero size.
  FATE: add a test for vp8 with changing frame size.
  fate: add kgv1 fate test.
  oggdec: calculate correct timestamps in Ogg/FLAC

Conflicts:
	libavcodec/4xm.c
	libavcodec/cook.c
	libavcodec/dvdata.c
	libavcodec/dvdsubdec.c
	libavcodec/lagarith.c
	libavcodec/lagarithrac.c
	libavcodec/utils.c
	tests/fate/video.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-29 04:11:10 +02:00
Diego Biurrun
a92be9b856 Replace memset(0) by zero initializations.
Also remove one pointless zero initialization in rangecoder.c.
2012-03-28 09:38:33 +02:00
Michael Niedermayer
3edff185ab Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits)
  ipmovie: do not read audio packets before the codec is known
  truemotion2: check size before GetBitContext initialisation
  avio: Only do implicit network initialization for network protocols
  avio: Add an URLProtocol flag for indicating that a protocol uses network
  adpcm: ADPCM Electronic Arts has always two channels
  matroskadec: Fix a bug where a pointer was cached to an array that might later move due to a realloc()
  fate: Add missing reference file from 9b4767e4.
  mov: Support MOV_CH_LAYOUT_USE_DESCRIPTIONS for labeled descriptions.
  4xm: Prevent buffer overreads.
  mjpegdec: parse RSTn to prevent skipping other data in mjpeg_decode_scan
  vp3: add fate test for non-zero last coefficient
  vp3: fix streams with non-zero last coefficient
  swscale: remove unused U/V arguments from yuv2rgb_write().
  timer: K&R formatting cosmetics
  lavf: cosmetics, reformat av_read_frame().
  lavf: refactor av_read_frame() to make it easier to understand.
  Report an error if pitch_lag is zero in AMR-NB decoder.
  Revert "4xm: Prevent buffer overreads."
  4xm: Prevent buffer overreads.
  4xm: pass the correct remaining buffer size to decode_i2_frame().
  ...

Conflicts:
	libavcodec/4xm.c
	libavcodec/mjpegdec.c
	libavcodec/truemotion2.c
	libavformat/ipmovie.c
	libavformat/mov_chan.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-06 02:45:12 +01:00
Martin Storsjö
32b83aeec1 avio: Add an URLProtocol flag for indicating that a protocol uses network
This definition is in two files, since the definitions will move
to the private header at the next bump.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-05 23:56:52 +02:00
Michael Niedermayer
7b0b10ce41 Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits)
  rtpenc: Add support for G726 audio
  rtpdec: Interpret the different G726 names as bits_per_coded_sample
  rtpenc: Change rtp_send_samples to handle sample sizes other than even bytes
  rtpenc: Cast a rescaling parameter to int64_t
  h264: cap max has_b_frames at MAX_DELAYED_PIC_COUNT - 1.
  ARM: fix indentation in ff_dsputil_init_neon()
  ARM: NEON put/avg_pixels8/16 cosmetics
  ARM: add remaining NEON avg_pixels8/16 functions
  ARM: clean up NEON put/avg_pixels macros
  fate: split acodec-pcm into individual tests
  swscale: #include "libavutil/mathematics.h"
  pmpdec: don't use deprecated av_set_pts_info.
  rv34: align temporary block of "dct" coefs
  Add PlayStation Portable PMP format demuxer
  proto: Realign struct initializers
  proto: Use .priv_data_size to allocate the private context
  mmsh: Properly clean up if the second ffurl_alloc failed
  rtmp: Clean up properly if the handshake failed
  md5proto: Remove the get_file_handle function
  applehttpproto: Use the close function if the open function fails
  ...

Conflicts:
	libavcodec/vble.c
	libavformat/mmsh.c
	libavformat/pmpdec.c
	libavformat/udp.c
	tests/ref/acodec/pcm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-02 00:51:11 +01:00