Commit graph

527 commits

Author SHA1 Message Date
Edward Hervey
05b51dfec0 mpegtsdemux: header cleanups/updates 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
David Schleef
303a2eaec4 mpegtsdemux: check value before using as denominator 2013-04-15 17:05:30 -07:00
Sebastian Dröge
e51cd4fe2f gst: Add better support for static plugins 2013-04-15 15:59:22 +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
Sebastian Dröge
4ca886c53b mpegtsbase: Call ::program_stopped after removing all streams
Subclasses want to access the program while removing the streams
and will currently crash because of dereferencing NULL in some cases.
2013-04-10 16:19:00 +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
Sebastian Dröge
acacef9fbb mpegtsdemux: Fix various compiler warnings 2013-03-03 12:30:32 +01: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
David Schleef
a19c0b5697 tsdemux: Add descriptors for SMPTE 302m audio 2013-02-04 18:07:17 -08:00
Matthias Hardt
0e3fdb1e16 tsdemux: extract ISO 639 language codes for subtitles into taglists
https://bugzilla.gnome.org/show_bug.cgi?id=680200
2012-12-28 23:32:55 +00:00
Josep Torra
3d012665f0 tsdemux: forward upstream time segments after flushes
Also reset segment info and drop the segment event when demuxer is
flushed.
Restore demuxer segment with the info stored in base when demuxer is
going to push data again if needed.
Drop code to recover the segment info from base in the initial program
becauses it's superseded by the new code.
2012-11-14 22:51:35 +01:00
Josep Torra
0b3e0ed080 tsdemux: reset the stream some more in the flushes
Now that we handle flushing in the FLUSH_STOP event we need to make
the streams ready if they were flushing.
2012-11-12 22:57:19 +01:00
Josep Torra
150376efe4 mpegtspacketizer: flush observations too
Flush the previous observations when the packetizer is flushed.
Also don't leak them in the dispose.
2012-11-12 22:57:19 +01:00
Josep Torra
1fc5fffe08 mpegtsbase: fix double unref of seek event 2012-11-12 22:57:19 +01:00
Josep Torra
cc40d49bed mpegtsbase: flush in FLUSH_STOP to avoid race conditions
Ensure the chain is not running before reset the state to avoid race
conditions and random corruptions downstream.
Also fixes segfaults in the packetizer due wrong available values that
causes gst_adapter_map to return a NULL pointer.
2012-11-12 22:57:19 +01:00
Josep Torra
996da425a9 Revert "tspacketizer: ensure that a null pointer isn't accessed"
This reverts commit 6efd611b8c.

Also this extra check won't be needed if it's fixed the race by moving
flush actions to FLUSH_STOP.
2012-11-10 19:52:46 +01:00
Josep Torra
80dd130fb0 Revert "tsbase: add a guard with an atomic boolean when flushing"
This reverts commit e14e310f71.

Would be better move the packetizer flushing to FLUSH_STOP and avoid
the race that way. Without introducing a memory barrier that could
have impact in the performance.
2012-11-10 19:46:40 +01:00
Josep Torra
e14e310f71 tsbase: add a guard with an atomic boolean when flushing 2012-11-10 00:08:35 +01:00
Josep Torra
6efd611b8c tspacketizer: ensure that a null pointer isn't accessed
Mitigates segfault due race condition in FLUSH_START handling and
mpegts_base_chain.
2012-11-09 22:17:11 +01:00
Edward Hervey
651203de07 mpegts: Only use timestamp-based PCR/PTS estimation when needed
When dealing with non-time based push-mode streams, we need to revert
to using the offset-based PCR/PTS estimation logic of packetizer.

This solves uses cases such as:
 pushfile:// ! tsdemux
 src ! queue ! tsdemux

https://bugzilla.gnome.org/show_bug.cgi?id=687178
2012-11-09 12:15:24 +01:00
Tim-Philipp Müller
9e1b75fda3 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-04 00:09:59 +00:00
Sebastian Pölsterl
43938bbf54 tsdemux: Fix name of CAT GstStructure
The structure previously was assigned the name "pat".

https://bugzilla.gnome.org/show_bug.cgi?id=686948
2012-10-29 13:16:46 +01:00
Tim-Philipp Müller
465374f3c8 tsdemux: fix program packet sequence counter parsing in PES header 2012-10-19 01:05:44 +01:00
Tim-Philipp Müller
10c881b107 tsdemux: fix some inconsequential PES header parsing issues
additional_copy_info: need to get rid of the highest
bit, not the lowest one

program_packet_sequence_counter: also need to get rid
of the highest bit instead of multiplying with a random
value

original_stuff_length: want to AND 0x3f to extract the
lowest 6 bits, not multiply by it.

