Commit graph

68 commits

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