Commit graph

17832 commits

Author SHA1 Message Date
Nicola Murino
3573f71c91 osxaudio: add support for parsing more channel layouts ...
... and fallback to gst_audio_info_set_format for not yet supported layouts.

Fix audio playback on iOS 12.
Based on patch from Byron Schiel <byron@canary.is>

https://bugzilla.gnome.org/show_bug.cgi?id=796919
2018-09-24 15:50:23 +03:00
Alicia Boya García
bc0ea0dbbb qtdemux: turn impossible condition into an assert
qtdemux_update_streams() is only ever called after checking
`qtdemux->streams_aware` is TRUE. There is no need to check for that
condition again.

`qtdemux->streams_aware` is only modified when the demuxer is
hard-resetted, which is mutually exclusive with demuxing, so it cannot
be modified during the call.

https://bugzilla.gnome.org/show_bug.cgi?id=797191
2018-09-24 08:33:02 +01:00
Alicia Boya García
7ceefec714 matroskademux: Emit no-more-pads after parsing Tracks
Currently matroskademux does not emit no-more-pads until the first
Cluster is parsed, even though the Tracks have already been parsed and
from that point on there can be no more tracks.

This is important in MSE because the browser needs to know when the MSE
initialization segment has been completely parsed so that it can expose
the tracks to the user. Some applications depend on this been done
before they feed frames to the demuxer.

As a consequence, historically WebKit has relied on hacks such as
listening to the `pad-added` event, which made impossible to support
multiple tracks in the same file. Let's fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=797187
2018-09-21 17:41:57 -03:00
Alicia Boya García
0e60076a39 matroskademux: Parse successive Tracks elements
This patch allows matroskademux to parse a second Tracks element,
erroring out if the tracks are not compatible (different number, type or
codec) and emitting new caps and tag events should they have changed.

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Alicia Boya García
f279bc5336 matroskademux: Refactor track parsing out from adding tracks
This splits gst_matroska_demux_add_stream() into:

* gst_matroska_demux_parse_stream(): will read the Matroska bytestream
  and fill a GstMatroskaTrackContext.

* gst_matroska_demux_parse_tracks(): will check there are no repeated
  tracks.

* gst_matroska_demux_add_stream(): creates and sets up the pad for the
  track.

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Alicia Boya García
9dc7859184 matroskademux: Allow Matroska headers to be read more than once
This is necessary for MSE, where a new MSE initialization segment may be
appended at any point. These MSE initialization segments consist of an
entire WebM file until the first Cluster element (not included). [1]

Note that track definitions are ignored on successive headers, they must
match, but this is not checked by matroskademux (look for
`(!demux->tracks_parsed)` in the code).

Source pads are not altered when the new headers are read.

This patch has been splitted from the original patch from eocanha in [2].

[1] https://www.w3.org/TR/mse-byte-stream-format-webm/
[2] https://bug334082.bugzilla-attachments.gnome.org/attachment.cgi?id=362212

https://bugzilla.gnome.org/show_bug.cgi?id=793333
2018-09-21 17:27:57 -03:00
Mathieu Duponchelle
9605028a71 splitmuxsink: Implement split-after
The behaviour of split-now is to output the current GOP after
starting a new file.

The newly-added split-after signal will output the current GOP
to the old file if possible once a new GOP is opened.

https://bugzilla.gnome.org/show_bug.cgi?id=796982
2018-09-21 16:31:34 +02:00
Seungha Yang
916ad09009 flvmux: Don't leak codec_data buffer
Use gst_buffer_replace() to prevent buffer leak

https://bugzilla.gnome.org/show_bug.cgi?id=797179
2018-09-20 11:35:31 +03:00
Sebastian Dröge
c6e07a6eee qtmux: Set Closed Caption track width/height to that of the first video track
Otherwise software like Premiere or Final Cut Pro won't like our files.

https://bugzilla.gnome.org/show_bug.cgi?id=797111
2018-09-20 11:35:31 +03:00
Tim-Philipp Müller
03a8e6af72 meson: add glib-checks option to disable API guards and such
We want this enabled by default, also in releases, but people
may want to disable this for performance-critical workloads or
on embedded devices.
2018-09-19 11:45:59 +01:00
Tim-Philipp Müller
04cb304b2d meson: fix missing closing bracket in option descriptions 2018-09-19 11:45:00 +01:00
Sebastian Dröge
54a5b3f845 qtmux: Initialize caption track language code to 0 instead of "und"
Without this, Final Cut considers it "non-standard" and 0 (english) is a
good default for closed captions.

https://bugzilla.gnome.org/show_bug.cgi?id=797111
2018-09-18 17:32:46 +03:00
Song Bing
1dc6881a13 v4l2videodec: Add HEVC decoder support
https://bugzilla.gnome.org/show_bug.cgi?id=771686
2018-09-13 20:48:09 -04:00
Nicolas Dufresne
2510b5937d v4l2videodec: Move capture probe after input format is set
This is to support Amlogic CODEC driver which does not provide a full
list of formats when the driver is initially opened. GStreamer does
not strictly need this full list initially, but only later, in order
to negotiate with downstream if multiple format can be selected.

