Commit graph

294 commits

Author SHA1 Message Date
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Sebastian Dröge
9eda151348 hlssink2: New HLS sink element based on splitmuxsink
This embeds the muxer inside the sink and accepts elementary streams
while the old HLS sink required the muxer outside. Apart from that the
interface is the same as before.
Currently only mpegtsmux is supported, but support for other muxers is
just a matter of adding a property.

The advantage of the new sink is that it reduces complexity a lot and
properly handles pre-encoded streams with appropriately spaced
keyframes.

https://bugzilla.gnome.org/show_bug.cgi?id=781496
2017-05-12 12:03:10 +02:00
Ting-Wei Lan
b5abaabeae meson: hls: libm is required because m3u8.c uses math.h
https://bugzilla.gnome.org/show_bug.cgi?id=782119
2017-05-03 14:18:33 +01:00
Sebastian Dröge
bb8b27bee4 hlssink: Remove some unused struct fields 2017-04-19 12:36:46 +01:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03:00
Seungha Yang
b8344ea997 m3u8: Fix parsing EXT-X-DISCONTINUITY
EXT-X-DISCONTINUITY tag should have no trailing ":" character

https://bugzilla.gnome.org/show_bug.cgi?id=780179
2017-03-17 12:13:40 +02:00
Seungha Yang
16dd0e693d m3u8: Release m3u8 lock if consistent checking failed
To fix deadlock during live m3u8 update

https://bugzilla.gnome.org/show_bug.cgi?id=780180
2017-03-17 12:13:40 +02:00
Matthew Waters
fd8d35298f Revert "adaptivedemux: answer duration queries for live streams"
Completely disabling duration reporting with live streams is not cool.

This reverts commit e1b68d9a65.

https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-14 16:50:30 +11:00
Seungha Yang
3c5eae63c0 hlsdemux: Try to find type at the end of a fragment
hlsdemux tries to find type if given buffer size is large enought to
find type (currently the threshold is 2KB), or EOS in some cases.
However, since there can be small byte fragments such as WebVTT,
demux should try to find type at the end of a fragment

https://bugzilla.gnome.org/show_bug.cgi?id=779011
2017-03-06 10:09:20 +02:00
Dongil Park
ffbe690656 hlsdemux: Fix checking adaptation_field_control field to parse pcr
The PCR_flag and PCR value is in adaptation_field, not in payload.
The MSB of adaptation_field_control is used as whether adaptation_
field is exist or not.

For the case(PCR in only adaptation_field without payload), we modify
checking condition about adaptation_field_control field.

https://bugzilla.gnome.org/show_bug.cgi?id=778731
2017-03-03 14:20:45 +11:00
Seungha Yang
5bd4bc8080 hls: Fix various leak on hlsdemux and m3u8
* default_variant should be freed, it holds ref.
* GstHLSMedia holds GstM3U8 ref.
* gst_m3u8_get_next_fragment() increases ref count.

https://bugzilla.gnome.org/show_bug.cgi?id=778073
2017-03-02 20:24:00 +02:00
Alex Ashley
e1b68d9a65 adaptivedemux: answer duration queries for live streams
For duration queries on live streams, adaptivedemux ignores the query.
The problem then is that the query is answered by the downstream
qtdemux element, with the duration of the currently passing fragment.

This commit changes the behaviour of adaptivedemux to answer the duration
queries for live streams, returning GST_CLOCK_TIME_NONE.

    https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-02 19:54:04 +02:00
Seungha Yang
b2e9891f8a hlsdemux: Implement adaptivedemux's _stream_seek()
_stream_seek() can be called by adaptivedemux when "restart download" condition.
It's mostly caused by track switching.

https://bugzilla.gnome.org/show_bug.cgi?id=776997
2017-03-02 19:25:48 +02:00
Seungha Yang
78b2169c32 hlsdemux: Simplify seeking code by using macro
Import an adaptivedemux's macro to minimize code.
Also, this patch considers KEY_UNIT and TRICKMODE_KEY_UNITS
as snap seek.

https://bugzilla.gnome.org/show_bug.cgi?id=776997
2017-03-02 19:25:48 +02:00
Seungha Yang
32c4850b33 hlsdemux: Early terminate seeking if we don't need to do
Some codes are imported from dashdemux

