Commit Graph

123 Commits

Author SHA1 Message Date
Ronald S. Bultje e73c6aaabf asf: reset side data elements on packet copy.
Prevents crash (double free) when free()ing the original packet.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-03-22 12:17:14 -07:00
Justin Ruggles bdbf1fa405 asfdec: Do not set AVCodecContext.frame_size 2012-02-29 15:45:50 -05:00
Ronald S. Bultje bb6d5411e1 asf: don't seek back on EOF.
Seeking back on EOF will reset the EOF flag, causing us to re-enter
the loop to find the next marker in the ASF file, thus potentially
causing an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-28 16:25:05 -08:00
Ronald S. Bultje 6e57a02b9f asf: error out on ridiculously large minpktsize values.
They cause various issues further down in demuxing.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-28 14:32:34 -08:00
Ronald S. Bultje 41afac7f7a asf: prevent packet_size_left from going negative if hdrlen > pktlen.
This prevents failed assertions further down in the packet processing
where we require non-negative values for packet_size_left.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-18 09:12:32 -08:00
Diego Biurrun 6df5c528ca Move some conditionally used variables into the block where they are used.
This allows dropping the av_unused argument from them.
2012-02-13 19:20:54 +01:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Justin Ruggles e9dc920127 asfdec: add side data to ASFStream packet instead of output packet.
fixes memleak of side data
2011-12-21 17:52:31 -05:00
John Stebbins b88eb87630 asf: use packet dts as approximation of pts
Having a somehow off seeking is better than having none at all.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-12-02 11:11:47 +01:00
Luca Barbato 73f027c17b asf: do not call av_read_frame
The asf_read_pts should read the bitstream directly.
2011-12-02 11:11:47 +01:00
Anton Khirnov c3f9ebf743 lavf: make av_set_pts_info private.
It's supposed to be called only from (de)muxers.
2011-11-30 20:34:45 +01:00
Diego Biurrun 2f5df0b12c Replace ffmpeg references with more accurate libav* references. 2011-11-02 10:42:55 +01:00
Anton Khirnov a2faa95151 lavf: make some seeking functions private
Specifically av_update_cur_dts(), av_seek_frame_binary() and
av_gen_search().

They are not supposed to be called outside lavf.
2011-10-28 09:23:24 +02:00
Anton Khirnov 1fa395e471 lavf: use avpriv_ prefix for ff_new_chapter().
It's used in libavdevice.
2011-10-20 20:57:23 +02:00
Anton Khirnov 3b3bbdd3e6 lavf,lavd: replace av_new_stream->avformat_new_stream part I.
Trivial replacements with sed are done in this commit:
sed 's/av_new_stream(\([^)]*\), 0)/avformat_new_stream(\1, NULL)/'
2011-10-19 17:02:11 +02:00
Anton Khirnov dfc2c4d900 lavf: use designated initialisers for all (de)muxers.
It's more readable and less prone to breakage.
2011-07-17 06:58:37 +02:00
Mans Rullgard 0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Mans Rullgard add41decd9 Remove return statements following infinite loops without break
These statements cannot be reached and are thus not needed.
This removes a number of compiler warnings.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:39:07 +01:00
Diego Biurrun 91c9aa0941 Move some conditionally used code below the appropriate #ifdef. 2011-07-03 18:30:01 +02:00
Anton Khirnov d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Mans Rullgard e65ab9d94f Remove unused variables 2011-06-02 20:06:00 +01:00
Mans Rullgard b122c65107 asfdec: add missing #include for av_bswap32()
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-05-19 12:38:43 +01:00
Uoti Urpala 29fa570d0c asfdec: fix possible overread on broken files. 2011-05-17 22:06:00 +02:00
Vladimir Pantelic 69fa23961e asfdec: do not fall back to binary/generic search
asf_read_seek() inside the asf demuxer already does the
right thing, it tries the index and if that fails it uses
binary search. If binary search is called from outside of asfdec.c
it will fail because the asf code cannot clean up after itself.
Therefore introduce AVFMT_NOBINSEARCH that prevents the seek
code to fallback to binary search and AVFMT_NOGENSEARCH that
prevents the seek code to fallback to generic search.
2011-05-17 22:06:00 +02:00
Vladimir Pantelic b58bc17cf7 asfdec: reindent after previous commit c7bd5ed 2011-05-17 22:05:22 +02:00
Vladimir Pantelic c7bd5edae4 asfdec: fallback to binary search internally
lavf will do that anyway in case seek by index fails
2011-05-17 21:48:16 +02:00
Uoti Urpala 0bd433a916 asfdec: fix assert failure on invalid files
Add an extra size validity check in asf_read_frame_header(). Without
this asf->packet_size_left may become negative, which triggers an
assertion failure later.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-03 22:36:08 -04:00
Ronald S. Bultje f8b1245922 asfdec: fix parsing of packets that overrun into padding.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-05-03 22:14:04 -04:00
Vladimir Pantelic 8408e1d7d6 asf: remove commented out code in asf_read_seek
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-04-20 12:47:13 +01:00
Diego Biurrun 0b5ae1fdd3 asfdec: Remove dead code from asf_read_close(). 2011-04-18 15:35:45 +02:00
Kostya Shishkov 2d8591c27e make containers pass palette change in AVPacket
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-04-15 18:02:05 +02:00
Max Horn ca402f32e3 handle malloc failures in ff_get_wav_header
ff_get_wav_header is reading data from a WAVE file and then uses it
(without validation) to malloc a buffer. It then proceeded to read
data into the buffer, without verifying that the allocation succeeded.

