Commit graph

346 commits

Author SHA1 Message Date
Thiago Santos
30b3aa3030 qtdemux: rework segment event handling for adaptive streaming
When a new time segment is received upstream is going to restart
with a new atom. Make the neededbytes and todrop variables
reflect that to avoid waiting too much or dropping the
initial bytes that contain the header.
2015-07-08 23:23:53 -03:00
Thiago Santos
38520a1e12 qtdemux: push data from adapter before starting new segment
The adapter might have data remaining from the previous segment,
push it all before clearing the adapter and starting a new segment.

It can accumulate data if it had pushed and got not-linked, returning
immediately without processing all the data. Before starting a new
segment this data should be handled.
2015-07-08 23:23:53 -03:00
Thiago Santos
ee7ddf6c67 qtdemux: flush samples before adding more from moof
Avoids accumulating all samples from a fragmented stream that could
lead to a 'index-too-big' error once it goes over 50MB of data. It
could reach that before 2h of playback so it doesn't take that long.

As upstream elements are providing data in time format they should
be the ones that have more information about the full media index
and should be able to seek if possible.
2015-07-08 11:53:44 -03:00
Thiago Santos
6ee4b31c0e qtdemux: rename upstream_newsegment to upstream_format_is_time
upstream_newsegment isn't really clear on what it means, it is set
to TRUE when the upstream element sends a segment in TIME format, so
rename it to be more clear about it.

It is important to know this because it means that upstream has
a notion of time and qtdemux is likely being driven by an upstream
element that is reading from a higher level abstraction than a file,
such as a DASH, MSS or DLNA element.
2015-07-08 11:53:44 -03:00
Thiago Santos
5994b30257 qtdemux: fix leak by flushing previous sample info from trak
In fragmented streaming, multiple moov/moof will be parsed and their
previously stored samples array might leak when new values are parsed.
The parse_trak and callees won't free the previously stored values
before parsing the new ones.

In step-by-step, this is what happens:

1) initial moov is parsed, traks as well, streams are created. The
   trak doesn't contain samples because they are in the moof's trun
   boxes. n_samples is set to 0 while parsing the trak and the samples
   array is still NULL.
2) moofs are parsed, and their trun boxes will increase n_samples and
   create/extend the samples array
3) At some point a new moov might be sent (bitrate switching, for example)
   and parsing the trak will overwrite n_samples with the values from
   this trak. If the n_samples is set to 0 qtdemux will assume that
   the samples array is NULL and will leak it when a new one is
   created for the subsequent moofs.

This patch makes qtdemux properly free previous sample data before
creating new ones and adds an assert to catch future occurrences of
this issue when the code changes.
2015-07-08 11:53:44 -03:00
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
Tim-Philipp Müller
8a0f4e74e4 qtdemux: stop parsing headers for fragmented mp4s at the first moof
Currently during header parsing, we scan through the entire file
and skip every moof+mdat chunk for fragmented mp4s, which makes
start-up incredibly slow. Instead, just stop at the first moof
chunk when have a moov, and start exposing the streams, so we
can go and start handling the moofs for real.
2014-11-30 15:30:04 +00:00
Edward Hervey
5b5e9f320f isomp4: Check presence of mfhd in moof
The 'mfhd' atom is mandatory in 'moof'. We can later on check whether
the fragment number properly increases
2014-11-26 16:36:39 +01:00
Jan Schmidt
61bbd2d226 qtdemux: Handle empty segments when seeking in reverse play.
Empty segments in an edit list have a media_start time of -1,
as they don't actually play any media. Allow for that when
aligning to the reference stream in reverse play.
2014-11-27 00:17:03 +11:00
Sanjay NM
26a1344f37 Miscellaneous minor cleanups
Fix redundant variables and assignments,
and unreachable breaks.

