gstreamer/ext/ogg
Jan Schmidt d190977f1c ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_push),
(gst_a52dec_handle_event), (gst_a52dec_chain):
Add some debug output. Check that a discont has a valid
time associated.
* ext/alsa/gstalsasink.c: (gst_alsa_sink_check_event),
(gst_alsa_sink_loop):
Ignore TAG events. A little extra debug for broken timestamps.
* ext/dvdnav/dvdnavsrc.c: (dvdnavsrc_init), (dvdnavsrc_loop),
(dvdnavsrc_change_state):
Ensure we send a discont to engage the link before we send any
other events.
* ext/dvdread/dvdreadsrc.c: (dvdreadsrc_init),
(dvdreadsrc_finalize), (_close), (_open), (_seek_title),
(_seek_chapter), (seek_sector), (dvdreadsrc_get),
(dvdreadsrc_uri_get_uri), (dvdreadsrc_uri_set_uri):
Handle URI of the form dvd://title[,chapter[,angle]]. Currently only
dvd://title works in totem because typefinding sends a seek that ends
up going back to chapter 1 regardless.
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/mpeg2dec/gstmpeg2dec.h:
Output correct timestamps and handle disconts.
* ext/ogg/gstoggdemux.c: (get_relative):
Small guard against a null dereference.
* ext/pango/gsttextoverlay.c: (gst_textoverlay_finalize),
(gst_textoverlay_set_property):
Free memory when done. Don't call gst_event_filler_get_duration on
EOS events. Use GST_LOG and GST_WARNING instead of g_message and
g_warning.
* ext/smoothwave/gstsmoothwave.c: (gst_smoothwave_init),
(draw_line), (gst_smoothwave_dispose), (gst_sw_sinklink),
(gst_sw_srclink), (gst_smoothwave_chain):
Draw solid lines, prettier colours.
* gst/mpeg2sub/gstmpeg2subt.c: (gst_mpeg2subt_init):
Add a default palette that'll work for some movies.
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_init),
(gst_dvd_demux_handle_dvd_event), (gst_dvd_demux_send_discont),
(gst_dvd_demux_send_subbuffer), (gst_dvd_demux_reset):
* gst/mpegstream/gstdvddemux.h:
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_send_discont),
(gst_mpeg_demux_parse_syshead), (gst_mpeg_demux_parse_pes):
* gst/mpegstream/gstmpegparse.c: (gst_mpeg_parse_init),
(gst_mpeg_parse_handle_discont), (gst_mpeg_parse_parse_packhead):
* gst/mpegstream/gstmpegparse.h:
Use PTM/NAV events when for timestamp adjustment when connected to
dvdnavsrc. Don't use many discont events where one suffices.
* gst/playback/gstplaybasebin.c: (group_destroy),
(gen_preroll_element), (gst_play_base_bin_add_element):
* gst/playback/gstplaybasebin.h:
Make sure we remove subtitles from the same bin we put them in.
* gst/subparse/gstsubparse.c: (convert_encoding), (parse_subrip),
(gst_subparse_buffer_format_autodetect),
(gst_subparse_change_state):
Fix some memleaks and invalid accesses.
* gst/typefind/gsttypefindfunctions.c: (ogganx_type_find),
(oggskel_type_find), (cmml_type_find), (plugin_init):
Some typefind functions for Annodex v3.0 files
* gst/wavparse/gstwavparse.h:
GstRiffReadClass is the correct parent class.
2005-01-25 15:34:09 +00:00
..
gstogg.c fix ogm[audio/video]parse plugin registration (riff won't load if bytestream is already loaded) 2004-12-26 19:00:21 +00:00
gstoggdemux.c ext/a52dec/gsta52dec.c: Add some debug output. Check that a discont has a valid time associated. 2005-01-25 15:34:09 +00:00
gstoggmux.c ext/ogg/gstoggmux.c: eos/bos debugging 2005-01-13 17:13:51 +00:00
gstogmparse.c OGM text support, Matroska UTF-8 text support, deadlock fixes all over the place, subtitle awareness in decodebin/pla... 2005-01-08 18:22:41 +00:00
Makefile.am ext/mad/gstmad.c: Allow for mp3 rate/channels changes. However, only very conservatively. Reason that we *have* to en... 2004-09-20 12:40:40 +00:00
README Added README 2004-07-30 18:24:57 +00:00

ogg and the granulepos
----------------------

an ogg streams contains pages with a serial number and a granule pos. The granulepos
is a number that is codec specific and denotes the 'position' of the last packet
in that page.

ogg has therefore no notion about time, it only knows about bytes and granule positions.

The granule position is just a number, it can contain gaps or can just be any random
number.


theora and the granulepos
-------------------------

the granulepos in theora consists of the framenumber of the last keyframe shifted some
amount of bits plus the number of p/b-frames.

This means that given a framenumber or a timestamp one cannot generate the granulepos
for that frame. eg frame 10 could have several valid granulepos values depending on if
the last keyframe was on frame 5 or 0. Given a granulepos we can, however, create a
unique correct timestamp and a framenumber.

in a raw theroa stream we use the granulepos as the offset field.


vorbis and granulepos
---------------------

the granulepos in vorbis happens to be the same as the sample counter. conversion to and
from granulepos is therefore easy.

in a raw vorbis stream we use the granulepos as the offset field.


What can ogg do?
----------------

An ogg demuxer can read pages and get the granuleposition from it. It can ask the decoder
elements to convert a granulepos to time.

An ogg demuxer can also get the granulepos of the first and the last page of a stream to
get the start and end timestamp of that stream. It can also get the length in bytes of
the stream (when the peer is seekable, that is).

An ogg demuxer is therefore basically able to seek to any byte position and timestamp.
When asked to seek to a given granulepos, the ogg demuxer should always convert the 
value to a timestamp using the peer decoder element conversion function. It can then
binary search the file to eventually end up on the page with the given granule pos or
a granulepos with the same timestamp.

Seeking in ogg currently
------------------------

When seeking in an ogg, the decoders can choose to forward the seek event as a 
granulepos or a timestamp to the ogg demuxer.

In the case of a granulepos, the ogg demuxer will seek back to the beginning of
the stream and skip pages until it finds one with the requested timestamp.

In the case of a timestamp, the ogg demuxer also seeks back to the beginning of
the stream. For each page it reads, it asks the decoder element to convert the 
granulepos back to a timestamp. The ogg demuxer keeps on skipping pages until the
page has a timestamp bigger or equal to the requested one.

It is therefore important that the decoder elements in vorbis can convert a granulepos
into a timestamp or never seek on timestamp on the oggdemuxer.

The default format on the oggdemuxer source pads is currently defined as a the 
granulepos of the packets, it is also the value of the OFFSET field in the GstBuffer.


Oggmux
------

The oggmuxer uses the offset fields to fill in the granulepos in the pages.


TODO
----

- use the OFFSET field in the GstBuffer to store/read the granulepos as 
  opposed to the OFFSET_END field.
- Seeking should be implemented with a binary search.