Commit Graph

53 Commits

Author SHA1 Message Date
wm4 c41e0aedf5 network: prevent SIGPIPE on OSX
OSX does not know MSG_NOSIGNAL, and provides its own non-standard
mechanism instead. I guess Apple hates standards.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-30 22:29:19 +02:00
Timothy Gu 7206b94fb8 network: Move variable declaration under an #if
Avoids an unused variable warning.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-28 03:06:05 +02:00
wm4 a9f1d584e5 lavf: move TLS-related ifdeffery to library specific files
There is no need to have this mess in network.c.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-27 22:24:00 +02:00
Vittorio Giovara 45340f9fc7 network: Do not leave context locked on error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-23 13:42:33 +02:00
Michael Niedermayer 7620d48f2e avformat/network: Check for av_malloc* failures in ff_tls_init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-03 02:21:55 +01:00
Olivier Langlois f78bc96b7c lavf: Use av_gettime_relative()
Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-17 20:13:33 +02:00
Michael Niedermayer 2ebacb0fc4 avformat/network: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-13 23:39:49 +02:00
Michael Niedermayer 7439475e69 avformat/network: check ff_socket_nonblock() return and print a debug message
Fixes CID1026744
Fixes CID1026743

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-13 17:08:03 +01:00
Michael Niedermayer baab248c49 avformat/network: check for fcntl() failure in ff_socket()
Fixes: CID1087075
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 16:34:32 +02:00
Michael Niedermayer b8a954e46d avformat/network: fix duplicate include
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 16:58:58 +02:00
Michael Niedermayer 49515cb840 avformat: remove duplicate includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-21 15:36:33 +02:00
Thilo Borgmann d814a839ac Reinstate proper FFmpeg license for all files. 2013-08-30 15:47:38 +00:00
Michael Niedermayer 296eaa84b9 Merge commit '9d5ec50ead97e088d77317e77b18cef06cb3d053'
* commit '9d5ec50ead97e088d77317e77b18cef06cb3d053':
  ff_socket: put out-of-line and fallback to fcntl() for close-on-exec

Conflicts:
	libavformat/network.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-10 10:18:18 +02:00
Rémi Denis-Courmont 9d5ec50ead ff_socket: put out-of-line and fallback to fcntl() for close-on-exec
This supports non-Linux systems (SOCK_CLOEXEC is non-standard) and
older Linux kernels to the extent possible.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-09 11:26:50 +03: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
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
Andrey Utkin 1e85b5e077 ff_network_wait_fd_timeout(): check for interrupt before operation
Reviewed-by: Lukasz M <lukasz.m.luki@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-12 21:27:27 +02:00
Michael Niedermayer efa9e6b423 ff_network_wait_fd_timeout: do not break with timeout < 0
Most code treats timeout < 0 like 0 already

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-06 01:31:37 +02:00
Michael Niedermayer 84f77f8423 Merge commit 'ec7c51c7868d3ccc66b5cc38bf126258b94f086c'
* commit 'ec7c51c7868d3ccc66b5cc38bf126258b94f086c':
  avf: move ff_http_match_no_proxy to network

Conflicts:
	libavformat/internal.h
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-16 23:45:42 +02:00
Luca Barbato ec7c51c786 avf: move ff_http_match_no_proxy to network
It is only used by network protocols.
2013-06-16 14:41:00 +02:00
Michael Niedermayer 21bf0d6f80 avformat/network: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-05 14:29:04 +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 c8faa47484 avformat/network: check the return value from setsockopt()
Fixes: CID1026742
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-03 16:12:00 +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
Dave Yeo e615a77799 os2threads: move from lavc to compat/
For useage in other places besides lavc. Needed after commit
90f9a5830b

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-28 12:49:20 +02:00
Michael Niedermayer a4d3757b29 Merge commit '90f9a5830b5d332de7ebb1ab45589f1870cbd65d'
* commit '90f9a5830b5d332de7ebb1ab45589f1870cbd65d':
  w32pthreads: move from lavc to compat/

Conflicts:
	libavcodec/Makefile
	libavcodec/pthread.c
	libavcodec/vp8.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-24 13:01:41 +02:00
Anton Khirnov 90f9a5830b w32pthreads: move from lavc to compat/
It will be used in other places than lavc.
2013-05-24 09:26:54 +02:00
Dave Yeo 925c9f444f Fix OS/2 threading
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-29 18:56:33 +01:00
Michael Niedermayer 99efd59626 Merge commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967'
* commit 'cb45553f577f8e0ebfe05d3287e1b6fa5859b967':
  Remove pointless #undefs of previously forbidden functions.
  fate: Add dependencies for bmp, cdxl, dfa, mp3

Conflicts:
	doc/examples/muxing.c
	libavfilter/filtfmts.c
	libavutil/des.c
	libavutil/eval.c
	libavutil/log.c
	libavutil/parseutils.c
	tests/fate/mp3.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-05 13:34:45 +01:00
