Commit Graph

275 Commits

Author SHA1 Message Date
Michael Niedermayer 36552345d0 Merge commit 'd7f530b0d67fe3996dbfa990a47c865e0d1400a2'
* commit 'd7f530b0d67fe3996dbfa990a47c865e0d1400a2':
  aviobuf: check context before using it

See: 7441d1ec33
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-20 21:25:37 +02:00
Vittorio Giovara d7f530b0d6 aviobuf: check context before using it
Avoid a possible null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CID 1135769
2014-10-20 10:38:38 +01:00
wm4 c8422f04a3 avformat/aviobuf: fix avio_flush() for read streams
avio_flush() did nothing useful for read streams. Fix it to behave as
expected, and discard the currently read buffer properly.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-30 21:31:08 +02:00
Michael Niedermayer 7a2c380e93 avformat/aviobuf: remove uses of deprecated url_feof()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-27 22:30:07 +02:00
James Almer 5c3c67126f lavf/avio: rename url_feof() to avio_feof()
It's a public function and should use the avio_ namespace

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 00:48:22 +02:00
Carl Eugen Hoyos ff9a154157 Add int64_t probesize2 instead of int probesize to AVFormatContext.
Allows to set a probesize >2G.
Tested-by: Oliver Fromme
2014-07-30 11:09:25 +02:00
Nicolas George 04bc370072 lavf/avio: do not include bprint.h.
C++ chokes on the definition of AVBPrint.
Including avio.h from c++ code used to work.
Fix trac ticket #3800.

Signed-off-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-25 05:37:45 +02:00
Andrey Utkin 8a4c0866dc avio: Introduce avio_read_to_bprint(avioctx, bp, max_size)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-23 18:42:41 +02:00
Michael Niedermayer 46380e8d26 avformat/aviobuf/ff_get_line: also accept \r as end of line character
Fixes Ticket3108

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-17 23:49:05 +02:00
Michael Niedermayer cdc166acd8 Merge commit '32d05934abc7427bb90380a4c1ab20a15fd7d821'
* commit '32d05934abc7427bb90380a4c1ab20a15fd7d821':
  mp3dec: decode more data from Info header

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-18 00:38:07 +02:00
Alessandro Ghedini 32d05934ab mp3dec: decode more data from Info header
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-04-17 20:08:19 +02:00
Michael Niedermayer 61b5ef7754 libavformat/aviobuf: keep track of the original buffer-size and restore it after probe/ensure-seekback
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 23:58:48 +01:00
Michael Niedermayer 0d4a66ee7f avformat/aviobuf: ffio_ensure_seekback: only copy the initialized part of the buffer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-26 23:52:38 +01:00
Michael Niedermayer 9600486d10 avformat/aviobuf: optimize sequential backward seeking
This reduces the number of protocol seeks

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-01 23:57:40 +01:00
Michael Niedermayer 2adf422ce2 avformat/aviobuf: factorize buffer_size out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-01 23:27:37 +01:00
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