Commit Graph

99 Commits

Author SHA1 Message Date
Tomas Härdin
54cbbdd25a mxfdec: Remove unused variables 2011-12-20 09:59:29 +01:00
Tomas Härdin
6e9081f4d8 mxfdec: Make sure x < index_table->nb_ptses
Without this the demuxer will SIGSEGV on files with IndexEntryCount < IndexDuration
2011-12-20 09:58:37 +01:00
Tomas Härdin
085249a379 mxfdec: Ignore the last entry in Avid's index table segments
The last entry is the total size of the essence container.
Previously a TemporalOffset error would be logged, even though segments like
these are expected.
2011-12-20 09:18:44 +01:00
Tomas Härdin
0e764cf541 mxfdec: Don't parse slices or DeltaEntryArrays
The most recent demuxing/seeking code doesn't need them
2011-12-16 11:54:08 +01:00
Tomas Härdin
f98726551c mxfdec: Remove dead/useless code 2011-12-16 11:54:07 +01:00
Tomas Härdin
2eba8da675 mxfdec: Hybrid demuxing/seeking solution
This uses the old demuxing code for OP1a and separate demuxing code for OPAtom.
Timestamp output is added to the old demuxing code.
The seeking code is made to seek to the start of the desired EditUnit only,
from which the normal demuxing code takes over (if OP1a). This means we don't
use delta entries or slices, only StreamOffsets.
OPAtom seeking basically works like before.
This also makes D-10 seeking behave the same way as OP1a and OPAtom. In other
words, we allow seeking before the start or past the end for D-10 too.
This fixes ticket #746.
2011-12-16 11:54:03 +01:00
Tomas Härdin
36c305f9db mxfdec: Add mxf_edit_unit_absolute_offset()
This maps an EditUnit in an index table to the corresponding absolute offset
in the file.
2011-12-16 11:48:02 +01:00
Tomas Härdin
b56adc7842 mxfdec: Replace zero IndexDurations with st->duration
The mxf_d10 muxer outputs files with zero IndexDurations..
2011-12-16 11:48:02 +01:00
Tomas Härdin
2212e040b7 mxfdec: Add "fake" index to MXFIndexTable to assist seeking
This changes mxf_compute_ptses() to be used for MXFIndexTable, and also adds
code for computing the fake index to it.
This also temporarily disables PTS computation. A future patch will restore it.
2011-12-16 11:45:40 +01:00
Tomas Härdin
8ce41721a4 mxfdec: Add MXFIndexTables
This structs collects MXFIndexTableSegments belonging to one IndexSID and some
other bits of useful information.
2011-12-16 11:32:52 +01:00
Tomas Härdin
31029e30fa mxfdec: Move mxf_read_packet*() near the bottom of the file
This simplifies future commits.
2011-12-16 11:32:52 +01:00
Tomas Härdin
7d531e83b6 mxfdec: Set DTS and PTS on video packets
This involves computing DTS/PTS from the index tables.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Tomas Härdin
8a2cb2abbf mxfdec: Only sort IndexTableSegments once
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Tomas Härdin
0bcada9f61 mxfdec: Add Avid's essence element key
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Tomas Härdin
1e14bfc117 mxfdec: Add support for Avid indexes
These indexes duplicate every entry and have the total size of the essence
container as the last entry.
This patch also computes the size of the packets when unknown.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Tomas Härdin
89cc8c17df mxfdec: Check slice_count before freeing slice_offset_entries
This fixes SIGSEGV on sliceless (single stream) VBR files

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Tomas Härdin
c0ee522df6 mxfdec: Bring back accumulated_offset that was removed in 5e67e3e
I thought it had to do with file offsets, but's actually the offset inside
the essence container.
In other words, unbreak multiple EditUnitByteCounts.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-12-12 18:34:37 +01:00
Carl Eugen Hoyos
5207f9597e Separate mxf_essence_container_uls for audio and video.
It is a really bad idea to assign a video codec id
when we have set codec_type to audio and vice versa.