Anton Khirnov cb45553f57 Remove pointless #undefs of previously forbidden functions. 2012-12-04 21:40:22 +01:00
Michael Niedermayer 8943ad4014 Merge commit '4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26'
* commit '4521645b1aee9e9ad8f5cea7b2392cd5f6ffcd26':
  avio: fix pointer type mismatches in avio_enum_protocols()
  avserver: use socklen_t where appropriate
  udp: use socklen_t where appropriate
  network: use HAVE_THREADS instead of local hack
  af_channelmap: remove stray enum declaration
  buffersink: remove stray semicolon after function definition

Conflicts:
	libavformat/avio.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-28 13:19:11 +01:00
Mans Rullgard 9efbfe57e0 network: use HAVE_THREADS instead of local hack
HAVE_THREADS is set in config.h if pthreads or w32threads is
available, which presumably the proper condition here.

Also fixes undefined behaviour in preprocessor directives.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-27 13:11:17 +01:00
Andrey Utkin d2b18c8f5b Introduce ff_network_wait_fd_timeout()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-09 17:17:05 +02:00
Michael Niedermayer c581cb4e4f Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Fix even more missing includes after the common.h removal
  build: Factor out rangecoder dependencies to CONFIG_RANGECODER
  build: Factor out error resilience dependencies to CONFIG_ERROR_RESILIENCE
  x86: avcodec: Consistently name all init files
  Add more missing includes after removing the implicit common.h
  Add some more missing includes after removing the implicit common.h
  Don't include common.h from avutil.h
  rtmp: Automatically compute the hash for SWFVerification

Conflicts:
	configure
	doc/APIchanges
	doc/examples/decoding_encoding.c
	libavcodec/Makefile
	libavcodec/assdec.c
	libavcodec/audio_frame_queue.c
	libavcodec/avpacket.c
	libavcodec/dv_profile.c
	libavcodec/dwt.c
	libavcodec/libtheoraenc.c
	libavcodec/rawdec.c
	libavcodec/rv40dsp.c
	libavcodec/tiff.c
	libavcodec/tiffenc.c
	libavcodec/v210dec.h
	libavcodec/vc1dsp.c
	libavcodec/x86/Makefile
	libavfilter/asrc_anullsrc.c
	libavfilter/avfilter.c
	libavfilter/buffer.c
	libavfilter/formats.c
	libavfilter/vf_ass.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fade.c
	libavfilter/vf_select.c
	libavfilter/video.c
	libavfilter/vsrc_testsrc.c
	libavformat/version.h
	libavutil/audioconvert.c
	libavutil/error.h
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-16 16:20:30 +02:00
Martin Storsjö 70766c2182 Add some more missing includes after removing the implicit common.h
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-15 23:48:48 +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
Ronald S. Bultje 4b1b1449d9 network: Don't redefine error codes if they already exist in errno.h
Since the errno.h values don't match the error codes that winsock
returns, map the winsock error codes to the errno ones, to make
sure explicit checks against AVERROR(x) match.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-06-26 17:22:21 +03:00
Michael Niedermayer c065255bba Merge remote-tracking branch 'qatar/master'
* qatar/master:
  aacenc: Fix LONG_START windowing.
  aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
  avplay: use the correct array size for stride.
  lavc: extend doxy for avcodec_alloc_context3().
  APIchanges: mention avcodec_alloc_context()/2/3
  avcodec_align_dimensions2: set only 4 linesizes, not AV_NUM_DATA_POINTERS.
  aacsbr: ARM NEON optimised sbrdsp functions
  aacsbr: align some arrays
  aacsbr: move some simdable loops to function pointers
  cosmetics: Remove extra newlines at EOF

Conflicts:
	libavcodec/utils.c
	libavfilter/formats.c
	libavutil/mem.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-29 00:34:59 +01:00
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Michael Niedermayer 52c522c720 Merge remote-tracking branch 'qatar/master'
* qatar/master: (27 commits)
  asfdec: add side data to ASFStream packet instead of output packet.
  idroqdec: set AVFMTCTX_NOHEADER and create streams as they occur.
  nellymoserdec: Indicate that the decoder can handle changed parameters
  libavcodec: Apply parameter change side data when decoding audio
  flvdec: Add param change side data if the sample rate or channels have changed
  libavformat: Add a utility function for adding parameter change side data
  libavcodec: Define a side data type for parameter changes
  aacdec: Handle new extradata passed as side data
  flvdec: Export new AAC/H.264 extradata as side data on the next packet
  libavcodec: Define a side data type for new extradata
  flacdec: skip all track indices at once instead of looping.
  mxf: Add PictureEssenceCoding UL for V210.
  mxfdec: consider QuantizationBits between 17 and 24 to be pcm_s24*
  mxfenc: Add support for MPEG-2 MP@HL-14 in mxf container.
  mxf: H.264/MPEG-4 AVC Intra support
  configure: Show whether the safe bitstream reader is enabled
  x86: Tighten register constraints for decode_significance*_x86.
  Replace Subversion revisions in comments by Git hashes.
  h264_cabac: synchronize decode_significance_*_x86 conditionals
  w32threads: wait for the waked thread in pthread_cond_signal.
  ...

