Commit Graph

80 Commits

Author SHA1 Message Date
Alexandra Hájková
5c31eaa999 Remove unnecessary get_bits.h #includes and add missing headers where needed.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2016-05-04 15:14:14 +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
Luca Barbato
41ed749fe9 ogg: Do not try to use the parser if it is not present
Bug-Id: 886
CC: libav-stable@libav.org
2015-09-10 14:47:33 +02: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
Anton Khirnov
2f3fadfbe3 lavc,lavf: switch to the new vorbis parse API 2014-11-06 09:00:46 +01:00
Anton Khirnov
5e80fb7ff2 lavc: add a public API for parsing vorbis packets.
It is required by (at least) the ogg demuxer.

Mark the current semi-public apriv API for removal.
2014-11-06 08:51:25 +01:00
Anton Khirnov
6896f95b24 vorbis_parser: add an AV prefix to VorbisParseContext
This is done in preparation for making it public.
2014-11-06 08:47:54 +01:00
Andrew Stone
db68ef898a ogg: update event_flags with STREAM_/METADATA_UPDATED whenever metadata changes.
Originally, AVFormatContext and a metadata dict were provided to ff_vorbis_comment(),
but this presented issues if an AVStream was being updated or the metadata on
AVFormatContext wasn't actually being updated. To remedy this, ff_vorbis_stream_comment()
explicitly updates a stream's metadata and sets any necessary flags.

ff_vorbis_comment() does not modify any flags, and any calls to it that update
AVFormatContext's metadata (just a single call) must also update
AVFormatContext.event_flags after detecting any metadata changes to the provided
dictionary, as signaled by a positive return value.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-13 16:25:19 +00:00
Anton Khirnov
23f741f793 matroskadec: parse the channel layout mask for FLAC
It is commonly stored in a vorbiscomment block in codec private data.
2014-05-28 07:50:32 +02:00
Alessandro Ghedini
0048deb84c oggparsevorbis: export replaygain tags from Vorbis comments
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-04-04 17:40:51 +02:00
Vittorio Giovara
fd2384f02b oggparsevorbis: fail on memory allocation error 2013-10-12 15:37:56 +02:00
James Almer
c18375ec80 oggvorbisdec: add support for embedded cover art
Signed-off-by: James Almer <jamrial@gmail.com>
2013-10-12 15:34:10 +02:00
Vittorio Giovara
ed9245dba8 oggparsevorbis: check allocations
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-12 15:24:26 +02:00
James Almer
9c15ef35d4 oggparsevorbis: support official chapter extension
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-10-12 15:24:08 +02:00
Vittorio Giovara
90e15e340d oggparsevorbis: return meaningful errors
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-10-05 23:16:48 +02:00
Vittorio Giovara
49fe9c05f9 oggparsevorbis: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-10-03 23:26:09 +02:00
Martin Storsjö
d872fb0f7f lavf: Reset the entry count and allocation size variables on av_reallocp failures
When av_reallocp fails, the associated variables that keep track of
the number of elements in the array (and in some cases, the
separate number of allocated elements) need to be reset.