https://bugzilla.gnome.org/show_bug.cgi?id=776997
2017-03-02 19:25:48 +02:00
Thomas Bluemel
9ce5646a0f hlsdemux: Add support for EXT-X-DISCONTINUITY-SEQUENCE
https://bugzilla.gnome.org/show_bug.cgi?id=772811
2017-03-02 19:05:57 +02:00
Sebastian Dröge
95b85eae5a hlsdemux: Compare media type of the correct variable that is actually set
CID 1364752
2017-02-28 15:31:53 +02:00
Seungha Yang
b1efa8d499 hlsdemux: Fix GHashTable leak
https://bugzilla.gnome.org/show_bug.cgi?id=778828
2017-02-21 13:11:25 +00:00
Jan Schmidt
691b5968e1 hlsdemux: Redo typefind after stripping tags
When stripping the ID3 header, redo typefinding so
we set audio caps instead of still setting id3
caps and plugging a useless id3demux
2017-02-07 23:53:30 +11:00
Seungha Yang
b5cf96fc35 hls: m3u8: Set sequence position for live
hls live starts playback from the allowed latest fragment,
but its "sequence position" is set to zero, and so stream
time is also set to zero.

This does not make sense, because hls live allows seeking to past position,
and it's negative stream time from downstream element's point of view.
Note that, allowed seekable range (and seeking query) is
from the first fragment of playlist to the allowed latest fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=777682
2017-01-31 13:23:34 +02:00
Seungha Yang
de86258c94 hls: Exclusion of last three fragment in case of live playback
HLS spec 6.3.3 is saying that
"the client SHOULD NOT choose a segment which starts less than
three target durations from the end of the Playlist file."

To ensure above statement, the third fragment from the end of playlist
should be excluded from seekable range and also from available starting fragment.
(i.e., the fourth fragment from end of playlist is the starting fragment).

https://bugzilla.gnome.org/show_bug.cgi?id=777682
2017-01-31 13:23:34 +02:00
Seungha Yang
e9e6e4a4f6 hlsdemux: Consider timestamp of the first fragment in playlist when live seeking
During live playback, the first fragment in a updated
playlist can be advanced from that of startup playlist.
Meanwhile, since hlsdemux finds target seek position
by just accumulating fragment's duration, the base should
be adjusted to the updated first fragment's timestamp.

https://bugzilla.gnome.org/show_bug.cgi?id=777682
2017-01-31 13:23:34 +02:00
Sebastian Dröge
075ceffd9b hlsdemux: Detect media sequence number inconsistencies and fail
Without failing, we would play back random parts of the stream which is
arguably a worse user experience, and failing is also recommended by the
spec here.

And also handle live streams without any media sequence numbers at all
properly, that is, make sure the sequence numbers are increasing instead
of starting again at 0 every time.

https://bugzilla.gnome.org/show_bug.cgi?id=775665
2017-01-18 13:36:16 +02:00
Sebastian Dröge
ee647ca4be hlsdemux: Extract ID3 tags, strip them from the output and provide them as tags
They often don't only contain the PCR information but also other
metadata, like title. Give this information to the pipeline.

Also strip the tags from the stream as we a) already parsed them now and
b) decoders don't like these tags to happen in the middle of the stream
(i.e. the start of each fragment) and tagdemux only can strip them off
the beginning and end.
2016-12-19 11:51:36 +02:00
Sebastian Dröge
674efaadd9 m3u8: Mark uri_join() function as static
We don't really want to export this, especially not without any
namespacing. This can cause problems for static builds.
2016-11-28 10:49:23 +02:00
Edward Hervey
9053a01e72 hlsdemux: Handle GST_SEEK_TYPE_NONE seek
When one is only updating the "stop" position (i.e. non-flushing seek,
with GST_SEEK_TYPE_NONE on the "start" (or stop in reverse) position),
we only need to store those values instead of moving the current position.

https://bugzilla.gnome.org/show_bug.cgi?id=775127
2016-11-26 10:45:52 +01:00
Sebastian Dröge
cff42b2b40 hlsdemux: Fix NULL pointer dereference when checking if there is a next fragment
Thanks to Aleksandr <tumaleksandr@yandex.ua> for reporting and
suggesting the fix.

https://bugzilla.gnome.org/show_bug.cgi?id=774287
2016-11-12 10:39:11 +02:00
Michael Olbrich
c2920ec3ea hlsdemux: don't try to access non-existant iframe variant
If the playlist does not contain any iframe variants then
demux->master->iframe_variants is NULL. If the previous variant is an
iframe variant then there is at least one iframe variant and
demux->master->iframe_variants->data can be safely used.

https://bugzilla.gnome.org/show_bug.cgi?id=773635
2016-10-31 14:03:06 +02:00
Scott D Phillips
67d0eefb81 meson: hls: Only build when any crypto_dep is found
https://bugzilla.gnome.org/show_bug.cgi?id=773114
2016-10-24 00:51:21 +01:00
Arnaud Vrac
e2dea99dc9 hlsdemux: fix hls demux stream type inheritance
GstHLSDemuxStream inherits GstAdaptiveDemuxStream, not
GstAdaptiveDemux. Fixes memory corruption issues.

