Commit Graph

76 Commits

Author SHA1 Message Date
Luca Barbato d1f05dd183 ogg: calculate the start position once all the headers are parsed
The fisbone packets can be muxed in any order as long the last one
comes before the first data packet.
2012-09-24 22:35:29 +02:00
Luca Barbato 7751e4693d ogg: check that the expected number of headers had been parsed
Not having the header for a codec is a tell-tale of a broken file.
2012-09-24 22:35:29 +02:00
Dale Curtis ef0d779706 Fix uninitialized reads on malformed ogg files.
The ogg decoder wasn't padding the input buffer with the appropriate
FF_INPUT_BUFFER_PADDING_SIZE bytes. Which led to uninitialized reads in
various pieces of parsing code when they thought they had more data than
they actually did.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-03-08 11:52:15 -08:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Diego Biurrun e873c03ac7 misc Doxygen markup improvements 2011-12-05 13:06:58 +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
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 84ad31ff18 lavf: replace av_new_stream->avformat_new_stream part II.
Manual replacements are done in this commit.

In many cases, the id is some constant made up number (e.g. 0 for video
and 1 for audio), which is then not used in the demuxer for anything.
Those ids are removed.
2011-10-19 17:02:11 +02:00
Nicolas George 4ca59d1948 oggdec: add support for Xiph's CELT codec
This patch also introduces CODEC_ID_CELT.

Signed-off-by: Nicolas George <nicolas.george@normalesup.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-09-26 13:51:29 +02:00
Laurent Aimar 0e7efb9d23 oggdec: fix out of bound write in the ogg demuxer
Between ogg_save() and ogg_restore() calls, the number of streams
could have been reduced.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-17 09:41:02 -07:00
Chris Evans 4cc3467e7a oggdec: prevent heap corruption.
Specifically crafted samples can reinit ogg->streams[] while
reading samples, and thus we should not cache old pointers since
these may no longer be valid.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-07-11 16:37:11 -07:00
Nicolas George 9cec1bbd14 ogg: propagate return values and return more meaningful error values
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-07-04 15:59:58 +02:00
Reimar Döffinger 0a94020b5b oggdec: Abort Ogg header parsing when encountering a data packet.
Fixes Bugzilla #11.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-07-04 12:54:27 +02:00
Ronald S. Bultje 9ed6cbc3ee ogg: fix double free when finding length of small chained oggs.
ogg_save() copies streams[], but doesn't keep track of free()'ed
struct members. Thus, if in between a call to ogg_save() and
ogg_restore(), streams[].private was free()'ed, this would result
in a double free -> crash, which happened when e.g. playing small
chained ogg fragments.
2011-06-29 09:45:52 -07:00
Diego Biurrun b751f61106 Remove stray extra arguments from av_dlog() invocations. 2011-06-02 23:11:58 +02:00
Mans Rullgard e65ab9d94f Remove unused variables 2011-06-02 20:06:00 +01:00
Clément Bœsch e575685fad Cosmetics: fix prototypes in oggdec
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-12 13:34:20 +02:00
Clément Bœsch 5780f41af5 oggdec: fix memleak with continuous streams.
This avoids the creation of a new AVStream instead of replacing it when
a stream reset occurs (track change with some webradios for example).

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-12 13:34:20 +02:00
Clément Bœsch b3bbc6fdc5 oggdec: use explicit AVInputFormat struct initializers
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-12 11:32:26 +02:00
Clément Bœsch f95257d27c oggdec: simplify ogg_probe
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-05-12 11:32:26 +02:00
Diego Biurrun 045dd4b928 Replace some commented-out debug printf() / av_log() messages with av_dlog(). 2011-04-29 17:27:01 +02:00
Clément Bœsch dc713546d4 oggdec: reindent after 8f3eebd6
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2011-04-24 16:45:45 +02:00
Michael Niedermayer 52512d0a43 oggdec: use av_freep() instead of av_free()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-04-20 17:37:16 +02:00
Clément Bœsch 8f3eebd663 oggdec: simplify audio chained ogg streams support
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-04-15 11:45:03 +02:00
Clément Bœsch 47dec30edb oggdec: fix demuxing chained audio streams
Chained ogg served by icecast and mpd should demux
properly now.