https://bugzilla.gnome.org/show_bug.cgi?id=736875
https://bugzilla.gnome.org/show_bug.cgi?id=736876
https://bugzilla.gnome.org/show_bug.cgi?id=736879
https://bugzilla.gnome.org/show_bug.cgi?id=736880
https://bugzilla.gnome.org/show_bug.cgi?id=736881
https://bugzilla.gnome.org/show_bug.cgi?id=736888
https://bugzilla.gnome.org/show_bug.cgi?id=736890
https://bugzilla.gnome.org/show_bug.cgi?id=736892
https://bugzilla.gnome.org/show_bug.cgi?id=736893
https://bugzilla.gnome.org/show_bug.cgi?id=736894
2014-09-24 00:45:31 +01:00
Matej Knopp
8a4931726d qtdemux: Handle mp4a without ESDS atom
https://bugzilla.gnome.org/show_bug.cgi?id=736986
2014-09-22 13:04:52 -03:00
Tim-Philipp Müller
884f81ba28 qtdemux: mark jpeg and png as parsed so avdec_mjpeg can be used too
https://bugzilla.gnome.org/show_bug.cgi?id=735971
2014-09-03 23:08:16 +01:00
Jan Schmidt
9375e90203 qtdemux: Silence some warnings for normal file contents 2014-09-03 23:47:49 +10:00
Thiago Santos
fa103ca5ad qtdemux: avoid crashing on dash streams
DASH/fragmented moov might have no samples as those are carried
in moof fragments. Avoid crashing or failing the stream because
of that.
2014-08-18 14:05:52 -03:00
Jan Schmidt
ca068865c3 qtdemux: Improve framerate calculation/guessing
Change the way the output framerate is calculated
to ignore the first sample (which is sometimes truncated
in my testing) and use the new gst_video_guess_framerate()
function to recognise common standard framerates better.

Remove the code that was sorting the first 20 sample
durations and then ignoring the result.
2014-08-15 01:12:20 +10:00
George Kiagiadakis
9dd48c503c qtdemux: forward DISCONT from upstream to the output streams
This makes sense in DASH reverse playback, where the upstream dashdemux
will download DASH segments in reverse order, but push their buffers
forward to qtdemux and mark each segment start as DISCONT. This needs
to be forwarded downstream to the parser/decoder, otherwise it won't work.

https://bugzilla.gnome.org/show_bug.cgi?id=734443
2014-08-11 10:28:14 +02:00
Tim-Philipp Müller
e8321af983 qtdemux: improve debug logging of fourccs
If we can't show ASCII, at least show them
in big endian order.
2014-08-09 20:50:01 +01:00
Tim-Philipp Müller
f41d03cd4d qtdemux: add support for 'wma ' mapping as found in some ismv files
e.g. To_The_Limit_720_2962.ismv
2014-08-09 20:49:53 +01:00
Tim-Philipp Müller
6183f83190 qtdemux: add support for 'vc-1' mapping as found in some ismv files
e.g. To_The_Limit_720_2962.ismv
2014-08-09 20:49:49 +01:00
Jan Schmidt
d9e1aa4959 isomp4/qtmux: Write correct file duration when gaps exist.
When writing out a trak with an edit list, make sure the
overall file duration is also updated to reflect the
lengthening of the stream.

Add some more debug to qtdemux to warn about streams that
are longer than the file and get truncated.
2014-08-08 04:01:19 +10:00
Tim-Philipp Müller
5122410f11 qtdemux: fix language code parsing for 3-letter codes starting with 'a'
And handle special value for 'unspecified' explicitly.

https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/QTFFChap4/qtff4.html
2014-07-21 18:21:50 +01:00
Jan Schmidt
8da6ee0312 isomp4: Add object type id and fourcc for DTS/DTS-HD
Enables playback for files with DTS audio tracks.
Also add an extra AC-3 variant fourcc from Nero
2014-06-26 19:57:41 +10:00
Thiago Santos
9fda7b107f qtdemux: avoid looping indefinitely in broken svq3 files
Abort if an atom with size 0 is read from within the svq3 stsd
atoms

https://bugzilla.gnome.org/show_bug.cgi?id=726512
2014-06-10 15:33:33 -03:00
Thiago Santos
c25d94b7ef qtdemux: upstream handles seek if fragmented and on time segment
Otherwise we can reject seeks on local files that contain fragmented-like
atoms like 'mvex'. Also improve a message log

https://bugzilla.gnome.org/show_bug.cgi?id=730722
2014-05-30 15:01:50 -03:00
Thiago Santos
2b454bf87f qtdemux: remove last flow return from stream struct
It is already stored on GstPad on core

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 19:51:12 -03:00
Thiago Santos
4b0ce7dc30 qtdemux: use GstFlowCombiner
Removes the common code to combining flow returns to let it be
handled by core gstutils' GstFlowCombiner

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 15:30:12 -03:00
Thiago Santos
d423b9f63e qtdemux: parse tkhd transformation matrix and add tags if appropriate
Handle the transformation matrix cases where there are only simple rotations
(90, 180 or 270 degrees) and use a tag for those cases. This is a common scenario
when recording with mobile devices