With this change, we will no longer probe twice the device, since the
probed list can be directly used for negotation.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
7f42b12e8c v4l2: Add a debug message beforing waiting for codec stop
Add a debug message right before waiting for the driver.
This is useful in order to debug drivers without a properly
implemented decoder or encoder stop command.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
09f9b37b0b v4l2: Add a debug message indicating probe operation
It's useful to see the v4l2 element running the probe
operation, to confirm it's turned on and working.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
63535d9086 v4l2: Add JPEG encoding support
This commit adds the support for V4L JPEG stateful encoders.
2018-09-13 20:48:09 -04:00
Ezequiel Garcia
944debd3db v4l2: Add FWHT codec support
The recently added vicodec (virtual codec) V4L driver
uses the Fast Walsh-Hadamard Transform for encoding
and decoding.

Add support for it.
2018-09-13 20:48:09 -04:00
Nicolas Dufresne
6e1ad47db1 v4l2: Sync kernel header with linuxtv tree
This notably add HEVC and FWHT support, and VP8/9 profiles are now an
enumeration and their control exposed as a menu.
2018-09-13 20:48:09 -04:00
Vivia Nikolaidou
94f8603411 qtmux: Allow up to 1 trak timescale unit of lateness in prefill mode
For 59.94 FPS, it's common to set 60000 as timescale. For that
timescale, if the audio is late by as little as 0:00:00.000016666
(definitely less than one audio sample), lateness gets rounded to 1.
Added a safeguard that allows lateness up to 1 sample with the specific
trak's timescale, to make sure that values less than e.g. one audio
sample won't break the prefill mode. What will happen in this case is
that the audio will get squeezed back to the video's timestamp, which in
practice means that the audio will be 0.000016666 seconds early (with
the patch).

https://bugzilla.gnome.org/show_bug.cgi?id=797133
2018-09-13 13:51:18 +03:00
Nicolas Dufresne
43c5db3c72 v4l2object: Fix indentation 2018-09-12 20:49:41 -04:00
Nicolas Dufresne
4d0f5f056e v4l2object: Protect against zero PAR num/demu
This fixes an assertion when the driver implement CROPCAP but does
not set the PAR.
2018-09-12 20:49:41 -04:00
Tim-Philipp Müller
0d88e3553a wavpackparse: fix handling of correction streams
Accept wavpack correction streams (.wvc) on sink pad, so
that wavpackparse can also be used to packetise correction
streams.

Fix parsing of subblock ID tags - the higher bits are
flags and are not part of the ID. This resulted in
correction blocks not being recognised properly and
the output not having the right (correction) caps.
2018-09-12 01:05:05 +01:00
Nirbheek Chauhan
3da5144bbe meson: Explicitly pass -DWIN32 while building speex
The speex headers assume that WIN32 will always be defined when
building on Windows, but this is only true by default on MinGW.
Always set it explicitly.
2018-09-07 18:51:17 +05:30
Seungha Yang
1cd5a5241f flvmux: Don't omit streamheader from caps on downstream reconfigure
The reconfigured downstream elements (e.g., dynamically added sink element)
most likely require the flv streamheader

https://bugzilla.gnome.org/show_bug.cgi?id=797089
2018-09-06 15:52:09 -04:00
Martin Kelly
be05515da7 matroskamux: don't store used UIDs
Currently, whenever we generate a 128-bit UID, we store it in a list and
return 0 if we ever encounter a collision. This is so mathematically
improbable that it's not worth checking for, so we can save memory and
time by not tracking the UID. Even if a collision happened, a list of
only 10 UIDs would be unlikely to detect it.

This article has a good description of how improbable a collision is:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Collisions

https://bugzilla.gnome.org/show_bug.cgi?id=797086
2018-09-06 14:14:56 -04:00
Sebastian Dröge
d9b52d1f5e qtmux: Use existing helper function to create "und" language code 2018-09-06 20:07:57 +03:00
Nirbheek Chauhan
6720da07cf meson: Don't skip plugins that don't build with MSVC
We now have options for all plugins, so we will just disable these in
the cerbero recipe instead. These require external deps, so they won't
affect gst-build either.
2018-09-05 20:15:57 +05:30
Nirbheek Chauhan
c0ff8a036a mpg123: Remove ssize_t fallback, not needed anymore
The mpg123 headers now contain a definition for ssize_t and building
with MSVC fails because of a redefinition for ssize_t
2018-09-04 12:39:19 +05:30
Alicia Boya García
794dcfbfee qtdemux: Keep sample data from the current fragment only (push mode)
This patch clears the sample table whenever the demuxing of a new
fragment begins. This avoids increasing memory usage for long videos.
This behavior was already present when upstream_format_is_time; this
patch extends it to all push mode operation (e.g. Media Source
Extensions).

