Commit graph

291 commits

Author SHA1 Message Date
Thiago Santos 63f35eeb12 qtdemux: fix index size check and debug message
It is allocating samples_count + n_samples, not only n_samples
2015-07-08 11:53:44 -03:00
Thiago Santos f40c1f8b09 qtdemux: avoid looping reading the 'moof' atom forever
It gets stuck if it only finds a moof and no mfra/mfro or moov
atoms. Skip the moof to continue the parsing to have it either
play or error out.

https://bugzilla.gnome.org/show_bug.cgi?id=745089
2015-07-06 11:00:20 -03:00
Gilbok Lee 0dcd76447a qtdemux: does not detect orientation
Most files don't contain the values for transposing the coordinates
back to the positive quadrant so qtdemux was ignoring the rotation
tag. To be able to properly handle those files qtdemux will also ignore
the transposing values to only detect the rotation using the values
abde from the transformation matrix:

[a b c]
[d e f]
[g h i]

https://bugzilla.gnome.org/show_bug.cgi?id=738681
2015-06-25 00:24:21 -03:00
Thiago Santos eceb2ccc73 qtdemux: accumulate previous edts entries into segment.base
Allows playing edts editted files with proper synchronization of
streams. This patch fixes the regression introduced by
bf95f93c01 that was added to fix
segment seeks handling.

Having the accumulated_base separated from the main segment.base
allows handling both segment seeks and edts editted files.

https://bugzilla.gnome.org/show_bug.cgi?id=751361
2015-06-23 22:34:36 -04:00
Thiago Santos aef61c2251 qtdemux: improve some debug messages
Those messages are about the stream, use the pad as the
debug object to make it clear from the logs

https://bugzilla.gnome.org/show_bug.cgi?id=751361
2015-06-23 22:34:35 -04:00
Jan Schmidt b7cbfe1fa1 qtdemux: Move multiview caps calculations, add half-aspect heuristics
Move the multiview caps calculations to the configure_stream()
function, so the rest of the video info is available, and
use the gst_video_multiview_guess_half_aspect() function to
determine if the half-aspect flag should be set on frame-packed
video.
2015-06-23 11:58:41 +10:00
Nicolas Dufresne dd72267a8d qtdemux: Add cslg support
The cslg atom provide information about the DTS shift. This is
needed in recent version of ctts atom where the offset can be
negative. When cslg is missing, we parse the CTTS table as proposed
in the spec to calculate these values.

In this implementation, we only need to know the shift. As GStreamer
cannot transport negative timestamps, we shift the timestamps forward
using that value and adapt the segment to compensate. This patch also
removes bogus offset of ctts_soffset, this offset shall be included
in the edit list.

https://bugzilla.gnome.org/show_bug.cgi?id=751103
2015-06-22 17:51:49 -04:00
Nicolas Dufresne 135e516730 qtdemux: Adjust segment according to ctts offset
In presence of a CTTS, the segment start/stop must be offset so
the segment start/stop include the PTS. This is needed since the
PTS cannot be negative in this format. This fixes issues where the
running time of the first buffer isn't at the start.

https://bugzilla.gnome.org/show_bug.cgi?id=740575
2015-06-12 17:18:24 -04:00
Jan Schmidt fff76157d8 qtdemux: Add basic support for MPEG-A stereoscopic video
The MPEG-A format provides an extension to the ISO base media
file format to store stereoscopic content encoded with different
codecs like H.264 and MPEG-4:2. The stereo video media information(svmi)
atom declares the presence and storage method for the video.

Stereo video information for MPEG-A can also be supplied through
the 'stvi' atom (ref: ISO/IEC_14496-12, ISO/IEC_23000-11), which
is not implemented in this patch.

Also missing is support for stereo video encoded as separate video tracks
for now.

Based on a patch by Sreerenj Balachandran <sreerenj.balachandran@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=611157
2015-06-11 12:11:42 +10:00
Vineeth TM 720ff75c72 qtdemux: fix reverse playback
When performing seek, segment->start is being updated with desired_offset,
but in case of reverse playback segment->start should be 0 and
segment->stop should be updated with desired offset.

https://bugzilla.gnome.org/show_bug.cgi?id=750675
2015-06-10 10:41:13 +02:00
Thiago Santos d03b9513f1 qtdemux: remove fixme from 2006
It has been verified by use over time.
2015-05-25 08:47:47 -03:00
Thiago Santos fc0a184592 qtdemux: fix reverse playback of fragmented media
qtdemux creates a samples array and gets the timestamps for buffers by
accumulating their durations. When doing reverse playback of fragments,
accumulating samples will lead to wrong timestamps as the timestamps
should go decreasing from fragment to fragment and the accumulation
will produce wrong results.

In this case, when receiving a discont for fragmented reverse playback,
the previous samples information should be flushed before new data
is processed.
2015-05-25 08:46:18 -03:00
Paul Hyunil 3792e9ca9b qtdemux: fix example pipeline in docs
The gst-launch script for example launch line to test qtdemux is
missing a queue before the decodebins, otherwise the gst-launch-1.0
command won't work.

