[Swfdec] 4 commits - doc/Makefile.am libswfdec/swfdec_script.c libswfdec/swfdec_swf_decoder.c libswfdec/swfdec_tag.c

Benjamin Otte company at kemper.freedesktop.org
Thu Apr 26 13:50:58 PDT 2007


 doc/Makefile.am                |    4 +++-
 libswfdec/swfdec_script.c      |   10 +++++++---
 libswfdec/swfdec_swf_decoder.c |    7 +++----
 libswfdec/swfdec_tag.c         |   11 +++++++----
 4 files changed, 20 insertions(+), 12 deletions(-)

New commits:
diff-tree c210a2353bf2cf8a8596b5aa093998570828f014 (from 49526e285454382685069cbace8a57dff8276e26)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 26 22:51:29 2007 +0200

    allow creating empty scripts

diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index d675207..7cba6cf 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -2751,12 +2751,16 @@ swfdec_script_new (SwfdecBits *bits, con
    * DefineFunction and friends override this */
   script->flags = SWFDEC_SCRIPT_SUPPRESS_ARGS;
 
-  if (!swfdec_script_foreach_internal (bits, validate_action, script) ||
-      (len -= swfdec_bits_left (bits) / 8) == 0) {
+  if (!swfdec_script_foreach_internal (bits, validate_action, script)) {
     swfdec_script_unref (script);
     return NULL;
   }
-  script->buffer = swfdec_bits_get_buffer (&org, len);
+  len -= swfdec_bits_left (bits) / 8;
+  if (len == 0) {
+    script->buffer = swfdec_buffer_new ();
+  } else {
+    script->buffer = swfdec_bits_get_buffer (&org, len);
+  }
   return script;
 }
 
diff-tree 49526e285454382685069cbace8a57dff8276e26 (from 655c749e407c64922ff2babb679a367a04aa3777)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 26 22:49:47 2007 +0200

    parse the closing tag

diff --git a/libswfdec/swfdec_swf_decoder.c b/libswfdec/swfdec_swf_decoder.c
index 6c13e70..7802663 100644
--- a/libswfdec/swfdec_swf_decoder.c
+++ b/libswfdec/swfdec_swf_decoder.c
@@ -298,7 +298,9 @@ swfdec_swf_decoder_parse (SwfdecDecoder 
 	buffer = NULL;
       swfdec_bits_init (&s->b, buffer);
       func = swfdec_swf_decoder_get_tag_func (tag);
-      if (func == NULL) {
+      if (tag == 0) {
+	s->state = SWFDEC_STATE_EOF;
+      } else if (func == NULL) {
 	SWFDEC_WARNING ("tag function not implemented for %d %s",
 	    tag, swfdec_swf_decoder_get_tag_name (tag));
       } else if (s->main_sprite->parse_frame < s->main_sprite->n_frames) {
@@ -319,9 +321,6 @@ swfdec_swf_decoder_parse (SwfdecDecoder 
 	SWFDEC_ERROR ("data after last frame");
       }
 
-      if (tag == 0) {
-	s->state = SWFDEC_STATE_EOF;
-      }
 
       if (buffer)
 	swfdec_buffer_unref (buffer);
diff-tree 655c749e407c64922ff2babb679a367a04aa3777 (from 8ea005547ad53d429a8ff76f3ff7ad188cc75db8)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 26 22:49:36 2007 +0200

    parse the closing tag

diff --git a/libswfdec/swfdec_tag.c b/libswfdec/swfdec_tag.c
index 74c5083..c613769 100644
--- a/libswfdec/swfdec_tag.c
+++ b/libswfdec/swfdec_tag.c
@@ -209,7 +209,7 @@ tag_func_define_sprite (SwfdecSwfDecoder
   swfdec_sprite_set_n_frames (sprite, swfdec_bits_get_u16 (&parse), SWFDEC_DECODER (s)->rate);
 
   s->parse_sprite = sprite;
-  while (tag != 0 && s->parse_sprite->parse_frame < s->parse_sprite->n_frames) {
+  while (swfdec_bits_left (&parse)) {
     int x;
     guint tag_len;
     SwfdecTagFunc *func;
@@ -231,21 +231,24 @@ tag_func_define_sprite (SwfdecSwfDecoder
     }
 
     func = swfdec_swf_decoder_get_tag_func (tag);
-    if (func == NULL) {
+    if (tag == 0) {
+      break;
+    } else if (func == NULL) {
       SWFDEC_WARNING ("tag function not implemented for %d %s",
           tag, swfdec_swf_decoder_get_tag_name (tag));
     } else if ((swfdec_swf_decoder_get_tag_flag (tag) & 1) == 0) {
       SWFDEC_ERROR ("invalid tag %d %s during DefineSprite",
           tag, swfdec_swf_decoder_get_tag_name (tag));
-    } else {
+    } else if (s->parse_sprite->parse_frame < s->parse_sprite->n_frames) {
       ret = func (s);
 
       if (swfdec_bits_left (&s->b)) {
         SWFDEC_WARNING ("early parse finish (%d bytes)", 
 	    swfdec_bits_left (&s->b) / 8);
       }
+    } else {
+      SWFDEC_ERROR ("data after last frame");
     }
-
   }
 
   s->b = parse;
diff-tree 8ea005547ad53d429a8ff76f3ff7ad188cc75db8 (from d9885a97992dbc5f868f6c23075683e518b64dc8)
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Apr 26 21:25:03 2007 +0200

    add missing headers

diff --git a/doc/Makefile.am b/doc/Makefile.am
index 558d819..5ce6db0 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -65,7 +65,8 @@ IGNORE_HFILES= \
 	swfdec_cache.h \
 	swfdec_cached.h \
 	swfdec_character.h \
-	swfdec_codec.h \
+	swfdec_codec_audio.h \
+	swfdec_codec_video.h \
 	swfdec_color.h \
 	swfdec_connection.h \
 	swfdec_debug.h \
@@ -100,6 +101,7 @@ IGNORE_HFILES= \
 	swfdec_sound.h \
 	swfdec_sprite.h \
 	swfdec_sprite_movie.h \
+	swfdec_stroke.h \
 	swfdec_swf_decoder.h \
 	swfdec_tag.h \
 	swfdec_text.h \


More information about the Swfdec mailing list