Commit Graph

160 Commits

Author SHA1 Message Date
Luca Barbato c1d647b15a mp3: Make the seek more robust
Try to parse up to 4 packets to find the closest packet.

Reported-By: jan.schlueter@ofai.at
2015-07-11 18:45:45 +02:00
Michael Niedermayer 041aa800f2 avformat/mp3dec: Remove the ID3v1 tag removial code
The code is simply broken, the read packets are not aligned to
the mp3 frames, the file end or the id3 tag thus this simply
cannot reliably find the ID3v1 tag to remove it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-24 02:52:11 +02:00
Carl Eugen Hoyos 3323c5f353 Remove a few occurences of "long long" from the libraries. 2015-06-13 09:28:41 +02:00
Michael Niedermayer f722009ad9 avformat/mp3dec: Ensure the buffer is large enough to avoid seeks from the first frame search
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-27 17:06:24 +02:00
wm4 2b3e9bbfb5 avformat/mp3: skip junk at the beginning of mp3 files
Apparently it can happen that a mp3 file has junk data between id3 tag
and actual mp3 data. Skip this to avoid outputting nonsense timestamps.
(Two packets had the same timestamps, because the mp3 parser failed to
compute a frame duration.)

In this case, the junk consisted of 1044 bytes of zero, which
incidentally is the same size as normal mp3 frames in this stream. I
suspect the mp3 was edited with some tool which wiped the Xing/LAME
headers. Data near the end of the file suggests it was encoded with
"LAME3.97", but the normal Xing/LAME headers are missing. So this could
be "normal". mpg123 also attempts to skip at least 64KB of junk data by
scanning for headers.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-27 15:50:04 +02:00
wm4 537ab68053 avformat/mp3: large id3 tags break concatenated file detection
If the file size is much larger than what is indicated in the XING
header, the demuxer assumes it's a concatenated file, and throws away
the (presumably) incorrect duration information. Unfortunately, this
also triggers if the id3 tags are very large (embedded pictures and
such). Then the half-baked heuristic not only breaks the duration
display, but also gapless audio.

