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 <libswfdec/swfdec_decoder.h>
29 #include <libswfdec/swfdec_bits.h>
30 #include <libswfdec/swfdec_types.h>
31 #include <libswfdec/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 */
72 SwfdecBuffer
* jpegtables
; /* jpeg tables for DefineJPEG compressed jpeg files */
75 struct _SwfdecSwfDecoderClass
{
76 SwfdecDecoderClass decoder_class
;
79 GType
swfdec_swf_decoder_get_type (void);
81 gpointer
swfdec_swf_decoder_get_character (SwfdecSwfDecoder
* s
,
83 gpointer
swfdec_swf_decoder_create_character (SwfdecSwfDecoder
* s
,
87 void swfdec_swf_decoder_add_script (SwfdecSwfDecoder
* s
,
88 SwfdecScript
* script
);
89 SwfdecScript
* swfdec_swf_decoder_get_script (SwfdecSwfDecoder
* s
,
92 SwfdecTagFunc
swfdec_swf_decoder_get_tag_func (int tag
);
93 const char *swfdec_swf_decoder_get_tag_name (int tag
);
94 int swfdec_swf_decoder_get_tag_flag (int tag
);