https://bugzilla.gnome.org/show_bug.cgi?id=796899
2018-09-03 12:38:17 -03:00
Nirbheek Chauhan
5ca7a02371 meson: Fix osxaudio build on iOS
Must define HAVE_IOS, and use appleframeworks dependency to ensure the
right frameworks are picked up.
2018-09-01 09:30:23 +05:30
Nicolas Dufresne
66351255f7 v4l2object: Only offer MMAP/DMABUF pool
The propose allocation was offering a pool even in DMABUF_IMPORT or
USERPTR mode. These pool are internal only.
2018-08-31 15:44:02 -04:00
Nicolas Dufresne
fe5236be87 v4l2transform: Add "disable-passthrough" property
This allow forcing going through the transform driver even if there
isn't an conversion happening. This is usedful when the m2m driver can
be used to adapt the type of memory between two drivers.
2018-08-31 15:43:53 -04:00
Sebastian Dröge
abf2af1a66 deinterlace: Reset frame/tc/caption pointer to NULL after moving it in the history 2018-08-31 14:26:32 +03:00
Edward Hervey
8b4db06733 rtpmp4vpay: Increase ranking
Both rtpmp4vpay and rtpmp4gpay support MPEG4 elementary streams. But
the most supported variant is the video-specific one (rtpmp4vpay),
therefore increase the rank of that one so that auto-plugging of
payloaders for MPEG4 elementary streams ends up picking that one
and not the generic one.
2018-08-29 09:51:42 +02:00
Tim-Philipp Müller
9d6621a30d matroskademux: implement keyframe search also without cluster prev size
If we have cluster prev size (GStreamer muxer will write it by default),
we can go back to the previous cluster efficiently, but if we don't then
just search backwards until we find a cluster ebml identifier, like we
do when searching for clusters in the bisection loop.
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
2d6efbbae2 matroskademux: make max backtrack distance for keyframe search configurable
Add property instead of hardcoding it in the code.

In some scenarios such as CCTV variable fps and extra long GOPs are
used to minimise storage space, for example. In those cases there might
not be any keyframes for many minutes, so provide a property to override
the max allowed distance.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
2990f0730a matroskademux: set limit how much to backtrack to find a keyframe
If we seek without an index and land on a cluster that starts
with a delta frame.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
ffb4533137 matroskademux: no need to search for keyframes for intra-only streams
If the video streams are all I-frame only then we don't need to look
for a cluster with a keyframe, we can just assume there will be one.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
694631520d matroskademux: figure out if we have prev_size when starting up
This is useful to know in case someone initiates a seek or
direction change before we reach the second cluster.
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
43ce85f794 matroskademux: try to ensure keyframe when seeking without index
When seeking in pull mode without an index (because there is no index
or the file is still being written to) we bisect to find the right
cluster to jump to. However, it's possible the cluster we found doesn't
start with a keyframe, which leads to decoding errors, so if we know
that the found cluster starts with a delta frame try to scan back to
previous clusters until we find one that starts with a keyframe or
we are back at the beginning. Theoretically it's possible that all
clusters but the first one do not start with a keyframe and the
keyframes are in the middle of clusters, but this is extremely
unusual, so we will cover this case with a basic sanity check.

This problem is especially problematic with content recorded with
dynamic GOP and FPS, where long GOP lengths and low FPS may cause a
large set of clusters to lack key frames. Playback would then be
started on a non-keyframe cluster, and the large number of such frames
would make the content impossible to decode fo a long stretch of time.

Based on patch by: Mats Lindestam <matslm@axis.com>

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:01:21 +02:00
Tim-Philipp Müller
93ddea2a70 matroskademux: extract cluster prevsize if available
This is useful for reverse playback/trickmodes
without an index, and will also be useful in the
seek handler if we need to scan back to find a cluster
that starts with a keyframe.

https://bugzilla.gnome.org/show_bug.cgi?id=790696
2018-08-27 23:00:53 +02:00
Nicolas Dufresne
480a7bcab8 v4l2bufferpool: Validate stride/offset when importing
This will prevent situation where buffer size allow importing but rendering
goes wrong due to a miss-match in expected stride and offset.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
1c729be537 v4l2object: Add a method to try and import buffers
This method will check if a buffer, base on it's video meta,
can be imported. It will also try and adapt the request stride
in case this is the only that miss-match.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
d6d8187345 v4l2allocator: Trace the buffer index we import to
https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
73555b5440 v4l2bufferpool: Fix typo in error message
https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
77c052f0e8 v4l2bufferpool: Only queue buffer if preparation worked
The preparation code imports the buffer, doing bunch of
validation. Only queue the buffer in the driver if the
importation worked. This way we don't rely on the driver
to validate.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
24368c1162 v4l2object: Only allow DMABuf export for STREAMING device
DMABuf exportation requires mmap, which requires STREAMING
capabilities.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
90a70e08b7 v4l2bufferpool: Activate the other pool first
This change has no effect. We will need to acquire a buffer from the
pool later in order to validate / adapt with the video alignment for
the downstream buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00
Nicolas Dufresne
fe3a70fefd v4l2src: Simplify format handling
Always initially use try_format(), delaying set_format() to when the
allocation is being negotiated. This avoid having two code paths, and
will be help adding support for properly importing buffers of specific
strides and offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=583890
2018-08-27 13:41:30 -04:00