Commit Graph

164 Commits

Author SHA1 Message Date
Alexander Strasser db3c9701f4 lavf/avio: Introduce avio_find_protocol_name
Make it possible to find out what protocol will be chosen
for a given URL.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2014-02-16 22:34:21 +01:00
Michael Niedermayer 7f019129e1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavf: Remove a now useless parameter to ffurl_register_protocol

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-30 17:48:47 +01:00
Martin Storsjö 0c5f839693 lavf: Remove a now useless parameter to ffurl_register_protocol
This was added in 9b07a2dc02 as an ABI hack to allow older
code built with lavf 52 to register protocols even if the size
of the URLProtocol struct was increased. Later, registering
protocols from outside of lavf was removed and this workaround
isn't needed any longer since lavf 53.

This removes an unchecked malloc and a memory leak for the cases
when this workaround actually was used - which it hasn't since
lavf 53.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-10-30 09:53:48 +02:00
Derek Buitenhuis 25c7db7cc9 avio: Check for memory allocation failure of private data
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-10-29 11:40:15 +00:00
Michael Niedermayer 0436ffc294 Merge commit '53151723e377b9c43f876e20d7f27a17993256c8'
* commit '53151723e377b9c43f876e20d7f27a17993256c8':
  avio: K&R formatting cosmetics

Conflicts:
	libavformat/avio.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-28 12:17:57 +01:00
Luca Barbato 53151723e3 avio: K&R formatting cosmetics 2013-10-28 00:04:50 +01:00
Derek Buitenhuis d206fd996b avio: Check for memory allocation failure of private data
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-10-27 19:15:03 +00:00
Luca Barbato ea71aafd68 avio: Use AVERROR_PROTOCOL_NOT_FOUND
When the protocol is missing ffurl_alloc() should return
AVERROR_PROTOCOL_NOT_FOUND instead of AVERROR(ENOENT).

Bug-Id: 577
CC: libav-stable@libav.org
2013-10-21 15:55:20 +02:00
Andrey Utkin 34fd21120d retry_transfer_wrapper(): check for interrupt before operation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-12 21:27:27 +02:00
Carl Eugen Hoyos 1db88c33f2 Suggest recompilation with openssl or gnutls if the https protocol is not found.
Fixes ticket #2765.
2013-07-10 16:20:40 +02:00
Michael Niedermayer 5d876be87a avio: Handle AVERROR_EOF in the same way as the return value 0
This makes sure the ffurl_read_complete function actually
returns the number of bytes read, as the documentation of the
function says, even if the underlying protocol uses AVERROR_EOF
instead of 0.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-07 13:30:01 +03:00
Michael Niedermayer a46e578dda avformat/avio: Fix EOF handiling of ffurl_read_complete()
Fixes Ticket2537

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-24 14:23:44 +02:00
Nicolas George d9fad53f4b lavf/avio: check for : in filenames for protocols.
If the first "special" character in a filename is a comma,
it can introduce protocol options, but only if there is a
colon at the end. Otherwise, it is just a filename with a
comma.

Fix trac ticket #2303.
2013-02-28 19:30:56 +01:00
Nicolas George 3d7f4f8726 lavf/avio: check that the protocol supports the open mode.
Fix trac ticket #2139.
2013-02-24 11:51:16 +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 4521645b1a avio: fix pointer type mismatches in avio_enum_protocols()
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-27 13:43:44 +01:00
Michael Niedermayer a96577df38 avio: fix sizeof argument
Fixes CID732284
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-19 22:35:32 +02:00
Michael Niedermayer d30351363f url_alloc_for_protocol: fix use of uninitialized variable
Fixes CID703830
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-19 22:14:13 +02:00
Michael Niedermayer 9a27fd12f3 avio: replace ETIMEDOUT by EIO
ETIMEDOUT is not available on all platforms

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-08 02:28:20 +02:00
Andrey Utkin 7870722592 Add 'rw_timeout' into URLContext
If set non-zero, limits duration of retry_transfer_wrapper() loop, thus
affects ffurl_read*(), ffurl_write()
Measured in microseconds.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-29 00:05:03 +02:00
Michael Niedermayer 6c180b35c4 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpegvideo_enc: don't use deprecated avcodec_encode_video().
  cmdutils: refactor -codecs option.
  avconv: make -shortest a per-output file option.
  lavc: add avcodec_descriptor_get_by_name().
  lavc: add const to AVCodec* function parameters.
  swf(dec): replace CODEC_ID with AV_CODEC_ID
  dvenc: don't use deprecated AVCODEC_MAX_AUDIO_FRAME_SIZE
  rtmpdh: Do not generate the same private key every time when using libnettle
  rtp: remove ff_rtp_get_rtcp_file_handle().
  rtsp.c: use ffurl_get_multi_file_handle() instead of ff_rtp_get_rtcp_file_handle()
  avio: add (ff)url_get_multi_file_handle() for getting more than one fd
  h264: vdpau: fix crash with unsupported colorspace
  amrwbdec: Decode the fr_quality bit properly