None of these fields are actually used though, so these
should not have caused any issues.
2012-10-19 01:05:34 +01:00
Raimo Järvi
9640669689 tsdemux: Fix parsing P-STD_buffer in PES header
https://bugzilla.gnome.org/show_bug.cgi?id=686294
2012-10-19 00:29:40 +01:00
Andoni Morales Alastruey
f768dfd925 tsdemux: fix potential crash dereferencing NULL program pointer
https://bugzilla.gnome.org/show_bug.cgi?id=686358
2012-10-18 17:54:41 +01:00
Tim-Philipp Müller
32ba17cd0f Use gst_element_class_set_static_metadata()
where possible. Avoids some string copies. Also re-indent
some stuff. Also some indent fixes here and there.
2012-10-17 17:46:34 +01:00
Sebastian Dröge
e5eceaaa73 mpegtsdemux: First push EOS, then destroy all programs
And also properly remove the program from the subclass
2012-10-12 15:38:44 +02:00
Mark Nauwelaerts
578861abea replace gst_element_class_set_details_simple with gst_element_class_set_metadata 2012-09-14 17:27:49 +02:00
Mark Nauwelaerts
b807753453 ext, gst: only activate in pull mode if upstream is seekable 2012-09-11 17:47:33 +02:00
Tim-Philipp Müller
2483c82bd7 video/x-dvd-subpicture -> subpicture/x-dvd 2012-08-20 23:37:00 +01:00
Edward Hervey
105737db54 mpegtspacketizer: Fix flushing/sync handling
There was a stray adapter_flush() now that we used a temporary buffer
2012-08-14 19:07:58 +02:00
Edward Hervey
121aa3ad13 mpegtspacketizer: Better detect PCR resets
Assume that any differences in PCR greater than 15s means there is
a reset in the stream.
2012-08-14 19:07:51 +02:00
Edward Hervey
3153965658 mpegtspacketizer: Remove/demote some debugging 2012-08-14 19:07:39 +02:00
Edward Hervey
9abedc97ff tsdemux: Always use current PTS/DTS
This avoids setting old PTS and/or DTS
2012-08-14 19:07:33 +02:00
Edward Hervey
e25c2e8e74 mpegtspacketizer: Remove unneeded memset(0) 2012-08-14 19:07:28 +02:00
Edward Hervey
8b80114101 mpegts: Use G_GNUC_INTERNAL 2012-08-14 19:07:24 +02:00
Edward Hervey
4d4d2f6eb0 mpegtspacketizer: Use gst_structure_*_take_value where applicable
Saves copying/freeing data
2012-08-14 19:06:16 +02:00
Edward Hervey
5de6fd1ff8 mpegtspacketizer: Cache the GIConv
Avoids having to constantly open/free them (which will end up being
very often with EIT/NIT).
2012-08-14 19:06:11 +02:00
Edward Hervey
e3c0bbe5f6 mpegtbase: reset element in READY=>PAUSED
Ensures all subclass reset vmethods are called
2012-08-14 19:06:04 +02:00
Edward Hervey
b1295aef14 mpegtspacketizer: Use more Quarks 2012-08-14 19:05:58 +02:00
Edward Hervey
d54624aa49 tsdemux: Remove useless code
PCR/OPCR is meant to be handled by the packetizer
2012-08-14 19:05:52 +02:00
Edward Hervey
4f55cc12ae tsdemux: Calculate pcr/time/offset separately per program
Avoids quite a few issues with multi-program streams
2012-08-14 19:05:48 +02:00
Edward Hervey
a8d1e88bda tsparse: Push out buffer on main source pad 2012-08-14 19:05:44 +02:00
Edward Hervey
558beab1b4 mpegtbase: vmethod to notify when we're done processing input
This can be used to notify subclasses no more data is expected this
round.
tsparse will use it to push whole buffers (without copy) on the main
source pad.
It could also be used later to decide whether to push pending data
in order to reduce latency.
2012-08-14 19:05:37 +02:00
Sebastian Dröge
bdc46898de gst: Add stream-id to stream-start events 2012-08-06 14:05:08 +02:00
Tim-Philipp Müller
489b102a43 gst_tag_list_free -> gst_tag_list_unref 2012-08-04 16:31:30 +01:00
Sebastian Dröge
afd50a79f4 tag: Update for taglist/tag event API changes 2012-07-28 00:32:58 +02:00
Mark Nauwelaerts
76aedf5641 tsdemux: more correctly determine expected PES packet payload size
... particularly considering that packet_length == 0 is possible.
2012-07-12 10:17:57 +02:00
Mark Nauwelaerts
006fe188e7 tsdemux: correctly determine expected PES packet payload size
Avoids consistently failing to detect that a packet is complete, which
would then only be pushed upon the start of a next packet, which leads
to quite a delay in case of a sparse (subtitle) stream.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=666674
2012-07-11 20:43:46 +02:00
Edward Hervey
d3271381ee mpegtsbase: Move known PSI PIDs to where they belong
This avoids tsdemux parsing data is doesn't really care about

Conflicts:

	gst/mpegtsdemux/mpegtsparse.c
2012-06-29 10:02:30 +02:00
Edward Hervey
ada9990092 mpegtbase: Add more known default SI PIDs 2012-06-29 09:59:13 +02:00
Edward Hervey
b5967d2323 tsdemux: Fix AAC LATM caps 2012-06-29 09:23:32 +02:00
Tony Houghton
a996d2f01a Correct satellite delivery descriptor parsing.
Original code to parse satellite delivery descriptors to generate
"satellite" structures appeared to be copy & pasted from cable's code
without amending for satellite.

Also added 8PSK to dvbsrc's enum for modulation.

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

Conflicts:

	gst/mpegdemux/gstmpegdesc.h
	gst/mpegdemux/mpegtspacketizer.c
2012-06-21 11:37:21 +01:00
Edward Hervey
b8f32811ca tsparse: Rework handling and cleanups
tspad always has a static source pad which output everything received
(not functional yet).

Program pads are now request pads.

Remove all cruft that should have been removed from the switch over
to mpegtsbase.

Conflicts:

	gst/mpegtsdemux/mpegtsparse.c
