Commit graph

531 commits

Author SHA1 Message Date
Víctor Manuel Jáquez Leal
e1834d1512 gst: Fix unintialized variable warnings
While cross-compiling with Linaro GCC 5.1-2015.08, it complained
about a couple unitialized variables.

This patch initializes them to zero.

https://bugzilla.gnome.org/show_bug.cgi?id=761094
2016-01-27 13:46:07 +01:00
Thiago Santos
0906d822ad qtdemux: drop flushes from our own offset seek
Prevents downstream from receiving flushes for a seek only in
upstream. Those seeks are only to start reading from the right
offset when skipping or returning to qt atoms.

https://bugzilla.gnome.org/show_bug.cgi?id=758928
2015-12-22 12:33:39 -03:00
Edward Hervey
d78d589627 qtdemux: Stop pushing data as soon as possible in push-mode
When working in push-mode, we attempt to push out everything currently
buffered in the adapter.

This has two pitfalls:
* We could stop earlier (the moment we get a non-ok or non-not-linked)
* We return the last combined flow return, which might be completely
  different from the previous combined flow return
2015-12-07 16:36:15 +01:00
Luis de Bethencourt
a400d504ca qtdemux: add support for Opus
Add support for demuxing Opus encapsulated in MP4 files, based on the
following spec: https://www.opus-codec.org/docs/opus_in_isobmff.html

https://bugzilla.gnome.org/show_bug.cgi?id=742643
2015-11-26 21:46:14 +00:00
Luis de Bethencourt
9d70682e73 qtdemux: use macro for codec_name
Use _codec() macro instead of duplicating code.
2015-11-25 22:48:36 +00:00
Thiago Santos
2dbc9f86fc qtdemux: restore the segment on case of soft reset
When seeking back to restore the mdat position a flush is pushed
through and it resets downstream segment information. Make sure
that after the flush (that does a soft reset) a segment will
be pushed again

Fixes regressions spotted at
https://ci.gstreamer.net/job/GStreamer-master-validate/2100/
2015-11-24 10:57:28 -03:00
Luis de Bethencourt
53f8f1abae qtdemux: unite duplicate FourCC
Unite in fourcc.h the FourCCs that are used twice or more in qtdemux
2015-11-20 11:05:51 +00:00
Luis de Bethencourt
ca6d71ef2a qtdemux: remove duplicate FourCC
Use the available FourCCs in fourcc.h instead of duplicating them.
2015-11-19 19:28:25 +00:00
Sebastian Dröge
cc119e6eb9 qtdemux: Replace tabs with spaces 2015-11-18 19:11:51 +02:00
Sebastian Dröge
b404b2239a qtdemux: Cast to signed integers to prevent unsigned compare between negative and positive numbers
This fixes seeking if the first entries in the samples table are negative. The
binary search would always fail on this as the array would not be sorted if
interpreting the negative numbers as huge positive numbers. This caused us to
always output buffers from the beginning after a seek instead of close to the
seek position.

Also add a case to the comparison function for equality.
2015-11-18 19:11:51 +02:00
Thiago Santos
8bcc733cec qtdemux: only send initial gaps for non-fragmented streams
It would be unusual to have the header segment with an 'edts' atom
indicating gaps at the beginning when handling fragmented streams.

The header usually doesn't contain any timestamping information, this
should come from the playlist/manifest and the segments with media
in those scenarios.

https://bugzilla.gnome.org/show_bug.cgi?id=758171
2015-11-17 09:42:07 -03:00
Thiago Santos
ef8cb05823 Revert "Revert "qtdemux: respect qt segments in push-mode for empty starts""
This reverts commit d842ff288a.

This was reverted by accident
2015-11-17 09:41:34 -03:00
Sebastian Dröge
d842ff288a Revert "qtdemux: respect qt segments in push-mode for empty starts"
This reverts commit 142d8e2d23.
2015-11-16 13:52:05 +02:00
Vineeth TM
0d4e3847f0 qtdemux: Fix string memory leak
The string got using g_strdup_printf will be allocated memory
and should be freed after use.

https://bugzilla.gnome.org/show_bug.cgi?id=758161
2015-11-16 10:22:16 +02:00
Thiago Santos
142d8e2d23 qtdemux: respect qt segments in push-mode for empty starts
In push-mode it is hard to support qt segments overall but it is
possible to support when the file isn't heavily edited but just contain
a segment to indicate a gap at the beginning. This also allows properly
timestamping data that has negative DTS in push-mode.

It is relevant to support those for 2 scenarios:

1) fragmented streaming
2) HTTP playback of 'regular' mp4

https://bugzilla.gnome.org/show_bug.cgi?id=753484
2015-11-09 11:49:27 -03:00
Philippe Normand
9f0c22e891 qtdemux: support for cenc auxiliary info parsing outside of moof box
When the cenc aux info index is out of moof boundaries, keep track of
it and parse the beginning of the mdat box, before the first sample.

