Commit Graph

58 Commits

Author SHA1 Message Date
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
It is supposed to be a flag. The only currently defined value is
AVIO_SEEKABLE_NORMAL, but other ones may be added in the future.
However all the current lavf code treats this field as a bool (mainly
for historical reasons).
Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
2016-09-30 16:54:33 +02:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Martin Storsjö 183b9d843a ape: Don't allow the seektable to be omitted
The seektable is required for filling in ape->frames[i].pos
further down.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-12 10:53:25 +03:00
Anton Khirnov 488b2984fe ape demuxer: check for EOF in potentially long loops
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-09-02 19:28:55 +02:00
Kostya Shishkov 472391b9a7 ape: use correct context for the bit table printed in debug 2013-03-27 16:20:08 +01:00
Kostya Shishkov 613a37eca4 ape: 3.80-3.92 decoding support 2013-03-25 18:40:56 +01:00
Kostya Shishkov c42e262513 add support for Monkey's Audio versions from 3.93 2013-03-15 09:50:42 +01:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Anton Khirnov 980e65f119 ape: create audio stream before reading tags.
Tags may contain attached picture, which will be exported as video
streams.

This ensures that the audio stream is always the first.
2012-06-24 07:55:33 +02:00
Martin Storsjö 20234a4bd7 cosmetics: Align muxer/demuxer declarations
Also add missing trailing commas, break long codec_tag lines and
add spaces in codec_tag declarations.

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-04-06 19:19:59 +03:00
Justin Ruggles 9727264220 ape: do not set AVCodecContext.frame_size.
prevents lavf from setting incorrect packet durations.
2012-03-05 13:08:17 -05:00
Justin Ruggles f1c3d4a68a ape: skip packets with invalid size 2012-02-06 13:22:01 -05:00
Justin Ruggles ac3f8d317c ape: calculate final packet size instead of guessing
Calculates based on total file size and wavetaillength from the header.
Falls back to multiplying finalframeblocks by 8 instead of 4 so that it will
at least be overestimating for 24-bit. Currently it can underestimate the
final packet size, leading to decoding errors.
2012-02-06 13:22:01 -05:00
Justin Ruggles c2c316158f ape: stop reading after the last frame has been read
This avoids buffer overread when the last packet size estimate is too small.
2012-02-06 13:09:11 -05:00
Justin Ruggles 66f7be3603 ape: return AVERROR_EOF instead of AVERROR(EIO) when demuxing is finished 2012-02-06 13:09:11 -05:00
Justin Ruggles 1bc035bc03 ape: return error if seeking to the current packet fails in ape_read_packet() 2012-02-06 13:09:11 -05:00
Paul B Mahol 86b57e4efe ape: fix seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-04 14:32:33 -05:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +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 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
Laurent Aimar 273aab99bf ape demuxer: fix segfault on memory allocation failure.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-12 21:12:31 +02:00
Diego Biurrun ab3d241be1 ape: adjust some printf format strings to correctly match argument types 2011-07-26 00:34:52 +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
Diego Biurrun f190f676bc Replace custom DEBUG preprocessor trickery by the standard one. 2011-06-03 00:44:06 +02:00
Diego Biurrun b0a4e5f9e7 Employ correct printf format specifiers, mostly in debug output. 2011-05-31 23:45:14 +02:00
Carl Eugen Hoyos ab088f7d28 ape: Allow demuxing of files with metadata tags.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-05-24 19:07:33 +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
Kostya Shishkov 29a290439b ape: check that number of seektable entries is equal to number of frames
fixes issue2480

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-04-01 09:34:44 +02: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
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
Kostya 8312e3fc90 Do not attempt to decode APE file with no frames
This fixes invalid reads/writes with this sample:
http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt
2011-03-16 12:53:52 +01: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 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
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
Stefano Sabatini 2874c81cc8 Replace all remaining occurrences of AVERROR_NOMEM with
AVERROR(ENOMEM).

AVERROR_NOMEM is deprecated and will be dropped at the next libavutil
major bump.

Originally committed as revision 22791 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-03 14:15:00 +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
Stefano Sabatini 5ae092ee34 Replace all the occurrences of AVERROR_EIO with AVERROR(EIO), and mark
AVERROR_EIO for deletion at the next major bump.

Originally committed as revision 22513 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-13 19:19:44 +00:00
David Conrad 0fc07ad951 Set start_time and duration in AVStream instead of AVFormatContext for
formats with only one stream; the AVFormatContext values will be derived from
the AVStream and this helps in calculating stream bitrate.

Originally committed as revision 21361 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-01-21 09:47:02 +00:00
Kostya Shishkov 191e34cd67 Move APE tag parsing into separate module.
Based on patch by Matti Hamalainen (mhamalai<mot>students<punkt>oamk<punkt>)

Originally committed as revision 19629 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-11 17:08:09 +00:00
Matti Hamalainen 6984380c61 Do not use internals of ByteIOContext during APE tags parsing.
Patch by Matti Hamalainen, mail = reverse("if.kmao.stneduts@ialamahm")
Thread: [PATCH] 2/6 Fix broken APE tag key handling

Originally committed as revision 19628 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-11 16:55:49 +00:00
Matti Hamalainen 22667e40be Remove incorrect APE tag size adjustment based on flags.
Patch by Matti Hamalainen (mhamalai <luona> students <piste> oamk <piste> fi)
Thread: [PATCH] 1/6 Remove incorrect APE tag size adjustment based on flags

Originally committed as revision 19627 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-08-11 16:43:44 +00:00
Aurelien Jacobs 41d7f7bdb9 apedec: display a warning when truncating a metadata tag
Originally committed as revision 17394 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-17 15:44:11 +00:00
Aurelien Jacobs 3f9867b150 use new metadata API in ape demuxer
Originally committed as revision 17388 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-17 00:02:13 +00:00
Benoit Fouet 76b9092f24 Add a context to av_log() calls and extend ape_dumpinfo prototype to do that.
Originally committed as revision 17372 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-02-16 14:44:31 +00:00
Diego Biurrun 6a5d31ac25 Fix build: Add intreadwrite.h and bswap.h #includes where necessary.
Originally committed as revision 16556 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-01-11 22:19:48 +00:00
Luca Abeni dd1c8f3e6e Bump Major version, this commit is almost just renaming bits_per_sample to
bits_per_coded_sample but that cannot be done seperately.
Patch by Luca Abeni
Also reset the minor version and fix the forgotton change to libfaad.
Note: The API/ABI should not be considered stable yet, there still may
be a change done here or there if some developer has some cleanup ideas and
patches!

Originally committed as revision 15262 to svn://svn.ffmpeg.org/ffmpeg/trunk
2008-09-08 14:24:59 +00:00