• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer AIFF parser
2  * Copyright (C) <2008> Pioneers of the Inevitable <songbird@songbirdnest.com>
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., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 
21 #ifndef __GST_AIFF_PARSE_H__
22 #define __GST_AIFF_PARSE_H__
23 
24 
25 #include <gst/gst.h>
26 #include <gst/base/gstadapter.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GST_TYPE_AIFF_PARSE \
31   (gst_aiff_parse_get_type())
32 #define GST_AIFF_PARSE(obj) \
33   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AIFF_PARSE,GstAiffParse))
34 #define GST_AIFF_PARSE_CLASS(klass) \
35   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AIFF_PARSE,GstAiffParseClass))
36 #define GST_IS_AIFF_PARSE(obj) \
37   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AIFF_PARSE))
38 #define GST_IS_AIFF_PARSE_CLASS(klass) \
39   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AIFF_PARSE))
40 
41 typedef enum {
42   AIFF_PARSE_START,
43   AIFF_PARSE_HEADER,
44   AIFF_PARSE_DATA
45 } GstAiffParseState;
46 
47 typedef struct _GstAiffParse GstAiffParse;
48 typedef struct _GstAiffParseClass GstAiffParseClass;
49 
50 /**
51  * GstAiffParse:
52  *
53  * Opaque data structure.
54  */
55 struct _GstAiffParse {
56   GstElement parent;
57 
58   /*< private >*/
59   GstPad      *sinkpad;
60   GstPad      *srcpad;
61 
62   GstEvent    *close_segment;
63   GstEvent    *start_segment;
64 
65   /* AIFF decoding state */
66   GstAiffParseState state;
67 
68   /* format of audio, see defines below */
69   gint format;
70 
71   gboolean is_aifc;
72 
73   /* useful audio data */
74   guint32 rate;
75   guint16 channels;
76   guint16 width;
77   guint16 depth;
78   guint32 endianness;
79   gboolean floating_point;
80 
81   /* real bytes per second used or 0 when no bitrate is known */
82   guint32 bps;
83 
84   guint bytes_per_sample;
85   guint max_buf_size;
86 
87   guint32   total_frames;
88 
89   guint32 ssnd_offset;
90   guint32 ssnd_blocksize;
91 
92   /* position in data part */
93   guint64	offset;
94   guint64	end_offset;
95   guint64 	dataleft;
96   /* offset/length of data part */
97   guint64 	datastart;
98   guint64 	datasize;
99   /* duration in time */
100   guint64 	duration;
101 
102   /* pending seek */
103   GstEvent *seek_event;
104 
105   /* For streaming */
106   GstAdapter *adapter;
107   gboolean got_comm;
108   gboolean streaming;
109 
110   /* configured segment, start/stop expressed in time */
111   GstSegment segment;
112   gboolean segment_running;
113 
114   /* discont after seek */
115   gboolean discont;
116 
117   /* tags */
118   GstTagList *tags;
119 };
120 
121 struct _GstAiffParseClass {
122   GstElementClass parent_class;
123 };
124 
125 GType gst_aiff_parse_get_type(void);
126 
127 G_END_DECLS
128 
129 #endif /* __GST_AIFF_PARSE_H__ */
130