https://bugzilla.gnome.org/show_bug.cgi?id=679522
2014-05-24 15:38:54 -04:00
Thiago Santos
f0b99d96a9 qtdemux: add tag mappings for _swr, _mak and _mod tags
swr -> Application name
mak -> device manufacturer
mod -> device model
2014-05-23 03:15:42 -03:00
Edward Hervey
420661bd95 qtdemux: Fix leak of palette_data in error cases
CID #1212151
2014-05-12 16:56:35 +02:00
Eric Trousset
bd51aa7aa8 qtdemux: don't respond to a position query in BYTE format with a TIME position
https://bugzilla.gnome.org/show_bug.cgi?id=729553
2014-05-09 16:12:45 +01:00
Vincent Penquerc'h
b692539b55 qtdemux: guard against invalid frame size to avoid division by 0
Coverity 1139690
2014-05-02 09:49:32 +01:00
Vincent Penquerc'h
436c8c11a0 qtdemux: trivial typo fix 2014-05-02 09:49:17 +01:00
Luis de Bethencourt
5dc2e6bef1 qtdemux: check return from qt_demux_video_caps
Now qtdemux_video_caps() can return NULL. We need to check this return before
using it's value.

https://bugzilla.gnome.org/show_bug.cgi?id=728987
2014-04-26 20:51:36 -04:00
Tim-Philipp Müller
c9597298f9 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 23:35:17 +01:00
Luis de Bethencourt
c073a6c779 qtdemux: initialize caps pointer to null
Make sure the caps pointer returns initialized when using it in
qtdemux_parse_tree ().

https://bugzilla.gnome.org/show_bug.cgi?id=728987
2014-04-25 18:23:23 -04:00
Vincent Penquerc'h
595a9cb5c5 isomp4: fix incorrect masking for multiple tags
Coverity 206058
2014-04-16 17:44:50 +01:00
Jimmy Ohn
ecf188e6cd qtdemux: replace duplicated variable when parsing trex atom
https://bugzilla.gnome.org/show_bug.cgi?id=727878
2014-04-10 09:03:02 +02:00
Sebastian Dröge
d47806320d qtdemux: Properly return stream flags when parsing trex atom
https://bugzilla.gnome.org/show_bug.cgi?id=727867
2014-04-09 08:58:48 +02:00
Thiago Santos
7f1d51ba90 qtdemux: handle tags in mac encoding
Check the charset from (C)*** tags and set the charset
to convert from MAC encoding if suitable.

https://bugzilla.gnome.org/show_bug.cgi?id=723166
2014-02-13 12:37:03 -03:00
Thiago Santos
52fc078310 qtdemux: remove elst_offset variables
They are not used anymore
2014-01-15 15:33:45 -03:00
Thiago Santos
5fe1b3eb28 qtdemux: remember reverse playback when verifying the segment end
Check if the rate is positive or negative to correctly compare the current
position with the segment to make reverse playback work
2014-01-15 15:33:45 -03:00
Thiago Santos
90a5565229 qtdemux: do not ignore empty segments
Make sure empty segments are used and pushed with a gap event
to represent its data (or lack of it)

Each QtSegment is mapped into a GstSegment with the corresponding
media range. For empty QtSegments a gap event is pushed instead
of GstBuffers and it advances to the next QtSegment.

To make this work with seeks, need to keep track of the starting
'base' to make sure it remains consistently increasing when
pushing new segment events.
For example: if a seek makes qtdemux start from 5s, the first
segment will have a base=0. When the next segment is activated,
its base time will be QtSegment.time - qtdemux.segment_base so
that it doesn't include the first 5s that weren't played and
shouldn't be accounted on the running time

This purposedly will remove the fix made for
https://bugzilla.gnome.org/show_bug.cgi?id=700264, at this
point it was decided to respect the gaps, even if they cause
a delay on playback, because that's the way the file was crafted.

