Commit graph

150 commits

Author SHA1 Message Date
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
Edward Hervey
a76c658e8d tsdemux: Flush out pending data on EOS
Ensures downstream elements (like decoders) really get all the data
2013-07-29 09:42:11 +02:00
Edward Hervey
e6ebd9024e tsdemux: HDV only has mpeg 1 audio layer 2
Set that accordingly on the caps
2013-07-27 12:18:36 +02:00
Edward Hervey
1f7fa9be1d tsdemux: Remember requested seek rate and use it
The new seek handling re-creates the segment time information once it
has enough information after a seek.

The problem was that we'd completely ignore the requested rate. So store
that and use it in the newly created segment.

https://bugzilla.gnome.org/show_bug.cgi?id=694369
2013-07-24 15:51:46 +02:00
Edward Hervey
069a497d19 tsdemux: Create and send codec tag
Helps with applications that rely on presence of that tag for user-facing
information.

https://bugzilla.gnome.org/show_bug.cgi?id=702216
2013-07-23 15:11:51 +02:00
Sebastian Dröge
44e404fe41 tsdemux: Add support for group-id in the stream-start event 2013-07-23 10:33:31 +02:00
Douglas Bagnall
dfb101e0ed tsdemux: disentangle requested program number from active program number
The program_number attribute was overloaded, trying to indicate both
the currently playing program, and the program requested via the
"program-number" property.  The end result was that setting the
property didn't work (see #690934).

I added a new requested_program_number field rather than reviving the
current_program_number field because it seemed this would result in
fewer changes overall and be less confusing.  It breaks symmetry with
the "program-number" property, but it retains parallels with the likes
of program->program_number.

Because gst_ts_demux_reset is called after the properties have been
parsed, requested_program_number is initialised in gst_ts_demux_init.
Whether this is exactly the right place, I don't know.
2013-07-22 09:53:46 +02:00
Jesper Larsen
8e4f966018 tsdemux: fix program-number functionality
Setting the program-number property does not affect which program
is actually being demuxed.

Moving the initialization of the program_number from
gst_ts_demux_reset to gst_ts_demux_init seems to fix this issue.

https://bugzilla.gnome.org/show_bug.cgi?id=690934
2013-07-22 09:53:46 +02:00
Edward Hervey
1b1b3a40d7 mpegtsdemux: Remember seek sequence number
* Avoids handling twice the same seek (can happen with playbin and files
  with subtitles)
* Set the sequence number of the segment event to the sequence number of
  the seek event that generated it (-1 for the initial one).
2013-07-15 11:20:40 +02:00
Arnaud Vrac
024aa47f64 tsdemux: implement seeking in push mode 2013-07-15 11:20:40 +02:00
Arnaud Vrac
388c28381f tsdemux: recalculate new segment after byte seek
The seeking start time is approximated from the seek offset in bytes
using the accumulated PCR observations, so on a VBR stream there might
be a big difference between the actual PCR and the estimated one after
the seek. This might result in a long wait to skip all out of segments
packets.

Instead we just recalculate the new segment to start at the first PTS
after the seek, so that playback starts immediatly.
2013-07-15 10:51:28 +02:00
Edward Hervey
2fb7b87140 mpegtsdemux: Avoid vmethod calls
Depending on usage, tsparse and tsdemux might not need to be called
when new section/pes-data is available.
2013-07-09 12:25:11 +02:00
Edward Hervey
1c96c79b88 mpegtsdemux: Handle private section streams
Until now we simply ignored those streams (since we couldn't do anything
with it anyway). Now that we have the mpegts library and we offload the
section handling to the application side we can properly identify and
extract them.

By default it is disabled for tsparse and enabled for tsdemux, but there is
a property to change that.

