This file is indexed.

/usr/include/gpac/internal/swf_dev.h is in libgpac-dev 0.5.0+svn5324~dfsg1-1+b3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
/*
 *			GPAC - Multimedia Framework C SDK
 *
 *			Authors: Jean Le Feuvre
 *			Copyright (c) Telecom ParisTech 2000-2012
 *					All rights reserved
 *
 *  This file is part of GPAC / Scene Management sub-project
 *
 *  GPAC is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  GPAC is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; see the file COPYING.  If not, write to
 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef _GF_SWF_DEV_H_
#define _GF_SWF_DEV_H_

#include <gpac/scene_manager.h>
#include <gpac/color.h>
#include <gpac/media_tools.h>


#ifndef GPAC_DISABLE_SWF_IMPORT


#define SWF_TWIP_SCALE				(1/20.0f)


typedef struct SWFReader SWFReader;
typedef struct SWFSound SWFSound;
typedef struct SWFText SWFText;
typedef struct SWFEditText SWFEditText;
typedef struct SWF_Button SWF_Button;
typedef struct SWFShape SWFShape;
typedef struct SWFFont SWFFont;
typedef struct SWFAction SWFAction;

enum
{
	SWF_PLACE ,
	SWF_REPLACE,
	SWF_MOVE,
};

/*display list item (one per layer only)*/
typedef struct
{
	GF_Matrix2D mat;
	GF_ColorMatrix cmat;
	u32 depth;
	u32 char_id;
} DispShape;

struct SWFReader
{
	GF_SceneLoader *load;

	FILE *input;

	char *inputName;
	char *localPath;
	/*file header*/
	u32 length;
	char *mem;
	u32 frame_rate;
	u32 frame_count;
	Fixed width, height;
	Bool has_interact, no_as;
	Bool empty_frame;

	/*copy of the swf import flags*/
	u32 flags;

	/*bit reader*/
	GF_BitStream *bs;
	GF_Err ioerr;

	u32 current_frame;

	/*current tag*/
	u32 tag, size;

	GF_List *display_list;
	u32 max_depth;

	/*defined fonts*/
	GF_List *fonts;

	/*define sounds*/
	GF_List *sounds;

	/*the one and only sound stream for current timeline*/
	SWFSound *sound_stream;

	/*when creating sprites:
		1- all BIFS AUs in sprites are random access
		2- depth is ignored in Sprites
	*/
	u32 current_sprite_id;

	/*the parser can decide to remove nearly aligned pppoints in lineTo sequences*/
	/*flatten limit - 0 means no flattening*/
	Fixed flat_limit;
	/*number of points removed*/
	u32 flatten_points;

	u8 *jpeg_hdr;
	u32 jpeg_hdr_size;


	/*callback functions for translator*/
	GF_Err (*set_backcol)(SWFReader *read, u32 xrgb);
	GF_Err (*show_frame)(SWFReader *read);

	/*checks if display list is large enough - returns 1 if yes, 0 otherwise (and allocate space)*/
	Bool (*allocate_depth)(SWFReader *read, u32 depth);
	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);
	GF_Err (*remove_obj)(SWFReader *read, u32 depth, u32 ID);

	GF_Err (*define_shape)(SWFReader *read, SWFShape *shape, SWFFont *parent_font, Bool last_sub_shape);
	GF_Err (*define_sprite)(SWFReader *read, u32 nb_frames);
	GF_Err (*define_text)(SWFReader *read, SWFText *text);
	GF_Err (*define_edit_text)(SWFReader *read, SWFEditText *text);
	/*@button is NULL to signal end of button declaration, non-null otherwise. "action" callback will be
	called inbetween*/
	GF_Err (*define_button)(SWFReader *read, SWF_Button *button);

	GF_Err (*setup_image)(SWFReader *read, u32 ID, char *fileName);
	/*called whenever a sound is found. For soundstreams, called twice, once on the header (declaration),
	and one on the first soundstream block for offset signaling*/
	GF_Err (*setup_sound)(SWFReader *read, SWFSound *snd, Bool soundstream_first_block);
	GF_Err (*start_sound)(SWFReader *read, SWFSound *snd, Bool stop);
	/*performs an action, returns 0 if action not supported*/
	Bool (*action)(SWFReader *read, SWFAction *act);

	void (*finalize)(SWFReader *read);


	/* <BIFS conversion state> */

	/*all simple appearances (no texture)*/
	GF_List *apps;

	GF_List *buttons;

	/*current BIFS stream*/
	GF_StreamContext *bifs_es;
	GF_AUContext *bifs_au;

	GF_StreamContext *bifs_dict_es;
	GF_AUContext *bifs_dict_au;

	/*for sound insert*/
	GF_Node *root;

	/*current OD AU*/
	GF_StreamContext *od_es;
	GF_AUContext *od_au;

	GF_Node *cur_shape;
	u16 prev_od_id, prev_es_id;

	u32 wait_frame;
	SWF_Button *btn;
	GF_List *btn_over, *btn_not_over, *btn_active, *btn_not_active;

	/* </BIFS conversion state> */

	/* SVG conversion state */
	Bool print_stream_header;
	Bool print_frame_header;
	u32 frame_header_offset;
	char *svg_data;
	u32 svg_data_size;
	Bool svg_shape_started;
	/* end of SVG conversion state */

	/* MP4 user */
	void *user;
	GF_Err (*add_sample)(void *user, const char *data, u32 length, u64 timestamp, Bool isRap);
	GF_Err (*add_header)(void *user, const char *data, u32 length);
};


void swf_report(SWFReader *read, GF_Err e, char *format, ...);
SWFFont *swf_find_font(SWFReader *read, u32 fontID);
GF_Err swf_parse_sprite(SWFReader *read);
GF_Err swf_parse_tag(SWFReader *read);

