2 * Copyright (C) 2003-2006 David Schleef <ds@schleef.org>
3 * 2005-2006 Eric Anholt <eric@anholt.net>
4 * 2006-2007 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_SWF_DECODER_H__
23 #define __SWFDEC_SWF_DECODER_H__
28 #include <swfdec/swfdec_decoder.h>
29 #include <swfdec/swfdec_bits.h>
30 #include <swfdec/swfdec_types.h>
31 #include <swfdec/swfdec_rect.h>
35 //typedef struct _SwfdecSwfDecoder SwfdecSwfDecoder;
36 typedef struct _SwfdecSwfDecoderClass SwfdecSwfDecoderClass
;
37 typedef int (* SwfdecTagFunc
) (SwfdecSwfDecoder
*, guint
);
39 #define SWFDEC_TYPE_SWF_DECODER (swfdec_swf_decoder_get_type())
40 #define SWFDEC_IS_SWF_DECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_SWF_DECODER))
41 #define SWFDEC_IS_SWF_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_SWF_DECODER))
42 #define SWFDEC_SWF_DECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_SWF_DECODER, SwfdecSwfDecoder))
43 #define SWFDEC_SWF_DECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_SWF_DECODER, SwfdecSwfDecoderClass))
44 #define SWFDEC_SWF_DECODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_SWF_DECODER, SwfdecSwfDecoderClass))
46 struct _SwfdecSwfDecoder
48 SwfdecDecoder decoder
;
52 gboolean compressed
; /* TRUE if this is a compressed flash file */
53 z_stream z
; /* decompressor in use or uninitialized memory */
54 SwfdecBuffer
* buffer
; /* buffer containing uncompressed data */
55 guint bytes_parsed
; /* number of bytes that have been processed by the parser */
57 int state
; /* where we are in the top-level state engine */
58 SwfdecBits parse
; /* where we are in global parsing */
59 SwfdecBits b
; /* temporary state while parsing */
62 GHashTable
* characters
; /* list of all objects with an id (called characters) */
63 SwfdecSprite
* main_sprite
; /* the root sprite */
64 SwfdecSprite
* parse_sprite
; /* the sprite that parsed at the moment */
65 GHashTable
* scripts
; /* buffer -> script mapping for all scripts */
67 gboolean use_network
; /* allow network or local access */
68 gboolean has_metadata
; /* TRUE if this file contains metadata */
69 gboolean protection
; /* TRUE is this file is protected and may not be edited */
70 char * password
; /* MD5'd password to open for editing or NULL if may not be opened */
71 char * metadata
; /* NULL if unset or contents of Metadata tag (supposed to be RDF) */
73 SwfdecBuffer
* jpegtables
; /* jpeg tables for DefineJPEG compressed jpeg files */
76 struct _SwfdecSwfDecoderClass
{
77 SwfdecDecoderClass decoder_class
;
80 GType
swfdec_swf_decoder_get_type (void);
82 gpointer
swfdec_swf_decoder_get_character (SwfdecSwfDecoder
* s
,
84 gpointer
swfdec_swf_decoder_create_character (SwfdecSwfDecoder
* s
,
88 void swfdec_swf_decoder_add_script (SwfdecSwfDecoder
* s
,
89 SwfdecScript
* script
);
90 SwfdecScript
* swfdec_swf_decoder_get_script (SwfdecSwfDecoder
* s
,
93 SwfdecTagFunc
swfdec_swf_decoder_get_tag_func (int tag
);
94 const char *swfdec_swf_decoder_get_tag_name (int tag
);
95 int swfdec_swf_decoder_get_tag_flag (int tag
);