Conflicts:
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/flvdec.c
	libavformat/utils.c
	tests/ref/lavfi/pixdesc
	tests/ref/lavfi/pixfmts_copy
	tests/ref/lavfi/pixfmts_null
	tests/ref/lavfi/pixfmts_scale
	tests/ref/lavfi/pixfmts_vflip

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-22 01:51:53 +01:00
Sergey Radionov 139cef8e29 network: properly declare WSADATA in windows
Fixed "ISO C90 forbids mixed declarations and code" in ff_network_init

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-12-21 03:27:19 +01:00
Michael Niedermayer 0bd42ae72c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avformat: Avoid a warning about mixed declarations and code
  BMV demuxer and decoder
  matroskaenc: Make sure the seekhead struct is freed even on seek failure
  mpeg12enc: Remove write-only variables.
  mpeg12enc: Don't set up run-level info for level 0.
  msmpeg4: Don't set up run-level info for level 0.
  avformat: Warn about using network functions without calling avformat_network_init
  avformat: Revise wording
  rdt: Set AVFMT_NOFILE on ff_rdt_demuxer
  rdt: Check the return value of avformat_open
  rtsp: Discard the dynamic handler, if it has an alloc function which failed
  dsputil: use cpuflags in x86 versions of vector_clip_int32()

Conflicts:
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/Makefile
	libavformat/allformats.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-08 02:03:14 +01:00
Martin Storsjö ce145690b6 avformat: Warn about using network functions without calling avformat_network_init
This is to make developers aware of the fact that they will
start using the new init function at some point.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-07 19:29:33 +02:00
Michael Niedermayer 13b7781ec8 Merge remote-tracking branch 'qatar/master'
* qatar/master: (23 commits)
  x86inc: use sse versions of common macros instead of sse2 when applicable
  doc/APIchanges: add missing dates and hashes
  lavf: don't return from void av_update_cur_dts()
  Changelog: add more entries.
  Changelog: update ffmpeg/avconv incompatibility list.
  avconv: remove some redundant temporary variables.
  avconv: fix broken indentation
  avconv: move copy_initial_nonkeyframes to the options context.
  avconv: use file:stream instead of file.stream in log messages.
  doc/avconv: elaborate on basic functionality.
  doc/avconv: -sample_fmts, not -help sample_fmts prints the sample formats
  openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
  Call avformat_network_init/deinit in the programs
  Remove leftover includes of strings.h
  avutil: Don't allow using strcasecmp/strncasecmp
  Replace all usage of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of strcasecmp/strncasecmp
  avstring: Add locale independent implementations of toupper/tolower
  cosmetics: insert some spaces in explicit enum value assignments
  move 8SVX audio codecs to the audio codec list part on the next bump
  ...

Conflicts:
	avprobe.c
	doc/APIchanges
	ffplay.c
	ffserver.c
	libavcodec/avcodec.h
	libavdevice/bktr.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavformat/matroskaenc.c
	libavformat/wtv.c
	libavutil/avstring.c
	libavutil/avstring.h
	libavutil/avutil.h
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-07 03:01:43 +01:00
Martin Storsjö 2461284630 openssl: Only use CRYPTO_set_id_callback on OpenSSL < 1.0.0
Since 1.0.0, this function is deprecated. A new function,
CRYPTO_THREADID_set_callback is available, but if not set at all,
it uses the address of errno as thread id, which should be
sufficient for most systems.

On windows, it never was necessary to use this function even
before 1.0.0, it used the right win32 API function for this
by default.

Signed-off-by: Martin Storsjö <martin@martin.st>
2011-11-06 18:31:44 +02:00
Michael Niedermayer d8cab5c26b Merge remote-tracking branch 'qatar/master'
* qatar/master:
  http: Remove the custom function for disabling chunked posts
  rtsp: Disable chunked http post through AVOptions
  movdec: Set frame_size for AMR
  h264_weight: remove duplication functions.
  swscale: align vertical filtersize by 2 on x86.
  libavfilter: reindent.
  matroskadec: empty blocks are in fact valid.
  avfilter: don't abort() on zero-size allocations.
  h264: improve calculation of codec delay.
  movenc: Set a correct packet size for AMR-NB mode 15, "no data"
  avformat: Add functions for doing global network initialization
  avformat: Add the https protocol
  avformat: Add the tls protocol, using OpenSSL or gnutls
  avformat: Initialize gnutls in ff_tls_init()
  w32threads: Wrap the mutex functions in inline functions returning int
  configure: Allow linking to the gnutls library
  avformat: Add ff_tls_init()/deinit() that initialize OpenSSL
  configure: Allow linking to openssl
  avcodec: Allow locking and unlocking an avformat specific mutex
  avformat: Split out functions from network.h to a new file, network.c

Conflicts:
	Changelog
	configure
	doc/APIchanges
	libavcodec/internal.h
	libavcodec/version.h
	libavfilter/formats.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-06 02:23:34 +01:00