https://bugzilla.gnome.org/show_bug.cgi?id=345830
2014-01-15 15:33:45 -03:00
Thiago Santos
c1cd2f81f9 qtdemux: improve mss_mode/fragmented special handling
Make it clear what should be handled purely by mss mode:
1) Expose the streams on the first moof as there are no moov atoms
2) Properly cleanup streams on flushes

Add a note about the meaning of upstream_newsegment and mss_mode
for future reference.

Make all other special fragment handling shared for both dash
and mss streams.
2013-12-27 12:04:49 -03:00
Thiago Santos
a82f3418fd qtdemux: drain the adapter before pushing EOS
In a fragmented scenario, qtdemux is operating in push mode
and it gets a fragmented buffer. While processing its data
downstream gets unlinked (or a input-selector changes its
active pad and returns not-linked). Qtdemux stops processing
this fragment and returns not-linked upstream, leaving the
remaining data in its adapter.

When it gets an EOS it should make sure that all the data it
had received is pushed before pushing EOS.
2013-12-27 12:00:27 -03:00
Thiago Santos
1fd094d96b qtdemux: improve fragment-start tracking
Some buffers can have multiple moov atoms inside and the strategy
of using the gst_adapter_prev_pts timestamp to get the base timestamp
for the media of the fragment would fail as it would reuse the same
base timestamp for all moofs in the buffer instead of accumulating
the durations for all of them.

Heres a better explanation of the issue:
qtdemux receives a buffer where PTS(buf) = X
buf -> moofA | moofB | moofC

The problem was that PTS(buf) was used as the base timestamp for
all 3 moofs, causing all buffers to be X based. In this case we want
only moofA to be X based as it is what the PTS on buf means, and the
other moofB and moofC just use the accumulated timestamp from the
previous moofs durations.

To solve this, this patch uses gst_adapter_prev_pts distance
result, this allows qtdemux to calculate if it should use the
resulting pts or just accumulate the samples as it can identify
if the moofs belong to the same upstream buffer or not.

https://bugzilla.gnome.org/show_bug.cgi?id=719783
2013-12-04 10:36:38 -03:00
Thiago Santos
079dde49ed qtdemux: Use the timestamp of the moof as the base fragment start
In SmoothStreaming fragmented scenario, the timestamps are calculated
starting from the fragment buffer timestamp. When there is a not-linked
return from downstream, qtdemux will return upstream and will keep the
non-pushed data into its adapter.

On a new fragment buffer pushed to qtdemux, the new buffer timestamp
would overwrite the previous one that should be used on the still
to be pushed buffers. Because of this, this patch will also
update the fragment_start timestamp from the adapter last pts
to make sure the moof and timestamps are in sync and will result
in correct timestamps for all fragments.
2013-11-29 17:28:48 -03:00
Thiago Santos
45c16599ff qtdemux: avoid re-reading the same moov and entering into loop
In the scenario of "mdat | moov (with fragmented artifacts)" qtdemux
could read the moov again after the mdat because it was considering the
media as a fragmented one.

To avoid this loop this patch makes it store
the last processed moov_offset to avoid parsing it again.
And it also checks if there are any samples to play before
resturning to the mdat, so that it knows there is new data to be played.

https://bugzilla.gnome.org/show_bug.cgi?id=691570
2013-11-29 17:28:48 -03:00
Thiago Santos
fcc78aa3bd qtdemux: do not free streams if they were not created locally
When parsing a trak only free streams on failures if those streams
were created locally. They could have been created from a previous
fragment, in this case we they have valid info from the other fragment.
Including pads.

https://bugzilla.gnome.org/show_bug.cgi?id=691570
2013-11-29 17:28:48 -03:00
Tim-Philipp Müller
4278ab18ff qtdemux: fix compilation with gst debuging disabled
qtdemux.c:9452:1: error: label at end of compound statement
2013-11-29 09:21:52 +00:00
Jan Schmidt
b3b89dfec1 qtdemux: Add HydrogenAudio ReplayGain tags
Identical to the itunes (tm) version, but labelled with
org.hydrogenaudio.replaygain as the producer.
2013-11-28 22:36:44 +11:00
Jan Schmidt
fdfc6a2a86 qtdemux: Discard 2 byte subpicture packets
As for text subtitles and as suggested in #712643, throw
away the 2 byte terminator packets that some encoders insert.

This will make things better when remuxing and causes generation
of gap events.
2013-11-25 12:24:22 +11:00