Commit Graph

367 Commits

Author SHA1 Message Date
James Almer 155f4e9630 avformat/avio: add a crc callback function for CRC-32 IEEE-LE
Reviewed-by: Nicolas George <george@nsup.org>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-08-04 16:25:32 -03:00
James Almer d688f39dc4 cosmetics: fix some misspelled words
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-17 13:10:27 -03:00
Matthieu Bouron 5d75e46677 Merge commit 'db7968bff4851c2be79b15b2cb2ae747424d2fca'
* commit 'db7968bff4851c2be79b15b2cb2ae747424d2fca':
  avio: Allow custom IO users to get labels for the output bytestream

Merged-by: Matthieu Bouron <matthieu.bouron@stupeflix.com>
2016-06-23 15:59:44 +02:00
Martin Storsjö db7968bff4 avio: Allow custom IO users to get labels for the output bytestream
This allows callers with avio write callbacks to get the bytestream
positions that correspond to keyframes, suitable for live streaming.

In the simplest form, a caller could expect that a header is written
to the bytestream during the avformat_write_header, and the data
output to the avio context during e.g. av_write_frame corresponds
exactly to the current packet passed in.

When combined with av_interleaved_write_frame, and with muxers that
do buffering (most muxers that do some sort of fragmenting or
clustering), the mapping from input data to bytestream positions
is nontrivial.

This allows callers to get directly information about what part
of the bytestream is what, without having to resort to assumptions
about the muxer behaviour.

One keyframe/fragment/block can still be split into multiple (if
they are larger than the aviocontext buffer), which would call
the callback with e.g. AVIO_DATA_MARKER_SYNC_POINT, followed by
AVIO_DATA_MARKER_UNKNOWN for the second time it is called with
the following data.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-05-18 10:36:45 +03:00
Derek Buitenhuis f8e89d8a29 Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'
* commit 'fab8156b2f30666adabe227b3d7712fd193873b1':
  avio: Copy URLContext generic options into child URLContexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-21 15:55:09 +01:00
Martin Storsjö fab8156b2f avio: Copy URLContext generic options into child URLContexts
Since all URLContexts have the same AVOptions, such AVOptions
will be applied on the outermost context only and removed from the
dict, while they probably make sense on all contexts.

This makes sure that rw_timeout gets propagated to the innermost
URLContext (to make sure it gets passed to the tcp protocol, when
opening a http connection for instance).

Alternatively, such matching options would be kept in the dict
and only removed after the ffurl_connect call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-03-24 10:34:19 +02:00
Hendrik Leppkes 0d4b8a2c16 hls: read protocol options through the AVIOContext
This reverts commit 9f9ed79d4c.

The hlsopts member was never set anywhere and always NULL, furthermore
the HLS demuxer needs to retrieve the proper options from the underlying
http protocol (cookies, user-agent, etc), so a dummy context won't help.

Instead, use the AVIOContext directly to access the options.
2016-03-16 10:31:36 +01:00
Derek Buitenhuis 93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Derek Buitenhuis 9f9ed79d4c hls: Add and use a memebr of AVIOInternal rather than abuse opaque
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 20:10:11 +00:00
Derek Buitenhuis b9aa4ccff5 Merge commit 'cae448cfbf31d492cba782bc64fc4eed556ed83d'
* commit 'cae448cfbf31d492cba782bc64fc4eed556ed83d':
  aviobuf: add a private data struct for avio_open()ed contexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 18:43:16 +00:00
Anton Khirnov ec4c483976 lavf: add a protocol whitelist/blacklist for file opened internally
Should make the default behaviour safer for careless callers that open
random untrusted files.

Bug-Id: CVE-2016-1897
Bug-Id: CVE-2016-1898
2016-02-22 11:48:30 +01:00
Anton Khirnov 8c0ceafb0f urlprotocol: receive a list of protocols from the caller
This way, the decisions about which protocols are available for use in
any given situations can be delegated to the caller.
2016-02-22 11:45:31 +01:00
Anton Khirnov cae448cfbf aviobuf: add a private data struct for avio_open()ed contexts
It will be useful in the following commits.
2016-02-22 11:36:47 +01:00
Michael Niedermayer 1dba8371d9 avformat: add protocol_whitelist
Note to maintainers: update tools

Note to maintainers: set a default whitelist for your protocol
If that makes no sense then consider to set "none" and thus require the user to specify a white-list
for sub-protocols to be opened

Note, testing and checking for missing changes is needed

Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 03:39:34 +01:00
Michael Niedermayer 8fac0d6403 avformat/avio: free url/avio options
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-29 19:23:02 +01:00
Michael Niedermayer 115fb6d03e avformat/aviobuf: Fix end check in put_str16()
Fixes out of array read
Fixes: 03c406ec9530e594a074ce2979f8a1f0/asan_heap-oob_7dec26_4664_37c52495b2870a2eaac65f53958e76c1.flac

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-13 03:09:08 +01:00
Reynaldo H. Verdejo Pinochet baf4c489e5 avio: add detail to avio_printf() size warning
Previous "currently size is limited" didn't give away
much in terms of useful info.

Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
2015-12-27 00:09:16 -08:00
Bryan Huh a01ba7f579 avformat/aviobuf: Simplify avio_read() and avio_seek()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 12:14:03 +01:00
Bryan Huh a01c24e8c5 avformat/aviobuf: Improve readability of aviobuf (Add comments and docs)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 12:14:03 +01:00
Stephan Holljes 63c07a956b lavf/avio: add avio_accept and avio_handshake
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-08-01 00:58:31 +02:00
Michael Niedermayer 29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
wm4 dc87758775 avio: fix potential crashes when combining ffio_ensure_seekback + crc
Calling ffio_ensure_seekback() if ffio_init_checksum() has been called
on the same context can lead to out of bounds memory accesses and
crashes. The reason is that ffio_ensure_seekback() does not update
checksum_ptr after reallocating the buffer, resulting in a dangling
pointer.