Fixes ticket #721.
2011-12-10 14:58:57 +01:00
Reimar Döffinger
2483f53693 mxfdec: do not try to use an obviously broken index.
Also fixes a memleak.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
2011-12-10 13:19:24 +01:00
Tomas Härdin
ddcf3e0535 mxfdec: Index table driven demuxing and seeking
This adds OPAtom support and proper seeking.
D-10 and non-seekable OP1a streams still use the old demuxing/seeking code.
2011-12-08 20:28:49 +01:00
Tomas Härdin
5e67e3eac2 mxfdec: Compute packet offsets properly
This replaces the old essence_offset code
2011-12-08 19:13:18 +01:00
Tomas Härdin
5fb800f49a mxfdec: Use MaterialPackage - Track - TrackID instead of the system_item hack 2011-12-08 19:11:57 +01:00
Tomas Härdin
fd34dbea58 mxfdec: Parse more values in PartitionPack
These values include KAGSize, HeaderByteCount and IndexByteCount.
The length of the pack itself is also stored, and KAGSize is sanity checked.
The FATE sample has KAGSize == 0, which is adjusted to 512.
Other bad KAGSizes are set to 1.
2011-12-08 19:11:16 +01:00
Tomas Härdin
7560c26495 mxfdec: Parse TemporalOffsets 2011-12-08 18:19:48 +01:00
Tomas Härdin
623128d782 mxfdec: av_dlog():ify 'no corresponding source package found'
This isn't an error. It's also expected behavior for OPAtom files.
2011-12-08 18:19:48 +01:00
Tomas Härdin
336246238e mxfdec: Compute essence container offsets and lengths into mxf->partitions 2011-12-08 18:19:44 +01:00
Tomas Härdin
289bc14449 mxfdec: Make mxf->partitions sorted by offset
This also zeroes new entries for good measure (used by future patches).
2011-12-08 11:06:23 +01:00
Tomas Härdin
e5f9c8927b mxfdec: Parse ThisPartition 2011-12-07 17:43:36 +01:00
Tomas Härdin
dcd30b83b4 mxfdec: Speed up metadata and index parsing
Specifically, this means parsing as before until we run into essence.
At that point we seek to the footer and parse until EOF. After that we start
seeking backward to the previous partition and parse that until we run into
essence or the next partition. This procedure is repeated until we encounter
the last partition we parsed in the forward direction.

The end result of all this is that large essence containers aren't needlessly
parsed. This speeds up parsing large files a lot.
2011-12-07 17:22:02 +01:00
Tomas Härdin
e1914b5a2f mxfdec: Make sure DataDefinition is consistent between material track and source track
This fixes 0001GL.MXF.V1.mxf_opatom.mxf and 0001GL00.MXF.A1.mxf_opatom.mxf
getting two streams each due to both using the same SourcePackageID.
2011-12-07 16:26:09 +01:00
Tomas Härdin
1170749b39 mxfdec: Add EssenceContainer UL found in 0001GL00.MXF.A1.mxf_opatom.mxf 2011-12-07 16:26:09 +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
Tomas Härdin
fd1cea6549 mxfdec: Add hack that adjusts the n_delta calculation when system items are present
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-18 15:33:44 +01:00
Tomas Härdin
7ddb0607f3 mxfdec: Parse IndexTableSegments and convert them into AVIndexEntry arrays
Based on work by Georg Lippitsch <georg.lippitsch@gmx.at>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-18 15:33:36 +01:00
Clément Bœsch
eef3ea8c71 Rename remaining ByteIOContext to AVIOContext. 2011-11-14 07:22:30 +01:00
Michael Niedermayer
4354788a89 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  tls: Use ERR_get_error() in do_tls_poll
  indeo3: Fix a fencepost error.
  mxfdec: Fix comparison of unsigned expression < 0.
  mpegts: set stream id on just created stream, not an unrelated variable
  ra288: return error if input buffer is too small
  ra288: utilize DSPContext.vector_fmul()
  ra288: use memcpy() to copy decoded samples to output
  mace: only calculate output buffer size once
  Remove redundant filename self-references inside files.
  indeo3data: add missing config.h #include for HAVE_BIGENDIAN
  x86: drop pointless ARCH_X86 #ifdef from files in x86 subdirectory
  avplay: reset rdft when closing stream.
  doc/git-howto: expand format-patch and send-email notes.
  lavf: expand doxy for some AVFormatContext fields.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-11-09 02:59:49 +01:00
Alex Converse
735e601be1 mxfdec: Fix comparison of unsigned expression < 0.
'size' is populated by functions returning int64_t and int that return
negative error codes.
2011-11-08 10:59:52 -08:00
Michael Niedermayer
6faf0a21e1 Merge remote-tracking branch 'qatar/master'
* qatar/master: (53 commits)
  probe: Restore identification of files with very large id3 tags and no extension.
  probe: Remove id3 tag presence as a criteria to do file extension checking.
  mpegts: MP4 SL support
  mpegts: MP4 OD support
  mpegts: Add support for Sections in PMT
  mpegts: Replace the MP4 descriptor parser with a recursive parser.
  mpegts: Add support for multiple mp4 descriptors
  mpegts: Parse mpeg2 SL descriptors.
  isom: Add MPEG4SYSTEMS dummy object type indication.
  aacdec: allow output reconfiguration on channel changes
  nellymoserenc: take float input samples instead of int16
  nellymoserdec: use dsp functions for overlap and windowing
  nellymoserdec: do not fail if there is extra data in the packet
  nellymoserdec: fail if output buffer is too small
  nellymoserdec: remove pointless buffer size check.
  lavf: add init_put_byte() to the list of visible symbols.
  seek-test: free options dictionary after use
  snow: do not draw_edge if emu_edge is set
  tools/pktdumper: update to recent avformat api
  seek-test: update to recent avformat api
  ...

