Commit Graph

24 Commits

Author SHA1 Message Date
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
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Janne Grunau 8a2250344b jv: detect partial packets in the demuxer
Fixes fate-jv under valgrind which reports a different CRC for the last
frame from a partial read.
2014-02-12 20:12:18 +01:00
Vittorio Giovara d509ae5be0 jvdec: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-02-04 12:35:38 +01:00
Luca Barbato 15739a9bd1 jvdec: Do not feed the decoder with known wrong data
Still assume the size value is right in non-explode mode.
2013-12-20 17:44:20 +01:00
Paul B Mahol e518cb863e jvdec: Fix memory leak of jv->frames
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-12-20 17:44:20 +01:00
Luca Barbato 027712e851 jvdec: Return EOF on end of file 2013-12-20 17:44:20 +01:00
Justin Ruggles ef1b23ad21 jvdec: set channel layout 2012-11-12 10:33:20 -05:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Paul B Mahol d3d1b25e69 jv demux: set video stream duration
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-03-14 15:34:50 +01:00
Joakim Plate 9712e82a4e jvdec: Check return value of avio_seek and avoid modifying state if it fails
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-10 15:27:49 -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 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
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 f5b386afab Reemove remaining uses of deprecated AVERROR_NOTSUPP. 2011-04-06 14:10:08 +02:00
Anton Khirnov b4b167ecbf jvdec: don't use deprecated CODEC_TYPE_*/PKT_FLAG_KEY 2011-04-02 16:16: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 1dac4d5547 jvdec: don't use deprecated url_feof() 2011-03-16 12:24:23 +01:00
Peter Ross 7f05c164d8 jv demuxer: prevent video packet size overflow
In the event of overflow, the JV_PADDING state will avio_skip over
any overflow bytes (using JVFrame.total_size).

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-14 08:06:19 -04:00
Peter Ross 772cb06281 jv demuxer: define JV_PREAMBLE_SIZE instead of hard coding the number
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-14 08:05:54 -04:00
Peter Ross 20c1281fe3 jv demuxer: calculate palette_size for each frame in read_header
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-14 08:05:34 -04:00
Peter Ross bfaefd87dc Bitmap Brothers JV demuxer
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-03-14 08:05:02 -04:00