Fix it by subtracting the size of the headers (the check is off by some
bytes, but that doesn't matter at all). Note that there could be an
arbitrary amount of tags _after_ the mp3 data, but hopefully these are
not too large to trigger the heuristic in practice.

Also add a warning when this happens.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-24 15:06:54 +02:00
wm4 748d4816d9 avformat: add AVFMT_FLAG_FASTSEEK, use it for mp3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-22 22:27:05 +02:00
wm4 58fade2c68 avformat/mp3dec: make generic index mode the default
It's the most useful mode, because it seeks accurately, and does not
break features like gapless audio.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-22 14:41:57 +02:00
wm4 c3a73666ad avformat/mp3dec: allow enabling generic seek mode
"-usetoc 2" now invokes the generic seek and indexing mode. This mode
skips data until the seek target is reached, and this is exact. It also
makes gapless audio actually work if a seek past the start of the file
is involved.

Change the fate-gapless-mp3 test to use the new mode, and move the old
one to fate-gapless-mp3-toc (since the test forces use of the Xing TOC).
The new mode has a different result for the seek - this result is
actually correct.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-22 14:33:02 +02:00
wm4 066b92e91d avformat/mp3dec: use the common mechanism for skipping samples
The mp2 seek test results change. Whether to skip samples if the file
had no LAME gapless tags was inconsistent. When seeking to the start
of the file, 529 samples were skipped, but when playing from start,
nothing was skipped. This commit changes the behavior on seek to skip
nothing.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-22 14:16:35 +02:00
Michael Niedermayer ecf34e8fc2 avformat/mp3dec: Adjust returned timestamp in the CBR seeking case
With this the returned timestamp should match the packet instead of
the requested timestamp, which may lay between  packets

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-21 01:31:28 +02:00
wm4 92eef26e67 avformat/mp3dec: fix gapless audio when seeking in CBR mode
Removing a bunch of questionable hacks makes it work. These hacks
apparently try to make concatenated mp3s with Lame headers seekable,
which doesn't make too much sense anyway. The main change is that we
trust the Xing header file size field now (the same field is used for
seeking with Xing TOC). Note that a mp3 might contain an unknown number
of unsupported additional tags, so we can't reliably compute this size
manually.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-17 17:48:22 +02:00
wm4 3163083f7b avformat/mp3dec: offset seek index to end of vbr headers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-15 13:25:08 +02:00
wm4 ddd429fab6 Revert "avformat/mp3dec: offset seek index to end of id3v2 tag"
This reverts commit 8b76c0eb56.

It was slightly incorrect; the next commit fixes it.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-15 13:25:07 +02:00
Michael Niedermayer a742a0536d avformat/mp3dec: Allow forcing the use of the xing TOC for CBR files
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-15 13:25:07 +02:00
wm4 8b76c0eb56 avformat/mp3dec: offset seek index to end of id3v2 tag
The Xing index won't account for the id3 tag - it's relative to the
headers.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-31 23:22:07 +02:00
Michael Niedermayer 2d37c57f3e Merge commit 'fe99c52fa99e44961a09cd1324aefd492b797fc8'
* commit 'fe99c52fa99e44961a09cd1324aefd492b797fc8':
  mp3: Properly use AVCodecContext API

Conflicts:
	libavformat/mp3dec.c

See: 6ad42b3e15
See: b851bc20c6
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-11 20:21:16 +01:00
Vittorio Giovara fe99c52fa9 mp3: Properly use AVCodecContext API
Rather than having an unitialized context on the stack, allocate it with
defaults and free it when unneeded.

CC: libav-stable@libav.org
2015-03-11 17:57:56 +00:00
Michael Niedermayer b851bc20c6 avformat/mp3dec: Check for avcodec_alloc_context3() failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-26 20:11:19 +01:00
Michael Niedermayer 6ad42b3e15 avformat/mp3dec: properly allocate dummy AVCodecContext
Fixes (harmless) use of uninitialized variable

Found-by: jamrial
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-26 20:02:23 +01:00
Michael Niedermayer 2924514721 Merge commit '9deaec782810d098bca11c9332fab2d2f4c5fb78'
* commit '9deaec782810d098bca11c9332fab2d2f4c5fb78':
  lavf: move internal fields from public to internal context

Conflicts:
	libavformat/avformat.h
	libavformat/internal.h
	libavformat/mux.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-11 02:47:54 +01:00
Michael Niedermayer 8ddfc00ab7 avformat/mp3dec: Name the dummy variable as what it is, to avoid confusion
Found-by: nattyzs <nattyzs@163.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-14 20:08:13 +01:00
Luca Barbato 4fd7e63c87 mp3: Tweak the probe scores
Having more than 10 consecutive frames decoded as mp3 should be
considered a clear signal that the sample is mp3 and not mpegps.

Reported-By: Florian Iragne <florian@iragne.fr>
CC: libav-stable@libav.org
2014-12-07 21:50:47 +01:00
Michael Niedermayer 0b75b6c3cd avformat/mp3dec: avoid seeking to negative positions
Fixes Ticket4038

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-18 04:04:37 +01:00
Michael Niedermayer 279b2a4deb avformat/mp3dec: also accept Lavc as shortname to read delays
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 18:06:26 +02:00
Michael Niedermayer 899d3706d8 Merge commit '99143140dea12363af680d02e23cb42cfe191679'
* commit '99143140dea12363af680d02e23cb42cfe191679':
  mp3dec: fix reading the Xing tag

Conflicts:
	libavformat/mp3dec.c

See: 19ff479f69
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-24 12:49:53 +02:00
Anton Khirnov 99143140de mp3dec: fix reading the Xing tag
The quality scale field is only supposed to be present if the fourth bit
is set. In practice, lame always sets it, but other tools might not.

CC:libav-stable@libav.org
2014-10-24 09:03:16 +02:00
wm4 6c7f1155bb avformat/mp3dec: avoid early EOF with concatenated gapless mp3s
Consider a file created with something like:

    cat file1.mp3 file2.mp3 > result.mp3

Then if file2.mp3 has gapless information, result.mp3 would stop playing
something in the middle. This happens because the gapless info directs
the decoder to discard all samples after a certain position. To make
matters worse, the gapless info of file2.mp3 will be used when playing
the file1.mp3 part, because the gapless info is located at the end of
the file.

While handling concatenated gapless files correctly would be insane and
a lot of effort (especially without scanning the whole file on opening),
it's easy to prevent at least early EOF. Playback will happen to work,
even if it's slightly broken.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 14:57:12 +02:00
wm4 d87fe2687f avformat/mp3dec: fix gapless audio support
The code already had skipping of initial padding, but discarding
trailing frame padding was missing.

This is somewhat questionable, because it will make the decoder discard
any data after the declared file size in the LAME header. But note that
skipping full frames at the end of the stream is required. Encoders
actually create such files.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-20 19:46:25 +02:00
Michael Niedermayer 1b5ccae0f2 avformat/mp3dec: Improve seeking frame sync code
Fixes Ticket3884

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-10 02:32:41 +02:00
Carl Eugen Hoyos ef21b3d38e Ignore xing number of frames if the file is larger than indicated.
Fixes ticket #3777.
2014-07-24 15:34:36 +02:00
Michael Niedermayer a8bc175dd9 avformat/mp3dec: check the number of frames per buffer size
Fixes misdetection of issue3327-libc-2.17.so

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-12 21:05:47 +02:00
Michael Niedermayer cdc166acd8 Merge commit '32d05934abc7427bb90380a4c1ab20a15fd7d821'
* commit '32d05934abc7427bb90380a4c1ab20a15fd7d821':
  mp3dec: decode more data from Info header

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-18 00:38:07 +02:00
Michael Niedermayer 39edcadc07 Merge commit 'fbd8e042107ec63e0ddf155588c59dcb76007641'
* commit 'fbd8e042107ec63e0ddf155588c59dcb76007641':
  mp3dec: move XING/Info and VBRI parsing into their own functions

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-17 22:27:17 +02:00
Alessandro Ghedini 32d05934ab mp3dec: decode more data from Info header
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-04-17 20:08:19 +02:00
Alessandro Ghedini fbd8e04210 mp3dec: move XING/Info and VBRI parsing into their own functions
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-04-17 20:08:19 +02:00
Michael Niedermayer 1034fbdf53 Merge commit '15c5a8d22d12d29a364ca2ab6438f1dee2fa08c7'
* commit '15c5a8d22d12d29a364ca2ab6438f1dee2fa08c7':
  mp3dec: export replaygain tags from ID3v2

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-24 15:11:08 +01:00
Anton Khirnov 15c5a8d22d mp3dec: export replaygain tags from ID3v2 2014-03-24 06:13:39 +01:00
Michael Niedermayer 171dd67520 avformat/mp3dec: optimize mp3_seek() for dir < 0
this minimizes the amount of protocol seeks and reading needed in that case

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-02 00:20:31 +01:00
Michael Niedermayer 7546ac2fee avformat/mp3dec: fix start time in light of initial skip samples
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 01:05:16 +01:00
Michael Niedermayer 64f4816915 avformat/mp3dec: 4x faster probing
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-09 01:45:24 +01:00
Michael Niedermayer ba8716df7f avformat/mp3dec: perform seek resync in the correct direction
Fixes seeking to the last frame in CBR files
Fixes Ticket2773

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-25 19:37:03 +02:00
Michael Niedermayer 44fb7de8ee Merge commit 'c0779a67e85df856904ee6fab760c4233d4c2be5'
* commit 'c0779a67e85df856904ee6fab760c4233d4c2be5':
  mp3: add .mpa extension

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-12 15:02:23 +02:00
Vittorio Giovara c0779a67e8 mp3: add .mpa extension
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-09-12 13:16:15 +02:00
Michael Niedermayer 8d679bc7e6 avformat/mp3dec: improve detection of mp3s with huge id3 tags
When a id3 tag is larger than the amount of space we will probe
give it a score similar to what a .mp3 extension would have given it

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-26 00:57:35 +02:00
Michael Niedermayer 1787432b23 mp3dec: make const tables static const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-05 02:52:41 +02:00
Michael Niedermayer e096283ea5 mp3dec: detect CBR and use CBR axiom to seek
This should also work reasonable with truncated and growing mp3s.
Fixes Ticket2590

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-08 17:12:51 +02:00
Michael Niedermayer 19d4163331 avformat/mp3dec: read TOC even if not all needed information is available
This fixes hyothetical bugs with parsing of elements after the TOC

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-07 12:50:41 +02:00
Michael Niedermayer 4cc32e5cad avformat/mp3dec: read xing toc independant of usetoc, only skip filling index if requested
Fixes hypothetical parsing bug with -usetoc 0

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-07 12:49:37 +02:00
Michael Niedermayer 0844630e6b avformat/mp3dec: Add usetoc option to allow dlsabling the use of the xing TOC
The toc is inexact and not using it can thus make sense.
Using it is faster though, thus the opposite can similarly makes sense

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-06 05:43:48 +02:00
Michael Niedermayer f083b4c338 Merge commit 'e0f8be6413b6a8d334d6052e610af32935c310af'
* commit 'e0f8be6413b6a8d334d6052e610af32935c310af':
  avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriate

Conflicts:
	libavformat/ac3dec.c
	libavformat/avformat.h
	libavformat/avs.c
	libavformat/m4vdec.c
	libavformat/mov.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegvideodec.c
	libavformat/psxstr.c
	libavformat/pva.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 12:31:03 +02:00
Diego Biurrun e0f8be6413 avformat: Add AVPROBE_SCORE_EXTENSION define and use where appropriate 2013-05-04 21:43:06 +02:00
Michael Niedermayer 194d0399a2 Merge commit '505642f18276aed03278ac91b1f334ea888eac6a'
* commit '505642f18276aed03278ac91b1f334ea888eac6a':
  mp3dec: fallback to generic seeking when a TOC is not present

Conflicts:
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-19 21:36:23 +02:00
Michael Niedermayer 505642f182 mp3dec: fallback to generic seeking when a TOC is not present
Fixes seeking without a Xing/Info header.

CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-04-19 09:26:34 +02:00
Alexander Kojevnikov eae0879d96 mp3dec: Fix VBR bit rate parsing
When parsing the Xing/Info tag, don't set the bit rate if it's an Info tag.

When parsing the stream, don't override the bit rate if it's already set,
otherwise calculate the mean bit rate from parsed frames. This way, the bit
rate will be set correctly both for CBR and VBR streams.

CC:libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-03-08 07:32:11 +01:00
Alexander Kojevnikov 29d8cd265a mp3dec: Fix VBR bit rate parsing
When parsing the Xing/Info tag, don't set the bit rate if it's an Info tag.

When parsing the stream, don't override the bit rate if it's already set,
otherwise calculate the mean bit rate from parsed frames. This way, the bit
rate will be set correctly both for CBR and VBR streams.

Signed-off-by: Alexander Kojevnikov <alexander@kojevnikov.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-03-05 13:06:01 +01:00
Michael Niedermayer 7a84664ffe mp3_read_probe: make buffer related pointers const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-25 01:51:32 +01:00
Michael Niedermayer 91295f03d4 mp3dec: remove unused variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-29 22:11:21 +01:00
Michael Niedermayer b6267901c4 mp3demux: Rewrite xing TOC based seeking
The libav code depends on mp3 startcodes only occuring at the start of
frames. But there is nothing in mp3 that prevents them occuring elsewhere
by chance. Thus the code would fail randomly, the new code searches for 3
consecutive valid frames. If this turns out to be still insufficient the
number can be raised further, or additional checks added.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-21 03:13:46 +02:00
Michael Niedermayer 6d87781758 mp3dec: fix seeking without xing TOC
fixes regression from the xing toc support

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 22:00:52 +02:00
Michael Niedermayer 5864ce13d1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mp3dec: read Xing frame TOC index
  mp3dec: use named constants for Xing header flags
  libx264: add support for nal-hrd, required for Blu-ray streams.
  mov: support random access point grouping
  matroskadec: properly support BlockDuration

Conflicts:
	libavcodec/libx264.c
	libavformat/isom.h
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-20 21:46:35 +02:00
Anton Khirnov 50d1f4437b mp3dec: read Xing frame TOC index 2012-09-19 20:59:45 +02:00
Anton Khirnov 2d1a1a7f62 mp3dec: use named constants for Xing header flags 2012-09-19 20:59:44 +02:00
Michael Niedermayer 7a72695c05 Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'
* commit '36ef5369ee9b336febc2c270f8718cec4476cb85':
  Replace all CODEC_ID_* with AV_CODEC_ID_*
  lavc: add AV prefix to codec ids.

Conflicts:
	doc/APIchanges
	doc/examples/decoding_encoding.c
	doc/examples/muxing.c
	ffmpeg.c
	ffprobe.c
	ffserver.c
	libavcodec/8svx.c
	libavcodec/avcodec.h
	libavcodec/dnxhd_parser.c
	libavcodec/dvdsubdec.c
	libavcodec/error_resilience.c
	libavcodec/h263dec.c
	libavcodec/libvorbisenc.c
	libavcodec/mjpeg_parser.c
	libavcodec/mjpegenc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg4videodec.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/pcm.c
	libavcodec/r210dec.c
	libavcodec/utils.c
	libavcodec/v210dec.c
	libavcodec/version.h
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/v4l2.c
	libavformat/asfdec.c
	libavformat/asfenc.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/caf.c
	libavformat/electronicarts.c
	libavformat/flacdec.c
	libavformat/flvdec.c
	libavformat/flvenc.c
	libavformat/framecrcenc.c
	libavformat/img2.c
	libavformat/img2dec.c
	libavformat/img2enc.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/matroska.c
	libavformat/matroskadec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/movenc.c
	libavformat/mp3dec.c
	libavformat/mpeg.c
	libavformat/mpegts.c
	libavformat/mxf.c
	libavformat/mxfdec.c
	libavformat/mxfenc.c
	libavformat/nsvdec.c
	libavformat/nut.c
	libavformat/oggenc.c
	libavformat/pmpdec.c
	libavformat/rawdec.c
	libavformat/rawenc.c
	libavformat/riff.c
	libavformat/sdp.c
	libavformat/utils.c
	libavformat/vocenc.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-08-07 22:45:46 +02:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Michael Niedermayer d1dad7c824 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpc8: return more meaningful error codes.
  mpc: return more meaningful error codes.
  wv,mpc8: don't return apetag data in packets.
  rtmp: do not warn about receiving metadata packets
  x86: h264dsp: Adjust YASM #ifdefs
  x86: yadif: Mark mmxext optimizations as such
  h264: convert loop filter strength dsp function to yasm.
  Improve descriptiveness of a number of codec and container long names

Conflicts:
	libavcodec/flvdec.c
	libavcodec/libopenjpegdec.c
	libavformat/apetag.c
	libavformat/mp3dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-31 22:41:00 +02:00
Diego Biurrun 0177b7d23a Improve descriptiveness of a number of codec and container long names 2012-07-30 20:46:55 +02:00
Michael Niedermayer 706bd8ea19 Merge remote-tracking branch 'qatar/master'
* qatar/master: (35 commits)
  h264_idct_10bit: port x86 assembly to cpuflags.
  x86inc: clip num_args to 7 on x86-32.
  x86inc: sync to latest version from x264.
  fft: rename "z" to "zc" to prevent name collision.
  wv: return meaningful error codes.
  wv: return AVERROR_EOF on EOF, not EIO.
  mp3dec: forward errors for av_get_packet().
  mp3dec: remove a pointless local variable.
  mp3dec: remove commented out cruft.
  lavfi: bump minor to mark stabilizing the ABI.
  FATE: add tests for yadif.
  FATE: add a test for delogo video filter.
  FATE: add a test for amix audio filter.
  audiogen: allow specifying random seed as a commandline parameter.
  vc1dec: Override invalid macroblock quantizer
  vc1: avoid reading beyond the last line in vc1_draw_sprites()
  vc1dec: check that coded slice positions and interlacing match.
  vc1dec: Do not ignore ff_vc1_parse_frame_header_adv return value
  configure: Move parts that should not be user-selectable to CONFIG_EXTRA
  lavf: remove commented out cruft in avformat_find_stream_info()
  ...

Conflicts:
	Makefile
	configure
	libavcodec/vc1dec.c
	libavcodec/x86/h264_deblock.asm
	libavcodec/x86/h264_deblock_10bit.asm
	libavcodec/x86/h264dsp_mmx.c
	libavfilter/version.h
	libavformat/mp3dec.c
	libavformat/utils.c
	libavformat/wv.c
	libavutil/x86/x86inc.asm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-29 02:16:26 +02:00
Anton Khirnov f73e3938ac mp3dec: forward errors for av_get_packet().
Don't invent a bogus EIO error.

The code now doesn't check for ret == 0, but that check is redundant,
av_get_packet() never returns 0.
2012-07-28 14:37:00 +02:00
Anton Khirnov 67b1156fe8 mp3dec: remove a pointless local variable. 2012-07-28 14:36:55 +02:00
Anton Khirnov 61f8bb74f3 mp3dec: remove commented out cruft. 2012-07-28 14:36:51 +02:00
Michael Niedermayer ea8c12c90f mp3dec: mark as AVSTREAM_PARSE_FULL_RAW
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-26 02:03:56 +02:00
Michael Niedermayer 57d5a224ce mp3enc: add lame tag with start padding info
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-14 17:20:22 +02:00
Michael Niedermayer 19ff479f69 mp3dec: parse initial silence padding information from lame tag
And pass the information on to the lavf core.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-07-12 22:25:25 +02:00
Ronald S. Bultje 64bde80563 mp3/ac3 probe: search for PES headers to prevent probing MPEG-PS as MP3. 2012-05-30 09:08:29 -07:00
Michael Niedermayer 7da0a07283 mp3demux: fix id3 discard code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-08 03:47:58 +02:00
Michael Niedermayer f46185c289 mp3demux: fix off by 1 error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-08 03:45:17 +02:00
Reimar Döffinger 7effbee66c Mark truncated packets as corrupt in av_get_packet.
Manually remove that flag again for formats that read an arbitrary
amount of data and thus truncation is not an error.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-05-01 23:20:52 +02:00
Michael Niedermayer 2e0c360abd Merge remote-tracking branch 'qatar/master'
* qatar/master:
  cosmetics: Align muxer/demuxer declarations
  mpeg12: Do not change frame_pred_frame_dct flag and demote error into a warning
  avcodec: remove avcodec_guess_channel_layout()
  avutil: Add av_get_default_channel_layout()

Conflicts:
	doc/APIchanges
	libavcodec/mpeg12.c
	libavformat/cdg.c
	libavformat/matroskaenc.c
	libavformat/mpegts.c
	libavformat/nuv.c
	libavformat/wav.c
	libavutil/audioconvert.c
	libavutil/audioconvert.h
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-06 22:52:01 +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
Michael Niedermayer 2b07f572af mp3_probe: consider id3 tags to be low scoring mp3.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-19 20:49:04 +01:00
Ingo Brückl c05e2be9a2 mp3dec: Fix reading file size and frames in VBRI headers
The fields "Number of Bytes" and "Number of Frames" are mixed up. "Bytes"
come first, "Frames" behind.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-01 15:32:28 -08:00
Clément Bœsch 6a3cc21242 mp3dec: fix truncating packet error message while decoding a complete MP3.
The MP3 demuxer split the data in packets of 1024B which are later split
in MP3 frames by the MPEG audio parser. The last read is "truncated",
but this should not raise any error.

Solution-by: Michael Niedermayer
2012-01-30 23:29:34 +01:00
Michael Niedermayer e37f161e66 Merge remote-tracking branch 'qatar/master'
* qatar/master: (71 commits)
  movenc: Allow writing to a non-seekable output if using empty moov
  movenc: Support adding isml (smooth streaming live) metadata
  libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
  sunrast: Document the different Sun Raster file format types.
  sunrast: Add a check for experimental type.
  libspeexenc: use AVSampleFormat instead of deprecated/removed SampleFormat
  lavf: remove disabled FF_API_SET_PTS_INFO cruft
  lavf: remove disabled FF_API_OLD_INTERRUPT_CB cruft
  lavf: remove disabled FF_API_REORDER_PRIVATE cruft
  lavf: remove disabled FF_API_SEEK_PUBLIC cruft
  lavf: remove disabled FF_API_STREAM_COPY cruft
  lavf: remove disabled FF_API_PRELOAD cruft
  lavf: remove disabled FF_API_NEW_STREAM cruft
  lavf: remove disabled FF_API_RTSP_URL_OPTIONS cruft
  lavf: remove disabled FF_API_MUXRATE cruft
  lavf: remove disabled FF_API_FILESIZE cruft
  lavf: remove disabled FF_API_TIMESTAMP cruft
  lavf: remove disabled FF_API_LOOP_OUTPUT cruft
  lavf: remove disabled FF_API_LOOP_INPUT cruft
  lavf: remove disabled FF_API_AVSTREAM_QUALITY cruft
  ...

Conflicts:
	doc/APIchanges
	libavcodec/8bps.c
	libavcodec/avcodec.h
	libavcodec/libx264.c
	libavcodec/mjpegbdec.c
	libavcodec/options.c
	libavcodec/sunrast.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/x86/h264_deblock.asm
	libavdevice/libdc1394.c
	libavdevice/v4l2.c
	libavformat/avformat.h
	libavformat/avio.c
	libavformat/avio.h
	libavformat/aviobuf.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/utils.c
	libavformat/version.h
	libavformat/wtv.c
	libavutil/Makefile
	libavutil/file.c
	libswscale/x86/input.asm
	libswscale/x86/swscale_mmx.c
	libswscale/x86/swscale_template.c
	tests/ref/lavf/ffm

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-28 07:53:34 +01:00
Anton Khirnov 6e9651d106 lavf: remove AVFormatParameters from AVFormatContext.read_header signature 2012-01-27 10:51:57 +01:00
Michael Niedermayer 9d76cf0b18 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Templatize the code for different g726 bitrate variants
  rv40: move loop filter to rv34dsp context
  lavf: make av_set_pts_info private.
  rtpdec: Add support for G726 audio
  rtpdec: Add an init function that can do custom codec context initialization
  avconv: make copy_tb on by default.
  matroskadec: don't set codec timebase.
  rmdec: don't set codec timebase.
  avconv: compute next_pts from input packet duration when possible.
  lavf: estimate frame duration from r_frame_rate.
  avconv: update InputStream.pts in the streamcopy case.

Conflicts:
	avconv.c
	libavdevice/alsa-audio-dec.c
	libavdevice/bktr.c
	libavdevice/fbdev.c
	libavdevice/libdc1394.c
	libavdevice/oss_audio.c
	libavdevice/v4l.c
	libavdevice/v4l2.c
	libavdevice/vfwcap.c
	libavdevice/x11grab.c
	libavformat/au.c
	libavformat/eacdata.c
	libavformat/flvdec.c
	libavformat/mpegts.c
	libavformat/mxfenc.c
	libavformat/rtpdec_g726.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-01 02:54:24 +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
Michael Niedermayer b51eaf3b8c mp3probe: Detect mp3 stronger with just 200 frames, this should speed up detection
on mp3 streams.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-30 18:07:20 +01:00
Michael Niedermayer dd8ffc1925 Merge remote-tracking branch 'qatar/master'
* qatar/master: (47 commits)
  lavc: hide private symbols.
  lavc: deprecate img_get_alpha_info().
  lavc: use avpriv_ prefix for ff_toupper4.
  lavc: use avpriv_ prefix for ff_copy_bits and align_put_bits.
  lavc: use avpriv_ prefix for ff_ac3_parse_header.
  lavc: use avpriv_ prefix for ff_frame_rate_tab.
  lavc: rename ff_find_start_code to avpriv_mpv_find_start_code
  lavc: use avpriv_ prefix for ff_split_xiph_headers.
  lavc: use avpriv_ prefix for ff_dirac_parse_sequence_header.
  lavc: use avpriv_ prefix for some dv symbols used in lavf.
  lavc: use avpriv_ prefix for some flac symbols used in lavf.
  lavc: use avpriv_ prefix for some mpeg4audio symbols used in lavf.
  lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf.
  lavc: use avpriv_ prefix for ff_aac_parse_header().
  lavf: hide private symbols.
  lavf: use avpriv_ prefix for some dv functions.
  lavf: use avpriv_ prefix for ff_new_chapter().
  avcodec: add CODEC_CAP_DELAY note to avcodec_decode_audio3() documentation
  avcodec: clarify the CODEC_CAP_DELAY note in avcodec_decode_video2()
  avcodec: clarify documentation of CODEC_CAP_DELAY
  ...

Conflicts:
	configure
	doc/general.texi
	libavcodec/Makefile
	libavcodec/aacdec.c
	libavcodec/allcodecs.c
	libavcodec/avcodec.h
	libavcodec/dv.c
	libavcodec/dvdata.c
	libavcodec/dvdata.h
	libavcodec/libspeexenc.c
	libavcodec/mpegvideo.c
	libavcodec/version.h
	libavformat/avidec.c
	libavformat/dv.c
	libavformat/dv.h
	libavformat/flvenc.c
	libavformat/mov.c
	libavformat/mp3enc.c
	libavformat/oggparsespeex.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-21 02:01:26 +02:00
Anton Khirnov 82ab61f901 lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf.
Specifically, ff_mpa_freq_tab, ff_mpa_bitrate_tab, ff_mpa_decode_header,
ff_mpegaudio_decode_header.
2011-10-20 21:06:57 +02:00
Michael Niedermayer d0492578c8 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  presets: rename presets directory
  lavc: make avcodec_get_context_defaults3 "officially" public
  lavf: replace av_new_stream->avformat_new_stream part II.
  lavf,lavd: replace av_new_stream->avformat_new_stream part I.
  lavf: add avformat_new_stream as a replacement for av_new_stream.
  Use correct scaling table for bwd-pred MVs in second B-field
  Ut Video decoder
  Makefile: change presets extension to .avpreset
  lavfi: add rgbtestsrc source, ported from MPlayer libmpcodecs
  lavfi: add testsrc source
  AVOptions: add documentation.
  presets: update libx264 ffpresets

Conflicts:
	Changelog
	doc/APIchanges
	doc/ffmpeg.texi
	ffpresets/libx264-ipod320.ffpreset
	ffpresets/libx264-ipod640.ffpreset
	ffserver.c
	libavcodec/avcodec.h
	libavcodec/options.c
	libavcodec/version.h
	libavdevice/libdc1394.c
	libavfilter/avfilter.h
	libavfilter/vsrc_testsrc.c
	libavformat/flvdec.c
	libavformat/riff.c
	libavformat/version.h
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-20 02:34:51 +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
Michael Niedermayer c83442b057 mp3demux: pass on error code on packet read.
Reported-by: Tanami, Ohad
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-21 00:51:53 +02:00
Ingo Brückl 5d305c9398 Correct determination of file size and frames in VBRI headers
The fields "Number of Bytes" and "Number of Frames" are mixed up. "Bytes"
come first, "Frames" behind.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-15 20:16:55 +02:00
Michael Niedermayer 78accb876c Merge remote-tracking branch 'qatar/master'
* qatar/master:
  ffmpeg: fix some indentation
  ffmpeg: fix operation with --disable-avfilter
  simple_idct: remove disabled code
  motion_est: remove disabled code
  vc1: remove disabled code
  fate: separate lavf-mxf_d10 test from lavf-mxf
  cabac: Move code only used in the cabac test program to cabac.c.
  ffplay: warn that -pix_fmt is no longer working, suggest alternative
  ffplay: warn that -s is no longer working, suggest alternative
  lavf: rename enc variable in utils.c:has_codec_parameters()
  lavf: use designated initialisers for all (de)muxers.
  wav: remove a use of deprecated AV_METADATA_ macro
  rmdec: remove useless ap parameter from rm_read_header_old()
  dct-test: remove write-only variable
  des: fix #if conditional around P_shuffle
  Use LOCAL_ALIGNED in ff_check_alignment()

Conflicts:
	ffmpeg.c
	libavformat/avidec.c
	libavformat/matroskaenc.c
	libavformat/mp3enc.c
	libavformat/oggenc.c
	libavformat/utils.c
	tests/ref/lavf/mxf

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-17 20:12:02 +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
Michael Niedermayer 976a8b2179 Merge remote-tracking branch 'qatar/master'
* qatar/master: (40 commits)
  H.264: template left MB handling
  H.264: faster fill_decode_caches
  H.264: faster write_back_*
  H.264: faster fill_filter_caches
  H.264: make filter_mb_fast support the case of unavailable top mb
  Do not include log.h in avutil.h
  Do not include pixfmt.h in avutil.h
  Do not include rational.h in avutil.h
  Do not include mathematics.h in avutil.h
  Do not include intfloat_readwrite.h in avutil.h
  Remove return statements following infinite loops without break
  RTSP: Doxygen comment cleanup
  doxygen: Escape '\' in Doxygen documentation.
  md5: cosmetics
  md5: use AV_WL32 to write result
  md5: add fate test
  md5: include correct headers
  md5: fix test program
  doxygen: Drop array size declarations from Doxygen parameter names.
  doxygen: Fix parameter names to match the function prototypes.
  ...

Conflicts:
	libavcodec/x86/dsputil_mmx.c
	libavformat/flvenc.c
	libavformat/oggenc.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-04 00:45:21 +02:00
Mans Rullgard 0ebcdf5cda Do not include mathematics.h in avutil.h
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-07-03 21:42:06 +01:00
Michael Niedermayer f9ecb849ef Merge remote-tracking branch 'qatar/master'
* qatar/master:
  crypto: Use av_freep instead of av_free
  lavf: don't try to free private options if priv_data is NULL.
  swscale: fix types of assembly arguments.
  swscale: move two macros that are only used once into caller.
  swscale: remove unused function.
  options: Add missing braces around struct initializer.
  mov: Remove leftover crufty debug statement with references to a local file.
  dvbsubdec: Fix compilation of debug code.
  Remove all uses of now deprecated metadata functions.
  Move metadata API from lavf to lavu.

Conflicts:
	doc/APIchanges
	libavformat/aiffdec.c
	libavformat/asfdec.c
	libavformat/avformat.h
	libavformat/avidec.c
	libavformat/cafdec.c
	libavformat/matroskaenc.c
	libavformat/mov.c
	libavformat/mp3enc.c
	libavformat/wtv.c
	libavutil/avutil.h
	libavutil/internal.h
	libswscale/swscale.c
	libswscale/x86/swscale_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-06-09 04:47:19 +02:00
Anton Khirnov d2d67e424f Remove all uses of now deprecated metadata functions. 2011-06-08 07:43:45 +02:00