1 /* GStreamer |
|
2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> |
|
3 * |
|
4 * This library is free software; you can redistribute it and/or |
|
5 * modify it under the terms of the GNU Library General Public |
|
6 * License as published by the Free Software Foundation; either |
|
7 * version 2 of the License, or (at your option) any later version. |
|
8 * |
|
9 * This library is distributed in the hope that it will be useful, |
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
12 * Library General Public License for more details. |
|
13 * |
|
14 * You should have received a copy of the GNU Library General Public |
|
15 * License along with this library; if not, write to the |
|
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
17 * Boston, MA 02111-1307, USA. |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __MP3PARSE_H__ |
|
22 #define __MP3PARSE_H__ |
|
23 |
|
24 |
|
25 #include <gst/gst.h> |
|
26 #include <gst/base/gstadapter.h> |
|
27 |
|
28 G_BEGIN_DECLS |
|
29 |
|
30 #define GST_TYPE_MP3PARSE \ |
|
31 (gst_mp3parse_get_type()) |
|
32 #define GST_MP3PARSE(obj) \ |
|
33 (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_MP3PARSE,GstMPEGAudioParse)) |
|
34 #define GST_MP3PARSE_CLASS(klass) \ |
|
35 (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_MP3PARSE,GstMPEGAudioParseClass)) |
|
36 #define GST_IS_MP3PARSE(obj) \ |
|
37 (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_MP3PARSE)) |
|
38 #define GST_IS_MP3PARSE_CLASS(klass) \ |
|
39 (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_MP3PARSE)) |
|
40 |
|
41 typedef struct _GstMPEGAudioParse GstMPEGAudioParse; |
|
42 typedef struct _GstMPEGAudioParseClass GstMPEGAudioParseClass; |
|
43 typedef struct _MPEGAudioSeekEntry MPEGAudioSeekEntry; |
|
44 typedef struct _MPEGAudioPendingAccurateSeek MPEGAudioPendingAccurateSeek; |
|
45 |
|
46 |
|
47 struct _MPEGAudioSeekEntry { |
|
48 gint64 byte; |
|
49 GstClockTime timestamp; |
|
50 }; |
|
51 |
|
52 struct _MPEGAudioPendingAccurateSeek { |
|
53 GstSegment segment; |
|
54 gint64 upstream_start; |
|
55 GstClockTime timestamp_start; |
|
56 }; |
|
57 |
|
58 struct _GstMPEGAudioParse { |
|
59 GstElement element; |
|
60 |
|
61 GstPad *sinkpad, *srcpad; |
|
62 |
|
63 GstSegment segment; |
|
64 GstClockTime next_ts; |
|
65 gboolean discont; |
|
66 |
|
67 /* Offset as supplied by incoming buffers */ |
|
68 gint64 cur_offset; |
|
69 |
|
70 /* Upcoming timestamp given on an incoming buffer and |
|
71 * the offset at which it becomes active */ |
|
72 GstClockTime pending_ts; |
|
73 gint64 pending_offset; |
|
74 /* Offset since the last newseg */ |
|
75 gint64 tracked_offset; |
|
76 /* tracked_offset when resyncing started */ |
|
77 gint64 sync_offset; |
|
78 |
|
79 GstAdapter *adapter; |
|
80 |
|
81 guint skip; /* number of frames to skip */ |
|
82 guint bit_rate; /* in kbps */ |
|
83 gint channels, rate, layer, version; |
|
84 GstClockTime max_bitreservoir; |
|
85 gint spf; /* Samples per frame */ |
|
86 |
|
87 gboolean resyncing; /* True when attempting to resync (stricter checks are |
|
88 performed) */ |
|
89 gboolean sent_codec_tag; |
|
90 |
|
91 /* VBR tracking */ |
|
92 guint avg_bitrate; |
|
93 guint64 bitrate_sum; |
|
94 guint frame_count; |
|
95 guint last_posted_bitrate; |
|
96 gint last_posted_crc; |
|
97 guint last_posted_channel_mode; |
|
98 |
|
99 /* Xing info */ |
|
100 guint32 xing_flags; |
|
101 guint32 xing_frames; |
|
102 GstClockTime xing_total_time; |
|
103 guint32 xing_bytes; |
|
104 /* percent -> filepos mapping */ |
|
105 guchar xing_seek_table[100]; |
|
106 /* filepos -> percent mapping */ |
|
107 guint16 xing_seek_table_inverse[256]; |
|
108 guint32 xing_vbr_scale; |
|
109 guint xing_bitrate; |
|
110 |
|
111 /* VBRI info */ |
|
112 guint32 vbri_frames; |
|
113 GstClockTime vbri_total_time; |
|
114 guint32 vbri_bytes; |
|
115 guint vbri_bitrate; |
|
116 guint vbri_seek_points; |
|
117 guint32 *vbri_seek_table; |
|
118 gboolean vbri_valid; |
|
119 |
|
120 /* Accurate seeking */ |
|
121 GList *seek_table; |
|
122 GMutex *pending_seeks_lock; |
|
123 GSList *pending_accurate_seeks; |
|
124 gboolean exact_position; |
|
125 |
|
126 GSList *pending_nonaccurate_seeks; |
|
127 |
|
128 /* Track whether we're seekable (in BYTES format, if upstream operates in |
|
129 * TIME format, we don't care about seekability and assume upstream handles |
|
130 * it). The seek table for accurate seeking is not maintained if we're not |
|
131 * seekable. */ |
|
132 gboolean seekable; |
|
133 |
|
134 /* minimum distance between two index entries */ |
|
135 GstClockTimeDiff idx_interval; |
|
136 |
|
137 /* pending segment */ |
|
138 GstEvent *pending_segment; |
|
139 /* pending events */ |
|
140 GList *pending_events; |
|
141 }; |
|
142 |
|
143 struct _GstMPEGAudioParseClass { |
|
144 GstElementClass parent_class; |
|
145 }; |
|
146 |
|
147 #ifdef __SYMBIAN32__ |
|
148 IMPORT_C |
|
149 #endif |
|
150 GType gst_mp3parse_get_type(void); |
|
151 |
|
152 G_END_DECLS |
|
153 |
|
154 #endif /* __MP3PARSE_H__ */ |
|