2 * GPAC - Multimedia Framework C SDK
\r
4 * Copyright (c) Jean Le Feuvre 2000-2005
\r
5 * All rights reserved
\r
7 * This file is part of GPAC / Scene Management sub-project
\r
9 * GPAC is free software; you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation; either version 2, or (at your option)
\r
12 * any later version.
\r
14 * GPAC is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public
\r
20 * License along with this library; see the file COPYING. If not, write to
\r
21 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
\r
25 #ifndef _GF_SWF_DEV_H_
\r
26 #define _GF_SWF_DEV_H_
\r
28 #include <gpac/scene_manager.h>
\r
29 #include <gpac/color.h>
\r
31 #define SWF_TWIP_SCALE (1/20.0f)
\r
34 typedef struct SWFReader SWFReader;
\r
35 typedef struct SWFSound SWFSound;
\r
36 typedef struct SWFText SWFText;
\r
37 typedef struct SWFEditText SWFEditText;
\r
38 typedef struct SWF_Button SWF_Button;
\r
39 typedef struct SWFShape SWFShape;
\r
40 typedef struct SWFFont SWFFont;
\r
41 typedef struct SWFAction SWFAction;
\r
53 GF_SceneLoader *load;
\r
62 Fixed width, height;
\r
63 Bool has_interact, no_as;
\r
65 /*copy of the swf import flags*/
\r
77 GF_List *display_list;
\r
86 /*the one and only sound stream for current timeline*/
\r
87 SWFSound *sound_stream;
\r
89 /*when creating sprites:
\r
90 1- all BIFS AUs in sprites are random access
\r
91 2- depth is ignored in Sprites
\r
93 u32 current_sprite_id;
\r
95 /*the parser can decide to remove nearly aligned pppoints in lineTo sequences*/
\r
96 /*flatten limit - 0 means no flattening*/
\r
98 /*number of points removed*/
\r
105 /*callback functions for translator*/
\r
106 GF_Err (*set_backcol)(SWFReader *read, u32 xrgb);
\r
107 GF_Err (*show_frame)(SWFReader *read);
\r
109 /*checks if display list is large enough - returns 1 if yes, 0 otherwise (and allocate space)*/
\r
110 Bool (*allocate_depth)(SWFReader *read, u32 depth);
\r
111 GF_Err (*place_obj)(SWFReader *read, u32 depth, u32 ID, u32 prev_id, u32 type, GF_Matrix2D *mat, GF_ColorMatrix *cmat, GF_Matrix2D *prev_mat, GF_ColorMatrix *prev_cmat);
\r
112 GF_Err (*remove_obj)(SWFReader *read, u32 depth, u32 ID);
\r
114 GF_Err (*define_shape)(SWFReader *read, SWFShape *shape, SWFFont *parent_font, Bool last_sub_shape);
\r
115 GF_Err (*define_sprite)(SWFReader *read, u32 nb_frames);
\r
116 GF_Err (*define_text)(SWFReader *read, SWFText *text);
\r
117 GF_Err (*define_edit_text)(SWFReader *read, SWFEditText *text);
\r
118 /*@button is NULL to signal end of button declaration, non-null otherwise. "action" callback will be
\r
120 GF_Err (*define_button)(SWFReader *read, SWF_Button *button);
\r
122 GF_Err (*setup_image)(SWFReader *read, u32 ID, char *fileName);
\r
123 /*called whenever a sound is found. For soundstreams, called twice, once on the header (declaration),
\r
124 and one on the first soundstream block for offset signaling*/
\r
125 GF_Err (*setup_sound)(SWFReader *read, SWFSound *snd, Bool soundstream_first_block);
\r
126 GF_Err (*start_sound)(SWFReader *read, SWFSound *snd, Bool stop);
\r
127 /*performs an action, returns 0 if action not supported*/
\r
128 Bool (*action)(SWFReader *read, SWFAction *act);
\r
130 void (*finalize)(SWFReader *read);
\r
133 /* <BIFS conversion state> */
\r
135 /*all simple appearances (no texture)*/
\r
140 /*current BIFS stream*/
\r
141 GF_StreamContext *bifs_es;
\r
142 GF_AUContext *bifs_au;
\r
144 GF_StreamContext *bifs_dict_es;
\r
145 GF_AUContext *bifs_dict_au;
\r
147 /*for sound insert*/
\r
151 GF_StreamContext *od_es;
\r
152 GF_AUContext *od_au;
\r
154 GF_Node *cur_shape;
\r
155 u16 prev_od_id, prev_es_id;
\r
159 GF_List *btn_over, *btn_not_over, *btn_active, *btn_not_active;
\r
161 /* </BIFS conversion state> */
\r
165 void swf_report(SWFReader *read, GF_Err e, char *format, ...);
\r
166 SWFFont *swf_find_font(SWFReader *read, u32 fontID);
\r
167 GF_Err swf_parse_sprite(SWFReader *read);
\r
170 GF_Err swf_to_bifs_init(SWFReader *read);
\r
182 /*0: not defined, otherwise index of shape*/
\r
184 /*0: moveTo, 1: lineTo, 2: quad curveTo*/
\r
188 /*used by SWF->BIFS for IndexedCurveSet*/
\r
208 GF_List *fill_left, *fill_right, *lines;
\r
213 /*SWF font object*/
\r
220 /*the following may all be overridden by a DefineFontInfo*/
\r
222 /*index -> glyph code*/
\r
224 /*index -> glyph advance*/
\r
227 /*font flags (SWF 3.0)*/
\r
230 Bool is_unicode, is_ansi;
\r
231 Bool is_bold, is_italic;
\r
232 s16 ascent, descent, leading;
\r
238 /*chunk of text with the same aspect (font, col)*/
\r
245 /*origin point in local metrics*/
\r
246 Fixed orig_x, orig_y;
\r
260 struct SWFEditText
\r
265 Bool word_wrap, multiline, password, read_only, auto_size, no_select, html, outlines, has_layout, border;
\r
267 Fixed max_length, font_height;
\r
271 Fixed left, right, indent, leading;
\r
277 SWF_SND_UNCOMP = 0,
\r
286 /*0: 5.5k - 1: 11k - 2: 22k - 3: 44k*/
\r
288 u8 bits_per_sample;
\r
291 u32 frame_delay_ms;
\r
297 /*set when sound is setup (OD inserted)*/
\r
303 /*interaction states*/
\r
304 Bool hitTest, down, over, up;
\r
308 GF_ColorMatrix cmx;
\r
310 } SWF_ButtonRecord;
\r
316 SWF_ButtonRecord buttons[40];
\r
323 GF_SWF_AS3_GOTO_FRAME,
\r
324 GF_SWF_AS3_GET_URL,
\r
325 GF_SWF_AS3_NEXT_FRAME,
\r
326 GF_SWF_AS3_PREV_FRAME,
\r
329 GF_SWF_AS3_TOGGLE_QUALITY,
\r
330 GF_SWF_AS3_STOP_SOUNDS,
\r
331 GF_SWF_AS3_WAIT_FOR_FRAME,
\r
332 GF_SWF_AS3_SET_TARGET,
\r
333 GF_SWF_AS3_GOTO_LABEL,
\r
338 GF_SWF_COND_IDLE_TO_OVERDOWN = 1,
\r
339 GF_SWF_COND_OUTDOWN_TO_IDLE = 1<<1,
\r
340 GF_SWF_COND_OUTDOWN_TO_OVERDOWN = 1<<2,
\r
341 GF_SWF_COND_OVERDOWN_TO_OUTDOWN = 1<<3,
\r
342 GF_SWF_COND_OVERDOWN_TO_OUTUP = 1<<4,
\r
343 GF_SWF_COND_OVERUP_TO_OVERDOWN = 1<<5,
\r
344 GF_SWF_COND_OVERUP_TO_IDLE = 1<<6,
\r
345 GF_SWF_COND_IDLE_TO_OVERUP = 1<<7,
\r
346 GF_SWF_COND_OVERDOWN_TO_IDLE = 1<<8,
\r
353 u32 button_mask, button_key;
\r
354 /*target (geturl/set_target), label (goto_frame)*/
\r
361 #endif /*_GF_SWF_DEV_H_*/
\r