Not all of these might technically be needed, but it's better to
reset them if in doubt, to make sure variables don't end up
conflicting.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-26 23:14:03 +03:00
Alexandra Khirnova
5626f994f2 avformat: Use av_reallocp() where suitable
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-18 18:28:38 +02:00
Luca Barbato
3562684db7 ogg: Always alloc the private context in vorbis_header
It is possible to have an initial broken header and then valid packets.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-08-13 14:04:55 +02:00
Reimar Döffinger
efa7f42020 Use the avstring.h locale-independent character type functions
Make sure the behavior does not change with the locale.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-03-07 15:16:36 +02:00
Luca Barbato
fba8e5b608 oggdec: fix faulty cleanup prototype 2013-01-09 21:07:48 +01:00
Luca Barbato
d894f74762 oggdec: make sure the private parse data is cleaned up 2013-01-06 17:59:54 +01: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
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Justin Ruggles
f63412fc74 oggdec: output correct timestamps for Vorbis
Takes encoder delay into account by comparing first the coded page
duration with the calculated page duration. Handles last packet duration
if needed, also by comparing coded duration with calculated duration.
Also does better handling of timestamp generation for packets in the
first page for streamed ogg files where the start time is not
necessarily zero.
2012-03-20 14:39:57 -04:00
Justin Ruggles
5602a464c9 avcodec: add a Vorbis parser to get packet duration
This also allows for removing some of the Vorbis-related hacks.
2012-03-03 16:43:11 -05: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
1fa395e471 lavf: use avpriv_ prefix for ff_new_chapter().
It's used in libavdevice.
2011-10-20 20:57:23 +02:00
Anton Khirnov
d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00
Anton Khirnov
19711af5cd lavf: move internal functions from avformat.h to internal.h
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-06 16:35:00 -05:00
Reimar Döffinger
a351110eea Always use av_set_pts_info to set the stream time base.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-06 16:08:59 -05:00
Reimar Döffinger
8cb3c557a9 Ogg: discard non-essential metadata from Vorbis header when creating extradata
The first part of the metadata, the "vendor" string, is required by
libvorbis, it will refuse to play when it is not available.
Also we do not currently parse that part into metadata so it would also
be lost if we removed it as well.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-31 20:21:26 +00:00
Reimar Döffinger
ce20edb7bd Vorbis-in-Ogg: Do not set timebase to invalid values
Avoids an assert when the sample rate is invalid and the timebase
is thus set to e.g. 1/0.
Sample file is http://samples.mplayerhq.hu/ogg/fuzzed-srate-crash.ogg

This is a quick fix for a crash, not a final solution.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-29 13:48:13 +00:00
Anton Khirnov
ad7768f4c4 add ff_ prefix to metadata_conv()
patch by Anton Khirnov  anton _at_ khirnov _dot_ net

Originally committed as revision 25505 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-16 13:20:41 +00:00
Martin Storsjö
fb66c31da4 Fix building, include the header instead of the source file
Builds only seemed to have been broken in some configurations, though.

Originally committed as revision 25499 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-10-16 08:50:50 +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
Alex Converse
73c44cb286 oggparsevorbis: Add some sanity checks to header packet ordering/presence.
Originally committed as revision 24740 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-08-07 21:30:34 +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
8730fad595 oggdec: Parse ogm chapters
Originally committed as revision 22477 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-12 05:16:57 +00:00
David Conrad
533c30fced Const correctness for vorbis_comment
Originally committed as revision 22474 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-12 05:16:47 +00:00
David Conrad
b53cde48bd oggdec: Metadata is per-stream; don't merge multiple streams' together
Originally committed as revision 22473 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-12 05:16:44 +00:00
David Conrad
e4d2d8c5d7 Add ff_ prefix to vorbis_comment
Originally committed as revision 22472 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-12 05:16:39 +00:00
David Conrad
2ac41150c0 oggdec: Fix memory leak in setting up vorbis headers
Originally committed as revision 22460 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:17:49 +00:00
David Conrad
8f8320d7c3 oggdec: Don't use ogg_stream's seq for vorbis or speex headers
Originally committed as revision 22459 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-03-11 07:17:46 +00:00
Anton Khirnov
ca76a11948 Add a list of generic tags and change demuxers to follow it.
Patch by Anton Khirnov, wyskas at gmail dot com

Originally committed as revision 21587 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-02-01 11:39:10 +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
Justin Ruggles
961057decd Remove unnecessary entries in ff_vorbiscomment_metadata_conv. VorbisComment
keys are case-insensitive.

Originally committed as revision 20267 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-10-17 21:30:50 +00:00
Reimar Döffinger
98422c44cf Fix possible buffer over-read in vorbis_comment, fix it double to be sure.
First, make s signed, so that comparisons against end - p will not be made as
unsigned, making the check incorrectly pass if p is beyond end.
Also ensure that p will never be > end, so the code is correct also if
buf is not padded.

Originally committed as revision 20014 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-24 15:37:09 +00:00
Reimar Döffinger
7d507ceb79 Correctly print number of remaining bytes in oggparsevorbis instead of always
with inverted sign.

Originally committed as revision 19978 to svn://svn.ffmpeg.org/ffmpeg/trunk
2009-09-23 09:18:23 +00:00