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_8KHZ 5
34 #define SWFDEC_AUDIO_CODEC_NELLYMOSER 6
37 typedef struct _SwfdecAudioDecoder SwfdecAudioDecoder
;
38 typedef struct _SwfdecAudioDecoderClass SwfdecAudioDecoderClass
;
40 #define SWFDEC_TYPE_AUDIO_DECODER (swfdec_audio_decoder_get_type())
41 #define SWFDEC_IS_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AUDIO_DECODER))
42 #define SWFDEC_IS_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AUDIO_DECODER))
43 #define SWFDEC_AUDIO_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoder))
44 #define SWFDEC_AUDIO_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoderClass))
45 #define SWFDEC_AUDIO_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AUDIO_DECODER, SwfdecAudioDecoderClass))
47 struct _SwfdecAudioDecoder
52 guint codec
; /* codec this decoder uses */
53 SwfdecAudioFormat format
; /* format the codec was initialized with */
54 gboolean error
; /* if this decoder is in an error state */
57 struct _SwfdecAudioDecoderClass
60 GObjectClass object_class
;
63 gboolean (* prepare
) (guint codec
,
64 SwfdecAudioFormat format
,
66 SwfdecAudioDecoder
* (* create
) (guint codec
,
67 SwfdecAudioFormat format
);
69 void (* push
) (SwfdecAudioDecoder
* decoder
,
70 SwfdecBuffer
* buffer
);
71 SwfdecBuffer
* (* pull
) (SwfdecAudioDecoder
* decoder
);
74 GType
swfdec_audio_decoder_get_type (void);
76 void swfdec_audio_decoder_register (GType type
);
78 gboolean
swfdec_audio_decoder_prepare (guint codec
,
79 SwfdecAudioFormat format
,
81 SwfdecAudioDecoder
* swfdec_audio_decoder_new (guint codec
,
82 SwfdecAudioFormat format
);
84 void swfdec_audio_decoder_push (SwfdecAudioDecoder
* decoder
,
85 SwfdecBuffer
* buffer
);
86 SwfdecBuffer
* swfdec_audio_decoder_pull (SwfdecAudioDecoder
* decoder
);
87 gboolean
swfdec_audio_decoder_uses_format(SwfdecAudioDecoder
* decoder
,
89 SwfdecAudioFormat format
);
92 void swfdec_audio_decoder_error (SwfdecAudioDecoder
* decoder
,
94 ...) G_GNUC_PRINTF (2, 3);
95 void swfdec_audio_decoder_errorv (SwfdecAudioDecoder
* decoder
,