2012-06-21 11:34:28 +01:00
Edward Hervey
a8dd05742a mpegtbase: Always send EOS
subclass will take care of handling it more if needed
2012-06-21 11:25:17 +01:00
Wim Taymans
dbed726057 update for task api change 2012-06-20 10:40:42 +02:00
Edward Hervey
a931620208 mpegtspacketizer: Don't use GByteArray
Using a simple array comes to the same result for a fraction of the cost
2012-06-19 10:49:45 +01:00
Edward Hervey
8fd2d43d60 mpegtbase: Avoid copying GstStructure 2012-06-19 10:49:37 +01:00
Edward Hervey
94c68115ef mpegdesc: Don't allocate/free GstMPEGDescriptor
Just use static variables
2012-06-19 10:49:26 +01:00
Wim Taymans
b98ec32380 update for tag event change 2012-06-06 13:02:40 +02:00
Edward Hervey
e2576f0e86 mpegtsdemux: Also parse TOT (Time Offset Section)
It's the same as TDT, except with descriptors at the end
2012-06-05 10:54:27 +02:00
Edward Hervey
d9121c38ea mpegtsdemux: FIXME/Comment about issues/errors 2012-06-05 10:54:26 +02:00
Edward Hervey
9e117b83fc mpegtspacketizer: Fix leak 2012-06-05 10:54:26 +02:00
Edward Hervey
5f7ecaa0f1 mpegtspacketizer: Reduce usage of GstAdapter
Peek as much as possible in one go. Ideally we should remove usage of
adapter altogether, but for the time being it provides a big enough
speedup (around 2 times faster per packet processed).
2012-06-05 10:54:26 +02:00
Edward Hervey
f0867c7247 mpegtspacketizer: Avoid alloc/free where possible
Helps for streams with a lot of sections, like EIT
2012-06-05 10:54:26 +02:00
Edward Hervey
aab8c46f10 mpegtbase: Add more sections that don't have a CRC 2012-06-05 10:54:26 +02:00
Edward Hervey
25f6c78d79 mpegdefs: Add list of known table_id
Along with the specifications from which they come. Avoids having
to search for which spec a table_id belongs to
2012-06-05 10:54:26 +02:00
Edward Hervey
0e86e68c6a mpegtspacketizer: Clarify debug statements
Use hex values in more cases (since that's how PID/table_id/... are
represented in the various specs).
2012-06-05 10:54:26 +02:00
Edward Hervey
63f8b970af mpegtsbase/packetizer: Add CAT section handling
Allows reporting the global EMM
2012-06-05 10:54:25 +02:00
Edward Hervey
dfe6863387 mpegtbase: Add more debug in PSI handling
Allows us to identify which SI we don't handle
2012-06-05 10:47:49 +02:00
Edward Hervey
d47d1713d9 mpegtbase: Add more default known PSI table_id 2012-06-05 10:47:49 +02:00
Edward Hervey
9924c178c8 mpegtbase: Refactor PSI detection 2012-06-05 10:47:49 +02:00
Edward Hervey
9f7e70f754 mpegtbase: ECM/CA sections don't have a CRC
So don't check for it :)

Also add a bit more info in the warning message to speed up detecting
whether it's a false-positive or not.
2012-06-01 16:42:41 +02:00
Edward Hervey
8b2f229553 mpegdesc: Add more comments/info
Namely where they belong to
2012-05-26 15:54:51 +02:00
Edward Hervey
8aa64c5d7d tsdemux: Make sure we have a language code before using it 2012-05-26 15:54:48 +02:00
Edward Hervey
7784c0d350 mpegtsbase: Check before getting descriptors from structure
Avoids spurious warnings. Not having those descriptors is nothing
fatal, so check their presence before trying to get them.
2012-05-26 15:54:44 +02:00
Edward Hervey
b6732a27d3 pesparse: Be a bit more permissive with PTS/DTS parsing
According to the specifications a PTS_DTS_flags value of 0x01 is forbidden.
... but there are some rare files out there that do that.

Instead of erroring out, let's warn, carry on parsing accordingly.

If the packet is really corrupted there are enough checks afterward to
detect that.
2012-05-26 15:54:41 +02:00
Edward Hervey
12f24874aa mpegtsbase: Fix bit operation
"a % 8" corresponds to "a & 0x7" (and not 0xf).

spotted by Julian Scheel
2012-05-25 14:16:59 +02:00
Edward Hervey
a633347ed1 mpegtsbase: Speed up _is_psi()
By making it inline and simplifying the bit macros
2012-05-23 09:37:49 +02:00
Julian Scheel
a0a184931a tsdemux: Add language code to taglist.
Read the language codes for tracks from the mpegts descriptors and add it into
the pads taglist.

https://bugzilla.gnome.org/show_bug.cgi?id=673896
2012-05-22 18:13:30 +02:00
Edward Hervey
6bf54ff850 tsdemux: Adapt to new packetizer API
We no longer use GstBufferList and instead copy the incoming data
into newly allocated memory.

This makes tsdemux behaviour 3 to 4 times faster.
2012-05-22 17:43:38 +02:00
Edward Hervey
7fdf1cb0c8 tsparse: Adapt to new packetizer API 2012-05-22 17:43:38 +02:00
Edward Hervey
3c73d29162 mpegtsbase: Adapt to new packetizer behaviour 2012-05-22 17:43:38 +02:00
Edward Hervey
c6035d403c mpegtspacketizer: Avoid usage of GstBuffer internally
The overhead of creating/using 188 byte GstBuffer from GstAdapter
is too expensive.
We now peek the next packet, and provide a data/size which is only
valid until the packetizerpacket is cleared.