https://bugzilla.gnome.org/show_bug.cgi?id=749054
2015-05-08 11:06:31 +01:00
Tim-Philipp Müller 377c8405aa qtdemux: fix buffer leak on eos in push mode
Based on patch by Guillaume Desmottes.

scenario: validate.http.playback.seek_with_stop.raw_h264_1_mp4

https://bugzilla.gnome.org/show_bug.cgi?id=748617
2015-04-30 13:35:16 +01:00
Sebastian Dröge 178f0a4522 qtdemux: Check for sizes of the rdrf (redirect) atom before accessing the data and use g_strndup() instead of g_strdup()
Thanks to Ralph Giles for reporting this.
2015-04-29 19:41:29 +02:00
Vincent Penquerc'h f02ad47998 qtdemux: fix tag list leaks on error paths 2015-04-16 13:10:22 +01:00
Vincent Penquerc'h 765faa306a qtdemux: fix tag list leak on unknown stream type 2015-04-16 13:10:21 +01:00
Hyunjun Ko 7fbd1b472f qtdemux: Update segment.start after key-unit seek
When doing key uint seek, qtdemux calls gst_qtdemux_adjust_seek
to get proper offset. And then this offset is set to
segment.position and segment.time in gst_qtdemux_perform_seek but
segment.start is not updated.

After that, application sends segment query,
qtdemux sets start and stop to query using gst_segment_to_stream_time. Due
to the wrong value in segment.start, the stop position is smaller than
it should.

https://bugzilla.gnome.org/show_bug.cgi?id=746822
2015-04-10 10:12:50 -03:00
Sebastian Dröge bf95f93c01 qtdemux: Don't accumulate segment bases manually
gst_segment_do_seek() does that for us already, and doing it twice
will break non-flushing seeks in interesting ways. Leftover from 1.0
porting.

Also copy over segment offset and applied_rate, just in case.
2015-04-06 20:17:52 -07:00
Thiago Santos aeb4d32363 qtdemux: stbl_index is valid from 0 onwards
It indicates the last sample parsed, not the next one to parse.
As it starts in -1, any value from 0 onwards means that it has
some valid data.
2015-04-06 19:29:03 -03:00
Jan Schmidt ffa5fce094 qtdemux: Guard against 64-bit overflow
For large-file atoms, guard against overflow in the size field,
which could make us jump backward in the file and cause
infinite loops.
2015-04-03 23:07:07 +11:00
Mark Nauwelaerts 71b0b8d943 qtdemux: resurrect some flow return handling
https://bugzilla.gnome.org/show_bug.cgi?id=744572
2015-03-29 13:58:56 +02:00
Matej Knopp f75e443a7a qtdemux: fix key unit seek
Unlike many other seek flags, the KEY_UNIT seek
flag is not copied over into the GstSegment,
since it's only relevant for the seek itself,
so we need to pass it explicitly to the seek
handler here.

https://bugzilla.gnome.org/show_bug.cgi?id=745339
2015-03-01 13:06:55 +00:00
Thibault Saunier fa0870658d qtdemux: All segment resulting from a seek should have the same seqnum
https://bugzilla.gnome.org/show_bug.cgi?id=744983
2015-02-23 20:05:20 +01:00
Thiago Santos 84b7cf6795 qtmux: remove not needed condition
gst_buffer_replace can handle NULL inputs by itself
2015-02-18 10:36:06 -03:00
Thiago Santos a12e41c106 qtdemux: prefer the tfdt timestamp over the buffer's that is less accurate
The tfdt should be more accurate as the buffer timestamp is provided
by the fragmented format manifest and it might just be an approximation.
2015-02-18 09:57:48 -03:00
Edward Hervey 6798dc7912 isomp4: Redefine gst_isoff_ symbols to gst_isoff_qt_
We need different symbol names, because these symbols are also present
in the fragmented plugin ... which will cause conflicts when doing
static linking
2015-02-17 12:31:06 +01:00
Thiago Santos afa5481c50 qtdemux: do not use sparse streams in push-based seeking
Using the sparse streams can make the push-based seeking return
too far in the stream. It also can lead to issues as the
sparse streams will be ignored when restarting playback and,
 if the sparse stream is the one that has the earliest sample,
it will confuse qtdemux's offsets as one stream will have
an earlier offset than the demuxer's one which might lead to
early EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=742661
2015-02-14 11:36:11 -03:00
Philippe Normand 3a9b0188cd qtdemux: Initial 'sidx' atom parsing support
Parse the 'sidx' atom and update the total duration according to the
parser result. The isoff parser code is imported from
gst-plugins-bad's dashdemux and a gst_isoff_sidx_parser_add_data()
function was factored out of the gst_isoff_sidx_parser_add_buffer()
function.

https://bugzilla.gnome.org/show_bug.cgi?id=743578
2015-02-12 14:23:21 -03:00
Jan Schmidt a3059bec1f qtdemux: Simple implementation of GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS
When the trickmode key-units flag is set on the segment, simply skip
any sample on a video stream that isn't a keyframe
2015-02-04 21:58:31 +11:00
Thiago Santos 75dee31b0d qtdemux: parse stream tags
Keep global and stream tags separately and parse the udta node
that can be found under the trak atom. The udta will contain
stream specific tags and will be pushed as such

