Commit graph

179 commits

Author SHA1 Message Date
Vincent Penquerc'h
cb0eaeadfd tsdemux: fix segment position tracking for the general case
Different streams can have different PTS/DTS bases, and some
streams may not even have DTS.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-16 13:35:40 +01:00
Vincent Penquerc'h
338bfe5e35 tsdemux: handle seeks with no target (ie, keep current position)
Such seeks are used to change playback rate and we do not want
to alter the position in that case, so we bypass the flush/seek
logic, and set things up so a new segment is scheduled to be
regenerated.

https://bugzilla.gnome.org/show_bug.cgi?id=735100
2015-04-09 15:44:20 +01:00
Vincent Penquerc'h
ade79a9ad2 tsdemux: send new segment when a stream is added
This will happen when the PMT changes, replacing streams with
new ones. In that case, we need to accumulate the running time
from the previous chain in the segment base.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-09 15:44:20 +01:00
Vincent Penquerc'h
fc2460b331 tsdemux: keep track of current position
This allows seeking to correctly set the base on the segment.

https://bugzilla.gnome.org/show_bug.cgi?id=745102
2015-04-09 15:44:20 +01:00
Thiago Santos
b347ea9870 tsdemux: Fix segment and segment event handling during seeking
Always update the segment and not only for accurate seeking and always
send a new segment event after seeks.

For non-accurate force a reset of our segment info to start from
where our seek led us as we don't need to be accurate

https://bugzilla.gnome.org/show_bug.cgi?id=743363
2015-02-13 15:29:24 -03:00
Thiago Santos
b18a09dbec tsdemux: remove update segment logic
This is not needed in 1.x series anymore
2015-02-03 13:50:42 -03:00
Aurélien Zanelli
d0a50be26d tsdemux: don't mark streams as needing a new segment on flush
The flush is called on discont and we shouldn't output a new segment
each time a discont happens. So this commit remove the mark for a new
segment when flushing streams by propagating the 'hard' flag passed
on the flusing from the base class.

https://bugzilla.gnome.org/show_bug.cgi?id=743363
2015-02-03 13:50:42 -03:00
Edward Hervey
16fc431ada tsdemux: Only activate warning for real streams
streams with stream_type 0xff are PCR-only streams, it's normal not
to have a pad for them.
2014-12-01 13:31:21 +01:00
Tim-Philipp Müller
2cd4f5d0c1 tsdemux: send initial GAP event on sparse streams for faster startup with playbin
Signal sparse streams properly in stream-start event and force sending
of pending sticky events which have been stored on the pad already and
which otherwise would only be sent on the first buffer or serialized
event (which means very late in case of subtitle streams). Playsink in
playbin waits for stream-start or another serialized event, and if we
don't do this it will wait for the multiqueue to run full before
starting playback, which might take a couple of seconds.

https://bugzilla.gnome.org/show_bug.cgi?id=734040
2014-10-20 12:32:19 +02:00
Edward Hervey
b59a9262c0 tsdemux: GAP detection
All pads of a stream are now added at the beginning. In order to cope with
streams that don't get any data (forever or for a long time) we detect gaps
and push out GAP events when needed.

Cleanups and commenting by Jan Schmidt <jan@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=734040
2014-10-20 12:32:10 +02:00
Jesper Larsen
1b8e76d235 tsdemux: do not discard on discont if PES start
If a discontinuity in the stream is detected, data is discarded until
a new PES starts. If the first packet after the discontinuity is also
the start of a PES, there is no reason to discard the packets.

https://bugzilla.gnome.org/show_bug.cgi?id=737569
2014-09-29 11:41:01 +02:00
Aurélien Zanelli
77b850c08d tsdemux: fix trivial coding style issue
https://bugzilla.gnome.org/show_bug.cgi?id=736531
2014-09-12 11:31:59 +02:00
Thiago Santos
52257fe538 tsdemux: remove pads when resetting the element
Otherwise the pads will be there if it is restarted and the stream
can be a completely different one.

https://bugzilla.gnome.org/show_bug.cgi?id=734394
2014-08-19 00:02:33 -03:00
Thibault Saunier
03031037fa tsdemux: Do not tweak segments on reverse playback
We can't compare the first buffer start and the segment start in that
case... playback is going backward!

https://bugzilla.gnome.org/show_bug.cgi?id=734445
2014-08-13 17:46:55 +02:00
Mathieu Duponchelle
29dd215649 tsdemux: Do not scan for keyframe when in push mode.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490
2014-07-22 15:51:21 +02:00
Mathieu Duponchelle
39d7d438c6 tsdemux: Do not scan for a keyframe in non-accurate mode.
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=733490
2014-07-22 15:50:59 +02:00
Edward Hervey
22dfd9aef3 mpegts: Unify API : GstMpegts / gst_mpegts_ / GST_*_MPEGTS_
It was previously a mix and match of both variants, introducing just too much
confusion.