https://bugzilla.gnome.org/show_bug.cgi?id=755614
2015-11-04 15:29:10 +00:00
Reynaldo H. Verdejo Pinochet
82bffe3eef qtdemux: add support for FFV1 coded streams in mov
https://bugzilla.gnome.org/show_bug.cgi?id=752495
2015-10-15 10:38:34 -07:00
Guillaume Desmottes
360a6509c7 qtdemux: fix caps leak
If the QtDemuxStream are re-used they may already have caps which used
to be leaked.

Reproduced using the
validate.dash.playback.seek_forward.dash_exMPD_BIP_TC1 validate
scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=756561
2015-10-14 14:42:19 +03:00
Vineeth TM
8283337e73 qtdemux: Fix taglist memory leak
Free the stream and its sub items instead of just the stream

https://bugzilla.gnome.org/show_bug.cgi?id=756544
2015-10-14 10:22:19 +03:00
Vineeth TM
b26ce7ba6d qtdemux: Fix memory leak for corrupted file
Free brands before overriding them.

https://bugzilla.gnome.org/show_bug.cgi?id=756226
2015-10-08 15:03:36 +01:00
Thiago Santos
df0a31b4ee qtdemux: handle empty segments in seeking adjust
If seeking targets an empty segment skip it as there is no media
offset to get from it. Instead look for the next one.

This doesn't make seeking in push-mode work if you seek to an
empty segment but at least won't get you to wrong offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=753484
2015-10-02 19:23:43 +01:00
Manasa Athreya
e6a4c81af5 qtdemux: Check multi trex to find track id in mp4 mpeg-dash stream
If stream has more than one trex box which is not matched to actual
track id, it makes qtdemux crashed.

Author : Manasa Athreya (manasa.athreya@lge.com)

https://bugzilla.gnome.org/show_bug.cgi?id=754864
2015-10-02 17:38:57 +03:00
Chris Bass
563ffc0d8f qtdemux: support timed-text subtitle tracks.
https://bugzilla.gnome.org/show_bug.cgi?id=752818
2015-09-26 00:51:42 +02:00
Sebastian Dröge
d7a0fd82c0 qtdemux: Accumulate segments for edit lists before activating the next segment
eceb2ccc73 broke segment seeks by always
accumulating segments manually when activating a segment. This is only
needed when handling edit lists, not when activating a segment because of a
seek. Do the accumulation when switching edit list segments instead.

This fixes segment seeks again, while keeping edit lists playback working.

https://bugzilla.gnome.org/show_bug.cgi?id=755471
2015-09-24 09:33:33 +02:00
Alex Ashley
5d99d0dfa0 qtdemux: fix offset calculation when parsing CENC aux info
Commit 7d7e54ce68 added support for
DASH common encryption, however commit
bb336840c0 that went onto master
shortly before the CENC commit caused the calculation of the CENC
aux info offset to be incorrect.

The base_offset was being added if present, but if the base_offset
is relative to the start of the moof, the offset was being added twice.
The correct approach is to calculate the offset from the start of the
moof and use that offset when parsing the CENC aux info.
2015-08-18 11:48:03 +01:00
Sebastian Dröge
e9aa4c7467 qtdemux: Use signed integer type to be able to check for negative subtraction results
CID 1315829
2015-08-16 13:04:02 +02:00
Thiago Santos
41a4b68390 qtdemux: only look for more samples in moofs in pull-mode
For playback of some fragmented formats with qtdemux it will
try to look for the next moof after finishing one but it is only
possible for pull-mode. For playback of streaming fragmented formats
such as DASH it should just not try to look for another moof but
instead wait for more data.

https://bugzilla.gnome.org/show_bug.cgi?id=752602

https://bugzilla.gnome.org/show_bug.cgi?id=752603
2015-08-15 11:06:02 -03:00
Thiago Santos
288b0bbb38 qtdemux: fix small typo in comment 2015-08-10 19:11:17 -03:00
Tim-Philipp Müller
604cc2a548 qtdemux: fix suboptimal queue iteration code 2015-08-10 12:45:50 +01:00
Tim-Philipp Müller
0fbf5f3d9e qtdemux: don't use glib 2.44-only API 2015-08-10 12:32:23 +01:00
Alex Ashley
7d7e54ce68 qtdemux: add support for ISOBMFF Common Encryption
This commit adds support for ISOBMFF Common Encryption (cenc), as
defined in ISO/IEC 23001-7. It uses a GstProtection event to
pass the contents of PSSH boxes to downstream decryptor elements
and attached GstProtectionMeta to each sample.

https://bugzilla.gnome.org/show_bug.cgi?id=705991
2015-08-10 12:32:17 +01:00
Thiago Santos
e0878d6325 qtdemux: store the moof-offset also for push mode
It will be used in some cases for getting the correct offsets
from trun atoms.

https://bugzilla.gnome.org/show_bug.cgi?id=752603
2015-08-05 18:12:45 -03:00
Thiago Santos
bb336840c0 qtdemux: handle default-base-is-moof flag
Handle the flag from the tfhd that signals the base offset to
start from the moof atom

