gstreamer/gst
Edward Hervey 2762ead5ef mpegtsdemux: New PCR<=>Offset estimation code
This allows:
* Better duration estimation
* More accurate PCR location
* Overall more accurate running-time location and calculation

Location and values of PCR are recorded in groups (PCROffsetGroup)
with notable PCR/Offset observations in them (when bitrate changed
for example). PCR and offset are stored as 32bit values to
reduce memory usage (they are differences against that group's
first_{pcr|offset}.

Those groups each contain a global PCR offset (pcr_offset) which
indicates how far in the stream that group is.

Whenever new PCR values are observed, we store them in a sliding
window estimator (PCROffsetGroupCurrent).

When a reset/wrapover/gap is detected, we close the current group with
current values and start a new one (the pcr_offset of that new group
is also calculated).

When a notable change in bitrate is observed (+/- 10%), we record
new values in the current group. This is a compromise between
storing all PCR/offset observations and none, while at the same time
providing better information for running-time<=>offset calculation
in VBR streams.

Whenever a new non-contiguous group is start (due to seeking for example)
we re-evaluate the pcr_offset of each groups. This allows detecting as
quickly as possible PCR wrapover/reset.

When wanting to find the offset of a certain running-time, one can
iterate the groups by looking at the pcr_offset (which in essence *is*
the running-time of that group in the overall stream).
Once a group (or neighbouring groups if the running-time is between two
groups) is found, once can use the recorded values to find the most
accurate offset.

Right now this code is only used in pull-mode , but could also
be activated later on for any seekable stream, like live timeshift
with queue2.

Future improvements:
* some heuristics to "compress" the stored values in groups so as to keep
  the memory usage down while still keeping a decent amount of notable
  points.
* After a seek compare expected and obtained PCR/Offset and if the
  difference is too big, re-calculate position with newly observed
  values and seek to that more accurate position.

Note that this code will *not* provide keyframe-accurate seeking, but
will allow a much more accurate PCR/running-time/offset location on
any random stream.
For past (observed) values it will be as accurate as can be.
For future values it will be better than the current situation.
Finally the more you seek, the more accurate your positioning will be.
2013-09-28 13:15:43 +02:00
..
accurip gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
adpcmdec gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
adpcmenc gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
aiff aiffparse: don't leak adapter 2013-08-17 00:25:49 +01:00
asfmux asfmux: Various debug argument fixes 2013-07-27 06:39:16 +02:00
audiobuffer gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
audiofxbad audiofxbad: Change plugin name to audiofxbad from audiochannelmix 2013-09-19 20:17:01 +02:00
audiovisualizers audiovisualizer: Enable GLib deprecation warnings again 2013-05-15 11:02:29 +02:00
autoconvert gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
bayer Release 1.1.4 2013-08-28 13:07:27 +02:00
camerabin2 wrappercamerabinsrc: Add video-source-filter during construction 2013-06-11 12:47:53 +02:00
cdxaparse gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
coloreffects gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
dataurisrc gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
dccp gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
debugutils all: Fix for GST_DISABLE_GST_DEBUG 2013-07-29 09:42:12 +02:00
dvbsuboverlay gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
dvdspu all: Fix for GST_DISABLE_GST_DEBUG 2013-07-29 09:42:12 +02:00
faceoverlay gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
festival gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
fieldanalysis Release 1.1.4 2013-08-28 13:07:27 +02:00
freeverb gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
frei0r frei0r: add the build prefix path in the search dirs 2013-06-28 12:40:52 +02:00
games gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
gaudieffects Release 1.1.1 2013-06-05 18:29:49 +02:00
gdp gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
geometrictransform gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
hdvparse gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
id3tag id3mux: handle publisher, interpreted-by and musical-key tags 2013-08-20 14:45:22 +02:00
inter interaudiosrc: make silence memory actually contain silence 2013-08-14 18:19:21 +01:00
interlace interlace: fix negotiation if filter caps are passed to query_caps 2013-07-22 17:32:50 +01:00
ivfparse gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
ivtc ivtc: Use input framerate when possible 2013-08-20 16:02:59 +02:00
jp2kdecimator gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
jpegformat jpegparse: Forward segment event after caps 2013-08-20 10:16:00 +02:00
librfb rfb: Link with libgstbase for GstPushSrc 2013-06-07 15:18:15 +02:00
liveadder liveadder: Document that the latency is in milliseconds 2013-04-26 15:33:18 -04:00
midi midi: Fix handling of the SEGMENT query 2013-07-29 12:17:57 +02:00
mixmatrix gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
mpeg1sys gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
mpegdemux mpegpsdemux: minor clean-up 2013-09-02 23:28:38 +01:00
mpegpsmux mpegpsmux: Send stream-start event before any data 2013-07-10 12:28:38 +02:00
mpegtsdemux mpegtsdemux: New PCR<=>Offset estimation code 2013-09-28 13:15:43 +02:00
mpegtsmux mpegtsmux: Set the program number from prog-map 2013-08-21 13:02:02 +02:00
mve gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
mxf gst: Don't swap start/stop for negative rates in the SEGMENT query 2013-07-29 12:14:08 +02:00
nuvdemux gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
overlay gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
patchdetect gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
pcapparse pcapparse: Remove unneeded unref and only set pad caps if we have caps 2013-08-14 10:48:26 +02:00
pnm gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
rawparse rawparse: fix event order 2013-09-12 14:14:03 +02:00
real gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
removesilence gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
rtjpeg gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
sdi gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
sdp sdpdemux: Change rank to NONE until it can be autoplugged properly 2013-09-23 16:19:05 +02:00
segmentclip gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
siren all: Fix for GST_DISABLE_GST_DEBUG 2013-07-29 09:42:12 +02:00
smooth gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
smoothwave smoothwave: remove element unported from 0.8 2011-11-23 08:42:01 +01:00
speed gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
stereo gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
subenc webvttenc: Separate cues with two line breaks instead of one. 2013-07-05 18:32:43 +01:00
tta gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
vbidec gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
videofilters all: Fix for GST_DISABLE_GST_DEBUG 2013-07-29 09:42:12 +02:00
videomeasure gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
videoparsers h264parse: don't update src caps if only codec_data differs 2013-09-09 15:09:10 +02:00
videosignal videosignal: fix CFLAGS order 2013-05-18 12:21:59 +01:00
vmnc gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
y4m y4mdec: set timestamps when restriding buffer 2013-05-10 17:40:17 -07:00
yadif gst: Add better support for static plugins 2013-04-15 15:59:22 +02:00
Makefile.am build: build plugins and examples in parallel where possible, if make -jN is used 2010-03-30 01:17:15 +01:00