https://bugzilla.gnome.org/show_bug.cgi?id=772704
2016-10-11 09:48:54 +01:00
Sebastian Dröge
4f6ae1f48c adaptivedemux: Enable bitrate selection for trick mode streaming again
And scale the bitrate with the absolute rate (if it's bigger than 1.0) to get
to the real bitrate due to faster playback.

This allowed in my tests to play a stream with 10x speed without buffering as
the lowest bitrate is chosen, instead of staying/selecting the highest bitrate
and then buffering all the time.

It was previously disabled for not very well specified reasons, which seem to
be not valid anymore nowadays.
2016-08-25 19:52:37 +03:00
Nirbheek Chauhan
42af2d66d8 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Matej Knopp <matej.knopp@gmail.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-20 11:35:54 +01:00
xlazom00
94d11f87c7 hls, timecode: fix linking
https://bugzilla.gnome.org//show_bug.cgi?id=769587
2016-08-07 16:45:25 +01:00
Jan Schmidt
f2dc791479 hls: Avoid potential NULL pointer dereference.
Fixes CID 1364753
2016-08-04 22:28:13 +10:00
Jan Schmidt
d78686f7d4 hls: Avoid coverity warning about access off the end of an array.
Fixes CID 1364755
2016-08-04 22:22:44 +10:00
Luis de Bethencourt
2ed4135237 hls: m3u8: remove impossible condition
After the check in line 1,111,  media->uri can't be NULL. So the two checks
for GST_HLS_MEDIA_TYPE_CLOSED_CAPTIONS are the same, removing the redundant
one which goes to cc_unsupported.

CID 1364752
2016-08-04 11:17:56 +01:00
Jan Schmidt
35c82fee32 hlsdemux: Don't output pending data after error
If the last_ret status is not OK, skip output
of any pending PCR scan buffer, similarly to how
the pending decryption buffer is handled above.
2016-08-04 04:53:50 +10:00
Jan Schmidt
2df53e5a7d hlsdemux: Include config.h and add header in utils
In gsthlsdemux-util.c, include config.h before any
other headers, and add a copyright / license header.
2016-08-04 01:54:28 +10:00
Jan Schmidt
ebab5b17f4 hls: Fix compiler warning for possibly uninit variable 2016-08-03 23:51:14 +10:00
Michael Olbrich
89727ee9a3 hlsdemux: seek all streams 2016-08-03 23:49:54 +10:00
Michael Olbrich
decafb5f4c hlsdemux: simplify gst_hls_demux_seek()
Don't initialize current_sequence. It is always overwritten in the walk
loop.
2016-08-03 23:49:54 +10:00
Michael Olbrich
4704634f43 hlsdemux: don't download the last fragment when seeking beyond the end of the track
It's not used anyways.
2016-08-03 23:49:54 +10:00
Jan Schmidt
1d4eb71a05 hlsdemux: Add support for ID3 tag parsing
Parse start PTS out of the ID3 tags in
audio fragments. Informational only for now.
2016-08-03 23:49:54 +10:00
Jan Schmidt
8cf50dbc44 hlsdemux: Do some reading and dumping of PCRs
Read PCRs out of the MPEG-TS stream in a basic way
and (for now) just log them
2016-08-03 23:49:54 +10:00
Jan Schmidt
d9daa5d0b3 hlsdemux: Only use the primary stream for bitrate selection.
When playing alternate rendition auxilliary streams, ignore
them in bitrate measurement (for now).
2016-08-03 23:49:54 +10:00
Jan Schmidt
e91bddbcfd hlsdemux: Only select video and audio streams by default
Ignore subtitle streams for now, because the
different fragment duration causes problems
switching bitrates w/ decodebin2 group draining.
2016-08-03 23:49:54 +10:00
Jan Schmidt
216195b7b2 hlsdemux: Publish all media for alternate renditions.
Create an output stream for each media when alternate renditions
are present. Update the manifests for all those streams, and
make sure that typefinding is still done for files smaller than 2KB
such as small WebVTT files.
2016-08-03 23:49:54 +10:00
Jan Schmidt
f32c7aa88a hlsdemux: Adjust downstream buffer offsets
When fetching a byte-region from a server resource,
adjust the downstream buffer offsets so that downstream
doesn't know. This is because id3demux insists on the
first offset being 0. Later we might strip ID3 headers
entirely and this will be unneeded.
2016-08-03 23:49:54 +10:00
Jan Schmidt
f3397e0d54 hlsdemux: Choose the default variant and track it when updating
Modify playlist updating to track information across updates
better, although still hackish.

When connection_speed == 0, choose the default variant
not the first one in the (now sorted) variant list, as that
will have the lowest bitrate.
2016-08-03 23:49:54 +10:00
Tim-Philipp Müller
4df6f1ee93 hlsdemux: move variant list handling over to new master playlist code
Adapt hlsdemux for the m3u8 playlist changes.
2016-08-03 23:49:54 +10:00