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.
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>
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
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
66 GObjectClass object_class
;
69 gboolean (* prepare
) (guint codec
,
70 SwfdecAudioFormat format
,
72 SwfdecAudioDecoder
* (* create
) (guint codec
,
73 SwfdecAudioFormat format
);
75 void (* set_codec_data
)
76 (SwfdecAudioDecoder
* decoder
,
77 SwfdecBuffer
* buffer
);
78 void (* push
) (SwfdecAudioDecoder
* decoder
,
79 SwfdecBuffer
* buffer
);
80 SwfdecBuffer
* (* pull
) (SwfdecAudioDecoder
* decoder
);
83 GType
swfdec_audio_decoder_get_type (void);
85 void swfdec_audio_decoder_register (GType type
);
87 gboolean
swfdec_audio_decoder_prepare (guint codec
,
88 SwfdecAudioFormat format
,
90 SwfdecAudioDecoder
* swfdec_audio_decoder_new (guint codec
,
91 SwfdecAudioFormat format
);
93 void swfdec_audio_decoder_set_codec_data
94 (SwfdecAudioDecoder
* decoder
,
95 SwfdecBuffer
* buffer
);
96 void swfdec_audio_decoder_push (SwfdecAudioDecoder
* decoder
,
97 SwfdecBuffer
* buffer
);
98 SwfdecBuffer
* swfdec_audio_decoder_pull (SwfdecAudioDecoder
* decoder
);
99 gboolean
swfdec_audio_decoder_uses_format(SwfdecAudioDecoder
* decoder
,
101 SwfdecAudioFormat format
);
104 void swfdec_audio_decoder_error (SwfdecAudioDecoder
* decoder
,
106 ...) G_GNUC_PRINTF (2, 3);
107 void swfdec_audio_decoder_errorv (SwfdecAudioDecoder
* decoder
,