1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-20 16:25:04 +02:00
Commit Graph

189 Commits

Author SHA1 Message Date
Lukas Stabe
1fd80106be avformat: fix id3 chapters
These changes store id3 chapter data in ID3v2ExtraMeta and introduce
ff_id3v2_parse_chapters to parse them into the format context if needed.

Encoders using ff_id3v2_read, which previously parsed chapters into the
format context automatically, were adjusted to call
ff_id3v2_parse_chapters.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-10-05 17:10:23 +02:00
James Almer
318778de9e Merge commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3'
* commit 'fd9212f2edfe9b107c3c08ba2df5fd2cba5ab9e3':
  Mark some arrays that never change as const.

Merged-by: James Almer <jamrial@gmail.com>
2017-09-26 16:02:40 -03:00
Michael Niedermayer
0cc6dd1b81 avformat/id3v2: Use ffio_ensure_seekback() in id3v2_read_internal()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-19 21:14:26 +02:00
Anton Khirnov
fd9212f2ed Mark some arrays that never change as const. 2017-02-01 10:42:59 +01:00
Chris Moeller
ecd360041e avformat: fix ID3v2 parser for v2.2 comment frames
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-28 13:52:09 +01:00
Diego Biurrun
3ec6f855d0 srt: Adjust signedness of sscanf format strings
Fixes several warnings from -Wformat.
2016-10-28 13:28:36 +02:00
Michael Niedermayer
cc6a59d2b9 avformat/id3v2: fix memleak with empty strings
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-11 14:10:19 +02:00
Michael Niedermayer
65298a192a avformat/id3v2: Mark variable as unused to avoid "set but not used" warning
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-08 18:37:07 +02:00
Chris Moeller
7387506b06 avformat: read id3v2 comment tags
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-07 04:23:24 +02:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01: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
Michael Niedermayer
29d147c94d Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'
* commit '059a934806d61f7af9ab3fd9f74994b838ea5eba':
  lavc: Consistently prefix input buffer defines

Conflicts:
	doc/examples/decoding_encoding.c
	libavcodec/4xm.c
	libavcodec/aac_adtstoasc_bsf.c
	libavcodec/aacdec.c
	libavcodec/aacenc.c
	libavcodec/ac3dec.h
	libavcodec/asvenc.c
	libavcodec/avcodec.h
	libavcodec/avpacket.c
	libavcodec/dvdec.c
	libavcodec/ffv1enc.c
	libavcodec/g2meet.c
	libavcodec/gif.c
	libavcodec/h264.c
	libavcodec/h264_mp4toannexb_bsf.c
	libavcodec/huffyuvdec.c
	libavcodec/huffyuvenc.c
	libavcodec/jpeglsenc.c
	libavcodec/libxvid.c
	libavcodec/mdec.c
	libavcodec/motionpixels.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/noise_bsf.c
	libavcodec/nuv.c
	libavcodec/nvenc.c
	libavcodec/options.c
	libavcodec/parser.c
	libavcodec/pngenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/qsvdec.c
	libavcodec/svq1enc.c
	libavcodec/tiffenc.c
	libavcodec/truemotion2.c
	libavcodec/utils.c
	libavcodec/utvideoenc.c
	libavcodec/vc1dec.c
	libavcodec/wmalosslessdec.c
	libavformat/adxdec.c
	libavformat/aiffdec.c
	libavformat/apc.c
	libavformat/apetag.c
	libavformat/avidec.c
	libavformat/bink.c
	libavformat/cafdec.c
	libavformat/flvdec.c
	libavformat/id3v2.c
	libavformat/isom.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mpc.c
	libavformat/mpc8.c
	libavformat/mpegts.c
	libavformat/mvi.c
	libavformat/mxfdec.c
	libavformat/mxg.c
	libavformat/nutdec.c
	libavformat/oggdec.c
	libavformat/oggparsecelt.c
	libavformat/oggparseflac.c
	libavformat/oggparseopus.c
	libavformat/oggparsespeex.c
	libavformat/omadec.c
	libavformat/rawdec.c
	libavformat/riffdec.c
	libavformat/rl2.c
	libavformat/rmdec.c
	libavformat/rtpdec_latm.c
	libavformat/rtpdec_mpeg4.c
	libavformat/rtpdec_qdm2.c
	libavformat/rtpdec_svq3.c
	libavformat/sierravmd.c
	libavformat/smacker.c
	libavformat/smush.c
	libavformat/spdifenc.c
	libavformat/takdec.c
	libavformat/tta.c
	libavformat/utils.c
	libavformat/vqf.c
	libavformat/westwood_vqa.c
	libavformat/xmv.c
	libavformat/xwma.c
	libavformat/yop.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-27 23:15:19 +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
