]> git.sesse.net Git - vlc/blob - modules/demux/oggseek.h
mediacodec: don't loop in GetOutput
[vlc] / modules / demux / oggseek.h
1 /*****************************************************************************
2  * oggseek.h : ogg seeking functions for ogg demuxer vlc
3  *****************************************************************************
4  * Copyright (C) 2008 - 2010 Gabriel Finch <salsaman@gmail.com>
5  *
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
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28
29 #define PAGE_HEADER_BYTES 27
30
31 #define OGGSEEK_BYTES_TO_READ 8500
32
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 (?)
36  */
37
38 /* this is typedefed to demux_index_entry_t in ogg.h */
39 struct oggseek_index_entry
40 {
41     demux_index_entry_t *p_next;
42     demux_index_entry_t *p_prev;
43
44     /* value is highest granulepos for theora, sync frame for dirac */
45     int64_t i_value;
46     int64_t i_pagepos;
47
48     /* not used for theora because the granulepos tells us this */
49     int64_t i_pagepos_end;
50 };
51
52 int64_t Ogg_GetKeyframeGranule ( logical_stream_t *p_stream, int64_t i_granule );
53 bool    Ogg_IsKeyFrame ( logical_stream_t *, ogg_packet * );
54
55 int64_t Oggseek_GranuleToAbsTimestamp ( logical_stream_t *p_stream, int64_t i_granule,
56                                        bool b_presentation );
57 int     Oggseek_BlindSeektoAbsoluteTime ( demux_t *, logical_stream_t *, int64_t, bool );
58 int     Oggseek_BlindSeektoPosition ( demux_t *, logical_stream_t *, double f, bool );
59 int     Oggseek_SeektoAbsolutetime ( demux_t *, logical_stream_t *, int64_t i_granulepos );
60 const demux_index_entry_t *OggSeek_IndexAdd ( logical_stream_t *, int64_t, int64_t );
61 void    Oggseek_ProbeEnd( demux_t * );
62
63 void oggseek_index_entries_free ( demux_index_entry_t * );
64
65 int64_t oggseek_read_page ( demux_t * );