Commit Graph

17252 Commits

Author SHA1 Message Date
David Mitchell
d150a147da Improve support for PGS subtitles.
The previous implementation assumed that a new picture would always
supersede the previous picture. Similarly, presentation segments
were assumed to pertain to the most-recently-read picture.

However, each presentation segment may refer to 0 or more pictures
by their ID. Picture IDs may repeat, and a repeated picture ID
indicates that the old picture for that ID is no longer needed
and may be discarded.

The new implementation allocates a buffer with one slot for each
possible picture ID (the picture ID is a 16-bit field) and
properly decodes presentation segments so that all relevant
pictures are output upon encountering a display segment.

Given that most PGS streams are unlikely to use more than a small
fraction of the available picture IDs, it would probably be better
to use a more memory-efficient data structure. I'm lazy though, so
I leave this to a more motivated individual.

I've tested the code with MKV files in VLC (a recent revision from
their git repo) and with HandBrake (a version that I hacked up to
use ffmpeg's PGS subtitle decoder).

Review-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-23 19:47:49 +01:00
Michael Niedermayer
cf7c7f13cd pthreads: Generic progress lubrication support.
Fixes bug118, bug120 and bug125 at least

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-23 19:47:49 +01:00
Michael Niedermayer
575d494de5 pthreads: reset got_frames on flush.
This fixes memory corruption when seeking in broken streams.
a random mpeg4 in nut file was used to debug.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-23 19:47:49 +01:00
Michael Niedermayer
feb997577b Merge remote-tracking branch 'qatar/master'
* qatar/master: (25 commits)
  riff: fix invalid av_freep() calls on EOF in ff_read_riff_info
  pam: Fix a typo that broke writing and reading PAM files.
  mxfdec: fix memleak on av_realloc failures
  mxfdec: Do not parse slices or DeltaEntryArrays.
  mxfdec: hybrid demuxing/seeking solution
  mxfdec: Add Avid's essence element key.
  mfxdec: Separate mxf_essence_container_uls for audio and video.
  mxfdec: Compute packet offsets properly.
  mxfdec: Use MaterialPackage - Track - TrackID instead of the system_item hack.
  mxfdec: use av_dlog() for 'no corresponding source package found'
  mxfdec: Make mxf->partitions sorted by offset.
  mxfdec: parse ThisPartition
  mxfdec: Speed up metadata and index parsing.
  mxfdec: Make sure DataDefinition is consistent between material track and source track.
  mxfdec: add EssenceContainer UL found in 0001GL00.MXF.A1.mxf_opatom.mxf
  mxfdec: Add hack that adjusts the n_delta calculation when system items are present.
  mxfdec: Parse IndexTableSegments and convert them into AVIndexEntry arrays.
  mxfdec: Move FooterPartition to MXFContext and make sure it is never zero.
  mxfdec: check return value of avio_seek
  mxfdec: skip to end of structural sets
  ...

Conflicts:
	configure
	libavcodec/pnm.c
	libavformat/mxfdec.c
	libavformat/riff.c
	libavformat/rtsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-23 01:05:20 +01:00
Philip Langdale
9bf9c314a0 CrystalHD: Back up extradata to allow decoder reinit to work.
This was a regression that came in when I switched to using the
h.264 annex b filter all the time. As the filter modifies extradata,
its use violates the statelessness assumption that exists in the
'ffmpeg' command line tool, and maybe elsewhere. It assumes that
a docoder can be reinitalised and pointed to an existing stream and
get the same results.

For now, the only way to meet this requirement is to backup the
extradata.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 23:40:24 +01:00
Philip Langdale
eaf4bf6df2 CrystalHD: Initialise variables to silence valgrind.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 23:40:24 +01:00
Michael Niedermayer
199d4478de pthread: Change a signal to a broadcast as multiple threads
have been seen waiting and deadlocking on it in bug125.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 23:07:09 +01:00
Carl Eugen Hoyos
66b9d7065a pam: Fix a typo that broke writing and reading PAM files.
Reported and reviewed by Derek Buitenhuis.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-01-22 16:38:20 +01:00
Hendrik Leppkes
378b7beff5 mpeg12: fixed parsing in some mpeg2 streams
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 14:42:53 +01:00
Michael Niedermayer
e9a6152e17 lavc: fix FF_LOSS_COLORQUANT detection for gray8a->pal8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 14:42:53 +01:00
Reimar Döffinger
b4ec645f47 Extract some duplicated code.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-22 14:41:15 +01:00
Reimar Döffinger
b64b1608d8 Remove pointless and distracting ()
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-22 14:41:15 +01:00
Reimar Döffinger
57608d9029 Simplify: just add header_size directly.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-22 14:41:15 +01:00
Reimar Döffinger
b09c93d7bc Move some duplicated code, simplify.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-22 14:41:15 +01:00
Reimar Döffinger
0a403588d2 Make variable that always has the same value const.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-22 14:41:15 +01:00
Michael Niedermayer
9e34adfc02 RC: Fix initial buffer occupancy.
Fixes Ticket880
Regression since bf174a70cd

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 06:46:24 +01:00
Michael Niedermayer
018a6645bc aacenc: Fix bug in writing libavcodec_ident.
the written length was off by 2 causing aac decoders to fail with the data.
lucky the encoder was marked as experimental and not used much

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 06:46:23 +01:00
Carl Eugen Hoyos
f746f37901 Support decoding gray8a tiff images. 2012-01-22 04:49:46 +01:00
Michael Niedermayer
d1c48025a7 pngdec: Do not use SIMD paeth prediction for bpp=2
Fixes decoding of basi4a08.png

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 00:46:19 +01:00
Michael Niedermayer
fd8a8373aa pngdec: Fix masks for interlaced decoding
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 00:46:19 +01:00
Michael Niedermayer
602e97dfaa pngdec: Add some FF_DEBUG based av_logs.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-22 00:46:19 +01:00
Michael Niedermayer
2478612fc0 lavc: Mark the err_detect constants as audio+video as they also apply to audio.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-21 23:48:50 +01:00
Michael Niedermayer
44d4fe9dad error_detection: put the old error detection constants back.
The old constants are more useful to the end user and have
orthogonal meanings to the new ones.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-21 23:46:36 +01:00
Michael Niedermayer
b5a69e79c5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  rtpdec: Use our own SSRC in the SDES field when sending RRs
  Finalize changelog for 0.8 Release
  Prepare for 0.8 Release
  threads: change the default for threads back to 1
  threads: update slice_count and slice_offset from user context
  aviocat: Remove useless includes
  doc/APIChanges: fill in missing dates and hashes
  Revert "avserver: fix build after the next bump."
  mpegaudiodec: switch error detection check to AV_EF_BUFFER
  lavf: rename fer option and document resulting (f_)err_detect options
  lavc: rename err_filter option to err_detect and document it
  mpegvideo: fix invalid memory access for small video dimensions
  movenc: Reorder entries in the MOVIentry struct, for tigheter packing
  rtsp: Remove extern declarations for variables that don't exist
  aviocat: Flush the output before closing

Conflicts:
	Changelog
	RELEASE
	libavcodec/mpegaudiodec.c
	libavcodec/pthread.c
	libavformat/options.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-21 23:11:27 +01:00
Janne Grunau
2473a45c85 threads: change the default for threads back to 1
Using threaded decoding by default breaks backward compatibility if
AVHWAccel is used or if an appliction sets threadunsafe callbacks.
Avconv and avplay still use -threads auto if not specified.
2012-01-21 13:26:44 +01:00
Janne Grunau
afb8b207d6 threads: update slice_count and slice_offset from user context
They are used to signal the number of slices and offsets of each slice
out of band to the decoder.
2012-01-21 13:26:44 +01:00
Dustin Brody
d2a0041c20 mpegaudiodec: switch error detection check to AV_EF_BUFFER
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-01-21 08:38:12 +01:00
Dustin Brody
f88949214c lavc: rename err_filter option to err_detect and document it
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-01-21 08:28:18 +01:00
John Brooks
9b6aafba6c mpegvideo: fix invalid memory access for small video dimensions
When either video dimension is only one macroblock, subtractions
based on v_edge_pos and the macroblock size may be negative. In
that situation, an unsigned comparison isn't sufficent to test for
MV overruns, because a limit of (unsigned)-1 will let any other
value pass.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-01-21 08:28:08 +01:00
Michael Niedermayer
99a42f3fa9 ac3dec: Move center&surround mix level tables to parser.
That way all mix levels as exported by the parser
will have the same meaning.

Previously the 3bit center mix level for eac3 was
used to index in a 4 entry table leading to out of array reads.
this change removes the table and offsets the ac3 variable by 4
so it matches the meanings for eac3 except the reserved case.
The reserved case is then explicitly handled.

Idea-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-21 05:29:47 +01:00
Michael Niedermayer
8f0768cc22 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  Add a tool that uses avio to read and write, doing a plain copy of data
  ARM: fix build with FFT enabled and MDCT disabled
  lavf: force single-threaded decoding in avformat_find_stream_info
  avidec: migrate last of lavf from FF_ER_* to AV_EF_*
  avserver: fix build after the next bump.

Conflicts:
	libavformat/Makefile
	libavformat/avidec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-21 01:33:31 +01:00
Felipe Contreras
c3d5e290ca ARM: fix build with FFT enabled and MDCT disabled
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-01-20 16:14:01 +00:00
Michael Niedermayer
48706f41e1 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mpeg12: check for available bits to avoid an infinite loop
  fate: add some shorthands to run groups of tests
  fate: Give some tests more sensible names.
  cosmetics: Rename ffsink to avsink.

Conflicts:
	avconv.c
	cmdutils.c
	cmdutils.h
	ffmpeg.c
	ffplay.c
	tests/fate/audio.mak
	tests/fate/demux.mak
	tests/fate/dpcm.mak
	tests/fate/image.mak
	tests/fate/lossless-audio.mak
	tests/fate/lossless-video.mak
	tests/fate/microsoft.mak
	tests/fate/pcm.mak
	tests/fate/real.mak
	tests/fate/screen.mak
	tests/fate/video.mak
	tests/fate/voice.mak
	tests/fate/wma.mak

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-20 02:14:54 +01:00
Michael Bradshaw
de07355026 Changed indexing in libopenjpeg to shorten lines 2012-01-19 23:31:22 +01:00
Carl Eugen Hoyos
df42dd7323 Support gray8a encoding with libopenjpeg.
Reviewed-by: Michael Bradshaw
Reviewed-by: Paul B Mahol
2012-01-19 23:31:22 +01:00
Carl Eugen Hoyos
e209a37777 Simplify 32bit png decoding. 2012-01-19 23:31:22 +01:00
Carl Eugen Hoyos
21a1006109 Support encoding 16bit pixel formats to sgi. 2012-01-19 23:31:22 +01:00
Carl Eugen Hoyos
b614c14767 Simplify 32bit pam decoding.
Reviewed-by: Paul B Mahol
2012-01-19 23:31:21 +01:00
Carl Eugen Hoyos
34aadeaa2c Simplify PIX_FMT_RGB555LE selection in targa decoder.
Suggested by Jean First.
2012-01-19 23:31:21 +01:00
Carl Eugen Hoyos
b4634a006c Simplify targa decoding on big endian. 2012-01-19 23:31:21 +01:00
Javier Cabezas
1406d9ddc6 DNxHD: frame multithreading
Signed-off-by: Javier Cabezas <jcabgz@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-19 17:12:43 +01:00
Jindřich Makovička
a85ce653fb mpeg12: check for available bits to avoid an infinite loop
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-01-19 14:14:21 +01:00
Michael Niedermayer
1ce8377c78 wmalossless: Fix incompatoble pointer type warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-19 08:51:56 +01:00
Michael Niedermayer
c130428ab5 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  avprobe, cmdutils: K&R formatting cosmetics
  tests: K&R formatting cosmetics for test programs
  lavf: free packets for muxers implementing interleave_packet().
  lavf: fix and extend av_interleaved_write_frame() doxy.
  mov: Remove dead stores for spherical coordinates for channel position.
  error_resilience: K&R formatting cosmetics
  RELEASE_NOTES: mention hiding private symbols in shared builds.
  RELEASE_NOTES: mention some notable API changes in 0.8

Conflicts:
	cmdutils.h
	doc/RELEASE_NOTES
	ffprobe.c
	libavcodec/error_resilience.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-19 01:19:38 +01:00
Reimar Döffinger
6fd4b8a6ef Replace a av_fast_malloc with av_fast_padded_malloc.
This one was missed in the previous fraps fix, the
allocation is exactly the same in both cases.
Fixes fraps-v5 under valgrind.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-18 22:04:14 +01:00
Reimar Döffinger
e8b060f7e7 Use av_fast_padded_malloc in mimic and truemotion2 decoders.
Fixes use of uninitialized data errors under valgrind.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-18 22:04:14 +01:00
Reimar Döffinger
f9ced97543 Use av_fast_padded_malloc in fraps and mpc decoders.
Fixes FATE failures due to uninitialized reads under valgrind
for these two codecs.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2012-01-18 21:22:01 +01:00
Donald Ovcharov
ac84f2edd4 error_resilience: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2012-01-18 18:10:01 +01:00
Michael Niedermayer
e49780f749 lavc: call ff_init_buffer_info() from default reget buffer.
This is needed in case the get_buffer() callback doesnt set
width/height.
Ideally all decoders would make calls through some wraper
to the callbacks and that wraper would call ff_init_buffer_info()
But until thats done, the default reget buffer must call this
itself as it needs the values for the changed size check later.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-18 16:25:36 +01:00
Michael Niedermayer
2fb65d3e55 lavc: when w/h changes in reget buffer, print the values.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-18 16:25:36 +01:00