Commit Graph

260 Commits

Author SHA1 Message Date
Michael Niedermayer 7441d1ec33 avformat/aviobuf: fix null dereference in avio_close_dyn_buf()
Fixes CID1135769

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-11 16:16:04 +01:00
Michael Niedermayer 269f5d902a avformat/aviobuf: return error from avio_put_str16le() for invalid input
Found-by: Stefano Sabatini
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-13 19:16:27 +01:00
Michael Niedermayer b52ae27edf avio_put_str16le: Print error message in case of invalid UTF8 input
Found-by: Stefano Sabatini
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-13 19:09:04 +01:00
Michael Niedermayer 81c3bb78ac Merge commit 'd07b51bf0733fe58bbfa13c448775dc325463cb4'
* commit 'd07b51bf0733fe58bbfa13c448775dc325463cb4':
  aviobuf: Handle a NULL buffer in avio_close_dyn_buf

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-01 19:28:39 +01:00
Martin Storsjö d07b51bf07 aviobuf: Handle a NULL buffer in avio_close_dyn_buf
This simplifies proper error handling in rtsp.c/rtspdec.c. When
broadcasting over RTSP in TCP mode, the AVIOContext is closed and
recreated for each sent packet, and if the recreation fails, we might
try to close a NULL buffer when freeing things at the end.

Previously, if recreating the buffer in rtspdec.c failed, this would
crash later due to trying to close a NULL buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-01 09:56:27 +02:00
Michael Niedermayer 72eddc10fa Merge commit 'd872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9'
* commit 'd872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9':
  lavf: Reset the entry count and allocation size variables on av_reallocp failures

Conflicts:
	libavformat/avienc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 12:13:41 +02:00
Martin Storsjö d872fb0f7f lavf: Reset the entry count and allocation size variables on av_reallocp failures
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.

Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-26 23:14:03 +03:00
Michael Niedermayer 2ad8056c5e Merge commit '3627ce2f1dab1d33b7f99d78907a3e4d86b7d847'
* commit '3627ce2f1dab1d33b7f99d78907a3e4d86b7d847':
  aviobuf: Add functions for null buffers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-20 12:26:09 +02:00
Martin Storsjö 3627ce2f1d aviobuf: Add functions for null buffers
Null buffers are useful for simulating writing to a real buffer
for the sake of measuring how many bytes are written.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-19 22:42:37 +03:00
Michael Niedermayer 20dfab33f5 Merge commit '5626f994f273af80fb100d4743b963304de9e05c'
* commit '5626f994f273af80fb100d4743b963304de9e05c':
  avformat: Use av_reallocp() where suitable

Conflicts:
	libavformat/avidec.c
	libavformat/avienc.c
	libavformat/aviobuf.c
	libavformat/oggparsevorbis.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-19 11:01:26 +02:00
Alexandra Khirnova 5626f994f2 avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-18 18:28:38 +02:00
Michael Niedermayer a0fb608396 Merge commit '5afe1d27912be9b643ffb4ddc21f6d920260dbb0'
* commit '5afe1d27912be9b643ffb4ddc21f6d920260dbb0':
  avio: Add const qualifiers to ffio_read_indirect

Conflicts:
	libavformat/mpegts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-08 12:04:46 +02:00
Ben Avison 5afe1d2791 avio: Add const qualifiers to ffio_read_indirect
This provides at least some protection against potential accidental
corruption of AVIO buffer workspace.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-08 11:09:00 +03:00
Michael Niedermayer 8878aef048 Merge commit 'daf1e0d3de03bd424016e2a7520e4e94ece5c0ac'
* commit 'daf1e0d3de03bd424016e2a7520e4e94ece5c0ac':
  avio: Add an internal function for reading without copying

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 15:02:27 +02:00
Ben Avison daf1e0d3de avio: Add an internal function for reading without copying
As long as there is enough contiguous data in the avio buffer,
just return a pointer to it instead of copying it to the caller
provided buffer.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-08-05 15:14:25 +03:00
Hendrik Schreiber b512360184 avio: Don't set the seekable flag if no seek function is provided
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-26 21:46:18 +03:00
Hendrik Schreiber 650355089c avformat/aviobuf/ffio_init_context: set seekable automatically
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-23 17:19:32 +02:00
Michael Niedermayer 186ec17843 avformat/aviobuf: Add ffio_ensure_seekback()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-04 19:13:38 +02:00
Michael Niedermayer 2ca48e4666 avformat: Append data in fill_buffer() when possible
Data is appended in fill_buffer() when there is sufficient space left
and the data pointer only reset when needed.
Previously the data pointer was more often reset, loosing more seekback
space than otherwise needed.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-04 19:13:38 +02:00
Michael Niedermayer ad6a50c0ed avformat: add writeout_count statistic
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-08 13:30:40 +02:00
Michael Niedermayer a08194b4c5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  lavr: fix missing " in header documentation
  aviobuf: Discard old buffered, previously read data in ffio_read_partial

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:29:15 +01:00
Michael Niedermayer e1cf1a9c89 Merge commit 'a0b7e289075dccf223b7f407790d8a86fc5d77e8'
* commit 'a0b7e289075dccf223b7f407790d8a86fc5d77e8':
  aviobuf: Partial support for reading in read/write contexts
  build: Avoid detecting bogus components named 'x'