This should open the way to properly handle all private section streams,
including:
* DSM-CC
* MHEG
* Carousel data
* Metadata streams (though I haven't seen any of those in the wild)
* ... And all other specs/protocols making use of those

Partially fixes #560631
2013-07-06 14:50:52 +02:00
Edward Hervey
a3b6b1a951 mpegtsdemux: Handle registration descriptor for programs and streams
* Allows us to simplify some code and prepare for future cleanups.
* Remove useless casts
* Add some FIXME regarding VC1
2013-07-06 10:59:54 +02:00
Edward Hervey
7814ed196b mpegtsdemux: Switch to using GstMpegTsStreamType
We still have some other stream types which haven't been ported, but
we will do so once we have defined the enums in the mpegts library.

Also add some FIXMEs regarding items discovered during analysis
2013-07-04 08:45:32 +02:00
Edward Hervey
1f2bb15618 mpegtsdemux: GstMpegTS => GstMpegTs 2013-07-03 14:00:58 +02:00
Edward Hervey
92edd82c86 mpegtsdemux: Switch to MPEG-TS SI library
* Only mpeg-ts section packetization remains.
* Improve code to detect duplicated sections as early as possible
* Add FIXME for various issues that need fixing (but are not regressions)

https://bugzilla.gnome.org/show_bug.cgi?id=702724
2013-07-03 09:17:25 +02:00
Edward Hervey
9fd7f1c082 mpegtspacketizer: Speedup packet parsing
Avoid using bitshifting where not needed.

Speeds up packet parsing by 3% (this is *the* hotspot of mpeg-ts elements).
2013-06-24 07:49:34 +02:00
Edward Hervey
79e63e3daf mpegtsdemux: Fix for compiling without GST_DEBUG
Protect debug-only variables/usage, and in one case remove a useless
variable.
2013-06-19 12:29:46 +02:00
Arnaud Vrac
065d421d34 tsdemux: move some debug prints at the log level 2013-06-12 08:01:20 +02:00
Josep Torra
28a2902a7b tsdemux: fixes seeking in pull mode
Preserve the current segment and observations in pull mode seeks with
flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=698050
2013-06-12 08:01:06 +02:00
Edward Hervey
7837cab44e tsdemux: Demote a warning to debug level
We will get it for virtually every first packets.
2013-05-23 14:59:34 +02:00
Edward Hervey
65ba9b4756 tsdemux: convert packet PTS/DTS as soon as possible
We let the mpegtspacketizer deal with pcr wraparound/resets.

https://bugzilla.gnome.org/show_bug.cgi?id=674536
2013-04-26 15:49:18 +02:00
Thiago Santos
d8b8809d57 tsdemux: Fix caps string leak 2013-04-24 12:28:17 +02:00
Greg Rutz
2306d51d9d tsdemux: Add support for Motorola DigiCipher II MPEG2 video
Since there is a conflict between the DCII stream type and BluRay
stream types, moved the processing of BluRay-specific stream types
to the beginning of the function.  Only if a BluRay stream type
IS NOT found do we proceed to check the rest of the stream type
identifiers

Previous code was also "sort-of" handling a similar conflict between
BluRay AC3 audio and standard AC3 audio.  Moved the special case BluRay
AC3 handling in the main switch statement to the new BluRay-specific
switch.

https://bugzilla.gnome.org/show_bug.cgi?id=697892
2013-04-18 09:30:58 +02:00
Sebastian Dröge
2713fd1058 tsdemux: Check the continuity counter for non-section packets too
And if we detect a discontinuity there (like... when losing packets
or having MPEGTS over raw UDP with out-of-order packets) we just
drop the corresponding packet.

A future version could try to implement a re-ordering algorithm based
on that, similar to what rtpjitterbuffer does.
2013-04-11 13:11:44 +02:00
Edward Hervey
98265d0b28 tsdemux: Add support for TrueHD audio 2013-04-07 18:41:38 +02:00
Edward Hervey
ca3146a2cd tsparse: Ensure segment events are forwarded
We skip them for tsdemux though (recreated later)

Fixes #690949
2013-03-30 13:54:37 +01:00
Douglas Bagnall
0c9db072ce tsdemux: remove unused current_program_number field
https://bugzilla.gnome.org/show_bug.cgi?id=690934
2013-03-24 20:58:28 +00:00
Josep Torra
7fafbe2e22 tsdemux: expose VC1 streams with missing descriptor.
Fixes playback of VC1 streams when the descriptor is missing.
2013-02-05 23:07:12 +01:00