In addition, cleanup all the internal code to deal with that new
behaviour and remove double-checks which are no longer needed.

The section_length is now the corrected section_length (i.e. with
the additional 3 bytes).

Avoid using gst_adapter_prev_timestamp and instead track
the timestamp ourself.
2012-05-22 17:43:38 +02:00
Edward Hervey
6d01f5f1b3 mpegtspacketizer: Detect PCR wraparound in skew code
If the received PCR is going backwards (by a safe margin), include
that wraparound for further calculation.

https://bugzilla.gnome.org/show_bug.cgi?id=674536
2012-05-22 16:51:25 +02:00
Julian Scheel
5536bcf8b8 tsdemux: flush on pusi only for payload packets
Data should not be flushed out of the tsdemux because a payload unit start
indicator (pusi) is seen in a adaptation only ts packet. If the package contains no
payload a pusi does not indicate a new PES packet, but PSI information, etc.
This fixes playback of several TS files which contain ts packets without
payload but with pusi set to 1.

https://bugzilla.gnome.org/show_bug.cgi?id=676168
2012-05-18 11:12:20 +02:00
Edward Hervey
e75612c3fd tsdemux: Don't queue data for streams that don't have a pad
This would result in an error further down, and it also avoids processing
for that data which we wouldn't be using anyway.
2012-05-18 11:11:37 +02:00
Edward Hervey
8a4fd8358d tsdemux: Detect and handle scrambled packets
Users (tsdemux/mpegtsparse) can decide what to do with that
2012-05-18 11:11:31 +02:00
Edward Hervey
fa4b92e743 tsdemux: Emit no-more-pads when all pads are activated
Fixes #670921 again
2012-05-18 11:11:25 +02:00
Albert Astrals Cid
dda551e723 mpegts: support items in extended event descriptor
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=672478
2012-05-14 11:51:15 +02:00
Raimo Järvi
93ad7a4d06 Fix printf format compiler warnings on mingw-w64
https://bugzilla.gnome.org/show_bug.cgi?id=675520
2012-05-05 19:45:42 +01:00
Wim Taymans
7394deef33 tsbase: unref bad packets too
Conflicts:

	gst/mpegtsdemux/mpegtsbase.c
2012-05-01 11:50:39 +02:00
Wim Taymans
b56ab4b3cf tsdemux: reset the state of the stream when flushing
We need to reset the stream on a flush or else old packets could be added to the
list and leak.
2012-05-01 11:47:52 +02:00
Wim Taymans
eaf4d97815 mpegtsbase: don't push events upstream in pull mode
In pull mode, don't push the seek event upstream.
2012-05-01 11:43:07 +02:00
Wim Taymans
6bf0ebdcd8 mpegts: don't poke into private adapter fields 2012-05-01 09:41:18 +02:00
Wim Taymans
8da3c2a969 mpegtsdemux: we ignore warnings differently
We suppress the warnings in the .c file instead.
2012-04-20 11:25:31 +02:00
Gil Pedersen
fcd8155d87 mpegtsdemux: port to 0.11
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=674397
2012-04-20 11:25:31 +02:00
Wim Taymans
5bd76c7c97 mpegtsbase: clarify event ownership 2012-04-20 11:25:31 +02:00
Gil Pedersen
095a17ad03 mpegtsdemux: fix memory leaks
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=674393
2012-04-20 11:25:31 +02:00
Julian Scheel
1059905237 tsdemux: Set currentlist to NULL after free.
This prevents double free of currentlist is some circumstances.
2012-04-18 09:30:22 +02:00
Sebastian Dröge
cda192b3b7 gst: Update for GST_PLUGIN_DEFINE() API changes 2012-04-05 18:02:56 +02:00
Alessandro Decina
f4b292f994 tsdemux: set correct newsegment fields on _TIME seeks
Forward the seek rate and set NS.start to the seek target so that decoders can
apply clipping where necessary.
2012-04-05 09:16:07 +02:00
Sebastian Dröge
1318a97e0a gst: Update versioning 2012-04-04 14:44:34 +02:00
Alessandro Decina
3b525d1147 tsdemux: reset iterator to NULL after it's free
Fixes possible invalid memory access in gst_ts_demux_stream_flush
2012-04-04 07:24:28 +02:00
Edward Hervey
6800d0c4e0 tsdemux: Clear bufferlist/iterator when removing streams 2012-04-02 15:26:28 +02:00
Edward Hervey
dd6550a663 mpegtspacketizer: Don't leak buffer in fast variant 2012-04-02 15:25:46 +02:00
Edward Hervey
cd728627af mpegtsbase: Don't leak corrupt section packet buffer 2012-04-02 15:25:16 +02:00
Edward Hervey
881350f34c tsdemux: Fix several leaks
* dont' leak buffers when a stream is in discont state
* don't leak buffers when a program is removed/deactivated
* remove all programs when disposing
2012-03-30 19:20:17 +02:00
Edward Hervey
416b10b991 mpegtspacketizer: Handle rollover in offset calculations 2012-03-05 12:46:13 +01:00
Edward Hervey
d798cb7be3 tsdemux: printf fix 2012-03-05 11:27:51 +01:00
Edward Hervey
bb479b04c1 tsdemux: Update TODO 2012-03-05 10:17:56 +01:00
Edward Hervey
85878c142e mpegts: Switch rank of mpegtsdemux and tsdemux
More effort has been put lately in tsdemux and works in more use cases
2012-03-05 09:46:17 +01:00
Edward Hervey
c557f71756 tsdemux: Push packets as early as possible
When the PES header tells us how big the outgoing packet is, push the
packet downstream as soon as we have the specified size instead of waiting
for the beginning of the next packet.
Reduces latency and removes issues with very sparse streams (like subtitles
and subpictures).
2012-03-05 09:41:48 +01:00
Tim-Philipp Müller
0bb5a01639 tsdemux: fix confusing variable name 2012-03-03 15:47:01 +00:00
Edward Hervey
01f5f62d95 tsdemux: Fix segment start position
If we *really* can't figure out the first start position, that most
likely means the data to push out doesn't have any timestamp.
Use a default value of 0 then
2012-03-02 17:19:45 +01:00
Edward Hervey
a3ae51be29 mpegtsbase: Flush out the packetizer on flushing seeks
... else we end up with bogus data/offsets
2012-03-02 17:19:45 +01:00
Thibault Saunier
ece4dfc3c6 tsdemux: Activate pads only when receiving data for the stream
https://bugzilla.gnome.org/show_bug.cgi?id=670921
2012-03-02 17:19:45 +01:00
Edward Hervey
671550714f mpegtsbase: Check harder for program changes
And don't just rely on the section crc/version_number changing to
indicate that the program actually changed.
2012-03-02 10:54:48 +01:00
Edward Hervey
097f09b823 mpegtsbase/tsdemux: Refactor seek and segment handling
All calculations go through the mpegtspacketizer
Remove unused variables/code
2012-03-01 18:15:51 +01:00
Edward Hervey
77ece06a3f mpegtsbase: Error out on EOS without any pad
Avoids ending up with hanging pipelines
2012-03-01 18:15:51 +01:00
Edward Hervey
a4899af8d6 mpegtspacketizer: Offset calculation
Allows PCR<=>PTS<=>offset estimation/calculation
Right now the calculation is very naive, but can be extended later on
without disrupting the code in tsdemux/mpegtsbase
2012-03-01 18:15:51 +01:00
Edward Hervey
39cc29a7d2 mpegtspacketizer: clock fix and minor addition
* Don't take into account packets that arrived at the same time as
  previous ones for clock skew estimation