Conflicts:
	libavcodec/allcodecs.c
	libavdevice/alldevices.c
	libavformat/allformats.c
	libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-04 13:01:54 +01:00
Martin Storsjö 53c25ee073 aviobuf: Discard old buffered, previously read data in ffio_read_partial
This makes RTP custom IO work properly with pure read-only
AVIOContexts as well.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:17:10 +02:00
Martin Storsjö a0b7e28907 aviobuf: Partial support for reading in read/write contexts
So far, aviocontexts are used either in pure-read or pure-write
mode - full read/write mode doesn't work well (and implementing it
is a much larger, not totally trivial change).

This patch allows using avio_read and ffio_read_partial on
read/write aviocontexts, where the read operations are passed
through directly unbuffered, while writes are buffered as usual.

This is enough to support the operations needed by packet based
data transfer like in udp/rtp, where aviocontext is the only
public API for hooking up custom IO.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-01-03 15:14:09 +02:00
Diego Biurrun 511cf612ac miscellaneous typo fixes 2012-12-21 00:18:34 +01:00
Michael Niedermayer 1374b5e15b Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avio: K&R cosmetic formatting

Conflicts:
	libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-09 14:08:01 +01:00
Luca Barbato 1dd1c1c884 avio: K&R cosmetic formatting 2012-12-09 09:45:45 +01:00
Michael Niedermayer 8a34b85fa8 avio: detect implicit truncation by assert in avio_w*
This check is somewhat more lenient as would be ideal because we dont
know if the input is signed or unsigned

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-24 15:42:00 +02:00
Michael Niedermayer a3fb3a670e avio: avoid implicit truncation in avio_w*
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-24 15:27:03 +02:00
Michael Niedermayer b0554fec04 Merge commit 'c0329748b04e1f175dad8c9c2ebf22a5e2dc5b72'
* commit 'c0329748b04e1f175dad8c9c2ebf22a5e2dc5b72':
  fate: add a dependency helper macro
  Add support for building shared libraries with MSVC
  avcodec: Rename avpriv_frame_rate_tab to ff_mpeg12_frame_rate_tab
  gxf: Add a local copy of the relevant parts of the frame rate table
  configure: Split out msvc as a separate target OS
  aviobuf: Remove a senseless ifdef in avio_seek

Conflicts:
	configure
	libavcodec/dirac.c
	libavcodec/mpeg12data.h
	libavcodec/mpeg12enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-19 13:29:24 +02:00
Martin Storsjö b760ffdd07 aviobuf: Remove a senseless ifdef in avio_seek
This seemed to assume that one never used writing avio unless
muxers or networking was enabled.

This ifdef is a remnant since 8fa641f8.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-10-18 01:44:05 +03:00
Michael Niedermayer 120b38b966 avio: redesign ffio_rewind_with_probe_data()
This prevents a double free

Fixes CID718285
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-13 02:08:59 +02:00
Michael Niedermayer de31814ab0 Merge commit 'b522000e9b2ca36fe5b2751096b9a5f5ed8f87e6'
* commit 'b522000e9b2ca36fe5b2751096b9a5f5ed8f87e6':
  avio: introduce avio_closep
  mpegtsenc: set muxing type notification to verbose
  vc1dec: Use correct spelling of "opposite"
  a64multienc: change mc_frame_counter to unsigned
  arm: call arm-specific rv34dsp init functions under if (ARCH_ARM)
  svq1: Drop a bunch of useless parentheses
  parseutils-test: do not print numerical error codes
  svq1: K&R formatting cosmetics

Conflicts:
	doc/APIchanges
	libavcodec/svq1dec.c
	libavcodec/svq1enc.c
	libavformat/version.h
	libavutil/parseutils.c
	tests/ref/fate/parseutils

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-11 14:03:12 +02:00
Luca Barbato b522000e9b avio: introduce avio_closep 2012-10-10 18:56:55 +02:00
Stefano Sabatini 5d1203f063 avio: flush the internal buffer in avio_close()
This is consistent with stdio, and thus what people would naturally
expect.
2012-09-15 18:24:49 +02:00
Michael Niedermayer 9dcc4c30f9 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  configure: add support for bdver1 and bdver2 CPU types.
  avio: make avio_close NULL the freed buffer
  pixdesc: cosmetics
  proresenc: Don't free a buffer not owned by the codec
  proresenc: Write the full value in one put_bits call
  adpcmenc: Calculate the IMA_QT predictor without overflow
  x86: Add convenience macros to check for CPU extensions and flags
  x86: h264dsp: drop some unnecessary ifdefs around prototype declarations
  mss12: merge decode_pixel() and decode_top_left_pixel()
  mss12: reduce SliceContext size from 1067 to 164 KB
  mss12: move SliceContexts out of the common context into the codec contexts

