add a test for just-fixed crasher
[swfdec.git] / swfdec / swfdec_audio_stream.h
blob92d298468be901db9be82f2caf1412d0c18dc46b
1 /* Swfdec
2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2008 Benjamin Otte <otte@gnome.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301 USA
22 #ifndef _SWFDEC_AUDIO_STREAM_H_
23 #define _SWFDEC_AUDIO_STREAM_H_
25 #include <swfdec/swfdec_audio_decoder.h>
26 #include <swfdec/swfdec_audio_internal.h>
28 G_BEGIN_DECLS
30 typedef struct _SwfdecAudioStream SwfdecAudioStream;
31 typedef struct _SwfdecAudioStreamClass SwfdecAudioStreamClass;
33 #define SWFDEC_TYPE_AUDIO_STREAM (swfdec_audio_stream_get_type())
34 #define SWFDEC_IS_AUDIO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AUDIO_STREAM))
35 #define SWFDEC_IS_AUDIO_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AUDIO_STREAM))
36 #define SWFDEC_AUDIO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AUDIO_STREAM, SwfdecAudioStream))
37 #define SWFDEC_AUDIO_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AUDIO_STREAM, SwfdecAudioStreamClass))
38 #define SWFDEC_AUDIO_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AUDIO_STREAM, SwfdecAudioStreamClass))
40 struct _SwfdecAudioStream
42 SwfdecAudio audio;
44 SwfdecAudioDecoder * decoder; /* decoder in use */
45 GQueue * queue; /* all the samples we've decoded so far */
46 gsize queue_size; /* size of queue in samples */
47 gboolean done; /* no more data will arrive */
48 gboolean buffering; /* pull vfunc returned NULL */
51 struct _SwfdecAudioStreamClass
53 SwfdecAudioClass audio_class;
55 /* get another buffer if available */
56 SwfdecBuffer * (* pull) (SwfdecAudioStream * stream);
59 GType swfdec_audio_stream_get_type (void);
61 /* to be called from pull callback */
62 void swfdec_audio_stream_use_decoder (SwfdecAudioStream * stream,
63 guint codec,
64 SwfdecAudioFormat format);
65 void swfdec_audio_stream_done (SwfdecAudioStream * stream);
67 G_END_DECLS
68 #endif