Conflicts:
	Changelog
	cmdutils.c
	cmdutils_common_opts.h
	doc/ffmpeg.texi
	ffmpeg.c
	ffmpeg.h
	ffmpeg_opt.c
	libavcodec/h264.c
	libavcodec/options.c
	libavcodec/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-18 15:20:32 +02:00
Jordi Ortiz d6b9da1178 avio: add (ff)url_get_multi_file_handle() for getting more than one fd
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-08-17 22:14:30 +03:00
Michael Niedermayer e847f41285 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  libspeexenc: add supported sample rates and channel layouts.
  Replace usleep() calls with av_usleep()
  lavu: add av_usleep() function
  utvideo: mark interlaced frames as such
  utvideo: Fix interlaced prediction for RGB utvideo.
  cosmetics: do not use full path for local headers
  lavu/file: include unistd.h only when available
  configure: check for unistd.h
  log: include unistd.h only when needed
  lavf: include libavutil/time.h instead of redeclaring av_gettime()

Conflicts:
	configure
	doc/APIchanges
	ffmpeg.c
	ffplay.c
	libavcodec/utvideo.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-22 22:34:02 +02:00
Mans Rullgard 896bb0d742 Replace usleep() calls with av_usleep()
This reduces the dependency on unistd.h which is not available
on all systems.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-06-22 17:15:36 +01:00
Michael Niedermayer edf96d631c url: add ffurl_closep() which also sets the context pointer to NULL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-01 14:47:30 +02:00
Michael Niedermayer f89aa6751c lavf: use av_freep() in ffurl_close()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-01 14:40:05 +02:00
Michael Niedermayer f7c89705e4 avio: fix "discards const qualifier from pointer target type" warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-26 20:46:02 +02: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 32d545e0a4 avio: Add a function for signalling end of reading/writing
Signed-off-by: Martin Storsjö <martin@martin.st>
2012-05-22 23:16:41 +03:00
Nicolas George 12eeced8b4 avio: change ffurl_alloc return code.
If the designated protocol is not found, return
AVERROR_PROTOCOL_NOT_FOUND instead of AVERROR(ENOENT).
2012-04-28 16:39:54 +02:00
Michael Niedermayer 6679271700 avio: Fix "warning: initialization from incompatible pointer type"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-02-06 02:04:08 +01: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
Michael Niedermayer e37f161e66 Merge remote-tracking branch 'qatar/master'
* qatar/master: (71 commits)
  movenc: Allow writing to a non-seekable output if using empty moov
  movenc: Support adding isml (smooth streaming live) metadata
  libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
  sunrast: Document the different Sun Raster file format types.
  sunrast: Add a check for experimental type.
  libspeexenc: use AVSampleFormat instead of deprecated/removed SampleFormat
  lavf: remove disabled FF_API_SET_PTS_INFO cruft
  lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft
  lavf: remove disabled FF_API_REORDER_PRIVATE cruft
  lavf: remove disabled FF_API_SEEK_PUBLIC cruft
  lavf: remove disabled FF_API_STREAM_COPY cruft
  lavf: remove disabled FF_API_PRELOAD cruft
  lavf: remove disabled FF_API_NEW_STREAM cruft
  lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft
  lavf: remove disabled FF_API_MUXRATE cruft
  lavf: remove disabled FF_API_FILESIZE cruft
  lavf: remove disabled FF_API_TIMESTAMP cruft
  lavf: remove disabled FF_API_LOOP_OUTPUT cruft
  lavf: remove disabled FF_API_LOOP_INPUT cruft
  lavf: remove disabled FF_API_AVSTREAM_QUALITY cruft
  ...

Conflicts:
	doc/APIchanges
	libavcodec/8bps.c
	libavcodec/avcodec.h
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/options.c
	libavcodec/sunrast.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/h264_deblock.asm
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavformat/avformat.h
	libavformat/avio.c
	libavformat/avio.h
	libavformat/aviobuf.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/utils.c
	libavformat/version.h
	libavformat/wtv.c
	libavutil/Makefile
	libavutil/file.c
	libswscale/x86/input.asm
	libswscale/x86/swscale_mmx.c
	libswscale/x86/swscale_template.c
	tests/ref/lavf/ffm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-28 07:53:34 +01:00
