2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
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.
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.
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.
21 #ifndef __MP3PARSE_H__
22 #define __MP3PARSE_H__
26 #include <gst/base/gstadapter.h>
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))
41 typedef struct _GstMPEGAudioParse GstMPEGAudioParse;
42 typedef struct _GstMPEGAudioParseClass GstMPEGAudioParseClass;
43 typedef struct _MPEGAudioSeekEntry MPEGAudioSeekEntry;
44 typedef struct _MPEGAudioPendingAccurateSeek MPEGAudioPendingAccurateSeek;
47 struct _MPEGAudioSeekEntry {
49 GstClockTime timestamp;
52 struct _MPEGAudioPendingAccurateSeek {
54 gint64 upstream_start;
55 GstClockTime timestamp_start;
58 struct _GstMPEGAudioParse {
61 GstPad *sinkpad, *srcpad;
67 /* Offset as supplied by incoming buffers */
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 */
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 */
87 gboolean resyncing; /* True when attempting to resync (stricter checks are
89 gboolean sent_codec_tag;
95 guint last_posted_bitrate;
97 guint last_posted_channel_mode;
102 GstClockTime xing_total_time;
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;
113 GstClockTime vbri_total_time;
116 guint vbri_seek_points;
117 guint32 *vbri_seek_table;
120 /* Accurate seeking */
122 GMutex *pending_seeks_lock;
123 GSList *pending_accurate_seeks;
124 gboolean exact_position;
126 GSList *pending_nonaccurate_seeks;
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
134 /* minimum distance between two index entries */
135 GstClockTimeDiff idx_interval;
137 /* pending segment */
138 GstEvent *pending_segment;
140 GList *pending_events;
143 struct _GstMPEGAudioParseClass {
144 GstElementClass parent_class;
147 GType gst_mp3parse_get_type(void);
151 #endif /* __MP3PARSE_H__ */