GF_Err swf_to_bifs_init(SWFReader *read);
GF_Err swf_to_svg_init(SWFReader *read, u32 flags, Float angle);

SWFReader *gf_swf_reader_new(const char *path, const char *filename);
GF_Err gf_swf_read_header(SWFReader *read);
void gf_swf_reader_del(SWFReader *read);

GF_Err gf_swf_reader_set_user_mode(SWFReader *read, void *user,
                                   GF_Err (*add_sample)(void *user, const char *data, u32 length, u64 timestamp, Bool isRap),
                                   GF_Err (*add_header)(void *user, const char *data, u32 length));

typedef struct
{
	Fixed x, y;
	Fixed w, h;
} SWFRec;

typedef struct
{
	/*0: not defined, otherwise index of shape*/
	u32 nbType;
	/*0: moveTo, 1: lineTo, 2: quad curveTo*/
	u32 *types;
	SFVec2f *pts;
	u32 nbPts;
	/*used by SWF->BIFS for IndexedCurveSet*/
	u32 *idx;
} SWFPath;

typedef struct
{
	u32 type;
	u32 solid_col;
	u32 nbGrad;
	u32 *grad_col;
	u8 *grad_ratio;
	GF_Matrix2D mat;
	u32 img_id;
	Fixed width;

	SWFPath *path;
} SWFShapeRec;

struct SWFShape
{
	GF_List *fill_left, *fill_right, *lines;
	u32 ID;
	SWFRec rc;
};

/*SWF font object*/
struct SWFFont
{
	u32 fontID;
	u32 nbGlyphs;
	GF_List *glyphs;

	/*the following may all be overridden by a DefineFontInfo*/

	/*index -> glyph code*/
	u16 *glyph_codes;
	/*index -> glyph advance*/
	s16 *glyph_adv;

	/*font flags (SWF 3.0)*/
	Bool has_layout;
	Bool has_shiftJIS;
	Bool is_unicode, is_ansi;
	Bool is_bold, is_italic;
	s16 ascent, descent, leading;

	/*font familly*/
	char *fontName;
};

/*chunk of text with the same aspect (font, col)*/
typedef struct
{
	u32 fontID;
	u32 col;
	/*font size*/
	u32 fontSize;
	/*origin point in local metrics*/
	Fixed orig_x, orig_y;

	u32 nbGlyphs;
	u32 *indexes;
	Fixed *dx;
} SWFGlyphRec;

struct SWFText
{
	u32 ID;
	GF_Matrix2D mat;
	GF_List *text;
};

struct SWFEditText
{
	u32 ID;
	char *init_value;
	SWFRec bounds;
	Bool word_wrap, multiline, password, read_only, auto_size, no_select, html, outlines, has_layout, border;
	u32 color;
	Fixed max_length, font_height;
	u32 fontID;

	u32 align;
	Fixed left, right, indent, leading;
};


enum
{
	SWF_SND_UNCOMP = 0,
	SWF_SND_ADPCM,
	SWF_SND_MP3
};

struct SWFSound
{
	u32 ID;
	u8 format;
	/*0: 5.5k - 1: 11k - 2: 22k - 3: 44k*/
	u8 sound_rate;
	u8 bits_per_sample;
	Bool stereo;
	u16 sample_count;
	u32 frame_delay_ms;

	/*IO*/
	FILE *output;
	char *szFileName;

	/*set when sound is setup (OD inserted)*/
	Bool is_setup;
};

typedef struct
{
	/*interaction states*/
	Bool hitTest, down, over, up;
	u32 character_id;
	u16 depth;
	GF_Matrix2D mx;
	GF_ColorMatrix cmx;
	Bool skip;
} SWF_ButtonRecord;


struct SWF_Button
{
	u32 count;
	SWF_ButtonRecord buttons[40];
	u32 ID;
};

/*AS codes.*/
enum
{
	GF_SWF_AS3_GOTO_FRAME,
	GF_SWF_AS3_GET_URL,
	GF_SWF_AS3_NEXT_FRAME,
	GF_SWF_AS3_PREV_FRAME,
	GF_SWF_AS3_PLAY,
	GF_SWF_AS3_STOP,
	GF_SWF_AS3_TOGGLE_QUALITY,
	GF_SWF_AS3_STOP_SOUNDS,
	GF_SWF_AS3_WAIT_FOR_FRAME,
	GF_SWF_AS3_SET_TARGET,
	GF_SWF_AS3_GOTO_LABEL,
};

enum
{
	GF_SWF_COND_IDLE_TO_OVERDOWN = 1,
	GF_SWF_COND_OUTDOWN_TO_IDLE = 1<<1,
	GF_SWF_COND_OUTDOWN_TO_OVERDOWN = 1<<2,
	GF_SWF_COND_OVERDOWN_TO_OUTDOWN = 1<<3,
	GF_SWF_COND_OVERDOWN_TO_OUTUP = 1<<4,
	GF_SWF_COND_OVERUP_TO_OVERDOWN = 1<<5,
	GF_SWF_COND_OVERUP_TO_IDLE = 1<<6,
	GF_SWF_COND_IDLE_TO_OVERUP = 1<<7,
	GF_SWF_COND_OVERDOWN_TO_IDLE = 1<<8,
};

struct SWFAction
{
	u32 type;
	u32 frame_number;
	u32 button_mask, button_key;
	/*target (geturl/set_target), label (goto_frame)*/
	char *target;
	char *url;
};

#endif /*GPAC_DISABLE_SWF_IMPORT*/

#endif /*_GF_SWF_DEV_H_*/