To address this, change ff_get_wav_header to return an error if
allocation failed, and adapted all calling code to handle that error.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-04-14 13:56:09 +02:00
Anton Khirnov ff1ec0c3f8 avio: undeprecate av_url_read_fseek/fpause under nicer names
It seems their replacements won't be ready anytime soon.
2011-04-12 19:17:05 +02:00
Anton Khirnov acaceca2f1 asfdec: remove a forgotten declaration of nonexistent function 2011-04-08 07:08:12 +02:00
Vladimir Pantelic 4377fafda1 asfdec: also subtract preroll when reading simple index object
This was missed when ASF was changed to return timestamps
without preroll.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-23 13:46:19 +00:00
Anton Khirnov 933e90a69a avio: make av_url_read_fseek/fpause internal.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-21 14:54:52 -04:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Vladimir Pantelic de11ee906e asfdec: subtract the preroll value and thus output 0 based timestamps
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-17 16:25:54 +00:00
Anton Khirnov 45a8a02a41 lavf: replace avio_seek(SEEK_CUR) with avio_skip where it makes sense
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-16 22:24:51 -04:00
Anton Khirnov 3e68b3ba7b avio: deprecate url_ferror
AVIOContext.error should be used directly instead.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-15 08:04:28 -04:00
Anton Khirnov 66e5b1df36 avio: deprecate url_feof
AVIOContext.eof_reached should be used directly instead.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-07 17:20:31 -05:00
Anton Khirnov a2704c9712 avio: add avio_tell macro as a replacement for url_ftell
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-04 11:26:57 -05:00
Anton Khirnov e356fc57a2 lavf: replace all uses of url_fskip with avio_seek
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-01 12:22:16 -05:00
Anton Khirnov 6b4aa5dac8 avio: avio_ prefix for url_fseek
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-01 12:12:33 -05:00
Anton Khirnov b7effd4e83 avio: avio_ prefixes for get_* functions
In the name of consistency:
get_byte           -> avio_r8
get_<type>         -> avio_r<type>
get_buffer         -> avio_read

get_partial_buffer will be made private later

get_strz is left out becase I want to change it later to return
something useful.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-21 11:23:22 -05:00
Anton Khirnov ae628ec1fd avio: rename ByteIOContext to AVIOContext.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-20 08:37:15 -05:00
Mans Rullgard aabc2682fc asfdec: fix build for big endian targets
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-13 22:10:45 +00:00
Anton Khirnov 5cbd3b5d91 asfdec: don't export empty metadata
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-13 16:49:39 -05:00
Anton Khirnov 8bf6db1b29 asfdec: split reading stream properties out of asf_read_header()
This contains a rename from gsize->size

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-13 16:49:39 -05:00
Anton Khirnov 0b1d291a71 asfdec: deobfuscate reading video properties size
This code will be later split out into a function which takes a 'size'
argument, so I'm keeping the name 'sizeX' here.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-10 18:05:01 -05:00