Commit graph

342 commits

Author SHA1 Message Date
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
6e7930a10c qtmux: Make the default timescale 1/1800 second
The old default timescale of 1 millisecond produces irrational
numbers for a lot of framerate/audio-packet-duration multiples.
1/1800 is a nicer number, as it tends to produce better fractions
and therefore slightly higher accuracy overall
2014-08-15 13:03:52 +10: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
Edward Hervey
112d948b7e qtmux: Free node_header in error cases
CID #1212134
2014-05-12 16:53:32 +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
1be86ebb2a qtmux: handle 0 size packets without dividing by 0
Coverity 1139691
2014-05-02 10:21:09 +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
Vincent Penquerc'h
a5b7c12e35 isomp4: fix wrong atom flags set when adding samples
Coverity 206057
2014-04-16 17:44:50 +01:00
Vincent Penquerc'h
b344b29ff2 isomp4: catch fseek error
Coverity 206028
2014-04-16 17:44:50 +01:00
Vincent Penquerc'h
88eccee88c isomp4: report failures to caller
Coverity 206027
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
Stefan Sauer
9d9ffba17e isomp4mux: fix copy and paste
This fixes doc warnings.
2014-02-18 22:35:45 +01:00
Stefan Sauer
35da463618 docs: use the gtk-doc syntax to link to properties
Don't use docbook unless needed. Also stip other docbook tags in the the files we fix.
2014-02-18 22:35:00 +01: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
f5f27f7d0d qtmux: remove have_dts flag from pads
It was used in the past in 0.10 when there was no explicit DTS
field in buffers, now we have it in 1.x series and we can
check it directly with GST_BUFFER_DTS_IS_VALID
2014-02-07 13:10:25 -03:00
Thiago Santos
f89ba82f29 qtmux: improve support for sparse streams
Do not try to use subsequent buffer timestamps to calculate
sparse streams durations because the stream is sparse and
the buffers might not be 'time adjacent'. So rely on the
duration and give the option to the pad to provide
custom 'empty' buffers to represent the gaps in the
stream, this can vary on how the data is represented.

Right now, the only sparse stream supported is tx3g subtitles.
2014-02-07 13:10:24 -03:00
Thiago Santos
99e966e2e1 qtmux: add support for text/x-raw subtitles
Adds it to mp4mux, qtmux and gppmux.

Buffers need to be prefixed with 2 bytes for the text length before
being muxed.

https://bugzilla.gnome.org/show_bug.cgi?id=581295
2014-02-07 13:10:24 -03:00
Thiago Santos
d644cda79b qtmux: add support for the TX3G atoms
Adds functions for creating and setting values related to the
tx3g atom for raw text subtitle support.

QTFF spec has information on those atoms

https://bugzilla.gnome.org/show_bug.cgi?id=581295
2014-02-07 13:10:24 -03:00
Thiago Santos
2ae1897273 qtmux: add subtitle support to qtmuxmap structures
adds basic stubs for subtitle support around the qtmux and
qtmuxmap structures. Still no real subtitle implemented, but
basic functions in place

https://bugzilla.gnome.org/show_bug.cgi?id=581295
2014-02-07 13:10:24 -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
5adedf9f5a qtmux: respect the HDLR box string format for mov and isomedia
Mov spec says it uses a pascal style string, while isomedia uses
a null terminated one. Store the current atoms flavor into the HDLR
to be able to generate the correct output.

https://bugzilla.gnome.org/show_bug.cgi?id=705982
2014-01-09 11:58:46 -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
Sebastian Dröge
371482a90c qtdemux: Fix calcuation of descriptor length
https://bugzilla.gnome.org/show_bug.cgi?id=720813
2013-12-23 15:09:49 +01: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