1 /*****************************************************************************
2 * ogg.h : ogg stream demux module for vlc
3 *****************************************************************************
4 * Copyright (C) 2001-2010 the VideoLAN team
6 * Authors: Gildas Bazin <gbazin@netcourrier.com>
7 * Andre Pang <Andre.Pang@csiro.au> (Annodex support)
8 * Gabriel Finch <salsaman@gmail.com> (moved from ogg.c to ogg.h)
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 *****************************************************************************/
32 /*****************************************************************************
33 * Definitions of structures and functions used by this plugins
34 *****************************************************************************/
37 typedef struct oggseek_index_entry demux_index_entry_t;
40 typedef struct logical_stream_s
42 ogg_stream_state os; /* logical stream of packets */
45 es_format_t fmt_old; /* format of old ES is reused */
51 /* the header of some logical streams (eg vorbis) contain essential
52 * data for the decoder. We back them up here in case we need to re-feed
53 * them to the decoder. */
58 ogg_int64_t i_previous_granulepos;
60 /* program clock reference (in units of 90kHz) derived from the previous
63 mtime_t i_interpolated_pcr;
64 mtime_t i_previous_pcr;
69 /* Opus has a starting offset in the headers. */
71 /* Vorbis and Opus can trim the end of a stream using granule positions. */
74 /* offset of first keyframe for theora; can be 0 or 1 depending on version number */
75 int64_t i_keyframe_offset;
77 /* keyframe index for seeking, created as we discover keyframes */
78 demux_index_entry_t *idx;
80 /* skip some frames after a seek */
83 /* data start offset (absolute) in bytes */
86 /* kate streams have the number of headers in the ID header */
87 int i_kate_num_headers;
89 /* for Annodex logical bitstreams */
90 int i_secondary_header_packets;
101 ogg_sync_state oy; /* sync and verify incoming physical bitstream */
103 int i_streams; /* number of logical bitstreams */
104 logical_stream_t **pp_stream; /* pointer to an array of logical streams */
106 logical_stream_t *p_old_stream; /* pointer to a old logical stream to avoid recreating it */
108 /* program clock reference (in units of 90kHz) derived from the pcr of
119 /* after reading all headers, the first data page is stuffed into the relevant stream, ready to use */
122 /* count of total frames in video stream */
123 int64_t i_total_frames;
125 /* length of file in bytes */
126 int64_t i_total_length;
128 /* offset position in file (for reading) */
129 int64_t i_input_position;
131 /* current page being parsed */
132 ogg_page current_page;
142 input_attachment_t **attachments;
144 /* Length, if available. */