Commit graph

203 commits

Author SHA1 Message Date
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