* Add convenience method for processing the next ts packet
2012-03-01 18:15:51 +01:00
Edward Hervey
c10fc17a1e Revert "mpegtsdemux: Not apply various time the same PMT to a program when repetead"
This reverts commit 8cb0e87f56.

mpegtspacketizer already checks if it's a new PMT or not
2012-03-01 18:15:51 +01:00
Edward Hervey
d920d9d64f tsdemux: Remove all seeking code
It was more than bogus
2012-03-01 18:15:51 +01:00
Thibault Saunier
5c2e6dc512 mpegtspacketizer: catch section lengths extending past the buffer length
This is probably the cause for an occasional crash while streaming
MPEG. Blind fix after staring at the code and following logic, so
may or may not fix the issue, I cannot test.

(Port of 4275a70cb5 from mpegdemux)
2012-02-27 09:57:45 -03:00
Thibault Saunier
58a210e3d3 mpegtspacketizer: support more character set encodings
Support UTF-16BE, EUC-KR (KSX1001), GB2312 and ISO-10646/UTF8 text
encoding and fixed new line for multibyte encoding
    
https://bugzilla.gnome.org/show_bug.cgi?id=664257

(Port of 9759d66407 from the mpegtsdemux
element)
2012-02-27 09:42:27 -03:00
Thibault Saunier
336710d355 tsbase: Fix parsing of PSI table IDs
(Ported from mpegtsdemux d8fd874f52)
2012-02-24 19:08:40 -03:00
Thibault Saunier
f977d7e743 tsdemux: Avoid unlinkely leaks and segfault 2012-02-24 15:28:35 -03:00
Edward Hervey
b6d98aea5f tsdemux: Use new clock skew estimation for outgoing timestamps
Only used in live mode
2012-02-24 17:53:52 +01:00
Edward Hervey
e6ff2f7b83 tsdemux: Various code cleanup and dead code removal 2012-02-24 17:52:33 +01:00
Edward Hervey
4bc7cd04c1 mpegtspacketizer: Fix issues with skew code
* Always try to get a timestamp for the algorithm
* Remove dead variable
* Return proper default value
2012-02-24 17:47:38 +01:00
Thibault Saunier
6a8d2c45f6 mpegtspacketizer: Estimate clock skew and retimestamps buffers more precisly
Apply the EPTLA algotithm to estimate clock skew.
Reusing code from  -good/gst/rtpmanager/rtpjitterbuffer.c
2012-02-24 10:57:09 +01:00
Thibault Saunier
48a699812b tsdemux: Clean up AAC caps mess 2012-02-24 10:57:05 +01:00
Thibault Saunier
dc8b6c678d tsdemux: Reindent gstmpegdesc.h 2012-02-24 10:57:02 +01:00
Thibault Saunier
67fd590e9a tsdemux: Support more DTS/AC3 descriptors 2012-02-24 10:56:58 +01:00
Edward Hervey
6ef0ae4ffe tsdemux: Remove useless finalize() 2012-02-24 10:56:14 +01:00
Edward Hervey
8b73baeced tsdemux: Use incoming timestamps in live mode 2012-02-23 16:39:48 +01:00
Edward Hervey
8f433e1677 tsdemux: Report latency (700ms) 2012-02-23 16:39:48 +01:00
Edward Hervey
c492b00b69 mpegtsbase: Query whether upstream is live or not 2012-02-23 16:39:48 +01:00
Thibault Saunier
8cb0e87f56 mpegtsdemux: Not apply various time the same PMT to a program when repetead
Sometimes their are several times the same PMT applying to a same program in a stream,
tsdemux was totally baffled when this was happening, we now keep the one we
already applied so it works properly.
2012-02-17 12:19:20 -03:00
Thibault Saunier
adc947e127 tsdemux: fix glib deprecation 2012-02-17 12:19:20 -03:00
Thibault Saunier
1182dd0c1b tsdemux: Avoid throwing FLOW_ERROR on last PCR processing error
In the case of scanning last pcr, errors are not critical, so we keep
the stream flowing.
2012-02-15 15:48:44 -03:00
Thibault Saunier
cda0d3aed8 tsdemux: Add AAC latm support 2012-02-15 15:48:44 -03:00
Thibault Saunier
6094ec27b1 tsdemux: Minor refactoring/code cleaning
... add some debugging symbols in the mean time.
2012-02-15 15:48:44 -03:00
Vincent Penquerc'h
2dec0950cf tsdemux: add explicit supported AAC stream-format in template caps
https://bugzilla.gnome.org/show_bug.cgi?id=665394
2012-02-02 12:37:02 +00:00
Vincent Penquerc'h
8147669971 plenty: fixup glib deprecations 2012-01-27 15:47:07 +00:00
Mark Nauwelaerts
d8fdd3485b mpegtsdemux: break out when stream identified 2012-01-23 14:22:18 +01:00
Mark Nauwelaerts
b00ed32c5a mpegtsdemux: avoid NULL manipulation if invalid input 2012-01-23 14:22:18 +01:00
Edward Hervey
fcf511aa8f tsdemux: Don't provide bogus values in non-TIME push-mode
Only take the upstream segment values in GST_FORMAT_TIME
2012-01-10 11:45:25 +01:00
Edward Hervey
24408bce96 tsdemux: Handle rollover in PTS and DTS
Also hands back-rollover which can happen with PTS
2012-01-10 11:45:22 +01:00
Vincent Penquerc'h
7521b597f4 various: fix pad template ref leaks
https://bugzilla.gnome.org/show_bug.cgi?id=662664
2011-11-28 13:08:27 +00:00
Edward Hervey
e500ec524c tsdemux: Add notes on synchronization and scheduling 2011-11-16 12:47:58 +01:00
Youness Alaoui
894ac8f493 hlsdemux/tsdemux: Add HP copyright on work done on HLS 2011-09-09 12:12:12 +02:00
Youness Alaoui
59c61209cf tsdemux: Need to flush all streams when we receive a flush-start 2011-08-30 16:17:47 +02:00
Youness Alaoui
e380fbb019 tsdemux: In push mode, do not start pull loop if upstream seek fails 2011-08-26 09:51:46 +02:00
Sebastian Dröge
c86aba3469 tsdemux: Use FALSE instead of 0 for bool parameter 2011-08-24 09:35:18 +02:00
Youness Alaoui
744101a417 tsdemux: Need to send a newsegment after a seek 2011-08-24 08:12:29 +02:00
Youness Alaoui
cfd28a6f90 tsdemux: Forward seek/duration query/event to the sinkpad 2011-08-24 07:48:52 +02:00
Vincent Penquerc'h
66dbdfd4d1 tsdemux: do not try to compare a PCR with itself for statistics
Especially as one of the logs will cause a divide by zero.

