[Swfdec] 2 commits - libswfdec/swfdec_sprite_movie.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Thu Nov 29 01:36:45 PST 2007


 libswfdec/swfdec_sprite_movie.c                |   18 ++++++++++++++----
 test/trace/Makefile.am                         |    9 +++++++++
 test/trace/emptymovie-frames-bytes-5.swf       |binary
 test/trace/emptymovie-frames-bytes-5.swf.trace |    4 ++++
 test/trace/emptymovie-frames-bytes-6.swf       |binary
 test/trace/emptymovie-frames-bytes-6.swf.trace |    4 ++++
 test/trace/emptymovie-frames-bytes-7.swf       |binary
 test/trace/emptymovie-frames-bytes-7.swf.trace |    4 ++++
 test/trace/emptymovie-frames-bytes-8.swf       |binary
 test/trace/emptymovie-frames-bytes-8.swf.trace |    4 ++++
 test/trace/emptymovie-frames-bytes.as          |    9 +++++++++
 11 files changed, 48 insertions(+), 4 deletions(-)

New commits:
commit 248a6ed57bfcc7942cdb6a3ee1578bf518cf78bb
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 29 10:32:50 2007 +0100

    add test for frames and bytes properties of empty movies

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 1a40a31..36360e2 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -804,6 +804,15 @@ EXTRA_DIST = \
 	empty-stack.as \
 	empty-stack.swf \
 	empty-stack.swf.trace \
+	emptymovie-frames-bytes-5.swf \
+	emptymovie-frames-bytes-5.swf.trace \
+	emptymovie-frames-bytes-6.swf \
+	emptymovie-frames-bytes-6.swf.trace \
+	emptymovie-frames-bytes-7.swf \
+	emptymovie-frames-bytes-7.swf.trace \
+	emptymovie-frames-bytes-8.swf \
+	emptymovie-frames-bytes-8.swf.trace \
+	emptymovie-frames-bytes.as \
 	enumerate.as \
 	enumerate2-5.swf \
 	enumerate2-5.swf.trace \
diff --git a/test/trace/emptymovie-frames-bytes-5.swf b/test/trace/emptymovie-frames-bytes-5.swf
new file mode 100644
index 0000000..8c30119
Binary files /dev/null and b/test/trace/emptymovie-frames-bytes-5.swf differ
diff --git a/test/trace/emptymovie-frames-bytes-5.swf.trace b/test/trace/emptymovie-frames-bytes-5.swf.trace
new file mode 100644
index 0000000..fefcb76
--- /dev/null
+++ b/test/trace/emptymovie-frames-bytes-5.swf.trace
@@ -0,0 +1,4 @@
+undefined
+undefined
+undefined
+undefined
diff --git a/test/trace/emptymovie-frames-bytes-6.swf b/test/trace/emptymovie-frames-bytes-6.swf
new file mode 100644
index 0000000..9bc1c2d
Binary files /dev/null and b/test/trace/emptymovie-frames-bytes-6.swf differ
diff --git a/test/trace/emptymovie-frames-bytes-6.swf.trace b/test/trace/emptymovie-frames-bytes-6.swf.trace
new file mode 100644
index 0000000..d9ff83f
--- /dev/null
+++ b/test/trace/emptymovie-frames-bytes-6.swf.trace
@@ -0,0 +1,4 @@
+1
+1
+0
+0
diff --git a/test/trace/emptymovie-frames-bytes-7.swf b/test/trace/emptymovie-frames-bytes-7.swf
new file mode 100644
index 0000000..d54c0f4
Binary files /dev/null and b/test/trace/emptymovie-frames-bytes-7.swf differ
diff --git a/test/trace/emptymovie-frames-bytes-7.swf.trace b/test/trace/emptymovie-frames-bytes-7.swf.trace
new file mode 100644
index 0000000..d9ff83f
--- /dev/null
+++ b/test/trace/emptymovie-frames-bytes-7.swf.trace
@@ -0,0 +1,4 @@
+1
+1
+0
+0
diff --git a/test/trace/emptymovie-frames-bytes-8.swf b/test/trace/emptymovie-frames-bytes-8.swf
new file mode 100644
index 0000000..a46bb22
Binary files /dev/null and b/test/trace/emptymovie-frames-bytes-8.swf differ
diff --git a/test/trace/emptymovie-frames-bytes-8.swf.trace b/test/trace/emptymovie-frames-bytes-8.swf.trace
new file mode 100644
index 0000000..d9ff83f
--- /dev/null
+++ b/test/trace/emptymovie-frames-bytes-8.swf.trace
@@ -0,0 +1,4 @@
+1
+1
+0
+0
diff --git a/test/trace/emptymovie-frames-bytes.as b/test/trace/emptymovie-frames-bytes.as
new file mode 100644
index 0000000..2e25a0e
--- /dev/null
+++ b/test/trace/emptymovie-frames-bytes.as
@@ -0,0 +1,9 @@
+// makeswf -v 7 -s 200x150 -r 1 -o movie23.swf movie23.as
+
+createEmptyMovieClip ("a", 0);
+trace (a._framesloaded);
+trace (a._totalframes);
+trace (a.getBytesLoaded());
+trace (a.getBytesTotal());
+
+loadMovie ("fscommand:quit", "");
commit 7ab01fd3f9d44f2fe9d020c023d6cf92e011f85b
Author: Benjamin Otte <otte at gnome.org>
Date:   Thu Nov 29 10:31:43 2007 +0100

    empty movieclips have 1 frame, not 0

diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index 15d6af3..1626ede 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -842,8 +842,13 @@ swfdec_sprite_movie_get_frames_loaded (SwfdecSpriteMovie *movie)
   g_return_val_if_fail (SWFDEC_IS_SPRITE_MOVIE (movie), 0);
 
   resource = swfdec_movie_get_own_resource (SWFDEC_MOVIE (movie));
-  if (resource == NULL)
-    return movie->n_frames;
+  if (resource == NULL) {
+    /* FIXME: can we set n_frames to 1 for movies without sprites instead? */
+    if (movie->sprite)
+      return movie->n_frames;
+    else
+      return 1;
+  }
   dec = resource->decoder;
   if (dec == NULL)
     return -1;
@@ -861,8 +866,13 @@ swfdec_sprite_movie_get_frames_total (SwfdecSpriteMovie *movie)
   g_return_val_if_fail (SWFDEC_IS_SPRITE_MOVIE (movie), 0);
 
   resource = swfdec_movie_get_own_resource (SWFDEC_MOVIE (movie));
-  if (resource == NULL)
-    return movie->n_frames;
+  if (resource == NULL) {
+    /* FIXME: can we set n_frames to 1 for movies without sprites instead? */
+    if (movie->sprite)
+      return movie->n_frames;
+    else
+      return 1;
+  }
   dec = resource->decoder;
   if (dec == NULL)
     return 0;


More information about the Swfdec mailing list