[Swfdec] 5 commits - libswfdec/swfdec_as_object.c NEWS player/swfplay.c

Benjamin Otte company at kemper.freedesktop.org
Wed Aug 22 04:38:32 PDT 2007


 NEWS                         |    2 +-
 libswfdec/swfdec_as_object.c |   10 ++++------
 player/swfplay.c             |   29 +++++++++++++++++++++--------
 3 files changed, 26 insertions(+), 15 deletions(-)

New commits:
diff-tree c5efffeed0afc0e64f4d01a4323c9137189bf41f (from parents)
Merge: 36bd9448b3825d1db38969f18139a7c085be820f d0a5d682d6cac81945ea8e2494f4826ececb37ec
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 13:38:25 2007 +0200

    Merge branch 'master' of ssh://company@git.freedesktop.org/git/swfdec/swfdec

diff-tree 36bd9448b3825d1db38969f18139a7c085be820f (from 6f3db89d5b461a706c484b2e9da091b357d1fff0)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 13:38:05 2007 +0200

    add support for player scripts (aka FSCommand)
    
    also add a --no-scripts option to get rid of it

diff --git a/player/swfplay.c b/player/swfplay.c
index 23e3f8f..996deb2 100644
--- a/player/swfplay.c
+++ b/player/swfplay.c
@@ -59,6 +59,15 @@ view_swf (SwfdecPlayer *player, gboolean
 }
 
 static void
+do_fscommand (SwfdecPlayer *player, const char *command, const char *value, gpointer window)
+{
+  if (g_str_equal (command, "quit")) {
+    gtk_main_quit ();
+  }
+  /* FIXME: add more */
+}
+
+static void
 print_trace (SwfdecPlayer *player, const char *message, gpointer unused)
 {
   g_print ("%s\n", message);
@@ -93,7 +102,7 @@ main (int argc, char *argv[])
   SwfdecPlayer *player;
   GError *error = NULL;
   gboolean use_image = FALSE, no_sound = FALSE;
-  gboolean trace = FALSE;
+  gboolean trace = FALSE, no_scripts = FALSE;
   char *variables = NULL;
   char *s;
   GtkWidget *window;
@@ -101,6 +110,7 @@ main (int argc, char *argv[])
   GOptionEntry options[] = {
     { "delay", 'd', 0, G_OPTION_ARG_INT, &delay, "make loading of resources take time", "SECS" },
     { "image", 'i', 0, G_OPTION_ARG_NONE, &use_image, "use an intermediate image surface for drawing", NULL },
+    { "no-scripts", 0, 0, G_OPTION_ARG_NONE, &no_scripts, "don't execute scripts affecting the application", NULL },
     { "no-sound", 'n', 0, G_OPTION_ARG_NONE, &no_sound, "don't play sound", NULL },
     { "speed", 0, 0, G_OPTION_ARG_INT, &speed, "replay speed (will deactivate sound)", "PERCENT" },
     { "trace", 't', 0, G_OPTION_ARG_NONE, &trace, "print trace output to stdout", NULL },
@@ -139,21 +149,24 @@ main (int argc, char *argv[])
   player = swfdec_gtk_player_new (NULL);
   if (trace)
     g_signal_connect (player, "trace", G_CALLBACK (print_trace), NULL);
+  swfdec_gtk_player_set_speed (SWFDEC_GTK_PLAYER (player), speed / 100.);
+
+  if (no_sound)
+    swfdec_gtk_player_set_audio_enabled (SWFDEC_GTK_PLAYER (player), FALSE);
+
+  window = view_swf (player, use_image);
+  set_title (GTK_WINDOW (window), argv[1]);
+
+  if (!no_scripts)
+    g_signal_connect (player, "fscommand", G_CALLBACK (do_fscommand), window);
   
   if (delay) 
     loader = swfdec_slow_loader_new (loader, delay);
 
   swfdec_player_set_loader_with_variables (player, loader, variables);
 
-  if (no_sound)
-    swfdec_gtk_player_set_audio_enabled (SWFDEC_GTK_PLAYER (player), FALSE);
-
-  swfdec_gtk_player_set_speed (SWFDEC_GTK_PLAYER (player), speed / 100.);
   swfdec_gtk_player_set_playing (SWFDEC_GTK_PLAYER (player), TRUE);
 
-  window = view_swf (player, use_image);
-  set_title (GTK_WINDOW (window), argv[1]);
-
   gtk_main ();
 
   g_object_unref (player);
diff-tree 6f3db89d5b461a706c484b2e9da091b357d1fff0 (from d68ae26a9b84711a95c9f985b608f89e7dd2a231)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 11:29:35 2007 +0200

    typo

diff --git a/NEWS b/NEWS
index d1567bf..9cbfaa2 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,7 @@
  0.5.1 ("Heeeeelium")
 
 Features! This release got some. And they even give you the long awaited 
-embedded Youtube support. At the cost of lost of API changes, but who cares?
+embedded Youtube support. At the cost of lots of API changes, but who cares?
 - rewrite SwfdecLoader. Add SwfdecURL support structure in the process.
 - implement AsBroadcaster actionscript object.
 - implement Stage actionscript object. Movies can now do the scaling themselves.
diff-tree d68ae26a9b84711a95c9f985b608f89e7dd2a231 (from 0fcaa45507dc974d08ac3d27814cbc72a7237e64)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 11:04:04 2007 +0200

    set constructor before __proto__
    
    This avoids issues when __proto__.constructor is permanent

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index f6e07af..d24c337 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -494,12 +494,12 @@ swfdec_as_object_new (SwfdecAsContext *c
   g_assert (context->Object_prototype);
   
   object = swfdec_as_object_new_empty (context);
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object_prototype);
-  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object_prototype);
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   return object;
 }
 
diff-tree 0fcaa45507dc974d08ac3d27814cbc72a7237e64 (from 71cba217cf8baa498b14a09685aef92266e72dba)
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Aug 22 11:02:36 2007 +0200

    __proto__ and constructor of new objects aren't constant

diff --git a/libswfdec/swfdec_as_object.c b/libswfdec/swfdec_as_object.c
index 7d7062f..f6e07af 100644
--- a/libswfdec/swfdec_as_object.c
+++ b/libswfdec/swfdec_as_object.c
@@ -496,12 +496,10 @@ swfdec_as_object_new (SwfdecAsContext *c
   object = swfdec_as_object_new_empty (context);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object_prototype);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Object);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   return object;
 }
 


More information about the Swfdec mailing list