Commit graph

99 commits

Author SHA1 Message Date
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
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 f58f13e874 mpegtsdemux: Fix multiple-SI detection/parsing
We had two issues with the previous code:
1) We were badly handling PUSI-flagged packets. We were discarding the
   initial data (if pointer != 0) whereas we should have been accumulating
   it with the previous data (if there was a continuity of course).
   => First series of information loss
2) We were not checking whether there were more sections after the end
   of one (i.e. when the following byte was not a stuff byte).

This fixes those two issues.

Fixes #677443

https://bugzilla.gnome.org/show_bug.cgi?id=677443
2013-07-07 08:29:37 +02:00
Edward Hervey 513417e0ff mpegtbase: Fix switch/case typo
Ended up trying to analyze PMT ... with a PAT :(
2013-07-07 07:21:46 +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 9da7551993 mpegtsbase: Remove no-longer needed code
Since we now send all sections to the packetizer, we no longer need to do
anymore in-depth checks for the validity of a section.

The choice boils down to:
1) Is it from a known PES pid ? If so pass it on (which might be just pushing
   downstream in the case of tsparse, or accumulating PES data for tsdemux)
2) Is it from a known SI pid ? If so pass it to the section packetizer
2013-07-05 17:25:17 +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 26689fc437 mpegtsbase: Only warn for added streams when needed
We use add_stream(stream_type:-1) to ensure a programs' PCR Stream is
also taken into account. For most programs this will re-use an
existing ES stream.

So only warn that we are re-adding a stream if it was already present
AND it is not to ensure the PCR stream is taken into account.
2013-06-24 08:24:58 +02:00
Edward Hervey 40bcf48b0c mpegtbase: simplify code
We don't need generic methods for push/flush since we know all the
subclass that we control
2013-06-19 12:29:47 +02:00
Edward Hervey e66d543f00 tsparse: Ensure initial events are sent in the right order
First send stream-start, then caps, then segment.

The segment we push is from upstream in push-mode. If we work in pull-mode
then we initialize the base segment to BYTES.

https://bugzilla.gnome.org/show_bug.cgi?id=702422
2013-06-19 07:40:28 +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
Michael Rubinstein e6c8224609 mpegtsdemux: Free memory behind GString if we don't use it
https://bugzilla.gnome.org/show_bug.cgi?id=700903
2013-05-25 15:49:21 +02:00
Edward Hervey ce441cbff7 mpegtsbase: Post an error message when EOS'ing without source pads
This ensures we don't "hang" when files can't be decoded, or contain
no valid streams.
2013-05-23 14:59:34 +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 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
Sebastian Dröge acacef9fbb mpegtsdemux: Fix various compiler warnings 2013-03-03 12:30:32 +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 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
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 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 b807753453 ext, gst: only activate in pull mode if upstream is seekable 2012-09-11 17:47:33 +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 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
Tim-Philipp Müller 489b102a43 gst_tag_list_free -> gst_tag_list_unref 2012-08-04 16:31:30 +01: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 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 8fd2d43d60 mpegtbase: Avoid copying GstStructure 2012-06-19 10:49:37 +01: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 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 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 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 a633347ed1 mpegtsbase: Speed up _is_psi()
By making it inline and simplifying the bit macros
2012-05-23 09:37:49 +02:00
Edward Hervey 3c73d29162 mpegtsbase: Adapt to new packetizer behaviour 2012-05-22 17:43:38 +02:00
Wim Taymans 7394deef33 tsbase: unref bad packets too
Conflicts:

	gst/mpegtsdemux/mpegtsbase.c
2012-05-01 11:50:39 +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