Benjamin Otte
2007-Jun-15 14:02 UTC
[Swfdec] Branch 'as' - 5 commits - libswfdec/swfdec_as_native_function.c libswfdec/swfdec_edittext.c libswfdec/swfdec_edittext.h libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_image.c libswfdec/swfdec_image.h libswfdec/swfdec_morphshape.h libswfdec/swfdec_player.c libswfdec/swfdec_shape.c libswfdec/swfdec_shape.h libswfdec/swfdec_sound.c libswfdec/swfdec_sound.h libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite.h libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_swf_decoder.h libswfdec/swfdec_tag.c libswfdec/swfdec_text.h libswfdec/swfdec_video.c libswfdec/swfdec_video.h
libswfdec/swfdec_as_native_function.c | 10 ++-- libswfdec/swfdec_edittext.c | 2 libswfdec/swfdec_edittext.h | 3 - libswfdec/swfdec_font.c | 15 +++--- libswfdec/swfdec_font.h | 13 +++-- libswfdec/swfdec_image.c | 16 ++++--- libswfdec/swfdec_image.h | 12 ++--- libswfdec/swfdec_morphshape.h | 3 - libswfdec/swfdec_player.c | 1 libswfdec/swfdec_shape.c | 14 +----- libswfdec/swfdec_shape.h | 7 +-- libswfdec/swfdec_sound.c | 10 ++-- libswfdec/swfdec_sound.h | 10 ++-- libswfdec/swfdec_sprite.c | 27 +++--------- libswfdec/swfdec_sprite.h | 13 ++--- libswfdec/swfdec_swf_decoder.c | 4 - libswfdec/swfdec_swf_decoder.h | 4 - libswfdec/swfdec_tag.c | 76 +++++++++++----------------------- libswfdec/swfdec_text.h | 3 - libswfdec/swfdec_video.c | 4 - libswfdec/swfdec_video.h | 6 +- 21 files changed, 109 insertions(+), 144 deletions(-) New commits: diff-tree 9ff54695704fb4f628dcddd8ea5d834371cf89c7 (from 226d56f9c38e4cb568650c542e647ac943e1c47c) Author: Benjamin Otte <otte at gnome.org> Date: Fri Jun 15 16:03:23 2007 +0200 fix compile warning diff --git a/libswfdec/swfdec_player.c b/libswfdec/swfdec_player.c index a5d302c..10712be 100644 --- a/libswfdec/swfdec_player.c +++ b/libswfdec/swfdec_player.c @@ -22,6 +22,7 @@ #endif #include <math.h> +#include <string.h> #include <stdlib.h> #include <liboil/liboil.h> diff-tree 226d56f9c38e4cb568650c542e647ac943e1c47c (from parents) Merge: 13bb9bab9b039d85926978a48f2b41e9fcd93e03 34e26df3f9393189ebbc653664bb8f0ae8b48869 Author: Benjamin Otte <otte at gnome.org> Date: Fri Jun 15 15:53:45 2007 +0200 Merge branch 'as' of ssh://company at git.freedesktop.org/git/swfdec into as diff-tree 13bb9bab9b039d85926978a48f2b41e9fcd93e03 (from 50128dde7d95bb50bd8d46ef8c9cfc5e97b25908) Author: Benjamin Otte <otte at gnome.org> Date: Fri Jun 15 13:20:07 2007 +0200 pass the tag to the tag function This gets around the ned to use one-line functions that pass the right tag (see DefineText) and it prepares for the sprite handling rework. diff --git a/libswfdec/swfdec_edittext.c b/libswfdec/swfdec_edittext.c index 9d12274..ed641e8 100644 --- a/libswfdec/swfdec_edittext.c +++ b/libswfdec/swfdec_edittext.c @@ -83,7 +83,7 @@ swfdec_edit_text_init (SwfdecEditText * } int -tag_func_define_edit_text (SwfdecSwfDecoder * s) +tag_func_define_edit_text (SwfdecSwfDecoder * s, guint tag) { SwfdecEditText *text; guint id; diff --git a/libswfdec/swfdec_edittext.h b/libswfdec/swfdec_edittext.h index 0bf5c27..be38c4d 100644 --- a/libswfdec/swfdec_edittext.h +++ b/libswfdec/swfdec_edittext.h @@ -77,7 +77,8 @@ struct _SwfdecEditTextClass GType swfdec_edit_text_get_type (void); -int tag_func_define_edit_text (SwfdecSwfDecoder * s); +int tag_func_define_edit_text (SwfdecSwfDecoder * s, + guint tag); /* implemented in swfdec_html_parser.c */ SwfdecParagraph * swfdec_paragraph_html_parse (SwfdecEditText * text, diff --git a/libswfdec/swfdec_font.c b/libswfdec/swfdec_font.c index b3616dc..b7878a0 100644 --- a/libswfdec/swfdec_font.c +++ b/libswfdec/swfdec_font.c @@ -29,6 +29,7 @@ #include "swfdec_shape.h" #include "swfdec_stroke.h" #include "swfdec_swf_decoder.h" +#include "swfdec_tag.h" G_DEFINE_TYPE (SwfdecFont, swfdec_font, SWFDEC_TYPE_CHARACTER) @@ -124,7 +125,7 @@ convert_from_language (const char *s, Sw #endif int -tag_func_define_font_info (SwfdecSwfDecoder *s, guint version) +tag_func_define_font_info (SwfdecSwfDecoder *s, guint tag) { SwfdecFont *font; guint id, len, i; @@ -133,8 +134,6 @@ tag_func_define_font_info (SwfdecSwfDeco /* we just assume Latin1 (FIXME: option to change this?) */ SwfdecLanguage language = SWFDEC_LANGUAGE_LATIN; - g_assert (version == 1 || version == 2); - id = swfdec_bits_get_u16 (&s->b); font = swfdec_swf_decoder_get_character (s, id); if (!SWFDEC_IS_FONT (font)) { @@ -150,7 +149,7 @@ tag_func_define_font_info (SwfdecSwfDeco ansi = swfdec_bits_getbit (&s->b); if (jis != 0 || ansi != 0) { SWFDEC_LOG ("ansi = %d, jis = %d", ansi, jis); - if (version == 2) + if (tag == SWFDEC_TAG_DEFINEFONTINFO2) SWFDEC_INFO ("ANSI and JIS flags are supposed to be 0 in DefineFontInfo"); if (jis) language = SWFDEC_LANGUAGE_JAPANESE; @@ -158,7 +157,7 @@ tag_func_define_font_info (SwfdecSwfDeco font->italic = swfdec_bits_getbit (&s->b); font->bold = swfdec_bits_getbit (&s->b); wide = swfdec_bits_getbit (&s->b); - if (version > 1) + if (tag == SWFDEC_TAG_DEFINEFONTINFO2) language = swfdec_bits_get_u8 (&s->b); g_free (name); if (font->name) { @@ -205,7 +204,7 @@ swfdec_font_parse_shape (SwfdecSwfDecode } int -tag_func_define_font (SwfdecSwfDecoder * s) +tag_func_define_font (SwfdecSwfDecoder * s, guint tag) { guint i, id, n_glyphs, offset, next_offset; SwfdecFont *font; @@ -267,7 +266,7 @@ swfdec_font_parse_kerning_table (SwfdecS } int -tag_func_define_font_2 (SwfdecSwfDecoder * s) +tag_func_define_font_2 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; guint id; @@ -380,7 +379,7 @@ tag_func_define_font_2 (SwfdecSwfDecoder } int -tag_func_define_font_3 (SwfdecSwfDecoder * s) +tag_func_define_font_3 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits offsets, *bits = &s->b; SwfdecFont *font; diff --git a/libswfdec/swfdec_font.h b/libswfdec/swfdec_font.h index a14aa42..1ff7d46 100644 --- a/libswfdec/swfdec_font.h +++ b/libswfdec/swfdec_font.h @@ -74,13 +74,16 @@ struct _SwfdecFontClass GType swfdec_font_get_type (void); SwfdecShape * swfdec_font_get_glyph (SwfdecFont * font, - guint glyph); + guint glyph); int tag_func_define_font_info (SwfdecSwfDecoder * s, - guint version); -int tag_func_define_font (SwfdecSwfDecoder * s); -int tag_func_define_font_2 (SwfdecSwfDecoder * s); -int tag_func_define_font_3 (SwfdecSwfDecoder * s); + guint tag); +int tag_func_define_font (SwfdecSwfDecoder * s, + guint tag); +int tag_func_define_font_2 (SwfdecSwfDecoder * s, + guint tag); +int tag_func_define_font_3 (SwfdecSwfDecoder * s, + guint tag); G_END_DECLS #endif diff --git a/libswfdec/swfdec_image.c b/libswfdec/swfdec_image.c index 5a60681..075f771 100644 --- a/libswfdec/swfdec_image.c +++ b/libswfdec/swfdec_image.c @@ -90,19 +90,23 @@ swfdec_image_init (SwfdecImage * image) } int -swfdec_image_jpegtables (SwfdecSwfDecoder * s) +swfdec_image_jpegtables (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; SWFDEC_DEBUG ("swfdec_image_jpegtables"); + if (s->jpegtables) { + SWFDEC_FIXME ("duplicate DefineJPEGTables tag. Deleting first one"); + swfdec_buffer_unref (s->jpegtables); + } s->jpegtables = swfdec_bits_get_buffer (bits, -1); return SWFDEC_STATUS_OK; } int -tag_func_define_bits_jpeg (SwfdecSwfDecoder * s) +tag_func_define_bits_jpeg (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; int id; @@ -190,7 +194,7 @@ swfdec_image_jpeg_load (SwfdecImage *ima } int -tag_func_define_bits_jpeg_2 (SwfdecSwfDecoder * s) +tag_func_define_bits_jpeg_2 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; int id; @@ -229,7 +233,7 @@ swfdec_image_jpeg2_load (SwfdecImage *im } int -tag_func_define_bits_jpeg_3 (SwfdecSwfDecoder * s) +tag_func_define_bits_jpeg_3 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; guint id; @@ -463,7 +467,7 @@ swfdec_image_lossless_load (SwfdecImage } int -tag_func_define_bits_lossless (SwfdecSwfDecoder * s) +tag_func_define_bits_lossless (SwfdecSwfDecoder * s, guint tag) { SwfdecImage *image; int id; @@ -483,7 +487,7 @@ tag_func_define_bits_lossless (SwfdecSwf } int -tag_func_define_bits_lossless_2 (SwfdecSwfDecoder * s) +tag_func_define_bits_lossless_2 (SwfdecSwfDecoder * s, guint tag) { SwfdecImage *image; int id; diff --git a/libswfdec/swfdec_image.h b/libswfdec/swfdec_image.h index 3c1e71e..245c5ed 100644 --- a/libswfdec/swfdec_image.h +++ b/libswfdec/swfdec_image.h @@ -71,12 +71,12 @@ cairo_surface_t * swfdec_image_create_su (SwfdecImage * image, const SwfdecColorTransform *trans); -int swfdec_image_jpegtables (SwfdecSwfDecoder * s); -int tag_func_define_bits_jpeg (SwfdecSwfDecoder * s); -int tag_func_define_bits_jpeg_2 (SwfdecSwfDecoder * s); -int tag_func_define_bits_jpeg_3 (SwfdecSwfDecoder * s); -int tag_func_define_bits_lossless (SwfdecSwfDecoder * s); -int tag_func_define_bits_lossless_2 (SwfdecSwfDecoder * s); +int swfdec_image_jpegtables (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_bits_jpeg (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_bits_jpeg_2 (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_bits_jpeg_3 (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_bits_lossless (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_bits_lossless_2 (SwfdecSwfDecoder * s, guint tag); G_END_DECLS #endif diff --git a/libswfdec/swfdec_morphshape.h b/libswfdec/swfdec_morphshape.h index e09133c..de2b236 100644 --- a/libswfdec/swfdec_morphshape.h +++ b/libswfdec/swfdec_morphshape.h @@ -52,7 +52,8 @@ struct _SwfdecMorphShapeClass { GType swfdec_morph_shape_get_type (void); /* in swfdec_shape.c */ -int tag_define_morph_shape (SwfdecSwfDecoder * s); +int tag_define_morph_shape (SwfdecSwfDecoder * s, + guint tag); G_END_DECLS diff --git a/libswfdec/swfdec_shape.c b/libswfdec/swfdec_shape.c index 0e47cac..06705f0 100644 --- a/libswfdec/swfdec_shape.c +++ b/libswfdec/swfdec_shape.c @@ -353,7 +353,7 @@ swfdec_shape_add_styles (SwfdecSwfDecode } int -tag_define_shape (SwfdecSwfDecoder * s) +tag_define_shape (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; SwfdecShape *shape; @@ -377,7 +377,7 @@ tag_define_shape (SwfdecSwfDecoder * s) } int -tag_define_shape_3 (SwfdecSwfDecoder * s) +tag_define_shape_3 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; SwfdecShape *shape; @@ -398,13 +398,7 @@ tag_define_shape_3 (SwfdecSwfDecoder * s } int -tag_define_shape_2 (SwfdecSwfDecoder * s) -{ - return tag_define_shape (s); -} - -int -tag_define_shape_4 (SwfdecSwfDecoder *s) +tag_define_shape_4 (SwfdecSwfDecoder *s, guint tag) { SwfdecBits *bits = &s->b; SwfdecShape *shape; @@ -1020,7 +1014,7 @@ error: } int -tag_define_morph_shape (SwfdecSwfDecoder * s) +tag_define_morph_shape (SwfdecSwfDecoder * s, guint tag) { SwfdecBits end_bits; SwfdecBits *bits = &s->b; diff --git a/libswfdec/swfdec_shape.h b/libswfdec/swfdec_shape.h index d3d998d..1b062a1 100644 --- a/libswfdec/swfdec_shape.h +++ b/libswfdec/swfdec_shape.h @@ -76,10 +76,9 @@ struct _SwfdecShapeClass GType swfdec_shape_get_type (void); -int tag_define_shape (SwfdecSwfDecoder * s); -int tag_define_shape_2 (SwfdecSwfDecoder * s); -int tag_define_shape_3 (SwfdecSwfDecoder * s); -int tag_define_shape_4 (SwfdecSwfDecoder * s); +int tag_define_shape (SwfdecSwfDecoder * s, guint tag); +int tag_define_shape_3 (SwfdecSwfDecoder * s, guint tag); +int tag_define_shape_4 (SwfdecSwfDecoder * s, guint tag); void swfdec_shape_get_recs (SwfdecSwfDecoder * s, SwfdecShape * shape, SwfdecPatternFunc pattern_func, SwfdecStrokeFunc stroke_func); diff --git a/libswfdec/swfdec_sound.c b/libswfdec/swfdec_sound.c index dadd400..8c171a6 100644 --- a/libswfdec/swfdec_sound.c +++ b/libswfdec/swfdec_sound.c @@ -74,7 +74,7 @@ swfdec_sound_init (SwfdecSound * sound) } int -tag_func_sound_stream_block (SwfdecSwfDecoder * s) +tag_func_sound_stream_block (SwfdecSwfDecoder * s, guint tag) { SwfdecSound *sound; SwfdecBuffer *chunk; @@ -117,7 +117,7 @@ tag_func_sound_stream_block (SwfdecSwfDe } int -tag_func_define_sound (SwfdecSwfDecoder * s) +tag_func_define_sound (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *b = &s->b; int id; @@ -247,7 +247,7 @@ swfdec_sound_get_decoded (SwfdecSound *s } int -tag_func_sound_stream_head (SwfdecSwfDecoder * s) +tag_func_sound_stream_head (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *b = &s->b; int format; @@ -399,7 +399,7 @@ swfdec_sound_parse_chunk (SwfdecSwfDecod } int -tag_func_start_sound (SwfdecSwfDecoder * s) +tag_func_start_sound (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *b = &s->b; SwfdecSoundChunk *chunk; @@ -420,7 +420,7 @@ tag_func_start_sound (SwfdecSwfDecoder * } int -tag_func_define_button_sound (SwfdecSwfDecoder * s) +tag_func_define_button_sound (SwfdecSwfDecoder * s, guint tag) { guint i; guint id; diff --git a/libswfdec/swfdec_sound.h b/libswfdec/swfdec_sound.h index 118d37f..5f262f0 100644 --- a/libswfdec/swfdec_sound.h +++ b/libswfdec/swfdec_sound.h @@ -81,11 +81,11 @@ struct _SwfdecSoundClass GType swfdec_sound_get_type (void); -int tag_func_define_sound (SwfdecSwfDecoder * s); -int tag_func_sound_stream_block (SwfdecSwfDecoder * s); -int tag_func_sound_stream_head (SwfdecSwfDecoder * s); -int tag_func_start_sound (SwfdecSwfDecoder * s); -int tag_func_define_button_sound (SwfdecSwfDecoder * s); +int tag_func_define_sound (SwfdecSwfDecoder * s, guint tag); +int tag_func_sound_stream_block (SwfdecSwfDecoder * s, guint tag); +int tag_func_sound_stream_head (SwfdecSwfDecoder * s, guint tag); +int tag_func_start_sound (SwfdecSwfDecoder * s, guint tag); +int tag_func_define_button_sound (SwfdecSwfDecoder * s, guint tag); void swfdec_sound_render (SwfdecSound * sound, gint16 * dest, diff --git a/libswfdec/swfdec_sprite.c b/libswfdec/swfdec_sprite.c index cd678a9..de35c50 100644 --- a/libswfdec/swfdec_sprite.c +++ b/libswfdec/swfdec_sprite.c @@ -32,6 +32,7 @@ #include "swfdec_sound.h" #include "swfdec_sprite_movie.h" #include "swfdec_swf_decoder.h" +#include "swfdec_tag.h" G_DEFINE_TYPE (SwfdecSprite, swfdec_sprite, SWFDEC_TYPE_GRAPHIC) @@ -159,7 +160,7 @@ swfdec_get_clipeventflags (SwfdecSwfDeco } int -tag_show_frame (SwfdecSwfDecoder * s) +tag_show_frame (SwfdecSwfDecoder * s, guint tag) { SWFDEC_DEBUG("show_frame %d of id %d", s->parse_sprite->parse_frame, SWFDEC_CHARACTER (s->parse_sprite)->id); @@ -176,7 +177,7 @@ tag_show_frame (SwfdecSwfDecoder * s) } int -tag_func_set_background_color (SwfdecSwfDecoder * s) +tag_func_set_background_color (SwfdecSwfDecoder * s, guint tag) { SwfdecPlayer *player = SWFDEC_DECODER (s)->player; SwfdecColor color = swfdec_bits_get_color (&s->b); @@ -228,8 +229,8 @@ swfdec_sprite_convert_operator (guint op return CAIRO_OPERATOR_OVER; } -static int -swfdec_spriteseg_do_place_object (SwfdecSwfDecoder *s, unsigned int version) +int +swfdec_spriteseg_place_object (SwfdecSwfDecoder *s, guint tag) { SwfdecBits *bits = &s->b; int has_clip_actions; @@ -264,7 +265,7 @@ swfdec_spriteseg_do_place_object (Swfdec SWFDEC_LOG (" has_character = %d", has_character); SWFDEC_LOG (" move = %d", move); - if (version > 2) { + if (tag == SWFDEC_TAG_PLACEOBJECT3) { swfdec_bits_getbits (bits, 5); cache = swfdec_bits_getbit (bits); has_blend_mode = swfdec_bits_getbit (bits); @@ -390,19 +391,7 @@ swfdec_spriteseg_do_place_object (Swfdec } int -swfdec_spriteseg_place_object_2 (SwfdecSwfDecoder * s) -{ - return swfdec_spriteseg_do_place_object (s, 2); -} - -int -swfdec_spriteseg_place_object_3 (SwfdecSwfDecoder * s) -{ - return swfdec_spriteseg_do_place_object (s, 3); -} - -int -swfdec_spriteseg_remove_object (SwfdecSwfDecoder * s) +swfdec_spriteseg_remove_object (SwfdecSwfDecoder * s, guint tag) { int depth; @@ -416,7 +405,7 @@ swfdec_spriteseg_remove_object (SwfdecSw } int -swfdec_spriteseg_remove_object_2 (SwfdecSwfDecoder * s) +swfdec_spriteseg_remove_object_2 (SwfdecSwfDecoder * s, guint tag) { guint depth; diff --git a/libswfdec/swfdec_sprite.h b/libswfdec/swfdec_sprite.h index b9d62db..661be2b 100644 --- a/libswfdec/swfdec_sprite.h +++ b/libswfdec/swfdec_sprite.h @@ -85,7 +85,7 @@ struct _SwfdecSpriteClass GType swfdec_sprite_get_type (void); -int tag_func_define_sprite (SwfdecSwfDecoder * s); +int tag_func_define_sprite (SwfdecSwfDecoder * s, guint tag); void swfdec_sprite_add_sound_chunk (SwfdecSprite * sprite, guint frame, SwfdecBuffer * chunk, int skip, guint n_samples); void swfdec_sprite_set_n_frames (SwfdecSprite *sprite, guint n_frames, guint rate); @@ -98,12 +98,11 @@ int swfdec_sprite_get_frame (SwfdecSpr SwfdecContent *swfdec_content_new (int depth); void swfdec_content_free (SwfdecContent *content); -int tag_show_frame (SwfdecSwfDecoder * s); -int tag_func_set_background_color (SwfdecSwfDecoder * s); -int swfdec_spriteseg_place_object_2 (SwfdecSwfDecoder * s); -int swfdec_spriteseg_place_object_3 (SwfdecSwfDecoder * s); -int swfdec_spriteseg_remove_object (SwfdecSwfDecoder * s); -int swfdec_spriteseg_remove_object_2 (SwfdecSwfDecoder * s); +int tag_show_frame (SwfdecSwfDecoder * s, guint tag); +int tag_func_set_background_color (SwfdecSwfDecoder * s, guint tag); +int swfdec_spriteseg_place_object (SwfdecSwfDecoder * s, guint tag); +int swfdec_spriteseg_remove_object (SwfdecSwfDecoder * s, guint tag); +int swfdec_spriteseg_remove_object_2 (SwfdecSwfDecoder * s, guint tag); G_END_DECLS diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c index 33fb719..77a1f66 100644 --- a/libswfdec/swfdec_swf_decoder.c +++ b/libswfdec/swfdec_swf_decoder.c @@ -282,7 +282,7 @@ swfdec_swf_decoder_parse (SwfdecDecoder { guint header_length; guint x; - SwfdecTagFunc *func; + SwfdecTagFunc func; guint tag; guint tag_len; @@ -341,7 +341,7 @@ swfdec_swf_decoder_parse (SwfdecDecoder tag, swfdec_swf_decoder_get_tag_name (tag)); } else if (s->main_sprite->parse_frame < s->main_sprite->n_frames) { s->parse_sprite = s->main_sprite; - ret = func (s); + ret = func (s, tag); s->parse_sprite = NULL; swfdec_bits_syncbits (&s->b); diff --git a/libswfdec/swfdec_swf_decoder.h b/libswfdec/swfdec_swf_decoder.h index a913447..930d1e3 100644 --- a/libswfdec/swfdec_swf_decoder.h +++ b/libswfdec/swfdec_swf_decoder.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS //typedef struct _SwfdecSwfDecoder SwfdecSwfDecoder; typedef struct _SwfdecSwfDecoderClass SwfdecSwfDecoderClass; -typedef int SwfdecTagFunc (SwfdecSwfDecoder *); +typedef int (* SwfdecTagFunc) (SwfdecSwfDecoder *, guint); typedef struct _SwfdecRootExportData SwfdecRootExportData; typedef enum { @@ -98,7 +98,7 @@ void swfdec_swf_decoder_add_root_action SwfdecRootActionType type, gpointer data); -SwfdecTagFunc *swfdec_swf_decoder_get_tag_func (int tag); +SwfdecTagFunc swfdec_swf_decoder_get_tag_func (int tag); const char *swfdec_swf_decoder_get_tag_name (int tag); int swfdec_swf_decoder_get_tag_flag (int tag); diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c index 5d6a336..82a884d 100644 --- a/libswfdec/swfdec_tag.c +++ b/libswfdec/swfdec_tag.c @@ -47,13 +47,13 @@ #include "swfdec_video.h" int -tag_func_end (SwfdecSwfDecoder * s) +tag_func_end (SwfdecSwfDecoder * s, guint tag) { return SWFDEC_STATUS_OK; } int -tag_func_protect (SwfdecSwfDecoder * s) +tag_func_protect (SwfdecSwfDecoder * s, guint tag) { if (s->protection) { SWFDEC_INFO ("This file is really protected."); @@ -70,7 +70,7 @@ tag_func_protect (SwfdecSwfDecoder * s) } int -tag_func_frame_label (SwfdecSwfDecoder * s) +tag_func_frame_label (SwfdecSwfDecoder * s, guint tag) { SwfdecSpriteFrame *frame = &s->parse_sprite->frames[s->parse_sprite->parse_frame]; @@ -87,8 +87,8 @@ tag_func_frame_label (SwfdecSwfDecoder * /* text */ -static int -define_text (SwfdecSwfDecoder * s, int rgba) +int +tag_func_define_text (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; int id; @@ -150,10 +150,10 @@ define_text (SwfdecSwfDecoder * s, int r //printf(" font = %d\n",font); } if (has_color) { - if (rgba) { - glyph.color = swfdec_bits_get_rgba (bits); - } else { + if (tag == SWFDEC_TAG_DEFINETEXT) { glyph.color = swfdec_bits_get_color (bits); + } else { + glyph.color = swfdec_bits_get_rgba (bits); } //printf(" color = %08x\n",glyph.color); } @@ -175,21 +175,7 @@ define_text (SwfdecSwfDecoder * s, int r } int -tag_func_define_text (SwfdecSwfDecoder * s) -{ - return define_text (s, 0); -} - -int -tag_func_define_text_2 (SwfdecSwfDecoder * s) -{ - return define_text (s, 1); -} - - - -int -tag_func_define_sprite (SwfdecSwfDecoder * s) +tag_func_define_sprite (SwfdecSwfDecoder * s, guint define_sprite_tag) { SwfdecBits parse; int id; @@ -212,7 +198,7 @@ tag_func_define_sprite (SwfdecSwfDecoder while (swfdec_bits_left (&parse)) { int x; guint tag_len; - SwfdecTagFunc *func; + SwfdecTagFunc func; x = swfdec_bits_get_u16 (&parse); tag = (x >> 6) & 0x3ff; @@ -240,7 +226,7 @@ tag_func_define_sprite (SwfdecSwfDecoder SWFDEC_ERROR ("invalid tag %d %s during DefineSprite", tag, swfdec_swf_decoder_get_tag_name (tag)); } else if (s->parse_sprite->parse_frame < s->parse_sprite->n_frames) { - ret = func (s); + ret = func (s, tag); if (swfdec_bits_left (&s->b)) { SWFDEC_WARNING ("early parse finish (%d bytes)", @@ -267,7 +253,7 @@ tag_func_define_sprite (SwfdecSwfDecoder } int -tag_func_do_action (SwfdecSwfDecoder * s) +tag_func_do_action (SwfdecSwfDecoder * s, guint tag) { SwfdecScript *script; char *name; @@ -354,7 +340,7 @@ swfdec_button_append_content (SwfdecButt } int -tag_func_define_button_2 (SwfdecSwfDecoder * s) +tag_func_define_button_2 (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; int id; @@ -442,7 +428,7 @@ tag_func_define_button_2 (SwfdecSwfDecod } int -tag_func_define_button (SwfdecSwfDecoder * s) +tag_func_define_button (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; int id; @@ -505,19 +491,7 @@ tag_func_define_button (SwfdecSwfDecoder } static int -tag_func_define_font_info_1 (SwfdecSwfDecoder *s) -{ - return tag_func_define_font_info (s, 1); -} - -static int -tag_func_define_font_info_2 (SwfdecSwfDecoder *s) -{ - return tag_func_define_font_info (s, 2); -} - -static int -tag_func_file_attributes (SwfdecSwfDecoder *s) +tag_func_file_attributes (SwfdecSwfDecoder *s, guint tag) { int has_metadata, use_network; @@ -535,7 +509,7 @@ tag_func_file_attributes (SwfdecSwfDecod } int -tag_func_export_assets (SwfdecSwfDecoder * s) +tag_func_export_assets (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; guint count, i; @@ -568,7 +542,7 @@ tag_func_export_assets (SwfdecSwfDecoder } int -tag_func_do_init_action (SwfdecSwfDecoder * s) +tag_func_do_init_action (SwfdecSwfDecoder * s, guint tag) { SwfdecBits *bits = &s->b; guint id; @@ -603,7 +577,7 @@ tag_func_do_init_action (SwfdecSwfDecode struct tag_func_struct { char *name; - int (*func) (SwfdecSwfDecoder * s); + SwfdecTagFunc func; int flag; }; static struct tag_func_struct tag_funcs[] = { @@ -621,7 +595,7 @@ static struct tag_func_struct tag_funcs[ [SWFDEC_TAG_DEFINEFONT] = {"DefineFont", tag_func_define_font, 0}, [SWFDEC_TAG_DEFINETEXT] = {"DefineText", tag_func_define_text, 0}, [SWFDEC_TAG_DOACTION] = {"DoAction", tag_func_do_action, SPRITE}, - [SWFDEC_TAG_DEFINEFONTINFO] = {"DefineFontInfo", tag_func_define_font_info_1, 0}, + [SWFDEC_TAG_DEFINEFONTINFO] = {"DefineFontInfo", tag_func_define_font_info, 0}, [SWFDEC_TAG_DEFINESOUND] = {"DefineSound", tag_func_define_sound, 0}, [SWFDEC_TAG_STARTSOUND] = {"StartSound", tag_func_start_sound, SPRITE}, [SWFDEC_TAG_DEFINEBUTTONSOUND] @@ -631,13 +605,13 @@ static struct tag_func_struct tag_funcs[ [SWFDEC_TAG_DEFINEBITSLOSSLESS] {"DefineBitsLossless", tag_func_define_bits_lossless, 0}, [SWFDEC_TAG_DEFINEBITSJPEG2] = {"DefineBitsJPEG2", tag_func_define_bits_jpeg_2, 0}, - [SWFDEC_TAG_DEFINESHAPE2] = {"DefineShape2", tag_define_shape_2, 0}, + [SWFDEC_TAG_DEFINESHAPE2] = {"DefineShape2", tag_define_shape, 0}, [SWFDEC_TAG_DEFINEBUTTONCXFORM] = {"DefineButtonCXForm", NULL, 0}, [SWFDEC_TAG_PROTECT] = {"Protect", tag_func_protect, 0}, - [SWFDEC_TAG_PLACEOBJECT2] = {"PlaceObject2", swfdec_spriteseg_place_object_2, SPRITE}, + [SWFDEC_TAG_PLACEOBJECT2] = {"PlaceObject2", swfdec_spriteseg_place_object, SPRITE}, [SWFDEC_TAG_REMOVEOBJECT2] = {"RemoveObject2", swfdec_spriteseg_remove_object_2, SPRITE}, [SWFDEC_TAG_DEFINESHAPE3] = {"DefineShape3", tag_define_shape_3, 0}, - [SWFDEC_TAG_DEFINETEXT2] = {"DefineText2", tag_func_define_text_2, 0}, + [SWFDEC_TAG_DEFINETEXT2] = {"DefineText2", tag_func_define_text, 0}, [SWFDEC_TAG_DEFINEBUTTON2] = {"DefineButton2", tag_func_define_button_2, 0}, [SWFDEC_TAG_DEFINEBITSJPEG3] = {"DefineBitsJPEG3", tag_func_define_bits_jpeg_3, 0}, [SWFDEC_TAG_DEFINEBITSLOSSLESS2] @@ -662,13 +636,13 @@ static struct tag_func_struct tag_funcs[ [SWFDEC_TAG_DOINITACTION] = {"DoInitAction", tag_func_do_init_action, SPRITE}, [SWFDEC_TAG_DEFINEVIDEOSTREAM] = {"DefineVideoStream", tag_func_define_video, 0}, [SWFDEC_TAG_VIDEOFRAME] = {"VideoFrame", tag_func_video_frame, 0}, - [SWFDEC_TAG_DEFINEFONTINFO2] = {"DefineFontInfo2", tag_func_define_font_info_2, 0}, + [SWFDEC_TAG_DEFINEFONTINFO2] = {"DefineFontInfo2", tag_func_define_font_info, 0}, [SWFDEC_TAG_MX4] = {"MX4", NULL, 0}, [SWFDEC_TAG_ENABLEDEBUGGER2] = {"EnableDebugger2", NULL, 0}, [SWFDEC_TAG_SCRIPTLIMITS] = {"ScriptLimits", NULL, 0}, [SWFDEC_TAG_SETTABINDEX] = {"SetTabIndex", NULL, 0}, [SWFDEC_TAG_FILEATTRIBUTES] = {"FileAttributes", tag_func_file_attributes, 0}, - [SWFDEC_TAG_PLACEOBJECT3] = {"PlaceObject3", swfdec_spriteseg_place_object_3, SPRITE}, + [SWFDEC_TAG_PLACEOBJECT3] = {"PlaceObject3", swfdec_spriteseg_place_object, SPRITE}, [SWFDEC_TAG_IMPORTASSETS2] = {"ImportAssets2", NULL, 0}, [SWFDEC_TAG_DEFINEFONTALIGNZONES] = {"DefineFontAlignZones", NULL, 0}, [SWFDEC_TAG_CSMTEXTSETTINGS] = {"CSMTextSettings", NULL, 0}, @@ -695,7 +669,7 @@ swfdec_swf_decoder_get_tag_name (int tag return "unknown"; } -SwfdecTagFunc * +SwfdecTagFunc swfdec_swf_decoder_get_tag_func (int tag) { if (tag >= 0 && tag < n_tag_funcs) { diff --git a/libswfdec/swfdec_text.h b/libswfdec/swfdec_text.h index 3e8a7db..37d0312 100644 --- a/libswfdec/swfdec_text.h +++ b/libswfdec/swfdec_text.h @@ -61,8 +61,7 @@ struct _SwfdecTextClass { GType swfdec_text_get_type (void); -int tag_func_define_text (SwfdecSwfDecoder * s); -int tag_func_define_text_2 (SwfdecSwfDecoder * s); +int tag_func_define_text (SwfdecSwfDecoder * s, guint tag); G_END_DECLS diff --git a/libswfdec/swfdec_video.c b/libswfdec/swfdec_video.c index be3f6bf..7caaeca 100644 --- a/libswfdec/swfdec_video.c +++ b/libswfdec/swfdec_video.c @@ -177,7 +177,7 @@ swfdec_video_init (SwfdecVideo * video) } int -tag_func_define_video (SwfdecSwfDecoder *s) +tag_func_define_video (SwfdecSwfDecoder *s, guint tag) { SwfdecVideo *video; guint id; @@ -205,7 +205,7 @@ tag_func_define_video (SwfdecSwfDecoder } int -tag_func_video_frame (SwfdecSwfDecoder *s) +tag_func_video_frame (SwfdecSwfDecoder *s, guint unused_tag) { SwfdecVideo *video; guint id; diff --git a/libswfdec/swfdec_video.h b/libswfdec/swfdec_video.h index a64065b..43f15ce 100644 --- a/libswfdec/swfdec_video.h +++ b/libswfdec/swfdec_video.h @@ -51,8 +51,10 @@ struct _SwfdecVideoClass { GType swfdec_video_get_type (void); -int tag_func_define_video (SwfdecSwfDecoder * s); -int tag_func_video_frame (SwfdecSwfDecoder * s); +int tag_func_define_video (SwfdecSwfDecoder * s, + guint tag); +int tag_func_video_frame (SwfdecSwfDecoder * s, + guint tag); G_END_DECLS diff-tree 50128dde7d95bb50bd8d46ef8c9cfc5e97b25908 (from parents) Merge: 622ee9f1b3827bb3a73d33e4df5ccb26e8d504a7 228be8a9445d25e41ecd7a09102c85609ec81ad7 Author: Benjamin Otte <otte at gnome.org> Date: Thu Jun 14 18:48:55 2007 +0200 Merge branch 'as' of ssh://company at git.freedesktop.org/git/swfdec into as diff-tree 622ee9f1b3827bb3a73d33e4df5ccb26e8d504a7 (from bc7113af3746577aab5a3fd69e30394070d3517c) Author: Benjamin Otte <otte at gnome.org> Date: Thu Jun 14 18:48:42 2007 +0200 fix gtk-doc syntax diff --git a/libswfdec/swfdec_as_native_function.c b/libswfdec/swfdec_as_native_function.c index f6a5d64..0905178 100644 --- a/libswfdec/swfdec_as_native_function.c +++ b/libswfdec/swfdec_as_native_function.c @@ -31,11 +31,11 @@ /** * SwfdecAsNative: - * context: #SwfdecAsContext - * thisp: the this object. <warning>Can be %NULL.</warning> - * argc: number of arguments passed to this function - * argv: the @argc arguments passed to this function - * retval: set to the return value. Initialized to undefined by default + * @context: #SwfdecAsContext + * @thisp: the this object. <warning>Can be %NULL.</warning> + * @argc: number of arguments passed to this function + * @argv: the @argc arguments passed to this function + * @retval: set to the return value. Initialized to undefined by default * * This is the prototype for all native functions. */
Possibly Parallel Threads
- 15 commits - libswfdec/jpeg libswfdec/swfdec_bits.c libswfdec/swfdec_edittext.c libswfdec/swfdec_font.c libswfdec/swfdec_image.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c libswfdec/swfdec_shape.c libswfdec/swfdec_sprite.c
- Branch 'as' - 17 commits - libswfdec/jpeg libswfdec/swfdec_bits.c libswfdec/swfdec_font.c libswfdec/swfdec_image.c libswfdec/swfdec_root_sprite.c libswfdec/swfdec_script.c libswfdec/swfdec_shape.c libswfdec/swfdec_sound.c libswfdec/swfdec_sprite.c
- libswfdec-gtk/swfdec_playback_alsa.c libswfdec/swfdec_audio_event.h libswfdec/swfdec_audio_flv.h libswfdec/swfdec_audio_stream.h libswfdec/swfdec_bits.c libswfdec/swfdec_bits.h libswfdec/swfdec_buffer.c libswfdec/swfdec_buffer.h libswfdec/swfdec_cache.c
- Branch 'as' - 9 commits - libswfdec-gtk/swfdec_playback_alsa.c libswfdec/js libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_context.h libswfdec/swfdec_as_frame.c libswfdec/swfdec_as_frame.h libswfdec/swfdec_as_function.c
- 8 commits - libswfdec/swfdec_bits.h libswfdec/swfdec_font.c libswfdec/swfdec_font.h libswfdec/swfdec_loader.c libswfdec/swfdec_loader_internal.h libswfdec/swfdec_tag.c libswfdec/swfdec_text.c libswfdec/swfdec_text.h test/swfedit_token.c test/various