wm4
d4007d1763 id3v2: strip trailing spaces from APIC tag
The APIC description must be unique, and some ID3v2 tag writers add
spaces to write several APIC entries with the same description. The
trailing spaces simply serve as a way to disambiguate the description.
Do this so that API users do not have to special-case mp3 to fix this
cosmetic issue.

Requested-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-18 19:15:49 +02:00
Michael Niedermayer
622f1468c9 avformat/id3v2: detect PNG by header instead of mime
the mimetype for PNG can be set to jpeg

Fixes 01\ -\ Cider\ Time.mp3

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-18 18:38:53 +02:00
Andreas Cadhalpun
0382c94f13 id3v2: catch avio_read errors in check_tag
Since len is an unsigned int, the comparison is currently treated as
unsigned and thus ignores all errors from avio_read.

Thus cast len to int, which is unproblematic, because at that point len
is between 0 and 4.

This fixes 'Conditional jump or move depends on uninitialised value'
valgrind warnings in is_tag.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-11 20:21:48 +02:00
Michael Niedermayer
1cf81a2c50 Merge commit '379e5603f4131e677ecf5ba79973dcd5603f28ea'
* commit '379e5603f4131e677ecf5ba79973dcd5603f28ea':
  id3v2: Do not export empty APIC description

Conflicts:
	libavformat/id3v2.c

See: b697b297b7
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 22:51:38 +02:00
wm4
379e5603f4 id3v2: Do not export empty APIC description
APIC tags always have a description. Tag writers obviously leave it
empty if there is no description. In this case, libavformat would export
"" as title. Do not set the title instead.
2015-05-09 15:55:50 +02:00
wm4
b697b297b7 id3v2: do not export APIC description if empty
APIC tags always have a description. Tag writers obviously leave it
empty if there is no description. In this case, libavformat would export
"" as title. Do not set the title instead.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-08 01:07:13 +02:00
Michael Niedermayer
7f03f75ce7 Merge commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a'
* commit '8e32b1f0963d01d4f5d4803eb721f162e0d58d9a':
  libavformat: Use ffio_free_dyn_buf where applicable

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-25 00:48:50 +01:00
Martin Storsjö
8e32b1f096 libavformat: Use ffio_free_dyn_buf where applicable
Signed-off-by: Martin Storsjö <martin@martin.st>
2015-02-24 23:07:47 +02:00
Michael Niedermayer
b0be6d8385 avformat/id3v2: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 17:09:39 +01:00
Michael Niedermayer
eb215be9ce Merge commit '54bc15d5ebfd07fd468743ba29f709ea19e840b9'
* commit '54bc15d5ebfd07fd468743ba29f709ea19e840b9':
  id3v2: fix reading v2.2 attached pictures

Conflicts:
	libavformat/id3v2.c

See: 05c3c568dc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 13:01:40 +01:00
Michael Niedermayer
24c76bae5f Merge commit '932788be5af8dee062c77851b573ea47dd6d047a'
* commit '932788be5af8dee062c77851b573ea47dd6d047a':
  id3v2: add names to the parameters of ID3v2EMFunc.read

Conflicts:
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 12:53:53 +01:00
Michael Niedermayer
7eef45a76f avformat/id3v2: Fix incompatible pointer type warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 12:46:13 +01:00
Michael Niedermayer
06ec2f1d32 Merge commit '8809c974a3fb51f96e498a5556a4a5bbacc581ce'
* commit '8809c974a3fb51f96e498a5556a4a5bbacc581ce':
  id3v2: constify the 'tag' parameter to special metadata parsing callback

Conflicts:
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-15 12:45:20 +01:00
Anton Khirnov
54bc15d5eb id3v2: fix reading v2.2 attached pictures
In v2.2, the picture type is not a zero-terminated string, but has a
constant size of 3 bytes.
2015-01-14 17:17:24 +01:00
Anton Khirnov
932788be5a id3v2: add names to the parameters of ID3v2EMFunc.read
Some of them are not immediately obvious.
2015-01-14 17:17:24 +01:00
Anton Khirnov
8809c974a3 id3v2: constify the 'tag' parameter to special metadata parsing callback
Those functions should not ever modify it.
2015-01-14 17:17:24 +01:00
wm4
ea7af58fc6 avformat/id3v2: support USLT tags
I think this turned out pretty terrible. There's no good way to add new
custom tags that write to AVFormatContext->metadata.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-01-06 16:39:52 +01:00
Michael Niedermayer
081913aec5 avformat/id3v2: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-20 16:53:14 +01:00
Benoit Fouet
dc351e1381 id3v2: prefer TDRC for date over TDRL.
TDRL is what we used as a replacement of TYER, and, according to
http://id3.org/id3v2.4.0-changes :
    TYER - Year
        This frame is replaced by the TDRC frame, 'Recording time'
        [F:4.2.5].
