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 <swfdec/swfdec_color.h>
26 #include <swfdec/swfdec_event.h>
27 #include <swfdec/swfdec_graphic.h>
28 #include <swfdec/swfdec_types.h>
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 GSList
*labels
; /* names of the frame for "GotoLabel" */
59 SwfdecGraphic graphic
;
61 SwfdecSpriteFrame
* frames
; /* the n_frames different frames */
62 guint n_frames
; /* number of frames in this sprite */
63 SwfdecScript
* init_action
; /* action to run when initializing this sprite */
64 GArray
* actions
; /* SwfdecSpriteAction in execution order */
67 guint parse_frame
; /* frame we're currently parsing. == n_frames if done parsing */
70 struct _SwfdecSpriteClass
72 SwfdecGraphicClass graphic_class
;
75 GType
swfdec_sprite_get_type (void);
77 int tag_func_define_sprite (SwfdecSwfDecoder
* s
, guint tag
);
78 void swfdec_sprite_add_sound_chunk (SwfdecSprite
* sprite
, guint frame
,
79 SwfdecBuffer
* chunk
, int skip
, guint n_samples
);
80 void swfdec_sprite_set_n_frames (SwfdecSprite
*sprite
, guint n_frames
, guint rate
);
81 void swfdec_sprite_add_action (SwfdecSprite
* sprite
, guint tag
, SwfdecBuffer
*buffer
);
82 gboolean
swfdec_sprite_get_action (SwfdecSprite
* sprite
,
85 SwfdecBuffer
** buffer
);
86 int swfdec_sprite_get_frame (SwfdecSprite
* sprite
,
88 #define swfdec_sprite_is_loaded(sprite) ((sprite)->parse_frame == (sprite)->n_frames)