Commit graph

414 commits

Author SHA1 Message Date
Andre McCurdy
29433495d6 qtdemux: free seqh after calling qtdemux_parse_svq3_stsd_data()
The seqh buffer allocated in qtdemux_parse_svq3_stsd_data() needs to
be freed by the caller after use.

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

Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
2017-01-12 11:10:50 +02:00
Edward Hervey
4a279f4499 isomp4: Don't spam debug log with knonw/padding atoms
Only output WARNING messages for atoms we don't know how to handle
instead of for padding/known atoms we don't need to do any processing
on

https://bugzilla.gnome.org/show_bug.cgi?id=777095
2017-01-10 16:03:00 +01:00
Jan Schmidt
1fc3d42f8a qtdemux: Don't reset output timestamps when no tfdt
If a fragmented stream doesn't have a tfdt, don't
reset the output timestamps at each fragment boundary
by erroneously using the default value of 0. Introduced
by commit 69fc48

https://bugzilla.gnome.org/show_bug.cgi?id=754230
2017-01-07 23:57:35 +11:00
Jan Schmidt
107902ec51 qtdemux: Always snap to the start of the keyframe
When performing a key-unit seek, always snap to the start ts
of the keyframe buffer we landed on so that the keyframe is
entirely within the resulting outgoing segment. That seems
the most sensible result, since the user requested snapping
to the keyframe position.
2017-01-03 01:34:02 +11:00
Jan Schmidt
f415730fdf qtdemux: Omit cslg_shift when snapping seeks
Segments times and seek requests are stored and handled
in raw 'PTS' time, without the cslg_shift - which only applies
to outgoing samples. Omit the cslg_shift portion when
extracting PTS to compare for internal seek snaps.

If the cslg_shift is included, then keyframe+snap-before seeks
generate a segment start/stop time that already includes the
cslg_shift, and it's then added a 2nd time, causing the
first buffer(s) to have timestamps that are out of segment.
2017-01-03 01:34:02 +11:00
Seungha Yang
65c5d6d080 qtdemux: Fix key_time in gst_qtdemux_adjust_seek()
time in segment should be PTS based (not DTS).

https://bugzilla.gnome.org/show_bug.cgi?id=765498
2017-01-03 01:34:02 +11:00
Mark Nauwelaerts
867ce71922 qtdemux: implement pull mode SNAP flag seeking 2016-12-29 12:48:56 +01:00
Sebastian Dröge
76c007dd25 qtdemux: Check if we have enough data available when parsing edit lists
Also consume the data entry by entry to get complicated indexing out of
the code.

https://bugzilla.gnome.org/show_bug.cgi?id=776107
2016-12-14 21:48:24 +02:00
Sebastian Dröge
35748dc8f2 qtdemux: Check that the XiTh size is big enough
https://bugzilla.gnome.org/show_bug.cgi?id=775794
2016-12-14 10:17:41 +02:00
Heekyoung Seo
f7c033f4ec qtdemux: Check node length of video sample description
Add check for node length of video sample description and its fields and
for the XiTh atom.

Also unify the code a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=775794
2016-12-14 10:17:41 +02:00
Heekyoung Seo
a5bfaf8a79 qtdemux: Enable xvid/mp2 codec support
Add support for xvid video and mp2 audio, add m2v1 fourcc.

