Macro qtTrIdx() replaced by tr() and QT_TRANSLATE_NOOP()
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / ext / ogg / gstoggstream.h
1 /* GStreamer
2  * Copyright (C) 2009 David Schleef <ds@schleef.org>
3  *
4  * gstoggstream.h: header for GstOggStream
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_OGG_STREAM_H__
23 #define __GST_OGG_STREAM_H__
24
25 #include <ogg/ogg.h>
26
27 #include <gst/gst.h>
28 #include <gst/tag/tag.h>
29
30 G_BEGIN_DECLS
31
32 typedef enum {
33   GST_OGG_SKELETON_FISBONE,
34   GST_OGG_SKELETON_INDEX,
35 } GstOggSkeleton;
36
37 typedef struct {
38   guint64 offset;
39   guint64 timestamp;
40 } GstOggIndex;
41
42 typedef struct _GstOggStream GstOggStream;
43
44 struct _GstOggStream
45 {
46   ogg_stream_state stream;
47
48   glong serialno;
49   GList *headers;
50   gboolean have_headers;
51   GList *queued;
52
53   /* for oggparse */
54   gboolean in_headers;
55   GList *unknown_pages;
56   GList *stored_buffers;
57
58   gint map;
59   gboolean is_skeleton;
60   gboolean have_fisbone;
61   gint granulerate_n;
62   gint granulerate_d;
63   guint32 preroll;
64   guint granuleshift;
65   gint n_header_packets;
66   gint n_header_packets_seen;
67   gint64 accumulated_granule;
68   gint frame_size;
69   gint bitrate;
70   guint64 total_time;
71   gboolean is_sparse;
72
73   GstCaps *caps;
74
75   gboolean is_video;
76   /* vorbis stuff */
77   int nln_increments[4];
78   int nsn_increment;
79   int short_size;
80   int long_size;
81   int vorbis_log2_num_modes;
82   int vorbis_mode_sizes[256];
83   int last_size;
84   int version;
85   gint bitrate_upper;
86   gint bitrate_nominal;
87   gint bitrate_lower;
88   GstTagList *taglist;
89   /* theora stuff */
90   gboolean theora_has_zero_keyoffset;
91   /* VP8 stuff */
92   gboolean is_vp8;
93   /* OGM stuff */
94   gboolean is_ogm;
95   gboolean is_ogm_text;
96   /* fishead stuff */
97   guint16 skeleton_major, skeleton_minor;
98   gint64 prestime;
99   gint64 basetime;
100   /* index */
101   guint n_index;
102   GstOggIndex *index;
103   guint64 kp_denom;
104   guint64 idx_bitrate;
105 };
106
107
108 gboolean gst_ogg_stream_setup_map (GstOggStream * pad, ogg_packet *packet);
109 gboolean gst_ogg_stream_setup_map_from_caps_headers (GstOggStream * pad,
110     const GstCaps * caps);
111 GstClockTime gst_ogg_stream_get_end_time_for_granulepos (GstOggStream *pad,
112     gint64 granulepos);
113 GstClockTime gst_ogg_stream_get_start_time_for_granulepos (GstOggStream *pad,
114     gint64 granulepos);
115 GstClockTime gst_ogg_stream_granule_to_time (GstOggStream *pad, gint64 granule);
116 gint64 gst_ogg_stream_granulepos_to_granule (GstOggStream * pad, gint64 granulepos);
117 gint64 gst_ogg_stream_granulepos_to_key_granule (GstOggStream * pad, gint64 granulepos);
118 gint64 gst_ogg_stream_granule_to_granulepos (GstOggStream * pad, gint64 granule, gint64 keyframe_granule);
119 GstClockTime gst_ogg_stream_get_packet_start_time (GstOggStream *pad,
120     ogg_packet *packet);
121 gboolean gst_ogg_stream_granulepos_is_key_frame (GstOggStream *pad,
122     gint64 granulepos);
123 gboolean gst_ogg_stream_packet_is_header (GstOggStream *pad, ogg_packet *packet);
124 gint64 gst_ogg_stream_get_packet_duration (GstOggStream * pad, ogg_packet *packet);
125 void gst_ogg_stream_extract_tags (GstOggStream * pad, ogg_packet * packet);
126
127 gboolean gst_ogg_map_parse_fisbone (GstOggStream * pad, const guint8 * data, guint size,
128     guint32 * serialno, GstOggSkeleton *type);
129 gboolean gst_ogg_map_add_fisbone (GstOggStream * pad, GstOggStream * skel_pad, const guint8 * data, guint size,
130     GstClockTime * p_start_time);
131 gboolean gst_ogg_map_add_index (GstOggStream * pad, GstOggStream * skel_pad, const guint8 * data, guint size);
132 gboolean gst_ogg_map_search_index (GstOggStream * pad, gboolean before, guint64 *timestamp, guint64 *offset);
133
134
135
136
137 G_END_DECLS
138
139 #endif /* __GST_OGG_STREAM_H__ */