Commit graph

389 commits

Author SHA1 Message Date
David Evans 2ad30254c3 qtdemux: Add support for FLAC encapsulated in ISOBMFF
As defined by
https://git.xiph.org/?p=flac.git;a=blob_plain;f=doc/isoflac.txt

https://bugzilla.gnome.org/show_bug.cgi?id=773712
2016-11-18 18:03:30 +02:00
Seungha Yang e5b3d9257d qtdemux: Don't modify upstream TIME segment
TIME segment implies that stream/running time is being handled by upstream.
So, we shouldn't override it without any clue.
This patch is for fixing seek in DASH streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=774196
2016-11-15 14:46:34 +02:00
Jan Schmidt 324cc4dc4a isomp4: Don't use gst_video_colorimetry_to_string_full()
The API was reverted. Just use the plain
gst_video_colorimetry_to_string() function.
2016-11-02 11:46:07 +11:00
Sebastian Dröge 68b0441a5e qtdemux: Fix compiler warning
qtdemux.c: In function ‘qtdemux_parse_tree’:
qtdemux.c:10139:16: error: ‘color_table_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
             if (color_table_id != 0) {
                ^
qtdemux.c:10121:19: note: ‘color_table_id’ was declared here
           guint16 color_table_id;
                   ^~~~~~~~~~~~~~
2016-11-01 21:00:15 +02:00
Sebastian Dröge 7b565475bf qt: Add support for ProRes 4444 XQ
And also 4444 in the muxer.

https://bugzilla.gnome.org/show_bug.cgi?id=769048
2016-11-01 20:41:22 +02:00
Sebastian Dröge ec7f699604 qtdemux: Read colorimetry information from colr atom if available
https://bugzilla.gnome.org/show_bug.cgi?id=772181
2016-11-01 20:41:22 +02:00
Vincent Penquerc'h 5a889647ba qtdemux: extract interlaced information from jpeg video
This information is hidden in a small chunk of data.
Format found at https://developer.apple.com/standards/qtff-2001.pdf,
page 92, "Video Sample Description", under table 3.1.

https://bugzilla.gnome.org/show_bug.cgi?id=767771
2016-11-01 20:10:23 +02:00
Enrique Ocaña González 69fc488392 qtdemux: Use the tfdt decode time on byte streams when it's significantly different than the time in the last sample
We consider there's a sifnificant difference when it's larger than on second
or than half the duration of the last processed fragment in case the latter is
larger.

https://bugzilla.gnome.org/show_bug.cgi?id=754230
2016-11-01 20:07:39 +02:00
Xabier Rodriguez Calvar 415ae458d2 qtdemux: offset is irrelevant when no crypto info
Cause later it will try to use the crypto info array to get an index and
attach on of the positions as buffer's crypto info.

https://bugzilla.gnome.org/show_bug.cgi?id=770951
2016-09-10 11:29:55 +03:00
Xabier Rodriguez Calvar 92075e0256 qtdemux: Fix crash with no cenc aux offset
https://bugzilla.gnome.org/show_bug.cgi?id=770951
2016-09-07 09:58:22 +03:00
Thibault Saunier 150edef830 Use the new API to post flow ERROR messages on the bus
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-26 19:23:26 -03:00
Sebastian Dröge 45db90fdb0 qtdemux: When receiving a DISCONT buffer that does not point to a sample, remember the offset
And don't just reset everything. This makes sure that we can continue to
handle data in the following scenario:

moov: discont
moof: discont
mdat: continuous

Previously this would fail because the offset would be the accumulated offset
from moov and moof at the mdat position, while the buffer offset might be
something completely different.
2016-07-28 17:58:16 +03:00
Edward Hervey 85b0c3a83d qtdemux: Let upstream events go through upstream
There's no real reason to avoid sending QOS/NAVIGATION events upstrea.
Some elements might want to have that information.
2016-07-08 15:00:28 +02:00
Luis de Bethencourt a85dbfc246 qtdemux: fix AAC codec_data values
As seen in the parent switch for object_type_id, the 4 possible values are
0x40, 0x66, 0x67 and 0x68. Fixing the nested switch to match these values.

Looks like it was a typo making them decimal instead of hexadecimal.

CID 1363328
2016-07-06 12:47:18 +01:00
Sebastian Dröge df454fa28f qtdemux: Invent AAC codec_data if none is present
Without, raw AAC can't be handled and we have some information available in
the decoder that most likely allows us to decode the stream in one way or
another. This is the same code already used by matroskademux for the same
reasons, and ffmpeg/vlc play such files just fine too by guesswork.
2016-07-04 16:55:32 +02:00
Edward Hervey e3923df800 qtdemux: Handle upstream GAP in push-mode/time segment
This is to handle cases where upstream handles the fragmented streaming in TIME
segments and sends us data with gaps within fragments. This would happen when dealing
with trick-modes.

When upstream (push-based, TIME SEGMENT) wishes to send discontinuous samples,
it must obey the following rules:
* The buffer containing the [moof] must have a valid GST_BUFFER_OFFSET
* The buffers containing the first sample after a gap:
 * MUST start at the beginning of a sample,
 * MUST have the DISCONT flag set,
 * MUST have a valid GST_BUFFER_OFFSET relative to the beginning of the fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=767354
2016-07-01 14:21:04 +02:00
Seungha Yang 231018bcfe qtdemux: Push caps only when it was updated
Commit 7873bede31 caused new caps
event per moof without consideration of duplication.

https://bugzilla.gnome.org/show_bug.cgi?id=768268
2016-07-01 11:37:20 +02:00
Edward Hervey 30d2918ab0 qtdemux: Show state name in debugging
Makes it easier to trace what's going on
2016-06-07 18:40:14 +03:00
Edward Hervey 7d309d3f4b qtdemux: Remove useless variable
That variable is only needed for a debug statement, move it there
2016-06-07 18:40:14 +03:00
Edward Hervey d8f1a6c58e qtdemux: Add/Fix comments on the various structure variables
No variables were added/removed. This was just a good excuse to:
* Comment what most variables are used for (and when)
* Order them in such a way as to show first the common variables used
  in all cases, followed by those only used in push-mode
2016-06-07 18:40:14 +03:00
Edward Hervey 6f1eed7f02 qtdemux: Remove unused structure
Let's just remove it, been commented for 7+ years :)
2016-06-07 18:40:14 +03:00
Sebastian Dröge 24862c2f74 qtdemux: Forward segments directly if we are operating in PUSH mode on fragmented streams
We shouldn't go through segment activation as we will only have a limited
understanding of how the whole stream timeline looks like from the moof. We
only know about the current fragment, while upstream knows about the whole
stream.

This fixes seeking in DASH streams, both for seeks after the current moof and
for seeks into the current moof. The former would fail because the moof ends
and we can't activate any segment, the latter would cause a segment that stops
at the moof end, and no further fragments would be played because we end up
being EOS.

https://bugzilla.gnome.org/show_bug.cgi?id=767071
2016-06-07 16:19:39 +03:00
Sebastian Dröge 4498e57c10 qtdemux: Use the demuxer segment instead of a new one for MSS streams
Upstream might have told us something about the to be expected segment, so
let's use that information instead of coming up with a [0,-1] segment.

https://bugzilla.gnome.org/show_bug.cgi?id=767071
2016-06-01 09:32:03 +03:00
Sebastian Dröge 84e698c531 qtdemux: Only activate segments and send SEGMENT events if we have streams
But in that case also remove the pending newsegment event, otherwise we would
later send a possibly outdated event.

https://bugzilla.gnome.org/show_bug.cgi?id=767071
2016-06-01 09:32:03 +03:00
Sebastian Dröge f8eb909d90 qtdemux: In PULL mode, nothing is ever going to send us a SEGMENT event
https://bugzilla.gnome.org/show_bug.cgi?id=767071
2016-06-01 09:32:03 +03:00
Sebastian Dröge f3e68164e4 qtdemux: Don't override TIME segments from upstream that we just saw
The point of d8fb7a9c96 was to not have any
spurious segments stored for later if we do BYTES->TIME conversion, but
overriding any TIME segments from upstream does not make any sense.

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

https://bugzilla.gnome.org/show_bug.cgi?id=767071
2016-06-01 09:32:03 +03:00
Sebastian Dröge 7cd9d34c80 qtdemux: Set seek event seqnum on all SEGMENT events
Some were forgotten.

See https://bugzilla.gnome.org/show_bug.cgi?id=765935
2016-05-20 11:15:44 +03:00
Seungha Yang 56e273bc21 qtdemux: Parsing elst box based on version
segment_duration and media_time should be parsed based on version
of elst box. Specification defines that an elst box with version 1
has uint64 and int64 values for segment_duration and media_time,
respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=766301
2016-05-15 13:10:03 +03:00
Thiago Santos 00f23053b1 qtdemux: improve edts segment handling after seeks in push mode
Properly handle edts segments for push-based operation seeking.
We only support edts that a single segment that has media at the end,
being preceeded by any number of gap segments.

This also allows the qt segment rate to be respected after seeks

https://bugzilla.gnome.org/show_bug.cgi?id=765669
2016-05-09 11:46:46 -03:00
Thiago Santos 6604614dc5 qtdemux: properly activate segment with rate != 1.0
Also use the qt rate to identify the position within a qt segment
to properly translate playback time to qt media time

https://bugzilla.gnome.org/show_bug.cgi?id=765669
2016-05-09 10:49:53 -03:00
Thiago Santos c70ed4c914 qtdemux: update segment when new duration is found
Otherwise the old segment will have a shorter stop time and would
cause the stream to end too early.
2016-05-05 09:30:48 -03:00
Thiago Santos a5e02e948b qtdemux: dismember activate_segment into 2 parts
One that updates and push a new segment, the other will move the
stream to the new segment starting position
2016-05-05 09:30:48 -03:00
Sebastian Dröge e0b26059ae qtdemux: Store the segment sequence number in the EOS events and SEGMENT_DONE events/message
Also instead of storing it per stream, store it globally in the demuxer. It's
the same for each stream anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=765806
2016-04-29 15:13:34 +03:00
Seungha Yang cde45a41a5 qtdemux: Do not use unreliable framerate
timescale/1 is unreliable value for framerate. Due to downstream
element usually use framerate generated by qtdemux, let it be omitted
until the framerate can be reliably calculated.

https://bugzilla.gnome.org/show_bug.cgi?id=764733
2016-04-21 12:53:48 +03:00
Sebastian Dröge 707c69cb72 Revert "qtdemux: expose streams with first moof for fragmented format"
This reverts commit d8bb6687ea.

https://bugzilla.gnome.org/show_bug.cgi?id=764733
2016-04-21 12:53:33 +03:00
Alex Ashley 0c4cc14533 qtdemux: support seeking of CENC encrypted streams
When playing a stream that has been protected by DASH CENC, playback
will fail if a seek is performed. Qtdemux produces the error "stream
is protected using cenc, but no cenc protection system information
has been found" and playback stops.

The problem is that gst_qtdemux_reset() gets called as part of the
FLUSH during a seek. This function frees the protection_system_ids
array. When gst_qtdemux_configure_protected_caps() is called after the
seek has completed, the protection_system_ids array is empty and
qtdemux is unable to create the correct output caps for the protected
stream.

This commit changes it to only free the protection_system_ids on
hard resets.

https://bugzilla.gnome.org/show_bug.cgi?id=761787
2016-04-20 12:19:51 -03:00
Luis de Bethencourt 1bb9d9c682 qtdemux: check stream is available in PIFF parser
qtdemux->streams is an array, it will never evaluate to true when comparing
to NULL. Instead we want to check the number of streams to make sure the
stream is available.

https://bugzilla.gnome.org/show_bug.cgi?id=753614
CID 1358389
2016-04-12 11:39:48 +01:00
Luis de Bethencourt 574bf8e02f Revert "qtdemux: redundant check in PIFF parser"
This reverts commit 41e10524f3.
2016-04-12 11:37:36 +01:00
Luis de Bethencourt 41e10524f3 qtdemux: redundant check in PIFF parser
qtdemux->streams is an array of size GST_QTDEMUX_MAX_STREAMS, it will never
evaluate to true when comparing to NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=753614
CID 1358389
2016-04-12 11:08:37 +01:00
Seungha Yang faa664b8ea qtdemux: Fix parsing segment duration of empty edit list box
For empty edit list, segment-duration in edit list box should not be
used for segment event.

https://bugzilla.gnome.org/show_bug.cgi?id=764870
2016-04-11 10:28:07 +03:00
Philippe Normand fd7964e746 qtdemux: PIFF box detection and parsing support
The PIFF data is stored in a custom UUID box which is parsed and the
crypto_info of the element is updated accordingly. This allows
downstream decryptors to process and decrypt the protected content.

https://bugzilla.gnome.org/show_bug.cgi?id=753614
2016-04-02 18:01:10 +01:00
Jimmy Ohn 206e24855a qtdemux: Fix qtdemux memory leak in src_convert function
If we don't find the index of the sample correctly in src_convert function,
we have to unref about the qtdemux before returning value.
So, I have modify it about instead pass qtdemux as a parameter into
src_convert function.

https://bugzilla.gnome.org/show_bug.cgi?id=763973
2016-03-24 14:36:26 +02:00
Jimmy Ohn c633f2aab7 qtdemux: Add check condition for fail case in get_duration function
Currently, get_duration function always return the TRUE even though
it can't be set duration correctly. So, we need to add the else condition
about the fail case. Also, we already set the GST_CLOCK_TIME_NONE
in this function. So I have modify it which is related code in some
function.

https://bugzilla.gnome.org/show_bug.cgi?id=763968
2016-03-24 14:35:47 +02:00
Jimmy Ohn 0ef9e6d139 qtdemux: Modify data type of duration in handle_src_query function
Data type of duration need to modify from guint64 to GstClockTime
for consistency in handle_src_query function.

https://bugzilla.gnome.org/show_bug.cgi?id=763965
2016-03-24 14:34:55 +02:00
Vineeth TM 1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Jimmy Ohn 84f436f122 qtdemux: Add the function to get channels and sample rate for AAC
Add aac_get_channels and sample_rate function to get these value for
AAC.

https://bugzilla.gnome.org/show_bug.cgi?id=749110
2016-03-24 14:28:09 +02:00
Thiago Santos d8fb7a9c96 qtdemux: reset pending segment if we are already pushing one
When upstream is running in bytes in push-mode, qtdemux will
convert seeks from time to bytes and send it upstream. Upstream
element will perform a byte seek and send a byte segment to qtdemux
that will convert it to time and push it downstream.

There is, however, the pending_segment variable that stores a new
segment event to be pushed before the next data. When handling seeks
as mentioned above this variable was being ignored and, if it contained
some segment event, it would override the one resulting from the seek.
This would restore a previous segment and would cause the seek segment
to be discarded downstream.

This patch fixes this issue by unrefing any pending segment as the
seek from upstream should contain the latest one that should be
used, as requested by the application.

https://bugzilla.gnome.org/show_bug.cgi?id=763165
2016-03-07 15:26:13 -03:00
Thiago Santos b46af7fda7 qtdemux: run gst-indent
Otherwise commits will fail with our indent check hook
2016-03-07 15:26:13 -03:00
Philippe Normand 9c47c0da59 qtdemux: cenc aux info parsing from mdat support in PULL mode
This is already supported for PUSH mode but was failing in PULL mode.
The aux info is sometimes stored in the mdat before the first sample,
so the loop task needs to pull data stored at that location and
perform the aux info cenc parsing.

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

https://bugzilla.gnome.org/show_bug.cgi?id=762516
2016-02-25 12:46:27 +02:00
Philippe Normand 67f3fc1748 qtdemux: prevent buffer flow if any stream failed to be exposed
In some cases the stream configuration can fail, for instance if the
stream is protected and no decryptor was found. For those situations
the demuxer shouldn't emit any data on the corresponding source pad of
the stream and bail out.

https://bugzilla.gnome.org/show_bug.cgi?id=762516
2016-02-25 12:46:27 +02:00