https://bugzilla.gnome.org/show_bug.cgi?id=775794
2016-12-14 10:17:23 +02:00
Edward Hervey
50bb6630f5 qtdemux: Sanitize unknown codec caps
We might have non-printable characters in the unknown fourcc, replace
them with '_', in the same way we do it for unknown tags.
2016-12-02 08:52:06 +01:00
Sebastian Dröge
6939399e96 qtdemux: Increase inflate buffer in bigger steps
1024 bytes is quite small, let's do 4096 bytes (or one page).
Also remove redundant if, we're always in that case when getting here.
2016-12-01 14:44:26 +02:00
Sebastian Dröge
b79655d3c9 qtdemux: Ensure that size of the pasp atom is as much as we need
https://bugzilla.gnome.org/show_bug.cgi?id=775455
2016-12-01 14:30:49 +02:00
Sebastian Dröge
d46cc8df6c qtdemux: Free compressed moov node and it's corresponding decompressed data
https://bugzilla.gnome.org/show_bug.cgi?id=775455
2016-12-01 14:30:10 +02:00
Sebastian Dröge
b4d6b2af8e qtdemux: Check size of compressed MOOV header against available data
And actually read the size of the cmvd atom from the right position.

https://bugzilla.gnome.org/show_bug.cgi?id=775455
2016-12-01 14:29:21 +02:00
Sebastian Dröge
5e4883094b qtdemux: Fix zlib inflate loop
Handle errors cleanly, deallocate all memory and return the actual size
of the inflated data.

https://bugzilla.gnome.org/show_bug.cgi?id=775455
2016-12-01 14:27:55 +02:00
Sebastian Dröge
d0949baf3d qtdemux: Fix out of bounds read in tag parsing code
We can't simply assume that the length of the tag value as given
inside the stream is correct but should also check against the amount of
data we have actually available.

https://bugzilla.gnome.org/show_bug.cgi?id=775451
2016-12-01 13:32:22 +02:00
Vivia Nikolaidou
f8bf3a84ef qtdemux: Read interlacing information from 'fiel' atom
Read interlacing and TFF/BFF information from the 'fiel' atom and pass it
into the caps

https://bugzilla.gnome.org/show_bug.cgi?id=775414
2016-11-30 18:52:20 +02:00
Sebastian Dröge
499c5139bd qtdemux: Fix compiler warning
qtdemux.c: In function ‘qtdemux_parse_trak’:
qtdemux.c:10184:38: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 9 has type ‘gint {aka const int}’ [-Werror=format=]
           GST_DEBUG_OBJECT (qtdemux, "Found jpeg: len %u, need %lu", len,
                                      ^
2016-11-29 13:55:40 +02:00
Scott D Phillips
4ec5daba5f qtdemux: Change off_t type to gint
off_t is a signed integer type provided by sys/types.h on posix systems.
Replace with gint for building on non-posix systems (like windows).

https://bugzilla.gnome.org/show_bug.cgi?id=775287
2016-11-29 13:12:24 +02:00
David Evans
45843ab9a2 qtdemux: Be sure not to read off end of FLAC dfLa box
https://bugzilla.gnome.org/show_bug.cgi?id=773712
2016-11-21 17:51:14 +02:00
christophecvr
fc3022da1c qtdemux: Fix wrong compiler warning with gcc 6.2
| ../../../git/gst/isomp4/qtdemux.c: In function 'qtdemux_parse_tree':
| ../../../git/gst/isomp4/qtdemux.c:10224:24: error: 'size' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|                  offset += size;
|                         ^~
| ../../../git/gst/isomp4/qtdemux.c:10197:25: note: 'size' was declared here
|                  guint32 size, tag;
|                          ^~~~

https://bugzilla.gnome.org/show_bug.cgi?id=774747
2016-11-21 09:33:05 +02:00
Sebastian Dröge
bb35f15d44 qtdemux: Ensure that raw audio and video have properly aligned buffers
That is, aligned to the basic type for audio and to 32 bytes for video.
Fixes crashes if the raw buffers are passed to SIMD processing functions.

https://bugzilla.gnome.org/show_bug.cgi?id=774428
2016-11-20 13:08:27 +02:00
Seungha Yang
7d2a07076e qtdemux: Remove useless return variable
qtdemux_expose_streams() returns flow error immediately, if there is an error.
So, the variable for the flow return is not needed.

https://bugzilla.gnome.org/show_bug.cgi?id=774674
2016-11-18 18:05:23 +02:00
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