Commit graph

349 commits

Author SHA1 Message Date
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
Philippe Normand
fb5d50cd07 qtdemux: don't push encrypted buffer without cenc metadata
When the cenc metadata is stored outside of the moof box and the
stream is exposed it is possible that the cenc metadata hasn't been
processed yet while the first buffer is being pushed. When this
happens the buffer can't possibly be decrypted downstream so don't
push it.

https://bugzilla.gnome.org/show_bug.cgi?id=762516
2016-02-25 12:46:27 +02:00
Philippe Normand
459ef195bb qtdemux: read saio aux_info_type as a FOURCC
https://bugzilla.gnome.org/show_bug.cgi?id=756897
2016-02-24 10:54:23 +02:00
Matej Knopp
f96c9eb6bc qtdemux: workaround for files with wrong color_table_id value
Instead of erroring out, just use the default color table.

https://bugzilla.gnome.org/show_bug.cgi?id=761637
2016-02-19 16:00:59 +00:00
Philippe Normand
52b16768a2 qtdemux: plug leaks in cenc aux info parsing 2016-02-19 10:30:46 +02:00
Alex Ashley
97f6f7c713 qtdemux: only transform protected caps once
Commit 7873bede31
(https://bugzilla.gnome.org/show_bug.cgi?id=760774) changed the
behaviour of qtdemux to call gst_qtdemux_configure_stream() for
every new moof.

When playing a protected stream, gst_qtdemux_configure_stream()
calls gst_qtdemux_configure_protected_caps(). The
gst_qtdemux_configure_protected_caps() function takes the original
media format, puts this in a field called "original-media-type"
and then changes the caps to "application/x-cenc".

The gst_qtdemux_configure_protected_caps() did not handle the case
of being called multiple times, causing it to incorrectly set the
caps. The second call was causing the caps to be set to:

    application/x-cenc, original-media-type"application/x-cenc"

This commit makes gst_qtdemux_configure_protected_caps() check that
the caps have already been transformed, so that it only gets
changed once.

    https://bugzilla.gnome.org/show_bug.cgi?id=761769
2016-02-17 17:04:25 +02:00
Seungha Yang
7873bede31 qtdemux: fix framerate calculation for fragmented format
qtdemux calculates framerate using duration and the number of sample.
In case of fragmented mp4 format, however, the number of sample can
be figure out after parsing every moof box. Because qtdemux does not
parse every moof in QTDEMUX_STATE_HEADER state, it will cause incorrect
framerate calculation.

This patch will triger gst_qtdemux_configure_stream() for every new moof.
Then, framerate will be calculated by using duration and n_samples of the moof.

https://bugzilla.gnome.org/show_bug.cgi?id=760774
2016-01-29 11:01:44 +01:00
Seungha Yang
0391a93a35 qtdemux: handling zero segment-duration edit list
Based on document ISO_IEC_14496-12, edit list box can have
segment duration as zero. It does not imply that media_start equals to
media_stop. But, it just indicates a sample which should be presented
at the first. This patch derives segment duration using media_time
and duration of file. And set derived duration to segment-duration.

https://bugzilla.gnome.org/show_bug.cgi?id=760781
2016-01-29 10:57:05 +01:00
Seungha Yang
d8bb6687ea qtdemux: expose streams with first moof for fragmented format
In case of push mode, qtdemux expose streams after got moov box.
We can not guarantee that a moov box has sample data such as sample duration
and the number of sample in stbl box for fragmented format case.
So, if a moov has no sample data, streams will not be exposed until get the first moof.

https://bugzilla.gnome.org/show_bug.cgi?id=760779
2016-01-29 10:53:39 +01:00
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