So change TDRL usages to TDRC.

Fixes ticket #3694

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-04 14:11:53 +01:00
Benoit Fouet
242f8bb3a8 avformat/id3v2: support buggy id3v2.3 tag length in id3v2.4
Some encoders do not use syncsafe sizes in v2.4 id3 tags. Check the next
tag to try to choose between the two.

Fixes ticket #4003

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-17 16:05:53 +02:00
Benoit Fouet
8bcf425d06 avformat/id3v2: silence a warning when CONFIG_ZLIB is unset.
dlen is only read when CONFIG_ZLIB is set, so mark it as possibly
unused.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-16 15:54:02 +02:00
Michael Niedermayer
19bf1ed1f4 avformat/id3v2: Fix "warning: unused variable uncompressed_buffer_size" if zlib is unavailable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-30 12:21:07 +02:00
Carl Eugen Hoyos
ced0d6c14d Use correct msvc type specifiers for ptrdiff_t and size_t.
The Windows runtime aborts if it finds %t or %z.
Fixes ticket #3472.

Reviewed-by: Ronald Bultje
2014-04-24 18:01:30 +02:00
Peter Ross
5331773cc3 ff_id3v2_read: add option to limit ID3 magic number search
Several chunked formats (AIFF, IFF,DSF) store ID3 metadata within an 'ID3 '
chunk tag. If such chunks are stored sequentially, it is possible for the
ID3v2 parser to confuse the chunk tag for the ID3 magic number. e.g.

[1st chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]
[2nd chunk tag ('ID3 ') | chunk size] [ID3 magic number | metadata ...]

Fixes ticket #3530.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-19 04:25:01 +02:00
Peter Ross
c94305ae23 ff_id3v2_free_extra_meta: set the pointer pointing to extra_meta to NULL
Fixes ticket #3530.

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-19 04:24:24 +02:00
Peter Ross
847d8af59a avformat/id3v2: decode compilation metadata
Described http://id3.org/iTunes%20Compilation%20Flag

Signed-off-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-15 04:29:19 +01:00
Anssi Hannula
7fdf245ab9 avformat/id3v2: allow ID3 parsing without AVFormatContext
Add ff_id3v2_read_dict() for parsing without AVFormatContext, but
instead with AVIOContext and AVDictionary.

AVFormatContext is still used for logging, if available.

Chapter parsing is the only non-logging functionality that actually
needs AVFormatContext, and AFAICS it should be modified to write the
data to ID3v2ExtraMeta first, from where it can be implanted to
AVFormatContext by a separate function (like it is done with
read_apic() and ff_id3v2_parse_apic()). That is outside the scope of
this patch, though.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2013-12-31 05:15:19 +02:00
Anssi Hannula
53765ae33b avformat/id3v2: parse ID3 Private frames as extra metadata
They are used in HLS.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2013-12-31 03:18:53 +02:00
Carl Eugen Hoyos
05c3c568dc Read pictures in id3v2.2 2013-12-23 23:41:37 +01:00
Michael Niedermayer
ffbcb1c6f0 avformat/id3v2: Check avio_read() return value in read_chapter()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-15 22:11:28 +01:00
Michael Niedermayer
460f8fca9c avformat/id3v2: factor free code to the end of read_chapter()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-15 21:43:19 +01:00
Michael Niedermayer
476aceaa22 vformat/id3v2: check avio_read for short reads in addition to errors
Found-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-15 20:13:45 +01:00
Michael Niedermayer
0e0f6bd4a5 avformat/id3v2: Check avio_read() return code in id3v2_parse()
Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f5a04a9b50d_7087_mp3__mp3__tooSmallFinal.mp3
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-15 15:45:44 +01:00
Michael Niedermayer
6241e8a382 id2v2: check the return value of decode_str()
Fixes CID1030348
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-09 17:25:39 +02:00
Paul B Mahol
379fcc4955 id3v2: read all textual chapter subframes
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-07 09:28:07 +00:00
Paul B Mahol
f5846dc98c id3v2: stop ignoring text encoding for chapter titles
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-05-06 00:54:13 +00:00
Michael Niedermayer
760f7d3a90 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  compat: msvc: Make sure the object files are included when linking statically
  id3v2: check for end of file while unescaping tags

Conflicts:
	configure
	libavformat/id3v2.c

Note, ffmpeg is not affected by the out of buffer write bug

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-03 15:50:01 +02:00