Bug 22803 - Make header conform to implementation
[swfdec.git] / swfdec / swfdec_decoder.h
blobfad1b5b62462ded8c7e6e6b932e28d64346c9418
1 /* Swfdec
2 * Copyright (C) 2006 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_DECODER_H_
21 #define _SWFDEC_DECODER_H_
23 #include <glib-object.h>
24 #include <swfdec/swfdec_audio_internal.h>
25 #include <swfdec/swfdec_buffer.h>
26 #include <swfdec/swfdec_loader.h>
27 #include <swfdec/swfdec_player.h>
28 #include <swfdec/swfdec_types.h>
30 G_BEGIN_DECLS
33 typedef enum {
34 /* processing continued as expected */
35 SWFDEC_STATUS_OK = 0,
36 /* An error occured during parsing */
37 SWFDEC_STATUS_ERROR = (1 << 0),
38 /* more data needs to be made available for processing */
39 SWFDEC_STATUS_NEEDBITS = (1 << 1),
40 /* parsing is finished */
41 SWFDEC_STATUS_EOF = (1 << 2),
42 /* header parsing is complete, framerate, image size etc are known */
43 SWFDEC_STATUS_INIT = (1 << 3),
44 /* at least one new image is available for display */
45 SWFDEC_STATUS_IMAGE = (1 << 4)
46 } SwfdecStatus;
48 //typedef struct _SwfdecDecoder SwfdecDecoder;
49 typedef struct _SwfdecDecoderClass SwfdecDecoderClass;
51 #define SWFDEC_TYPE_DECODER (swfdec_decoder_get_type())
52 #define SWFDEC_IS_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_DECODER))
53 #define SWFDEC_IS_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_DECODER))
54 #define SWFDEC_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_DECODER, SwfdecDecoder))
55 #define SWFDEC_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_DECODER, SwfdecDecoderClass))
56 #define SWFDEC_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_DECODER, SwfdecDecoderClass))
58 struct _SwfdecDecoder
60 GObject object;
62 SwfdecLoaderDataType data_type; /* type of the data we provide or UNKNOWN if not known yet */
63 guint rate; /* rate per second in 256th */
64 guint width; /* width of stream */
65 guint height; /* guess */
66 guint bytes_loaded; /* bytes already loaded */
67 guint bytes_total; /* total bytes in the file or 0 if not known */
68 guint frames_loaded; /* frames already loaded */
69 guint frames_total; /* total frames */
72 struct _SwfdecDecoderClass
74 GObjectClass object_class;
76 SwfdecStatus (* parse) (SwfdecDecoder * decoder,
77 SwfdecBuffer * buffer);
78 SwfdecStatus (* eof) (SwfdecDecoder * decoder);
80 /* signals */
81 void (* missing_plugins) (SwfdecDecoder * dec,
82 const char ** details);
85 GType swfdec_decoder_get_type (void);
87 #define SWFDEC_DECODER_DETECT_LENGTH 4
88 SwfdecDecoder * swfdec_decoder_new (const SwfdecBuffer * buffer);
90 SwfdecStatus swfdec_decoder_parse (SwfdecDecoder * decoder,
91 SwfdecBuffer * buffer);
92 SwfdecStatus swfdec_decoder_eof (SwfdecDecoder * decoder);
94 void swfdec_decoder_use_audio_codec (SwfdecDecoder * decoder,
95 guint codec,
96 SwfdecAudioFormat format);
97 void swfdec_decoder_use_video_codec (SwfdecDecoder * decoder,
98 guint codec);
100 G_END_DECLS
101 #endif