1 /*****************************************************************************
2 * oggseek.h : ogg seeking functions for ogg demuxer vlc
3 *****************************************************************************
4 * Copyright (C) 2008 - 2010 Gabriel Finch <salsaman@gmail.com>
6 * Authors: Gabriel Finch <salsaman@gmail.com>
7 * adapted from: http://lives.svn.sourceforge.net/viewvc/lives/trunk/lives-plugins
8 * /plugins/decoders/ogg_theora_decoder.c
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU Lesser General Public License as published by
12 * the Free Software Foundation; either version 2.1 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
29 //#define OGG_SEEK_DEBUG 1
31 #define OggDebug(code) code
32 #define OggNoDebug(code)
34 #define OggDebug(code)
35 #define OggNoDebug(code) code
38 #define PAGE_HEADER_BYTES 27
40 #define OGGSEEK_BYTES_TO_READ 8500
42 /* index entries are structured as follows:
43 * - for theora, highest granulepos -> pagepos (bytes) where keyframe begins
44 * - for dirac, kframe (sync point) -> pagepos of sequence start (?)
47 /* this is typedefed to demux_index_entry_t in ogg.h */
48 struct oggseek_index_entry
50 demux_index_entry_t
*p_next
;
51 demux_index_entry_t
*p_prev
;
53 /* value is highest granulepos for theora, sync frame for dirac */
57 /* not used for theora because the granulepos tells us this */
58 int64_t i_pagepos_end
;
61 int Oggseek_BlindSeektoAbsoluteTime ( demux_t
*, logical_stream_t
*, vlc_tick_t
, bool );
62 int Oggseek_BlindSeektoPosition ( demux_t
*, logical_stream_t
*, double f
, bool );
63 int Oggseek_SeektoAbsolutetime ( demux_t
*, logical_stream_t
*, vlc_tick_t
);
64 const demux_index_entry_t
*OggSeek_IndexAdd ( logical_stream_t
*, vlc_tick_t
, int64_t );
65 void Oggseek_ProbeEnd( demux_t
* );
67 void oggseek_index_entries_free ( demux_index_entry_t
* );
69 int64_t oggseek_read_page ( demux_t
* );