Conflicts:
	doc/APIchanges
	libavcodec/mpegaudiodec.c
	libavcodec/nellymoserdec.c
	libavcodec/snow.c
	libavcodec/version.h
	libavcodec/wmadec.c
	libavformat/avformat.h
	libavformat/mpegts.c
	libavformat/mxfdec.c
	libavformat/utils.c
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-29 02:08:54 +02:00
Anton Khirnov
a2faa95151 lavf: make some seeking functions private
Specifically av_update_cur_dts(), av_seek_frame_binary() and
av_gen_search().

They are not supposed to be called outside lavf.
2011-10-28 09:23:24 +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
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
Michael Niedermayer
41f55277fa Merge remote-tracking branch 'qatar/master'
* qatar/master: (34 commits)
  h264: reset h->ref_count in case of errors in ff_h264_decode_ref_pic_list_reordering()
  error_resilience: fix the check for missing references in ff_er_frame_end() for H264
  4xm: prevent NULL dereference with invalid huffman table
  4xmdemux: prevent use of uninitialized memory
  4xm: clear FF_INPUT_BUFFER_PADDING_SIZE bytes in temporary buffers
  ptx: check for out of bound reads
  tiffdec: fix out of bound reads/writes
  eacmv: check for out of bound reads
  eacmv: fix potential pointer arithmetic overflows
  adpcm: fix out of bound reads due to integer overflow
  anm: prevent infinite loop
  avsdemux: check for out of bound writes
  avs: check for out of bound reads
  avsdemux: check for corrupted data
  AVOptions: refactor set_number/write_number
  AVOptions: cosmetics, rename static av_set_number2() to write_number().
  AVOptions: cosmetics, move and rename static av_set_number().
  AVOptions: split av_set_string3 into opt type-specific functions
  avidec: fix signed overflow in avi_sync()
  mxfdec: Fix some buffer overreads caused by the misuse of AVPacket related functions.
  ...

Conflicts:
	Changelog
	configure
	libavcodec/ptx.c
	libavcodec/ra144.c
	libavcodec/vaapi_vc1.c
	libavcodec/vc1.c
	libavcodec/version.h
	libavformat/4xm.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-11 03:42:43 +02:00
Alex Converse
0c46e958d1 mxfdec: Fix some buffer overreads caused by the misuse of AVPacket related functions. 2011-10-10 09:40:26 -07:00
Tomas Härdin
d377deaaa3 mxfdec: Move FooterPartition to MXFContext and make sure it's never set to zero
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-10-10 17:40:34 +02:00
Tomas Härdin
3e48dceac0 mxfdec: Consider QuantizationBits between 17 and 24 to be pcm_s24*
This fixes playback of BRD38772509.mxf

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-27 15:15:54 +02:00
Joakim Plate
a3f4fc813d [mxfdec] Check return value of avio_seek and avoid modifying state if it fails 2011-09-14 19:53:45 +02:00
Philip de Nier
47886e3644 mxfdec: skip to end of structural sets This fixes reading of partition packs. The code stops reading after the operational pattern and should skip the array of essence container labels that follow 2011-09-12 18:17:49 +02:00
Tomas Härdin
9289eada91 Parse MXF partitions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2011-09-02 20:40:54 +02:00
Michael Niedermayer
faba79e080 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  mxfdec: Include FF_INPUT_BUFFER_PADDING_SIZE when allocating extradata.
  H.264: tweak some other x86 asm for Atom
  probe: Fix insane flow control.
  mpegts: remove invalid error check
  s302m: use nondeprecated audio sample format API
  lavc: use designated initialisers for all codecs.
  x86: cabac: add operand size suffixes missing from 6c32576

Conflicts:
	libavcodec/ac3enc_float.c
	libavcodec/flacenc.c
	libavcodec/frwu.c
	libavcodec/pictordec.c
	libavcodec/qtrleenc.c
	libavcodec/v210enc.c
	libavcodec/wmv2dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2011-07-30 06:46:08 +02:00