https://bugzilla.gnome.org/show_bug.cgi?id=656927
2011-08-23 10:38:10 +02:00
Vincent Penquerc'h
b19a5ea1f3 tsdemux: do not keep a dangling pointer
When removing the current program, it will get freed by the
hash table removal callback, so ensure we clear our pointer
to it.

Fixes a crash later on in gst_ts_demux_push trying to access it.

https://bugzilla.gnome.org/show_bug.cgi?id=656927
2011-08-23 10:37:24 +02:00
Sebastian Dröge
6edff48378 mpegtsbase: First try if upstream handles seeking in TIME format before seeking in the demuxer 2011-08-23 09:52:20 +02:00
Sebastian Dröge
a27b7b6712 tsdemux: First send SEEKING queries upstream 2011-08-23 09:40:16 +02:00
Sebastian Dröge
ca0df16d52 tsdemux: Send DURATION query upstream first 2011-08-23 09:27:23 +02:00
Youness Alaoui
818762e8fc tsdemux: do not send a new-segment on stream removal
When a program is changed, stream_added is called which sets the
need_newsegment to TRUE, then stream_removed is called, which calls
the flush_pending_data, which checks for the newsegment and causes
it to send a new-segment.

We must not send the newsegment when flushing the pending data on the
removed stream. We should only push it when flushing data on the newly
added streams (after they finish parsing their PTS header)
2011-08-22 16:01:24 +02:00
Youness Alaoui
382710e200 tsdemux: Fix newsegment when switching programs
If a program/stream is changed, then a newsegment is sent which must
not be the same as the base segment since it happens later. We must
shift the start position by the time elapsed since the newsegment
and the current PTS of the stream
2011-08-22 16:01:17 +02:00
Youness Alaoui
4cc1dfb360 tsdemux: interpolate gap and fix timestamps depending on upstream segment 2011-08-22 15:55:47 +02:00
Youness Alaoui
02bc614163 tsbase: reinitiate segment at flush-stop event only 2011-08-18 14:54:22 +02:00
Edward Hervey
5c77682dab tsdemux: Take into account upstream newsegment events
If the incoming newsegment event was in time, use that position value
for the downstream newsegments.
2011-08-01 18:49:55 +02:00
Edward Hervey
adfb090b59 mpegtsbase: Remove programs on EOS
Allows subclasses to properly flush out pending data.
2011-08-01 15:46:12 +02:00
Edward Hervey
57279cdd24 tsdemux: Refactor stream/program removal
The program_stopped vmethod was called before stream_removed vmethod
was being called. Since we only did stream-related operations in there,
we just remove the program_stopped vmethod and do everything in the
stream_removed one.

