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

Pekka Lampila medar at kemper.freedesktop.org
Thu Nov 15 12:46:26 PST 2007


 libswfdec/swfdec_sprite_movie.c  |    4 -
 test/trace/Makefile.am           |    3 +
 test/trace/totalframes.swf       |binary
 test/trace/totalframes.swf.trace |    4 +
 test/trace/totalframes.xml       |  103 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 112 insertions(+), 2 deletions(-)

New commits:
commit 7c377ba3852ca8c66e5d42bbdec7662ca9b7a4fd
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Thu Nov 15 22:46:09 2007 +0200

    Add a test for _totalframes and _framesloaded

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 1a9640a..ab451a6 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -2309,6 +2309,9 @@ EXTRA_DIST = \
 	tointeger-various-6.swf.trace \
 	tointeger-various-7.swf \
 	tointeger-various-7.swf.trace \
+	totalframes.xml \
+	totalframes.swf \
+	totalframes.swf.trace \
 	trace_properties.as \
 	transform.swf \
 	transform.swf.trace \
diff --git a/test/trace/totalframes.swf b/test/trace/totalframes.swf
new file mode 100644
index 0000000..aef7074
Binary files /dev/null and b/test/trace/totalframes.swf differ
diff --git a/test/trace/totalframes.swf.trace b/test/trace/totalframes.swf.trace
new file mode 100644
index 0000000..ebbeb81
--- /dev/null
+++ b/test/trace/totalframes.swf.trace
@@ -0,0 +1,4 @@
+5
+5
+0
+0
diff --git a/test/trace/totalframes.xml b/test/trace/totalframes.xml
new file mode 100644
index 0000000..d61009c
--- /dev/null
+++ b/test/trace/totalframes.xml
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<swf version="6" compressed="1">
+  <Header framerate="1" frames="1">
+    <size>
+      <Rectangle left="0" right="4000" top="0" bottom="3000"/>
+    </size>
+    <tags>
+      <DefineSprite objectID="1" frames="5">
+        <tags>
+          <ShowFrame/>
+          <ShowFrame/>
+          <ShowFrame/>
+          <ShowFrame/>
+          <ShowFrame/>
+          <End/>
+        </tags>
+      </DefineSprite>
+      <DefineSprite objectID="2" frames="0">
+        <tags>
+          <End/>
+        </tags>
+      </DefineSprite>
+      <PlaceObject2 replace="0" depth="1" objectID="1" name="test1"/>
+      <PlaceObject2 replace="0" depth="2" objectID="2" name="test2"/>
+      <DoAction>
+        <actions>
+          <Dictionary>
+            <strings>
+              <String value="test1"/>
+              <String value="test2"/>
+              <String value="_totalframes"/>
+              <String value="_framesloaded"/>
+              <String value="FSCommand:quit"/>
+              <String value=""/>
+            </strings>
+          </Dictionary>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="0"/>
+            </items>
+          </PushData>
+          <GetVariable/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="2"/>
+            </items>
+          </PushData>
+          <GetMember/>
+          <Trace/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="0"/>
+            </items>
+          </PushData>
+          <GetVariable/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="3"/>
+            </items>
+          </PushData>
+          <GetMember/>
+          <Trace/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="1"/>
+            </items>
+          </PushData>
+          <GetVariable/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="2"/>
+            </items>
+          </PushData>
+          <GetMember/>
+          <Trace/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="1"/>
+            </items>
+          </PushData>
+          <GetVariable/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="3"/>
+            </items>
+          </PushData>
+          <GetMember/>
+          <Trace/>
+          <PushData>
+            <items>
+              <StackDictionaryLookup index="4"/>
+              <StackDictionaryLookup index="5"/>
+            </items>
+          </PushData>
+          <GetURL2 method="64"/>
+          <EndAction/>
+        </actions>
+      </DoAction>
+      <ShowFrame/>
+      <End/>
+    </tags>
+  </Header>
+</swf>
commit b1a1801d468a9dfb5524c36b87b43d83cd871e81
Author: Pekka Lampila <pekka.lampila at iki.fi>
Date:   Thu Nov 15 22:42:59 2007 +0200

    Fix _totalframes and _framesloaded for movies without own resource

diff --git a/libswfdec/swfdec_sprite_movie.c b/libswfdec/swfdec_sprite_movie.c
index bc5768e..6ffdc67 100644
--- a/libswfdec/swfdec_sprite_movie.c
+++ b/libswfdec/swfdec_sprite_movie.c
@@ -845,7 +845,7 @@ swfdec_sprite_movie_get_frames_loaded (SwfdecSpriteMovie *movie)
 
   resource = swfdec_movie_get_own_resource (SWFDEC_MOVIE (movie));
   if (resource == NULL)
-    return 1;
+    return movie->n_frames;
   dec = resource->decoder;
   if (dec == NULL)
     return -1;
@@ -864,7 +864,7 @@ swfdec_sprite_movie_get_frames_total (SwfdecSpriteMovie *movie)
 
   resource = swfdec_movie_get_own_resource (SWFDEC_MOVIE (movie));
   if (resource == NULL)
-    return 1;
+    return movie->n_frames;
   dec = resource->decoder;
   if (dec == NULL)
     return 0;


More information about the Swfdec mailing list