https://bugzilla.gnome.org/show_bug.cgi?id=692473
2015-02-02 14:05:51 -03:00
Thiago Santos 9a9d4eccea qtdemux: simplify segment.base math
Remove a fix for heavily edited files added for fixing
https://bugzilla.gnome.org/show_bug.cgi?id=345830 to work
with seeks and proper gaps playback. The fix was replaced
for a more general solution that bases on using previous
segment's duration, just like it works for media segments
playback.

https://bugzilla.gnome.org/show_bug.cgi?id=743518
2015-01-28 15:20:58 -03:00
Thiago Santos 2586a219f6 qtdemux: Fix data dropping for fragmented streams
For fragmented streams with extra data at the end of the mdat
qtdemux was not dropping those bytes and would try to use
that extra data as the beginning of a new atom, causing the
stream to fail.

https://bugzilla.gnome.org/show_bug.cgi?id=743407
2015-01-27 08:54:19 -03:00
Sebastian Dröge d5aab81a77 Constify some static arrays everywhere 2015-01-21 09:55:53 +01:00
Vincent Penquerc'h d854cfff9d qtdemux: fix deadlock seeking in files without seek entries
A mutex unlock was missing.

https://bugzilla.gnome.org/show_bug.cgi?id=739975
2015-01-19 17:49:54 +00:00
Sebastian Dröge b7134435ee qtdemux: v210 is v210, not UYVY and yuv2 is YUY2, not I420
Also add a few other raw video formats we support: v308, v216
and add comments for a few others we don't support yet.

https://developer.apple.com/library/mac/technotes/tn2162/
2015-01-13 19:05:40 +01:00
Thiago Santos 3e0be85840 qtdemux: fix stream time conversion
Use the right macro to convert to the correct scale or the
segment information will be wrong

https://bugzilla.gnome.org/show_bug.cgi?id=742572
2015-01-09 11:40:40 -03:00
Edward Hervey 6b69ef24a1 qtdemux: Fix debug statement
It was using the non-increasing offset variable, which made that statement
not so useful :)
2014-12-12 11:06:17 +01:00
Edward Hervey d1ae39d6d6 qtdemux: Add macros for the various timescale conversions
This helps make the code more readable and avoid future bad usage of
scaling function argument order.
2014-12-12 11:03:15 +01:00
Jan Schmidt de8d00348e qtdemux: Copy flags of the overall segment to output segments
Preserve the segment flags of the overall demux segment on the output
segments for each pad.
2014-12-12 00:56:49 +11:00
Edward Hervey 9a903c994f qtdemux: Fix rounding errors in duration update
Make sure we store updated segment stop/duration with the same
granularity as the duration timescale.

And add more debug
2014-12-10 17:39:17 +01:00
Edward Hervey b40cfcfffb qtdemux: Update duration when we get more information
When dealing with fragmented files, we will get more accurate duration
information via the mfra and moof atoms.

In order for playback to not stop at the initial duration (from the
moov atom), we need to check and update the various duration variables
when we find more information.

Fixes playback of fragmented files in pull mode
2014-12-10 16:55:44 +01:00
Edward Hervey 799609583e qtdemux: Remove variable assignments never read
As detected by clang/scan-build
2014-12-10 15:09:25 +01:00
Edward Hervey 7828f73516 qtdemux: Use GstClockTime for nanosecond-based time variables/fields
Avoids confusion with timescaled-based variables and bytes (offset)
variables.
And use GST_CLOCK_TIME_NONE where applicable
2014-12-10 15:09:25 +01:00
Jan Schmidt f4ca3c255a qtdemux: More fixes for reverse playback
When seeking or finding the previous keyframe, do
comparisons against targets and segments using composition time
to correctly decide which sample times match.
2014-12-04 22:53:07 +11:00
Jan Schmidt b3d1ab5267 qtdemux: Handle seeks past EOS as a seek to the end
Fix reverse playback of every frame by making seeks past/to EOS
find the last segment and start there.
2014-12-03 13:23:35 +11:00
Thiago Santos 148da6210a qtdemux: don't use GST_CLOCK_TIME_NONE in non GstClockTime variables
Use -1 instead as those are gint64/guint64 variables and not GstClockTime
2014-12-02 00:46:35 -03:00
Tim-Philipp Müller d65c3bbe7e qtdemux: implement seeking in fragmented mp4 files in pull mode based on the mfra table 2014-11-30 15:33:13 +00:00
Tim-Philipp Müller 77f37a6b22 qtdemux: use track fragment decoding time (tfdt) in parse_trun() for interpolation
As fallback if we don't have any existing samples
as reference point yet.

Based on patch by David Corvoysier <david.corvoysier@orange.com>
2014-11-30 15:33:13 +00:00
Tim-Philipp Müller e24f903b13 qtdemux: parse mfra random access box for fragmented mp4 files
If it's present, and we operate in pull mode.
2014-11-30 15:33:13 +00:00