Also, make sure we flush out all pending data before sending EOS.
2011-08-01 10:54:16 +02:00
Nicolas Dufresne
cbc0a2f056 mpegtsbase: Prevent stack gardening by using the right type
stream_type is stored as guint inside the GstStructure but was retreived
using valist with a pointer to guint16. This would cause stack gardening
when code is compiled without optimisation (e.g. in -O0 the compiler wont
pad the stack to optimise out required mask).

https://bugzilla.gnome.org/show_bug.cgi?id=655540
2011-08-01 09:33:25 +02:00
Edward Hervey
634d29cd88 mpegtsbase/tsdemux: Fix stream/pad activation order
We first activate new streams before shutting down old ones.
We emit no-more-pads after we add new streams and emit EOS before
removing old ones.
Also cleanup/refactor a bit more of the code accordingly
2011-07-25 18:56:49 +02:00
Edward Hervey
d0e8427b4e pesparse: Fix stuffing byte handling
We in fact get the size of the header (including stuffing bytes), therefore
use that instead of trying to skip 0xff bytes ourselves since some media
streams do start with 0xff (like mpeg audio's initial 0xfff).
2011-07-20 19:19:13 +02:00
Alessandro Decina
2b7e9abc59 mpegtsdemux: fix compiler warnings 2011-07-20 08:59:25 +02:00
Edward Hervey
a960e72efa mpegtsbase/tsdemux: Add more comments and removal unused variable 2011-07-19 09:49:40 +02:00
Edward Hervey
2b127601e9 mpegtsbase: Avoid double removal of streams
This can happen if the PCR pid is the same as a audio/video PID.
2011-07-19 09:49:40 +02:00
Edward Hervey
b170b2020c mpegtsbase: Add a GList of streams to the program
Allows faster iteration of all program streams.

We still keep the Array to allow fast retrieval of stream by PID.
2011-07-19 09:49:40 +02:00
Edward Hervey
dc18e2b16d mpegtsbase: Use a bit array instead of an array of gboolean
Makes know_psi and is_pes 32 times smaller
2011-07-19 09:49:39 +02:00
Edward Hervey
177e00f809 tsdemux: Use standalone PES parser 2011-07-18 09:13:15 +02:00
Edward Hervey
6f9a6cc2ba mpegtsdemux: Add standalone PES parser 2011-07-18 09:13:14 +02:00
Edward Hervey
42cf7d016c mpegdefs: clarify some stream ids 2011-07-17 09:49:06 +02:00
Edward Hervey
f6f885ddb8 tsdemux: whoops, tsdemux isn't ready yet for primary rank :) 2011-07-16 13:51:44 +02:00
Edward Hervey
a00900367a mpegtsbase/tsdemux: Cleanups and comments 2011-07-16 13:47:45 +02:00
Edward Hervey
9f1511e998 tsdemux: Fix newsegment creation for push mode
And all relevent comments to what it should be doing, refactor everything
a bit. Still not perfect ... but better.

Fixes #654657
2011-07-16 13:44:00 +02:00
Edward Hervey
b73679e13d mpegtsbase: Store incoming newsegments 2011-07-16 12:27:50 +02:00
Alessandro Decina
d439f2d38d mpegtsbase: actually set seen_pat=TRUE when we see a PAT 2011-07-15 00:03:52 +02:00
Edward Hervey
a82483e367 mpegtsbase: Split up whether we saw a PAT and its offset
Fixes the issue with streams that don't set an offset on their buffers,
like those coming from hlsdemux.

Fixes #653481
2011-07-14 22:10:27 +02:00
Olivier Crête
ca7a512739 mpegtsdemux: Restore erroneously removed data++
Also, put back some unused code in comment and replace // comments by /* */
2011-07-13 13:39:54 -04:00
Olivier Crête
d7a774cc44 mpegdemux: Fix unused-but-set warnings 2011-07-12 17:53:33 -04:00
Thiago Santos
ca8ea19cc3 tsdemux: only free the index array if it exists
Only free the array if it exists.

Contains an unrelated indentation fix, courtesy of gst-indent
2011-06-17 16:18:03 -03:00
Edward Hervey
b3ef72f2eb tsdemux: Don't free unexistent PAT
And cleanup find_timestamps a bit
2011-06-12 11:27:30 +02:00
Edward Hervey
e1a7d71184 tsdemux: More fixes to handle non-188 byte packets 2011-06-07 20:50:35 +02:00
Edward Hervey
6c0254b84b mpegts: Stop scanning for keyframes as early as possible 2011-06-07 20:50:35 +02:00
Janne Grunau
ae2e7624d6 mpegtsdemux: always try to seek for to a keyframe
keyframe is expected to lie in the the next ~2500 ms
2011-06-07 20:50:35 +02:00
Janne Grunau
9352cfc478 mpegtsdemux: fix timestamps in newsegement event after seeking 2011-06-07 20:50:34 +02:00
Janne Grunau
cde65d6d6e mpegtsdemux: payload parsing for H.264 2011-06-07 20:50:34 +02:00
Janne Grunau
ff15d6fa80 mpegtsdemux: implement key_unit seeking for MPEG2 video 2011-06-07 20:50:34 +02:00
Janne Grunau
3ce1ec7c9c mpegtsdemux: accurate seeking
* pes header parsing for pts is ugly, refactor
 * timestamps/newsegment after seeking is still off
2011-06-07 20:50:34 +02:00
Janne Grunau
15391b29e1 mpegtsdemux: push based seeking based on PCR
buffer timestamps are converted to GstClockTime to cover pcr/pts wraps.
multiple pcr/pts wraps are handled with an index which ensures at most
a single pcr wraparound between two entries.
the last seen pcr is recorded to have a nearby index point for short seeks
resuming playback might be delayed if the postion is not a keyframe

TODO: replace manual packet scanning and parsing in the initial duration estimation
2011-06-07 20:50:34 +02:00
Janne Grunau
f89a0abca0 mpegtsdemux: create function for pcr parsing 2011-06-07 20:50:34 +02:00
Janne Grunau
37f1decf78 mpegtsdemux: adaptation field length == 0 is valid
it can be used to insert a single stuffing byte
do not parse the following payload as adaptation field
2011-06-07 20:50:34 +02:00
Edward Hervey
f4c96f1dbb tsdemux: Fix scanning on small files
We were previously:
* Stopping early in the initial PCR scan
* Giving a negative offset for the second PCR scan
2011-05-31 12:58:11 +02:00
Edward Hervey
e3839f0241 mpegtsbase: Don't call program_stopped with a NULL program 2011-05-31 12:58:11 +02:00
Edward Hervey
ffc9303c9d tsdemux: Protect against program being removed 2011-05-30 13:01:20 +02:00
Stefan Kost
79e3b5b4bb various: fix author tag in element details 2011-05-18 10:31:38 +03:00
Edward Hervey
21add205b7 tsdemux: Don't leak bufferlist on streams without pads
https://bugzilla.gnome.org/show_bug.cgi?id=648929
2011-04-29 12:47:34 +02:00
Edward Hervey
565f068049 mpegtsbase: Unref buffers we don't use.
Avoids a massive leak :)