Fixes issue2337

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-04-10 04:33:15 +02:00
Anton Khirnov 8978fedaee avio: introduce an AVIOContext.seekable field
Use it instead of url_is_streamed and AVIOContext.is_streamed.
2011-04-03 22:46:40 +02: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 76aa876e69 avio: avio_ prefix for url_fsize
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-07 11:03:39 -05:00
Anton Khirnov e51975392d avio: deprecate url_fgetc and remove all it uses
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-07 10:51:21 -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 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
Reimar Döffinger 6bd69e6ada oggdec: Fix incorrect assumption about header/data interleaving
Currently (since the data_offset fix) the ogg demuxer assumes that
after the first non-header packets in any stream no more header packets
will follow.
This is not guaranteed, so change the code back again to wait until it
has finished the headers for all streams before returning from ogg_get_headers.

This fixes issue 2428.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-02-08 21:40:03 +00:00
Diego Elio Pettenò c6610a216e Prefix all _demuxer, _muxer, _protocol from libavformat and libavdevice.
This also lists the objects from those two libraries as internal (by adding
the ff_ prefix) so that they can then be hidden via linker scripts.
2011-01-26 22:10:09 +00:00
Aaron Colwell 365d8e471d Ensure that data_offset is set correctly when there are partial
data packets before the first complete one.
Patch by Aaron Colwell [acolwell chromium org].

Originally committed as revision 25846 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-11-29 19:02:28 +00:00
Anton Khirnov 03700d399b Export metadata in the generic format. Deprecate old conversion API.
patch by Anton Khirnov  anton _at_ khirnov _dot_ net

Originally committed as revision 25493 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-15 19:04:25 +00:00
Eli Friedman 461628c6a8 Fix printf format warnings
patch by Eli Friedman <eli dot friedman at gmail dot com>

Originally committed as revision 23547 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-06-09 08:59:41 +00:00
Reimar Döffinger f1a0518524 Enable AVFMT_GENERIC_INDEX for Ogg demuxer. This avoids the many
seeks needed for binary search when seeking to a previously seen
location.

Originally committed as revision 23279 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-05-23 23:33:38 +00:00
David Conrad adc725b558 oggdec: Move warning about missing granule to the correct place
Originally committed as revision 22891 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-16 12:21:38 +00:00
David Conrad 44a088eab7 oggdec: Fix duration calculation if the last page in a file has no granule
Originally committed as revision 22890 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-16 12:21:35 +00:00
David Conrad 49c2d29089 oggdec: Remove write-only variable
Originally committed as revision 22889 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-16 12:21:29 +00:00
Jean-Daniel Dupas cc947f04cc Replace all occurences of PKT_FLAG_KEY with AV_PKT_FLAG_KEY.
Patch by Jean-Daniel Dupas, devlists shadowlab org

Originally committed as revision 22744 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-31 12:29:58 +00:00
Stefano Sabatini 72415b2adb Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump.

Originally committed as revision 22735 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-30 23:30:55 +00:00
James Darnley 66061a1220 Add VorbisComment writing to FLAC files.
Patch by James Darnley <james darnley at gmail>.

Originally committed as revision 22605 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-20 13:36:43 +00:00
David Conrad 81b743eb10 oggdec: Pass packets to header() until the stream is done with them
This fixes some old ogm files that had the 3rd vorbis header after a data
packet in another stream. This is invalid in ogg, but this change shouldn't
affect the behaviour of any valid file.

Originally committed as revision 22478 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-12 05:17:01 +00:00
David Conrad d8b91fae1d oggdec: Seek to keyframes
Originally committed as revision 22463 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:18:00 +00:00
David Conrad 873d117e4b oggdec: Determine pts and filepos on a packet basis in read_timestamp
This takes into account whether the granule defines the start or end times
of packets, and sets the correct file offset of the associated page.

Originally committed as revision 22462 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:17:56 +00:00
David Conrad 6abaa27211 oggdec: Move PTS/DTS calculation to a function
Originally committed as revision 22461 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:17:53 +00:00
David Conrad 77560b0ef1 oggdec: Fix duration calculation for streams with non-zero start
Originally committed as revision 22458 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:17:43 +00:00