[Swfdec] 2 commits - libswfdec/swfdec_script.c libswfdec/swfdec_sprite.c libswfdec/swfdec_sprite_movie.c

Benjamin Otte company at kemper.freedesktop.org
Sat Apr 28 06:16:11 PDT 2007


 libswfdec/swfdec_script.c       |    4 ++--
 libswfdec/swfdec_sprite.c       |    7 ++++---
 libswfdec/swfdec_sprite_movie.c |    5 +++++
 3 files changed, 11 insertions(+), 5 deletions(-)

New commits:
diff-tree 158cee244eb9faa5c818d41b3e06a20bfbd0cbce (from 562832e0adf9dfdddb9b44c6191d9086a35c6478)
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Apr 28 15:16:53 2007 +0200

    WaitForFrame(2) is 1-indexed

diff --git a/libswfdec/swfdec_script.c b/libswfdec/swfdec_script.c
index 7cba6cf..a1ed9db 100644
--- a/libswfdec/swfdec_script.c
+++ b/libswfdec/swfdec_script.c
@@ -507,7 +507,7 @@ swfdec_action_wait_for_frame2 (JSContext
     } else {
       loaded = movie->n_frames;
     }
-    if (loaded < (guint) frame)
+    if (loaded <= (guint) frame)
       swfdec_script_skip_actions (cx, jump);
   } else {
     SWFDEC_ERROR ("no movie to WaitForFrame2 on");
@@ -539,7 +539,7 @@ swfdec_action_wait_for_frame (JSContext 
   } else {
     loaded = movie->n_frames;
   }
-  if (loaded < frame)
+  if (loaded <= frame)
     swfdec_script_skip_actions (cx, jump);
   return JS_TRUE;
 }
diff-tree 562832e0adf9dfdddb9b44c6191d9086a35c6478 (from e58f25683ddec3dd4e613d7a7b4d5ab58a27561c)
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Apr 28 15:16:29 2007 +0200

    handle gotos to not-yet loaded frames correctly

diff --git a/libswfdec/swfdec_sprite.c b/libswfdec/swfdec_sprite.c
index 19c1442..0bcb496 100644
--- a/libswfdec/swfdec_sprite.c
+++ b/libswfdec/swfdec_sprite.c
@@ -574,14 +574,15 @@ swfdec_sprite_set_n_frames (SwfdecSprite
 guint
 swfdec_sprite_get_next_frame (SwfdecSprite *sprite, guint current_frame)
 {
-  guint next_frame, n_frames;
+  guint next_frame;
 
   g_return_val_if_fail (SWFDEC_IS_SPRITE (sprite), 0);
 
-  n_frames = MIN (sprite->n_frames, sprite->parse_frame);
   next_frame = current_frame + 1;
-  if (next_frame >= n_frames)
+  if (next_frame >= sprite->n_frames)
     next_frame = 0;
+  if (next_frame >= sprite->parse_frame)
+    next_frame = current_frame;
   return next_frame;
 }
 
diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index 81ad295..d65d49a 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -165,6 +165,11 @@ swfdec_sprite_movie_goto (SwfdecMovie *m
   guint i, j, start;
 
   g_assert (goto_frame < mov->n_frames);
+  if (goto_frame >= movie->sprite->parse_frame) {
+    SWFDEC_WARNING ("jumping to not-yet-loaded frame %u (loaded: %u)",
+	goto_frame, movie->sprite->parse_frame);
+    return;
+  }
 
   if (mov->will_be_removed)
     return;


More information about the Swfdec mailing list