The prefix are from now on:
* GstMpegts for structures and type names (and not GstMpegTs)
* gst_mpegts_ for functions (and not gst_mpeg_ts_)
* GST_MPEGTS_ for enums/flags (and not GST_MPEG_TS_)
* GST_TYPE_MPEGTS_ for types (and not GST_TYPE_MPEG_TS_)

The rationale for chosing that is:
* the namespace is shorter/direct (it's mpegts, not mpeg_ts nor mpeg-ts)
* the namespace is one word under Gst
* it's shorter (yah)
2014-06-25 14:50:05 +02:00
Stefan Ringel
7c884374eb mpegts: change to GType and from gchar[] to gchar*
https://bugzilla.gnome.org/show_bug.cgi?id=730914
2014-06-24 16:06:01 +02:00
Tim-Philipp Müller
983eb6d28a tsdemux: fix up comment 2014-06-22 12:32:35 +01:00
Sebastian Dröge
59bdcd9ae3 tsdemux: Update comments to the new reality and remove unused variables 2014-06-21 16:55:05 +02:00
Edward Hervey
1d1d469488 tsdemux: Don't overwrite original seek value
In accurate mode, we'll be using start to fill in the seek segment,
therefore don't overwrite it with the shifted seek position.

https://bugzilla.gnome.org/show_bug.cgi?id=731698
2014-06-16 07:42:37 +02:00
Mathieu Duponchelle
79c13b713e tsdemux: implement proper seeking for h264 streams.
Co-Authored by: Thibault Saunier <tsaunier@gnome.org>

From a high level perspective, the new process for seeking h264
streams is as follows:

1) Rewind the stream until we find the first I-slice of a frame,
   and mark its offset in the stream.
2) Rewind the stream until we find SPS and PPS informations,
   to make sure the subsequent parser is up to date.
3) Accumulate optionnal SEI NAL units on the way.
4) Push the SPS, PPS and SEI units before the new keyframe.

https://bugzilla.gnome.org/show_bug.cgi?id=675132
2014-06-12 14:44:10 +02:00
Edward Hervey
0020a9344d tsdemux: Remove unused variable
The seeksegment was no longer used since the switch to calculating segments
when we see data.
2014-06-10 14:50:10 +02:00
Jan Schmidt
9538651a20 tsdemux: Remove extraneous extra parameter from check_pending_buffers function 2014-06-04 21:56:28 +10:00
Jan Schmidt
842c4a3d2c tsdemux: Reset pending_ts on a discont, to re-measure initial timestamps
Since all the other timestamp tracking now gets reset on a discont,
it makes sense to wait for a PCR and timestamp buffers like when
playback first starts
2014-06-04 21:54:43 +10:00
Thiago Santos
c56a4d54b8 tsdemux: add/remove pads to flowcombiner differently due to streaming nature
Due to mpegts streaming nature some pads are created but are only added
later to the element. This can cause a scenario where the first stream
doesn't have an available decoder (while the next ones still pending
would have) and tsdemux will fail with not-linked as the first stream
added wouldn't be linked.

To avoid this tsdemux needs to add pads to the flowcombiner
when they are created instead of only when adding them to the
element.
2014-05-27 10:29:32 -03:00
Thiago Santos
ae839d8dc2 mxfdemux: use GstFlowCombiner
Removes flow return combination code to use the newly added GstFlowCombiner

https://bugzilla.gnome.org/show_bug.cgi?id=709224
2014-05-26 23:29:43 -03:00
Thiago Santos
b66012a586 tsdemux: use GstFlowCombiner
Removes flow return combination code to use the newly added GstFlowCombiner
2014-05-26 23:29:43 -03:00
Tim-Philipp Müller
ab3153b9a2 tsdemux: remove confusing debug log line 2014-05-10 12:56:24 +01:00
Sebastian Dröge
986c8782e4 tsdemux: Push next buffer after a discont with the DISCONT flag 2014-03-29 10:33:45 +01:00
Sebastian Dröge
264d7dbd89 tsdemux: Drain remaining data on disconts 2014-03-29 10:33:45 +01:00
Sebastian Dröge
11bc356ce7 tsdemux: Don't dereference NULL if flushed before a program was selected 2014-03-29 10:33:45 +01:00
Sebastian Dröge
ba114b6b22 tsdemux: Ensure that all pending data is pushed even if the stream was not activated before
gst_ts_demux_push_pending_data() will check if it now can activate the
stream and add the pad, we don't have to check that ourselves.