This effectively fixes potential crashes when opening mp3 files.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-17 01:13:19 +02:00
Michael Niedermayer 4e640f0560 avformat/avio: move short seek threshold to the context
This allows us to adjust it internally.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-11 13:42:06 +02:00
Michael Niedermayer 0023ea4e20 avformat/aviobuf: Check for ffio_set_buf_size() failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-07 14:57:36 +02:00
Luca Barbato 252d6200c3 avio: Add avio_put_str16be 2015-06-07 10:14:45 +02:00
Michael Niedermayer ebab902a1c Merge commit 'bff0349d9da527084e1433167466d8afc9e25c7f'
* commit 'bff0349d9da527084e1433167466d8afc9e25c7f':
  avio: Add avio_read wrapper to simplify error checking

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-01 00:43:50 +02:00
Vittorio Giovara bff0349d9d avio: Add avio_read wrapper to simplify error checking
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2015-05-31 13:05:13 +02:00
Michael Niedermayer 541d75f9a0 avformat: add callback for opening further files
Previous version reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-11 21:55:18 +02:00
Michael Niedermayer 46778ab212 avformat/aviobuf: Do not resize the buffer in ffio_ensure_seekback() if there is no read function
Without a read function there can never be more data read than the buffer could
hold

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-27 05:06:36 +02:00
Michael Niedermayer 22af79a9c8 Merge commit 'b97f427fb56bdbf7de8e2d4b72d01114aa6eceda'
* commit 'b97f427fb56bdbf7de8e2d4b72d01114aa6eceda':
  lavf: Explicitly convert types at function pointer assignment

Conflicts:
	libavformat/avio.c
	libavformat/aviobuf.c
	libavformat/swfenc.c

See: a76a2ffe9d and others
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-12 12:38:20 +01:00
Diego Biurrun b97f427fb5 lavf: Explicitly convert types at function pointer assignment
This fixes a number of "assignment from incompatible pointer type" warnings.
2015-03-11 23:53:13 +01:00
Mark Reid 81a91269a2 libavformat/avio: added avio_put_str16be
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-03 17:49:15 +01:00
Michael Niedermayer 1fb3642317 Merge commit 'c86d8aed748adc3ba8df96fb1fe14aa45da77a31'
* commit 'c86d8aed748adc3ba8df96fb1fe14aa45da77a31':
  avio: Rename avclass symbols relating to avio

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-28 23:02:42 +01:00
Martin Storsjö c86d8aed74 avio: Rename avclass symbols relating to avio
Don't prefix them ffio_url, which is misleading, sounding too
much like the urlprotocol layer (like ffurl_*).

Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-28 22:07:04 +02:00
Michael Niedermayer 6e9bbaca6c Merge commit '8a273a746061a112e5e35066a8fd8e146d821a62'
* commit '8a273a746061a112e5e35066a8fd8e146d821a62':
  avio: Add an internal utility function for freeing dynamic buffers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:33:09 +01:00
Martin Storsjö 8a273a7460 avio: Add an internal utility function for freeing dynamic buffers
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:41 +02:00
Michael Niedermayer 58ed152857 avformat/aviobuf: Allow seeking to the end of the buffer for read only buffers
This undoes the effect of 3c18a7b188 for reading

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-28 20:56:50 +01:00
Michael Niedermayer 0b4fc4bacd Merge commit '3c18a7b18807de81566381a1bcbe9f6103c0296b'
* commit '3c18a7b18807de81566381a1bcbe9f6103c0296b':
  avio: Do not consider the end-of-buffer position valid

Conflicts:
	libavformat/aviobuf.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-28 20:37:28 +01:00
Luca Barbato 3c18a7b188 avio: Do not consider the end-of-buffer position valid
Trigger a refill if the seek action moves the pointer
at the end of the buffer.

Before this patch the read action following the seek would trigger
the refill, while write action would write outside the buffer.

In the Libav codebase few muxers seek forward outside of what
already has been written so it is quite unlikely to experience
the problem with the default buffer size.

CC: libav-stable@libav.org
2015-01-28 16:28:10 +01:00
Michael Niedermayer ed86dbd05d avformat/aviobuf: Check that avio_seek() target is non negative
Fixes out of array access

Suggested-by: Andrew Scherkus <scherkus@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 17:39:53 +01:00
Michael Niedermayer eac5c7b837 avformat/aviobuf: Fix infinite loop in ff_get_line()
Fixes ticket4152

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 19:05:56 +01:00
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
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