https://bugzilla.gnome.org/show_bug.cgi?id=648929
2011-04-29 12:47:34 +02:00
Edward Hervey
c26ca36cf0 mpegtsbase: Don't forget to free the program streams array
https://bugzilla.gnome.org/show_bug.cgi?id=648929
2011-04-29 12:47:34 +02:00
Edward Hervey
390502a093 tsdemux: Free packet buffer even if it doesn't have a payload
This can happen with AFC-only packets. Avoids leaking buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=648929
2011-04-29 12:47:34 +02:00
David Schleef
40f3b4a651 mpegtsdemux,tsdemux: Add byte-stream to h264 caps
Fixes #606662.
2011-04-24 19:40:08 -07:00
Tim-Philipp Müller
5d6bdf6052 Fix some unused-but-set-variable warnings with gcc 4.6 2011-04-15 00:24:47 +01:00
Thibault Saunier
17fd7ebcb4 android: make it ready for androgenizer
Remove the android/ top dir
Fixe the Makefile.am to be androgenized

To build gstreamer for android we are now using androgenizer which generates the needed Android.mk files.
Androgenizer can be found here: http://git.collabora.co.uk/?p=user/derek/androgenizer.git
2011-04-11 07:27:11 +02:00
Janne Grunau
bc91adcf55 mpegtsdemux: fix stream_info descriptor parsing 2011-03-24 15:18:34 +01:00
Mart Raudsepp
b69450af92 mpegtspacketizer: Handle all ISO8859-x encodings in get_encoding()
... according to ETSI EN 300 468, "Selection of character table"
2011-03-21 19:57:39 +01:00
Janne Grunau
3ebc8a43e2 mpegtsdemux: do not try to parse packets containing section data as PES 2011-03-21 19:30:17 +01:00
Janne Grunau
bf046719a2 mpegtsdemux: add stream types for DSM CC A, B, C, D 2011-03-21 19:27:08 +01:00
Janne Grunau
74a8e966f5 mpegtsdemux: fix playback if PMT is seen before PAT
The stream for the PMT pid has to be cleared since the version checking
in the packetizer won't emit the same PMT again otherwise.
2011-03-21 19:24:08 +01:00
Tim-Philipp Müller
6e321d2d87 mpegtspacketizer: fix log message printf format 2011-02-18 15:17:17 +00:00
David Schleef
de968b6c7d mpegtsdemux: Fix disting of headers 2011-02-17 14:43:38 -08:00
Janne Grunau
92d5ea2926 mpegtsdemux: use G_GUINT64_FORMAT as format specifier for guint64
fixes compilation on 32bit
2011-02-17 12:51:07 -08:00
Janne Grunau
535bf57d1f mpegtsdemux: relicense gstmpegdefs.h, gstmpegdesc.h and gstmpegdesc.c to LGPL only
with permission from the license header:
"""
This library is licensed under 2 different licenses and you
can choose to use it under the terms of either one of them. The
two licenses are the MPL 1.1 and the LGPL.
"""
2011-02-17 17:57:17 +01:00
Janne Grunau
22ecf13e42 mpegtsdemux: add MPEG TS demuxer rewrite from Edward Hervey
with contributions from Miquel Angel Farre Guiu and Zaheer Abbas Merali
2011-02-17 17:56:59 +01:00