Conflicts:
	libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-04 17:04:51 +02:00
Luca Barbato 3093939077 avio: make avio_close NULL the freed buffer 2012-09-04 15:04:46 +02:00
Michael Niedermayer 4b9e44868b lavf: fix avio statistics for packets directly read without the buffer.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-25 23:25:36 +02:00
Stefano Sabatini 725213545d lavf/avio: flush internal buffer when calling avio_close()
This seems the expected behavior.
2012-08-18 11:21:44 +02:00
jamal c49e0d2cdd aviobuf: Fix warning about discarded qualifier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-27 12:46:51 +02:00
Lou Logan b22ecbc6a5 cosmetics: various spelling fixes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-06 17:08:22 +02:00
Michael Niedermayer 47f8303069 lavf/aviobuf: use av_assert()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-15 19:44:42 +02:00
Michael Niedermayer 11153a9371 avio: Collect and print statistics of bytes read & seeks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-15 11:24:16 +02:00
Michael Niedermayer 9d7c1b4cf3 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  h264: new assembly version of get_cabac for x86_64 with PIC
  h264: use one table instead of several for cabac functions
  h264: (trivial) remove unneeded macro argument in x86/cabac.h
  libschroedingerdec: check malloc
  segment: reorder seg_write_header allocation
  avio: make avio_close(NULL) a no-op
  mov: Parse EC3SpecificBox (dec3 atom).

Conflicts:
	libavcodec/cabac.c
	libavcodec/x86/cabac.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-28 20:45:06 +02:00
Luca Barbato e1e146a2d1 avio: make avio_close(NULL) a no-op
Its behaviour in line with ffurl_close(NULL).
2012-04-27 14:03:43 -07:00
Reimar Döffinger a45605a1ba Add AVIO_FLAG_DIRECT.
Allows avoiding the buffer when using avio read, write and seek functions.
When using the ffmpeg executable -avioflags direct can be used to enable
this mode for input files, but has no effect on output files.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-04-04 20:39:33 +02:00
Michael Niedermayer a76a2ffe9d libavformat: Fix several "incompatible pointer type" warnings.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-30 19:52:30 +02: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
Anton Khirnov 2439f2ca82 lavf: remove disabled FF_API_OLD_AVIO cruft 2012-01-27 10:52:42 +01:00
Michael Niedermayer 757473831c Merge remote-tracking branch 'qatar/master'
* qatar/master: (29 commits)
  cabac: Move code only used within the CABAC test program into the test program.
  vp56: Drop unnecessary cabac.h #include.
  h264-test: Initialize AVCodecContext.av_class.
  build: Skip compiling network.h and rtsp.h if networking is not enabled.
  cosmetics: drop some pointless parentheses
  Disable annoying warning without changing behavior
  faq: Solutions for common problems with sample paths when running FATE.
  avcodec: attempt to clarify the CODEC_CAP_DELAY documentation
  avcodec: fix avcodec_encode_audio() documentation.
  FATE: xmv-demux test; exercise the XMV demuxer without decoding the perceptual codecs inside.
  vqf: recognize more metadata chunks
  FATE test: BMV demuxer and associated video and audio decoders.
  FATE: indeo4 video decoder test.
  FATE: update xxan-wc4 test to a sample with more code coverage.
  Change the recent h264_mp4toannexb bitstream filter test to output to an elementary stream rather than a program stream.
  g722enc: validate AVCodecContext.trellis
  g722enc: set frame_size, and also handle an odd number of input samples
  g722enc: split encoding into separate functions for trellis vs. no trellis
  mpegaudiodec: Use clearer pointer math
  tta: Fix returned error code at EOF
  ...

Conflicts:
	libavcodec/h264.c
	libavcodec/indeo3.c
	libavcodec/interplayvideo.c
	libavcodec/ivi_common.c
	libavcodec/libxvidff.c
	libavcodec/mpegvideo.c
	libavcodec/ppc/mpegvideo_altivec.c
	libavcodec/tta.c
	libavcodec/utils.c
	libavfilter/vsrc_buffer.c
	libavformat/Makefile
	tests/fate/indeo.mak
	tests/ref/acodec/g722

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-08 03:34:22 +01:00