https://bugzilla.gnome.org/show_bug.cgi?id=752603
2015-08-05 18:12:45 -03:00
Manasa Athreya
e6381ef285 qtdemux: fix 16-bit PCM audio advertised with 'raw ' fourcc
'NONE' and 'raw ' fourcc don't always contain U8 audio, it can
be more bits as well, in which case it's just like 'twos'.

https://bugzilla.gnome.org/show_bug.cgi?id=752613
2015-07-27 19:06:43 +01:00
Paul Hyunil
3740e69957 qtdemux: Support subtitle when track subtype is fourcc_subt
https://bugzilla.gnome.org/show_bug.cgi?id=752655
2015-07-21 12:24:15 +01:00
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
Thibault Saunier
a45d470236 qtdemux: Use GstVideoInfo helper to create caps for raw video
This way we do not miss mandatory fields in caps.
At the same time use the gst_pb_utils_get_codec_description
helper to get codec description.

https://bugzilla.gnome.org/show_bug.cgi?id=712335
2013-11-22 18:52:54 -03:00
Jan Schmidt
81e2c8130a isomp4: Handle mp4s subpicture streams better.
Clean up the handling of mp4s streams. Use the generic esds
descriptor function to extract the palette, instead of hard coding
a wrong magic offset.

Add some more size safety checks when parsing ES descriptors, and
replace magic numbers with the descriptive constants that are already
defined.

Enhance dump output for stsd atoms.

Streams from both bug 712643 and historic bug 568278 now both work
correctly.

Fixes: #712643
2013-11-21 02:28:27 +11:00
Jan Schmidt
b6f581eecc qtdemux: Merge all the fourcc headers into one
Remove qtdemux_fourcc.h and ftypcc.h and put it all in fourcc.h
2013-11-20 21:48:03 +11:00
Thiago Santos
cfdadd4114 qtdemux: remove math operation from loop
The elst_offset doesn't change inside the loop, so compute it
outside
2013-11-14 18:15:20 -03:00
Stefan Sauer
1a4e7338d9 qtmux: fix playback regression
In ae1150e85c flipping a condition misaligned the
else branch, where for there condition that was change there is none.
Fixes #712303
2013-11-14 20:56:36 +01:00
Thiago Santos
33ebda8ecf qtdemux: handle fragmented files with mdat before moofs
Assume a file with atoms in the following order: moov, mdat, moof,
mdat, moof ...

The first moov usually doesn't contain any sample entries atoms (or
they are all set to 0 length), because the real samples are signaled
at the moofs. In push mode, qtdemux parses the moov and then finds the mdat,
but then it has 0 entries and assumes it is EOS.

This patch makes it continue parsing in case it is a fragmented file so that
it might find the moofs and play the media.

https://bugzilla.gnome.org/show_bug.cgi?id=710623
2013-11-07 11:22:04 -03:00
Thiago Santos
0e78ffc9d6 qtdemux: When using a buffered mdat, store all received data for later use
In push mode, when qtdemux can't use a seek to skip the mdat buffer it has
to buffer it for later use.

The issue is that after parsing the next moov/moof, there might be some
trailing bytes from the next atom in the file. This data was being discarded
along with the already parsed moov/moof and playback would fail to continue
after the contents of this moov/moof are played.

This is particularly bad on fragmented files that have the mdat before the
corresponding moof. So you'd get:

mdat|moof|mdat|moof ...

