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
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 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 General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 /*****************************************************************************
27 *****************************************************************************/
29 #define PAGE_HEADER_BYTES 27
31 #define OGGSEEK_BYTES_TO_READ 8500
33 /* index entries are structured as follows:
34 * - for theora, highest granulepos -> pagepos (bytes) where keyframe begins
35 * - for dirac, kframe (sync point) -> pagepos of sequence start (?)
38 /* this is typedefed to demux_index_entry_t in ogg.h */
39 struct oggseek_index_entry
41 demux_index_entry_t *p_next;
42 demux_index_entry_t *p_prev;
44 /* value is highest granulepos for theora, sync frame for dirac */
48 /* not used for theora because the granulepos tells us this */
49 int64_t i_pagepos_end;
55 const demux_index_entry_t *oggseek_theora_index_entry_add ( logical_stream_t *,
59 void oggseek_index_entries_free ( demux_index_entry_t * );
61 int64_t oggseek_get_last_frame ( demux_t *, logical_stream_t *);
63 int oggseek_find_frame ( demux_t *, logical_stream_t *, int64_t i_tframe );
65 int64_t oggseek_read_page ( demux_t * );