SwfdecAsObjectClass is gone now
[swfdec.git] / swfdec / swfdec_audio_decoder.h
blob8c7fb5d836779262a3f3829fdd02e5032a0e2894
1 /* Swfdec
2 * Copyright (C) 2006-2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 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 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_AUDIO_DECODER_H_
21 #define _SWFDEC_AUDIO_DECODER_H_
23 #include <swfdec/swfdec_buffer.h>
24 #include <swfdec/swfdec_audio_internal.h>
26 G_BEGIN_DECLS
29 #define SWFDEC_AUDIO_CODEC_UNDEFINED 0
30 #define SWFDEC_AUDIO_CODEC_ADPCM 1
31 #define SWFDEC_AUDIO_CODEC_MP3 2
32 #define SWFDEC_AUDIO_CODEC_UNCOMPRESSED 3
33 #define SWFDEC_AUDIO_CODEC_NELLYMOSER_16KHZ 4
34 #define SWFDEC_AUDIO_CODEC_NELLYMOSER_8KHZ 5
35 #define SWFDEC_AUDIO_CODEC_NELLYMOSER 6
36 #define SWFDEC_AUDIO_CODEC_ALAW 7
37 #define SWFDEC_AUDIO_CODEC_MULAW 8
38 #define SWFDEC_AUDIO_CODEC_AAC 10
39 #define SWFDEC_AUDIO_CODEC_SPEEX 11
40 #define SWFDEC_AUDIO_CODEC_MP3_8KHZ 14
43 typedef struct _SwfdecAudioDecoder SwfdecAudioDecoder;
44 typedef struct _SwfdecAudioDecoderClass SwfdecAudioDecoderClass;
46 #define SWFDEC_TYPE_AUDIO_DECODER (swfdec_audio_decoder_get_type())
47 #define SWFDEC_IS_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AUDIO_DECODER))
48 #define SWFDEC_IS_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AUDIO_DECODER))
49 #define SWFDEC_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoder))
50 #define SWFDEC_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoderClass))
51 #define SWFDEC_AUDIO_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoderClass))
53 struct _SwfdecAudioDecoder
55 GObject object;
57 /*< private >*/
58 guint codec; /* codec this decoder uses */
59 SwfdecAudioFormat format; /* format the codec was initialized with */
60 gboolean error; /* if this decoder is in an error state */
63 struct _SwfdecAudioDecoderClass
65 /*< private >*/
66 GObjectClass object_class;
68 /*< public >*/
69 gboolean (* prepare) (guint codec,
70 SwfdecAudioFormat format,
71 char ** missing);
72 SwfdecAudioDecoder * (* create) (guint codec,
73 SwfdecAudioFormat format,
74 SwfdecBuffer * data);
76 void (* push) (SwfdecAudioDecoder * decoder,
77 SwfdecBuffer * buffer);
78 SwfdecBuffer * (* pull) (SwfdecAudioDecoder * decoder);
81 GType swfdec_audio_decoder_get_type (void);
83 void swfdec_audio_decoder_register (GType type);
85 gboolean swfdec_audio_decoder_prepare (guint codec,
86 SwfdecAudioFormat format,
87 char ** missing);
88 SwfdecAudioDecoder * swfdec_audio_decoder_new (guint codec,
89 SwfdecAudioFormat format,
90 SwfdecBuffer * data);
92 void swfdec_audio_decoder_push (SwfdecAudioDecoder * decoder,
93 SwfdecBuffer * buffer);
94 SwfdecBuffer * swfdec_audio_decoder_pull (SwfdecAudioDecoder * decoder);
95 gboolean swfdec_audio_decoder_uses_format(SwfdecAudioDecoder * decoder,
96 guint codec,
97 SwfdecAudioFormat format);
99 /* for subclasses */
100 void swfdec_audio_decoder_error (SwfdecAudioDecoder * decoder,
101 const char * error,
102 ...) G_GNUC_PRINTF (2, 3);
103 void swfdec_audio_decoder_errorv (SwfdecAudioDecoder * decoder,
104 const char * error,
105 va_list args);
109 G_END_DECLS
110 #endif