Alex Converse 7181c4edee cosmetics: Remove extra newlines at EOF 2012-01-27 17:19:09 -08:00
Anton Khirnov 374e469b8d lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft 2012-01-27 10:52:43 +01:00
Anton Khirnov 2439f2ca82 lavf: remove disabled FF_API_OLD_AVIO cruft 2012-01-27 10:52:42 +01: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ö acb074301c avio: Only do implicit network initialization for network protocols
The implicit network initialization is set to be removed in the
future, but is kept for compatibility. By not doing the implicit
initialization for non-network protocols, we avoid the warning
about avformat_network_init() not being called for these, where
it really doesn't make much sense.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-01-05 23:56:56 +02:00
Michael Niedermayer ad9e0ed170 avio: fix handling of , in urls
Fixes Ticket805

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-23 23:59:10 +01:00
Michael Niedermayer 58030fc6c8 avio: Fix handling of filenames that contain :
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-24 15:03:27 +01:00
Michael Niedermayer 6161c41817 avio: Support private options in URLProtocols
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-22 20:54:51 +01:00
Michael Niedermayer c12e1bd1bc avio: allow any chars in protocols
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-22 18:57:01 +01:00
Michael Niedermayer e161b079de Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits)
  configure: add check for w32threads to enable it automatically
  rtmp: do not hardcode invoke numbers
  cinepack: return non-generic errors
  fate-lavf-ts: use -mpegts_transport_stream_id option.
  Add an APIchanges entry and a minor bump for avio changes.
  avio: Mark the old interrupt callback mechanism as deprecated
  avplay: Set the new interrupt callback
  avconv: Set new interrupt callbacks for all AVFormatContexts, use avio_open2() everywhere
  cinepak: remove redundant coordinate checks
  cinepak: check strip_size
  cinepak, simplify, use AV_RB24()
  cinepak: simplify, use FFMIN()
  cinepak: Fix division by zero, ask for sample if encoded_buf_size is 0
  applehttp: Fix seeking in streams not starting at DTS=0
  http: Don't use the normal http proxy mechanism for https
  tls: Handle connection via a http proxy
  http: Reorder two code blocks
  http: Add a new protocol for opening connections via http proxies
  http: Split out the non-chunked buffer reading part from http_read
  segafilm: add support for raw videos
  ...

Conflicts:
	avconv.c
	configure
	doc/APIchanges
	libavcodec/cinepak.c
	libavformat/applehttp.c
	libavformat/version.h
	tests/lavf-regression.sh
	tests/ref/lavf/ts

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-19 02:00:06 +01:00
Martin Storsjö 45f511ece7 avio: Mark the old interrupt callback mechanism as deprecated
Prepare for removing it at an upcoming major bump.
2011-11-18 11:01:16 +01:00
Michael Niedermayer 5f268ca5c5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavf: pass options from AVFormatContext to avio.
  avformat: Use avio_open2, pass the AVFormatContext interrupt_callback onwards
  avio: add avio_open2, taking an interrupt callback and options
  avio: add support for passing options to protocols.
  avio: add and use ffurl_protocol_next().
  avformat: Pass the interrupt callback on to chained muxers/demuxers
  avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
  avformat: Use ff_check_interrupt
  avio: Add an internal utility function for checking the new interrupt callback
  avio: Add AVIOInterruptCB
  texi2html: remove stray \n
  doc: prettyfy the texi2html documentation
  swscale: handle unaligned buffers in yuv2plane1

Conflicts:
	libavformat/avformat.h
	libavformat/avio.c
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-14 00:33:39 +01:00
Martin Storsjö 1dee0aca74 avio: add avio_open2, taking an interrupt callback and options
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>
2011-11-13 13:17:04 +01:00
Anton Khirnov ddffc2fdc3 avio: add support for passing options to protocols.
Not used anywhere yet, support for passing options from avio_open() will
follow.
2011-11-13 13:14:39 +01:00
Anton Khirnov 163a31136d avio: add and use ffurl_protocol_next(). 2011-11-13 13:14:14 +01:00
Martin Storsjö 6f1b7b3944 avio: Add an AVIOInterruptCB parameter to ffurl_open/ffurl_alloc
Change all uses of these function to pass the relevant
callback on.
2011-11-13 13:12:17 +01:00
Martin Storsjö 9957cdbfd5 avformat: Use ff_check_interrupt 2011-11-13 13:08:13 +01:00