Commit Graph

33 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
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
Luca Barbato
e1a57cbb1c ape: Use the proper variable type
Avoid an unsigned underflow.

Bug-Id: 1041122
CC: libav-stable@libav.org
2015-02-15 18:20:54 +01:00
Katerina Barone-Adesi
c5560e72d0 apetag: Fix APE tag size check
The size variable is (correctly) unsigned, but is passed to several functions
which take signed parameters, such as avio_read, sometimes after having
numbers added to it. So ensure that size remains within the bounds that
these functions can handle.

CC: libav-stable@libav.org
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-17 06:37:05 -07:00
Diego Biurrun
d92024f18f lavf: more correct printf format specifiers 2014-03-11 13:13:41 +01:00
Anton Khirnov
e816aaacd6 apetag: use int64_t for filesize
CC: libav-stable@libav.org
2013-06-04 17:20:19 +02:00
Anton Khirnov
88de0c7901 apetag: add support for writing APE tags
This will be useful in the WavPack muxer.
2013-05-28 18:19:03 +02:00
Xi Wang
b655cfefaf apetag: fix error handling in ff_ape_parse_tag()
The following error handling is broken due to signedness.

    int file_size;
    uint32_t tag_bytes;
    int64_t tag_start;
    ...
    tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES;
    if (tag_start < 0) { ... }

Note that tag_bytes is unsigned, which makes the right-hand side of
`tag_start = ...' unsigned, too.  The 32-bit unsigned value is then
zero-extended to 64 bits.  Therefore, tag_start must be non-negative,
and the check (tag_start < 0) is always false, which breaks the error
handling.  This patch fixes the check.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-11-21 14:35:26 +01:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Anton Khirnov
921063877e apetag: change a forgotten return to return 0 2012-07-31 21:32:25 +02:00
Anton Khirnov
782e64fbe1 wv,mpc8: don't return apetag data in packets. 2012-07-31 20:53:54 +02:00
Anton Khirnov
728d2afa17 apetag: reindent 2012-07-02 16:16:38 +02:00
Anton Khirnov
02a951b919 apetag: export attached covers as video streams. 2012-07-02 16:16:11 +02:00
Anton Khirnov
b72767df8e apetag: fix the amount of data read from binary tags.
Substract the filename size from the data size.
2012-07-02 16:15:45 +02:00
Anton Khirnov
f2e175c756 apetag: make sure avio_get_str() doesn't read more than it should. 2012-07-02 16:15:34 +02:00
Paul B Mahol
14c98973f5 apetag: do not leak memory if avio_read() fails
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2012-02-23 16:16:37 -08:00
Ronald S. Bultje
6d11057006 apetag: propagate errors.
Fixes crashes if reading the tag value fails.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2012-02-23 15:53:26 -08:00
Paul B Mahol
f02edc4c06 apetag: add proper support for binary tags
export as attachment streams

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-17 14:16:11 -05:00
Anton Khirnov
d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Diego Biurrun
f190f676bc Replace custom DEBUG preprocessor trickery by the standard one. 2011-06-03 00:44:06 +02:00
Mans Rullgard
e65ab9d94f Remove unused variables 2011-06-02 20:06:00 +01: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
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
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
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
Carl Eugen Hoyos
c53ffb2ce5 Include apetag.h which contains the prototype for ff_ape_parse_tag().
Originally committed as revision 22096 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-28 01:43:47 +00:00
Diego Biurrun
18a49f118c Remove unused variable, fixes the warning:
libavformat/apetag.c:38: warning: unused variable `l'

Originally committed as revision 20878 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-12-15 23:41:22 +00:00
Michael Niedermayer
12ad66712a Use AV_METADATA_DONT_STRDUP* / use av_malloced metadata instead of strduped
arrays of fixed length.
Code from ffmbc with changes to adapt to our metadata API.

Originally committed as revision 20836 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-12-13 20:27:29 +00:00
Aurelien Jacobs
8da1d52cc1 remove old and useless debug code
It uses the old, deprecated metadata API and prints exactly the same thing
as what ffmpeg/ffplay does.

Originally committed as revision 20280 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-10-18 16:13:29 +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