When a moof was received, it usually came with some extra bytes that would
belong to the next mdat (because upstream doesn't care about atoms alignment).
So those bytes were being discarded and playback would fail.

This patch makes qtdemux store those extra bytes to reuse them later after the
mdat is emptied.

https://bugzilla.gnome.org/show_bug.cgi?id=710623
2013-11-07 11:22:03 -03:00
Thiago Santos
2eec7909aa qtdemux: check if the end_time is defined before using it
Avoids sending EOS too soon because of overflow. Can happen on
fragmented mp4 playback.
2013-10-25 11:30:36 -03:00
Thiago Santos
673301ef48 qtdemux: use correct unref function
Events aren't GstObjects, but GstMiniObjects
2013-10-23 13:38:56 -03:00
Stefan Sauer
ae1150e85c qtdemux: rename chunks_are_chunks to chunks_are_samples and flip the logic
As the variable name suggests, sometimes chunks are chunks. Rename the variable
to tell what they are when they are not chunks.
2013-10-15 09:53:30 +02:00
Stefan Sauer
6789ba1ece qtdemux: fix typos and add more logging for unhandled parts 2013-10-15 09:53:30 +02:00
Sebastian Dröge
21947f9d13 qtdemux: Add support for the mp2v fourcc for MPEG-2 video
https://bugzilla.gnome.org/show_bug.cgi?id=709270
2013-10-03 11:59:25 +02:00
Sreerenj Balachandran
e779b6587b qtdemux: Add HEVC support
https://bugzilla.gnome.org/show_bug.cgi?id=709093
2013-10-02 11:54:24 +02:00
Thiago Santos
dc02d91c14 qtdemux: add code to parse creation time earlier than 1970
Use g_date_time seconds manipulation to allow to cover the quicktime
spec for creation_time. It uses seconds since 1904.

Both paths could be done using the generic approach of seconds since
1904 with GDateTime handling, but the first path using seconds from
1970 should be more commonly found and avoids a few objects creation and
ref/unref, so keep it there for performance.

Additionally, the code for handling seconds since 1970 changed from >
to >= because having 0 seconds since 1970 is also a valid case for that
path to handle.

https://bugzilla.gnome.org/show_bug.cgi?id=707975
2013-09-24 15:16:54 -07:00
Thiago Santos
566b0dce40 qtdemux: only update stop position if seek requests it
Check for GST_SEEK_TYPE_NONE for stop poistion and only update
the stop time if it is requested. Otherwise just maintain whatever
was stored at the segment

https://bugzilla.gnome.org/show_bug.cgi?id=707530
2013-09-13 09:21:12 -03:00
Thiago Santos
be0eeae491 qtdemux: track streams that are EOS on push mode to finish earlier
When the segment has a defined stop position, qtdemux should check
when streams reach this position and mark those as EOS. When all
streams are EOS it will return GST_FLOW_EOS to upstream to allow
the pipeline to finish instead of continuously consume buffers
from upstream that are not useful for the segment.

https://bugzilla.gnome.org/show_bug.cgi?id=707530
2013-09-10 16:43:17 -03:00
Thiago Santos
33cf8b679d qtdemux: preserve stop of segment when doing seeks in push mode
When handling seeks in push mode, qtdemux converts the seek to bytes
and pushes upstream. It needs to keep track of the seek and the
subsequent segment to be able to map them back to the requested
seek time and properly preserve the segment stop of the seek.

This is done by using the start offset in bytes of the seek,
that should be the same of the segment from upstream. And this
is also backwards compatible with what qtdemux already was using.

https://bugzilla.gnome.org/show_bug.cgi?id=707530
2013-09-10 16:42:36 -03:00
Alex Ashley
a965185dee qtdemux: Add support for the avc3 sample entry format of the AVC file format
Amendment 2 of ISO/IEC 14496-15 (AVC file format) is defining a new
structure for fragmented MP4 called "avc3". The principal difference
between AVC1 and AVC3 is the location of the codec initialisation
data (e.g. SPS, PPS). In AVC1 this data is placed in the initial
MOOV box (moov.trak.mdia.minf.stbl.stsd.avc1) but in AVC3 this data
goes in the first sample of every fragment (i.e. the first sample in
each mdat box).  The principal reason for avc3 is to make it easier
for client implementations, because it removes the requirement to
insert the SPS+PPS in to the decoder pipeline every time there is a
representation change.

This commit adds support for the "avc3" atom, which is almost identical
to the "avc1" atom, except it does not contain any SPS or PPS data.

https://bugzilla.gnome.org/show_bug.cgi?id=702004
2013-09-04 13:33:22 +02:00
Thiago Santos
9549289a18 qtdemux: push buffers after segment stop until reaching a keyframe
This should make decoders able to precisely push buffers until the stop
time in case they need the next keyframe to do it.

Also, according to gst_segment_clip, it should only push a buffer that
the starting ts is strictly smaller than the segment stop, so we change
the min < comparison for <=
2013-08-28 12:58:56 -03:00
Chris Bass
3e9dea3f8c qtdemux: check denominator isn't zero before scaling duration.
When gst_qtdemux_configure_stream sets fps_d, check that n_samples is
non-zero before using it as a denominator to scale the stream duration.

https://bugzilla.gnome.org/show_bug.cgi?id=706076
2013-08-16 10:14:30 +02:00
Matej Knopp
2269ac8f28 qtdemux: elst should offset samples instead of buffers
The current approach where buffers are offset is not ideal, as during seek
and loop current time is compared to sample times.

https://bugzilla.gnome.org/show_bug.cgi?id=700264
2013-08-12 13:48:04 +02:00
Thibault Saunier
38946bd9f4 qtdemux: Fix compilation 2013-08-06 15:31:38 +02:00
Thibault Saunier
593a31f2b4 qtdemux: Raw buffer DTS should always be CLOCK_TIME_NONE 2013-08-06 15:17:44 +02:00
Sebastian Dröge
2e35b36aab gst: Don't swap start/stop for negative rates in the SEGMENT query 2013-07-29 12:12:41 +02:00
Matej Knopp
47ed79fb1c qtdemux: Check for data size when parsing h264 codec data from strf atom 2013-07-29 11:53:07 +02:00
Matej Knopp
2dcdfe07f7 qtdemux: Support H264 fourcc
https://bugzilla.gnome.org/show_bug.cgi?id=704996
2013-07-29 09:11:39 +02:00
Thiago Santos
e49b6e7c35 qtdemux: correctly handle seqnum for seeks and segments
Use the same seqnum on messages and events for derived events.
Fixed for flushes / stream-start / segment after a seek, and segment
after a segment.

Fixes #676242
2013-07-25 15:24:31 -03:00
Edward Hervey
3d48d25756 qtdemux: Add all the mpeg XDCAM variants
This should cover all known XDCAM variants (which are all mpeg2 video)

Fixes #672227
2013-07-23 15:03:31 +02:00
Sebastian Dröge
1a0278ed64 qtdemux: Add support for group-id in the stream-start event 2013-07-22 15:30:13 +02:00
Olivier Crête
96a8fb92e2 qtdemux: Add WRLE support 2013-07-19 14:58:30 -04:00
Tim-Philipp Müller
aa7d597120 qtdemux: make files from Vivotek camera play
Skip tracks of 'vivo' subtype with empty stsd instead of
erroring out saying that the file is broken.

https://bugzilla.gnome.org/show_bug.cgi?id=699791
2013-07-19 19:38:30 +01:00
Wim Taymans
bdd3c31902 qtdemux: simplify some helpers
Some helper functions are not needed anymore or can be simplified.
2013-07-19 17:26:54 +02:00
Wim Taymans
61a8937ced qtdemux: for non-raw video, move palette in caps
We only need to append the palette to raw video buffers, non-raw video has the
palette in the caps still.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=704292
2013-07-19 17:14:46 +02:00
Arnaud Vrac
40ab78825c qtdemux: nitpicking in esds parsing 2013-07-19 14:26:18 +02:00
Arnaud Vrac
d0d25a5e1f qtdemux: set proper caps for mpeg-1 audio
Remove AAC specific fields from mpeg-1 audio caps, remove assumption
that the mpeg1 audio layer is 3, and set `parsed' field.

https://bugzilla.gnome.org/show_bug.cgi?id=704548
2013-07-19 14:26:08 +02:00
Arnaud Vrac
5def061d20 qtdemux: remove chapter stream
Remove all streams that are actually table of contents, since we will
never need the data after parsing them.
2013-07-18 11:48:12 +02:00
Arnaud Vrac
ae67c13416 qtdemux: send gap event for sparse streams in push mode
This allows to pre-roll at least if the next subtitle buffer
is far away.
2013-07-18 11:48:11 +02:00
Arnaud Vrac
1237898351 qtdemux: do not use indexes from sparse stream when seeking in push mode
This makes seeking more accurate in push mode, since the previous
keyframe on a sparse stream might be far away.
2013-07-18 11:48:11 +02:00
Arnaud Vrac
e561d12655 qtdemux: advertise subtitle streams as sparse 2013-07-18 11:48:11 +02:00
Wim Taymans
4c97701650 qtdemux: extract the palette from stsd
Sometimes a palette is inside the stsd, extract it instead of always using
the default one
2013-07-17 15:17:19 +02:00
Wim Taymans
6b82c89562 qtdemux: add support for WRAW
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=704292
2013-07-17 09:57:17 +02:00
Wim Taymans
f698483bb3 qtdemux: palette is appended to buffers, not in caps
Fix the palette handling, in 1.0 we append the palette to the buffer instead of
placing it on the caps.

See also https://bugzilla.gnome.org/show_bug.cgi?id=704292
2013-07-17 09:57:16 +02:00
Arnaud Vrac
54bba4f60c qtdemux: reset segment on flush stop
cca2f555d1 introduces a regression, where the demux segment is not
reset on flush stop, so the next upstream segment event will calculate
an invalid base time on the new segment to be sent downstream.

https://bugzilla.gnome.org/show_bug.cgi?id=704255
2013-07-16 10:47:20 +02:00
Matej Knopp
ca32442f86 qtdemux: offset samples according to edit list
https://bugzilla.gnome.org/show_bug.cgi?id=700264
2013-07-15 09:59:23 +02:00
Matej Knopp
3111161e8a qtdemux: unselect instead of ignoring disabled track, detect chapter track
https://bugzilla.gnome.org/show_bug.cgi?id=704007
2013-07-12 11:45:33 +02:00
Matej Knopp
7b69f427f1 qtdemux: correct argument order in gst_util_uint64_scale_int_round
https://bugzilla.gnome.org/show_bug.cgi?id=703350
2013-07-10 09:20:17 +02:00
Matej Knopp
4053e1d6ac qtdemux: compute framerate from average sample duration
https://bugzilla.gnome.org/show_bug.cgi?id=703350
2013-07-01 12:53:17 +02:00
Wim Taymans
8428423c04 qtdemux: handle SEGMENT query 2013-06-20 11:31:22 +02:00
Sebastian Dröge
b001da2926 qtdemux: Disable usage of allocation queries
This can only reliably work if demuxers have a
separate streaming thread per srcpad. This should be
done in a demuxer base class, which integrates parts
of multiqueue

https://bugzilla.gnome.org/show_bug.cgi?id=701856
2013-06-19 11:07:48 +02:00
Alex Ashley
46a137c810 Avoid skipping moov atoms for fragmented MP4 files.
bug #700505

Following a representation change that causes a resolution change,
the video decoder fails to decode correctly. Dashdemux detects the
representation change and pushes a new caps event and an
initialization segment (a new moov atom) to the downstream qtdemux,
but it doesn't handle this new moov yet, it will only parse the
first one it receives.

This commit changes qtdemux to accept a new moov in a dash bitstream
switching scenario.
2013-06-19 01:44:22 -03:00
Thiago Santos
384e8f6c34 qtdemux: send stream-start only once for each stream
Do not send stream start again when reconfiguring a pad for new caps.
That is common for adaptive streams
2013-06-19 00:55:30 -03:00
Sebastian Dröge
adc9f0bd10 qtdemux: Do allocation query after exposing all pads and no-more-pads
Also configure video streams as early as possible.

Related https://bugzilla.gnome.org/show_bug.cgi?id=701856
but not fixing that.
2013-06-11 12:27:19 +02:00
Thiago Santos
7c12435f9b qtdemux: make sure taglist is writable before adding tags
Avoids assertions
2013-06-02 15:37:06 -03:00
Thiago Santos
78dfdee2aa qtdemux: effectively skip tracks that weren't listed on the 1st moov
Without this, stream is NULL and the code will try to access it, leading
to segfaults.
2013-06-02 13:06:15 -03:00
Thiago Santos
70fca21c28 qtdemux: skip redundant check
!got_moov is already checked the line above
2013-06-02 13:06:15 -03:00
David Schleef
318cd39c3e qtdemux: Add error if file has playready drm 2013-05-21 18:21:49 -07:00
Thiago Santos
55caa99ccd qtdemux: Do not expect EOS after a segment event if upstream is mss
In case qtdemux is handling a mss stream, do not mark the stream to wait
for EOS after a segment. Even if it seems to be the last one according to
the current streams information.

MSS handling is different here because there is another demuxer driving
the pipeline
2013-05-16 16:50:49 -03:00
Thiago Santos
5517e352ab qtdemux: only set channels and rate if qtdemux knows it
Setting both of those to 0 is pointless and means that qtdemux
doesn't know the real value. Avoid setting it in this case.
2013-05-16 16:50:49 -03:00
Arnaud Vrac
6edcc564ba qtdemux: set alac caps using info from codec buffer
The samplerate field in the STSD atom is not right for some ALAC files
(usually when audio is 96kHz/24bits), so the audio caps must be
extracted from the codec data.

https://bugzilla.gnome.org/show_bug.cgi?id=700382
2013-05-15 18:42:11 +01:00
Thiago Santos
a0e934e72e qtdemux: push new caps events when caps change
Whenever the demuxer has a new caps on a stream, it should set the
new_caps variable to true and a new caps event will be pushed before
the next buffer
2013-05-07 19:29:17 -03:00
Thiago Santos
725faab590 qtdemux: do not push discont buffers if they aren't discont
qtdemux takes its buffers from a GstAdapter. Those buffers are created
from the larger buffer that it obtained from upstream and they carry
the same flags, including DISCONT if it is set. In these cases, all
buffers that qtdemux is going to push would be marked as DISCONT.

This scenario can make parsers/decoders flush on every buffer leading
to no decoding at all hapenning. This patch prevents this by unsetting
the flag if it shouldn't be set.
2013-05-07 19:29:17 -03:00
Thiago Santos
4d073beeee qtdemux: some code cleanup for mss handling code
* Explicitly init variables for fragmented formats at init
* Do not use GstClockTime type if the variable isn't a timestamp
* Fix a style/readability issue at an if block
* Group 2 mss mode conditional blocks together to improve readability

Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:29:17 -03:00
Thiago Santos
d1b91c755c qtdemux: avoid storing non-time newsegments to push later
This can confuse downstream when they get a byte segment after receiving
the natural time segment from qtdemux that it sends when starting to
push buffers. This is specially the case with parsers that try to
convert the position from byte to time format and might miss the
correct position for playback to start.
2013-05-07 19:29:17 -03:00
Thiago Santos
895525b5cb qtdemux: avoid setting fields to non-writable caps 2013-05-07 19:29:17 -03:00
Wim Taymans
544d926732 qtdemux: don't send so many segment events
Only send one segment event in the beginning of the stream, not
after each moov and moof atom.

Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:29:17 -03:00
Wim Taymans
d9cd4fcc17 qtdemux: place incomming timestamps on output
Place the incomming timestamp (if any) directly onto the outgoing buffers
and interpollate other timestamps.

Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:29:17 -03:00
Thiago Santos
cca2f555d1 qtdemux: improve reset of internal status
Reset different variables on state changes to ready and when
handling a flush-stop. For handling flush stops we should check
if there is an upstream adaptive demuxer driving the pipeline as this
means that qtdemux will get a new moov atom. For 'standard' isomedia
streams this isn't true and qtdemux should keep the previous moov
information around.

Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:29:17 -03:00
Thiago Santos
6c69e59677 qtdemux: prepare qtdemux to accept multiple dash moovs in a row
Whenever dashdemux switches bitrates it sends a new moov with the
new stream configuration. qtdemux should now handle this by splitting
the exposing and configuration of streams into separate functions. When
the stream is new it is configured and exposed, when it is a new bitrate
of an existing stream it is only reconfigured.

Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:25:30 -03:00
Andre Moreira Magalhaes (andrunko)
2a7d3d1598 qtdemux: Move FLUSH_STOP/PAUSED_TO_READY handling to a reset method.
Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:18:03 -03:00
Louis-Francis Ratté-Boulianne
d499b461da qtdemux: Remove old pads when exposing streams and other general fixes.
Conflicts:
	gst/isomp4/qtdemux.c
2013-05-07 19:18:03 -03:00
Thiago Santos
a3c19eeea1 qtdemux: handle mss streams
smoothstreaming streams should be handled as a special kind of
fragmented isomedia. In MSS the fragments will not contain a
'moov' atom with the media descriptions, this has to be extracted
from the caps.

Additionally, there should be another demuxer upstream that is likely
going to be the one to answer/act on queries and events, so qtdemux has
to forward those upstream.
2013-05-07 19:18:03 -03:00
Yury Delendik
4bc06859d1 qtdemux: add support for VP6F VP6 flash codec
https://bugzilla.gnome.org/show_bug.cgi?id=699010
2013-04-27 09:39:45 +01:00
David Schleef
a55ccff854 qtdemux: check value inside enda to set endianness 2013-04-09 13:30:17 -07:00
David Schleef
53f8b05b08 Use %03u for format in gst_pad_create_stream_id_printf() 2013-03-25 18:57:08 -07:00
Matej Knopp
f29e62c131 qtdemux: make empty subtitle buffer recognition more robust
https://bugzilla.gnome.org/show_bug.cgi?id=696244
2013-03-23 11:24:23 +00:00
David Schleef
5bd2864101 qtdemux: split large raw audio samples
In order to deal with a file that has samples that are 24 seconds
long.  Seeking still doesn't work with such files.
2013-03-22 14:14:05 -07:00
Rodolfo Schulz de Lima
874808fd2c qtdemux: fix sample leak when processing private qt tags
https://bugzilla.gnome.org/show_bug.cgi?id=696355
2013-03-22 08:47:17 +00:00
Matej Knopp
49d9050e9a qtdemux: send GAP events for subtitle streams
https://bugzilla.gnome.org/show_bug.cgi?id=696244
2013-03-21 10:03:37 +00:00
Matej Knopp
516a0b8acb qtdemux: ignore empty subtitle buffers
https://bugzilla.gnome.org/show_bug.cgi?id=696244
2013-03-21 10:03:34 +00:00
Matej Knopp
f494635126 qtdemux: recognize SBTL subtype for subtitles
https://bugzilla.gnome.org/show_bug.cgi?id=696244
2013-03-21 10:03:14 +00:00
Tim-Philipp Müller
677bfecc6f qtdemux: add variant field to H.263 caps
avdec_h263 won't get plugged otherwise.
2013-03-02 13:59:52 +00:00
Arnaud Vrac
1cff6427f1 qtdemux: skip disabled tracks
ISO/IEC 14496-12 specifies disabled tracks should be completely
ignored, so just do it.

Avoids deadlock during prerolling for some files.

Also prevents 'chapter' subtitle tracks from showing up.

https://bugzilla.gnome.org/show_bug.cgi?id=693993
https://bugzilla.gnome.org/show_bug.cgi?id=628790
2013-03-02 13:54:23 +00:00
Tim-Philipp Müller
5b19be933b qtdemux: fix up dodgy code that tries to fix up a broken moov atom
After gst_buffer_new_and_alloc() gst_buffer_copy_into() will likely
append to the already-existing memory instead of filling it.
2013-02-18 20:04:05 +00:00
Tim-Philipp Müller
34b81f7c93 qtdemux: fix potential crash on short MOOV atom
Don't unmap short MOOV atom buffer twice, which happened
in the case where we don't fix up the MOOV atom.

Fixes crashes when thumbnailing partial mp4 file where
the MOOV atom is still incomplete.

https://bugzilla.gnome.org/show_bug.cgi?id=694010
2013-02-18 16:35:08 +00:00
Michael Smith
e3430b0d07 qtdemux: extract codec_data for ProRes 2013-02-12 13:19:53 -08:00
Youness Alaoui
f6a00ad6e9 qtdemux: set interleaved layout correctly for LPCM audio
https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:44:01 +00:00
Youness Alaoui
a76524ea08 qtdemux: add support for LPCM fourcc (uncompressed audio in Quicktime7)
https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:43:57 +00:00
Youness Alaoui
69b814546a qtdemux: print all debug for sound sample description v2
https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:43:49 +00:00
Youness Alaoui
92ff8a9b09 qtdemux: sound sample description v2 doesn't override samples_per_packet
https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:43:42 +00:00
Youness Alaoui
ee3d9cbd98 qtdemux: pass stsd data to qtdemux_audio_caps()
We will need that later for LPCM format support. Disable
QDM2 parsing of stsd data which dead code before as well
because data was always NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:43:38 +00:00
Youness Alaoui
6d3ff78575 qtdemux: add len check for sound sample descriptions v1 and v2
https://bugzilla.gnome.org/show_bug.cgi?id=663458
2013-01-28 23:43:28 +00:00
Mark Nauwelaerts
a1a579afeb qtdemux: push mode: only parse moov 1 once
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=691570
2013-01-27 12:54:20 +01:00
Tim-Philipp Müller
314efb684b qtdemux: avoid criticals if unknown fourcc has space at beginning or end
https://bugzilla.gnome.org/show_bug.cgi?id=682936
2012-11-25 14:16:09 +00:00
Tim-Philipp Müller
230cf41cc9 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:07:18 +00:00
Michael Smith
a88caf84b4 qtdemux: read video format header fully (so we can find 'pasp' atoms) for more fourccs.
Fixes aspect ratio of prores files.
2012-10-25 12:18:50 -07:00
Arnaud Vrac
bc79fe565c qtdemux: use correct type for channel-mask bitmask
Fixes crash on 32-bit systems.
2012-10-24 12:54:08 +01:00
Michael Smith
150bd97e96 qtdemux: with raw audio, set a default channel-mask for multichannel audio.
This doesn't actually parse 'chan' because it's absurdly complex.
2012-10-22 22:34:43 -07:00
Wim Taymans
199aaa4021 qtdemux: add support for 'generic' samples
Add support for stuffing a complete stream into 1 sample.

See https://bugzilla.gnome.org/show_bug.cgi?id=686550
2012-10-22 11:39:37 +02:00
Tim-Philipp Müller
aa3ba65eb5 qtdemux: don't leak gst_riff_strf_auds in case of MS/RIFF audio
https://bugzilla.gnome.org/show_bug.cgi?id=681192
2012-10-19 19:26:45 +01:00
Tim-Philipp Müller
e9682b938a qtdemux: don't assert if upstream size is not available when guessing bitrates
Fixes abort in push mode where the source is not seekable and the
size of the file is not available, as with

  cat foo.mp4 | gst-launch-1.0 playbin uri=fd://0

Less noticable with releases, since we disable all
g_assert() there.

https://bugzilla.gnome.org/show_bug.cgi?id=686008
2012-10-13 00:08:01 +01:00
Michael Smith
d60c9ce2a4 qtdemux: support more different fourcc values for other ProRes variants. 2012-10-12 14:35:49 -07:00
Michael Smith
1026970347 qtdemux: 24 bit audio here is S24LE, not S24_3LE. 2012-09-20 18:01:52 -07:00
Michael Smith
4f015c594c qtdemux: add support for prores
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=683839
2012-09-12 10:18:53 +02:00
Mark Nauwelaerts
f12ef67f56 ext, gst: only activate in pull mode if upstream is seekable 2012-09-11 17:44:51 +02:00
Wim Taymans
a374217786 qtdemux: don't reset segment
Don't reset the segment because we need the values for accumulation. the segment
is reset at start and after a flushing seek. Fixes some problems with files with
quicktime segments.
2012-09-11 11:59:54 +02:00
Tim-Philipp Müller
6dc7b4c3c7 video/x-3ivx and video/x-xvid -> video/mpeg,mpegversion=4
If it ever turns out that we really must use thoe specific
fourccs and not the generic one, we can still add a flavor
field to the caps later.
2012-09-10 00:43:24 +01:00
Tim-Philipp Müller
fb0f3c17f5 text/plain + text/x-pango-markup -> text/x-raw 2012-09-02 02:50:50 +01:00
Mark Nauwelaerts
e523b42d41 qtdemux: port segment event creation to 0.11 2012-08-28 19:01:11 +02:00
Mark Nauwelaerts
748304ced7 qtdemux: release extra event ref when replacing pending newsegment event 2012-08-28 16:28:29 +02:00
David Corvoysier
d0eed20428 isomp4: add DASH tfdt box support
MPEG DASH has defined a set of new boxes to specify duration, indexes and
offsets of ISOBMFF fragments.

The Track Fragment Base Media Decode Time (tfdt) Box can in particular be
included inside a traf box to specify the absolute decode time, measured on the
media timeline, of the first sample in decode order in the track fragment.

This information can be used by the isomp4 demux to find out the current position of
an MP4 fragment in the timeline.

This patch adds code to isomp4 to:
- parse the tfdt box
- adjust the time/position member of the new segment sent when playback starts

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=677535
2012-08-28 16:28:27 +02:00
Tim-Philipp Müller
4bb52bbadf docs: gst-launch -> gst-launch-1.0 and ffmpegcolorspace -> videoconvert 2012-08-27 21:20:30 +01:00
Tim-Philipp Müller
bce47066ca video/x-dvd-subpicture -> subpicture/x-dvd 2012-08-20 23:30:38 +01:00
Sebastian Dröge
7b5925b5a4 gst: Add stream-id to stream-start events 2012-08-06 13:43:57 +02:00
Tim-Philipp Müller
c074bfd0b9 gst_tag_list_free -> gst_tag_list_unref 2012-08-04 16:10:16 +01:00
René Stadler
75ee20ec67 qtdemux: fix double unref of private tag buffer 2012-08-01 12:16:41 +02:00