Fixes playback of very short MPEG TS files.
2014-03-29 10:33:45 +01:00
Edward Hervey
6629ca8f2b tsdemux: Support Bluray DTS/DTS-HD and AC3+/TrueHD streams
Apart from just adding detection of the proper stream type, we also need to only
output the first substream (0x71) which contains the core substream.

While this does not provide *full* DTS-HD support (since it will miss the complementary
substreams), it will still work in the way legacy (non-DTS-HD) bluray players would work.

https://bugzilla.gnome.org/show_bug.cgi?id=725563
2014-03-15 18:09:12 +01:00
Thiago Santos
6b4ce0d04f tsdemux: store global tags to push later
Keep a list of current global tags around and push them
whenever a new stream is started. Also convert all stream
specific tags to global as they are stream specific for
the container, so they are global for the streams from
within that container.

https://bugzilla.gnome.org/show_bug.cgi?id=644395
2014-02-26 10:26:57 -03:00
Sebastian Dröge
9682e44db6 tsdemux: We do not support the SKIP seek flag but that is not a problem 2014-01-30 20:29:58 +01:00
Sebastian Dröge
84bd65b9bd tsdemux: Add HEVC / h265 support 2014-01-06 13:54:40 +01:00
Edward Hervey
64592da3e9 tsdemux: Demote GST_ERROR to GST_WARNING
discontinuities are not errors per-se and we handle them correctly.
2013-10-28 09:15:20 +01:00
Edward Hervey
5e50cd507c tsdemux: Refactor language tag extraction
subtitling descriptor needs to be used with a different method to extract
language codes.
2013-10-11 10:29:20 +02:00
Jesper Larsen
b6d33e5ce4 tsdemux: Use mpegts-lib for ISO 639 language tags
https://bugzilla.gnome.org/show_bug.cgi?id=709180
2013-10-07 10:23:22 +02:00
Jesper Larsen
279bdef4ea tsdemux: Return descriptor in get_descriptor
https://bugzilla.gnome.org/show_bug.cgi?id=709180
2013-10-07 10:23:22 +02:00
Edward Hervey
0e9ce593bf tsdemux: Wait for valid PCR/offset obvervations
It is quite possible that we might get PTS/DTS before the first
PCR/Offset observation.

In order to end up with valid timestamp we wait until at least one
stream was able to get a proper running-time for any PTS/DTS.
Until then, we queue up the pending buffers to push out.

Once we see a first valid timestamp, we re-evaluate the amount of
running-time elapsed (based on returned inital running-time and amount
of data/DTS queued up) for any given stream.

Taking the biggest amount of elapsed time, we set that on the packetizer
as the initial offset and recalculate all pending buffers running-time
PTS/DTS.

Note: The buffer queueing system can also be used later on for the
dvb fast start proposal (where we queue up all stream packets before
seeing PAT/PMT and then push them once we know if they belong to the
chosen program).
2013-09-28 13:15:43 +02:00
Arnaud Vrac
85ad4f3ad6 tsdemux: fix buffer overflow
This can happen with a corrupt TS file, found with breakmydata element
plugged before tsdemux.

https://bugzilla.gnome.org/show_bug.cgi?id=708161
2013-09-27 15:10:23 +02:00
Edward Hervey
fd4fd13dc8 tsdemux: Refuse negative rates which we don't support yet
And remove a check which was done before
2013-08-21 14:44:38 +02:00
Edward Hervey
5208b8a050 pesparse: Remove unused argument
We always provided 0 as the offset and never used the returned value.

Based on feedback from Stas Sergeev <stsp@list.ru>

https://bugzilla.gnome.org/show_bug.cgi?id=657343
2013-08-14 10:33:14 +02:00
Tim-Philipp Müller
646ba6b3df mpegts: private/teletext -> application/x-teletext 2013-07-30 16:08:17 +01:00
Sebastian Dröge
6812f96de4 gst: Don't swap start/stop for negative rates in the SEGMENT query 2013-07-29 12:14:08 +02:00
Sebastian Dröge
12981a5d82 tsdemux: Implement SEGMENT query 2013-07-29 11:02:55 +02:00
Edward Hervey
a45aa8fe48 tsdemux: Remove unused macros 2013-07-29 09:42:12 +02:00
Edward Hervey
edd69b2989 tsdemux: Add more AC3 detection cases
ATSC ac3 streams are always guaranteed to be AC3 if EAC3 descriptor
is not present
If stream registration id is 'AC-3' then it's also guaranteed to be AC3.
Finally if AC3 descriptor is present it's guaranteed to be AC3.

Only silences a warning, but still.
2013-07-29 09:42:11 +02:00