fix jsut committed crasher by rewriting startDrag action
[swfdec.git] / libswfdec / swfdec_sprite.h
blob34a9c49e497525b2a3d8fb86a12e46e4107b9e19
1 /* Swfdec
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_SPRITE_H_
23 #define _SWFDEC_SPRITE_H_
25 #include <libswfdec/swfdec_color.h>
26 #include <libswfdec/swfdec_event.h>
27 #include <libswfdec/swfdec_graphic.h>
28 #include <libswfdec/swfdec_types.h>
30 G_BEGIN_DECLS
32 typedef struct _SwfdecSpriteClass SwfdecSpriteClass;
33 typedef struct _SwfdecSpriteAction SwfdecSpriteAction;
34 typedef struct _SwfdecExport SwfdecExport;
36 /* FIXME: It might make sense to event a SwfdecActionBuffer - a subclass of
37 * SwfdecBuffer that carries around a the tag.
38 * It might also make more sense to not parse the file into buffers at all
39 * and operate on the memory directly.
41 struct _SwfdecSpriteAction {
42 guint tag; /* the data tag (see swfdec_tag.h) */
43 SwfdecBuffer * buffer; /* the buffer for this data (can be NULL) */
46 #define SWFDEC_TYPE_SPRITE (swfdec_sprite_get_type())
47 #define SWFDEC_IS_SPRITE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_SPRITE))
48 #define SWFDEC_IS_SPRITE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_SPRITE))
49 #define SWFDEC_SPRITE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_SPRITE, SwfdecSprite))
50 #define SWFDEC_SPRITE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_SPRITE, SwfdecSpriteClass))
52 struct _SwfdecSpriteFrame
54 char *label; /* name of the frame for "GotoLabel" */
56 /* sound */
57 SwfdecSound *sound_head; /* sound head for this frame */
58 int sound_skip; /* samples to skip - maybe even backwards */
59 SwfdecBuffer *sound_block; /* sound chunk to play here or NULL for none */
60 guint sound_samples; /* number of samples in this frame */
61 GSList *sound; /* list of SwfdecSoundChunk events to start playing here */
64 struct _SwfdecSprite
66 SwfdecGraphic graphic;
68 SwfdecSpriteFrame * frames; /* the n_frames different frames */
69 guint n_frames; /* number of frames in this sprite */
70 SwfdecScript * init_action; /* action to run when initializing this sprite */
71 GArray * actions; /* SwfdecSpriteAction in execution order */
73 /* parse state */
74 guint parse_frame; /* frame we're currently parsing. == n_frames if done parsing */
77 struct _SwfdecSpriteClass
79 SwfdecGraphicClass graphic_class;
82 GType swfdec_sprite_get_type (void);
84 int tag_func_define_sprite (SwfdecSwfDecoder * s, guint tag);
85 void swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, guint frame,
86 SwfdecBuffer * chunk, int skip, guint n_samples);
87 void swfdec_sprite_set_n_frames (SwfdecSprite *sprite, guint n_frames, guint rate);
88 void swfdec_sprite_add_action (SwfdecSprite * sprite, guint tag, SwfdecBuffer *buffer);
89 gboolean swfdec_sprite_get_action (SwfdecSprite * sprite,
90 guint n,
91 guint * tag,
92 SwfdecBuffer ** buffer);
93 int swfdec_sprite_get_frame (SwfdecSprite * sprite,
94 const char * label);
96 SwfdecContent *swfdec_content_new (int depth);
97 void swfdec_content_free (SwfdecContent *content);
99 int tag_func_set_background_color (SwfdecSwfDecoder * s, guint tag);
102 G_END_DECLS
103 #endif