gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/video_stream_instance.cp...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/video_stream_instance.cp...
Date: Mon, 04 Jun 2007 19:21:21 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/06/04 19:21:21

Modified files:
        .              : ChangeLog 
        server         : video_stream_instance.cpp 
                         video_stream_instance.h 
        server/asobj   : Global.cpp Makefile.am 
        testsuite/misc-ming.all: NetStream-SquareTest.c 
Removed files:
        server/asobj   : Video.cpp Video.h 

Log message:
                * server/video_stream_instance.{cpp,h}: register Video AS class
                  interface and provide class initialization.
                * server/asobj/: Global.cpp, Makefile.am, Video.{cpp,h}: Drop 
Video file, video
                  class is now implemented in video_stream_instance.cpp
                * testsuite/misc-ming.all/NetStream-SquareTest.c: don't expect
                  failures due to video stream character NOT being a real Video
                  object.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3452&r2=1.3453
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.cpp?cvsroot=gnash&r1=1.26&r2=1.27
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.h?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Global.cpp?cvsroot=gnash&r1=1.61&r2=1.62
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Makefile.am?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Video.cpp?cvsroot=gnash&r1=1.10&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Video.h?cvsroot=gnash&r1=1.6&r2=0
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c?cvsroot=gnash&r1=1.11&r2=1.12

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3452
retrieving revision 1.3453
diff -u -b -r1.3452 -r1.3453
--- ChangeLog   4 Jun 2007 18:33:19 -0000       1.3452
+++ ChangeLog   4 Jun 2007 19:21:20 -0000       1.3453
@@ -1,5 +1,15 @@
 2007-06-04 Sandro Santilli <address@hidden>
 
+       * server/video_stream_instance.{cpp,h}: register Video AS class
+         interface and provide class initialization.
+       * server/asobj/: Global.cpp, Makefile.am, Video.{cpp,h}: Drop Video 
file, video
+         class is now implemented in video_stream_instance.cpp
+       * testsuite/misc-ming.all/NetStream-SquareTest.c: don't expect
+         failures due to video stream character NOT being a real Video
+         object.
+
+2007-06-04 Sandro Santilli <address@hidden>
+
        * testsuite/misc-ming.all/NetStream-SquareTest.c: set SWF rate back to
          an high value to allow for testing pixel color and also testing with
          eyes what's hard to test when nothing is shown due to Gnash not

Index: server/video_stream_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/video_stream_instance.cpp    30 May 2007 15:12:28 -0000      1.26
+++ server/video_stream_instance.cpp    4 Jun 2007 19:21:20 -0000       1.27
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-// $Id: video_stream_instance.cpp,v 1.26 2007/05/30 15:12:28 strk Exp $
+// $Id: video_stream_instance.cpp,v 1.27 2007/06/04 19:21:20 strk Exp $
 
 #include "sprite_instance.h"
 #include "video_stream_instance.h"
@@ -32,9 +32,80 @@
 
 namespace gnash {
 
-       static as_value
-       attach_video(const fn_call& fn)
+static as_object* getVideoInterface();
+static void attachVideoInterface(as_object& o);
+static void attachVideoProperties(as_object& o);
+static as_value video_ctor(const fn_call& fn);
+static as_value video_attach(const fn_call& fn);
+static as_value video_clear(const fn_call& fn);
+
+static as_object* getVideoInterface()
+{
+       static boost::intrusive_ptr<as_object> proto;
+       if ( proto == NULL )
        {
+               proto = new as_object();
+               attachVideoInterface(*proto);
+               proto->init_member("constructor", new 
builtin_function(video_ctor));
+       }
+       return proto.get();
+}
+
+static void attachVideoInterface(as_object& o)
+{
+       o.init_member("attachVideo", new builtin_function(video_attach));
+       o.init_member("clear", new builtin_function(video_clear));
+}
+
+static void attachVideoProperties(as_object& o)
+{
+       //int target_version = o.getVM().getSWFVersion();
+
+       boost::intrusive_ptr<builtin_function> gettersetter;
+
+       gettersetter = new builtin_function(&character::x_getset, NULL);
+       o.init_property("_x", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::y_getset, NULL);
+       o.init_property("_y", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::xscale_getset, NULL);
+       o.init_property("_xscale", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::yscale_getset, NULL);
+       o.init_property("_yscale", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::xmouse_get, NULL);
+       o.init_readonly_property("_xmouse", *gettersetter);
+
+       gettersetter = new builtin_function(&character::ymouse_get, NULL);
+       o.init_readonly_property("_ymouse", *gettersetter);
+
+       gettersetter = new builtin_function(&character::alpha_getset, NULL);
+       o.init_property("_alpha", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::visible_getset, NULL);
+       o.init_property("_visible", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::width_getset, NULL);
+       o.init_property("_width", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::height_getset, NULL);
+       o.init_property("_height", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::rotation_getset, NULL);
+       o.init_property("_rotation", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::parent_getset, NULL);
+       o.init_property("_parent", *gettersetter, *gettersetter);
+
+       gettersetter = new builtin_function(&character::target_getset, NULL);
+       o.init_property("_target", *gettersetter, *gettersetter);
+}
+
+static as_value
+video_attach(const fn_call& fn)
+{
                boost::intrusive_ptr<video_stream_instance> video = 
ensureType<video_stream_instance>(fn.this_ptr);
        
                if (fn.nargs < 1)
@@ -58,7 +129,25 @@
                        );
                }
                return as_value();
-       }
+}
+
+static as_value
+video_clear(const fn_call& /*fn*/)
+{
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+
+static as_value
+video_ctor(const fn_call& /* fn */)
+{
+       log_debug("new Video() TESTING !");
+
+       // I'm not sure We can rely on the def and parent values being accepted 
 as NULL
+       // Not till we add some testing...
+       boost::intrusive_ptr<as_object> obj = new video_stream_instance(NULL, 
NULL, -1);
+       return as_value(obj.get()); // will keep alive
+}
 
 video_stream_instance::video_stream_instance(video_stream_definition* def,
                character* parent, int id)
@@ -67,10 +156,16 @@
        m_def(def),
        //m_video_source(NULL),
        _ns(NULL),
-       m_decoder(m_def->get_decoder()) // should abort if m_def is null
+       m_decoder(NULL) // don't abort if m_def is null
 {
-       // FIXME: use new layout
-       init_member("attachVideo", new builtin_function(attach_video));
+       if ( m_def )
+       {
+               m_decoder = m_def->get_decoder();
+       }
+
+       set_prototype(getVideoInterface());
+                       
+       attachVideoProperties(*this);
 }
 
 video_stream_instance::~video_stream_instance()
@@ -80,6 +175,10 @@
 void
 video_stream_instance::display()
 {
+       // if m_def is NULL we've been constructed by 'new Video', in this
+       // case I think display() would never be invoked on us...
+       assert(m_def);
+
        matrix m = get_world_matrix();
        rect bounds(0.0f, 0.0f, PIXELS_TO_TWIPS(m_def->m_width), 
PIXELS_TO_TWIPS(m_def->m_height));
 
@@ -98,7 +197,13 @@
        } else if (m_decoder.get()) {
                uint8_t* data = 0;
                int size = 0;
-               int current_frame = 
get_parent()->to_movie()->get_current_frame();
+               character* parent = get_parent();
+               assert(parent);
+               sprite_instance* sprite = parent->to_movie();
+               assert(sprite);
+
+               int current_frame = sprite->get_current_frame();
+               assert(m_def);
                m_def->get_frame_data(current_frame, &data, &size);
 
                image::image_base* i = m_decoder->decodeFrame(data, size);
@@ -134,6 +239,10 @@
        
        // NOTE: do not use m_def->get_bounds()
 
+       // if m_def is NULL we've been constructed by 'new Video', in this
+       // case I think add_invalidated_bouns would never be invoked on us...
+       assert ( m_def );
+
   rect def_bounds(0.0f, 0.0f, 
     PIXELS_TO_TWIPS(m_def->m_width), PIXELS_TO_TWIPS(m_def->m_height));
     
@@ -150,4 +259,22 @@
        _ns = ns;
 }
 
+// extern (used by Global.cpp)
+void video_class_init(as_object& global)
+{
+       // This is going to be the global Video "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl;
+
+       if ( cl == NULL )
+       {
+               cl=new builtin_function(&video_ctor, getVideoInterface());
+               // replicate all interface to class, to be able to access
+               // all methods as static functions
+               //attachVideoInterface(*cl);
+       }
+
+       // Register _global.Video
+       global.init_member("Video", cl.get());
+}
+
 } // end of namespace gnash

Index: server/video_stream_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/video_stream_instance.h      28 May 2007 15:41:07 -0000      1.14
+++ server/video_stream_instance.h      4 Jun 2007 19:21:20 -0000       1.15
@@ -16,7 +16,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 // 
-// $Id: video_stream_instance.h,v 1.14 2007/05/28 15:41:07 ann Exp $
+// $Id: video_stream_instance.h,v 1.15 2007/06/04 19:21:20 strk Exp $
 
 #ifndef GNASH_VIDEO_STREAM_INSTANCE_H
 #define GNASH_VIDEO_STREAM_INSTANCE_H
@@ -84,6 +84,8 @@
        std::auto_ptr<embedVideoDecoder> m_decoder;
 };
 
+void video_class_init(as_object& global);
+
 }      // end namespace gnash
 
 

Index: server/asobj/Global.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Global.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- server/asobj/Global.cpp     25 May 2007 16:04:11 -0000      1.61
+++ server/asobj/Global.cpp     4 Jun 2007 19:21:20 -0000       1.62
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: Global.cpp,v 1.61 2007/05/25 16:04:11 strk Exp $ */
+/* $Id: Global.cpp,v 1.62 2007/06/04 19:21:20 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -56,7 +56,7 @@
 #include "System.h"
 #include "textformat.h"
 #include "TextSnapshot.h"
-#include "Video.h"
+#include "video_stream_instance.h"
 #include "extension.h"
 #include "VM.h"
 #include "timers.h"

Index: server/asobj/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Makefile.am,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/asobj/Makefile.am    4 Jun 2007 18:00:09 -0000       1.39
+++ server/asobj/Makefile.am    4 Jun 2007 19:21:20 -0000       1.40
@@ -15,7 +15,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-# $Id: Makefile.am,v 1.39 2007/06/04 18:00:09 rsavoye Exp $
+# $Id: Makefile.am,v 1.40 2007/06/04 19:21:20 strk Exp $
 
 AUTOMAKE_OPTIONS = 
 
@@ -67,7 +67,6 @@
        Stage.cpp       \
        System.cpp      \
        TextSnapshot.cpp\
-       Video.cpp       \
        MovieClipLoader.cpp\
        string.cpp \
        xml.cpp \
@@ -107,7 +106,6 @@
        Stage.h         \
        System.h        \
        TextSnapshot.h  \
-       Video.h         \
        gstring.h       \
        xml.h           \
        xmlsocket.h \

Index: testsuite/misc-ming.all/NetStream-SquareTest.c
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-ming.all/NetStream-SquareTest.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- testsuite/misc-ming.all/NetStream-SquareTest.c      4 Jun 2007 18:33:19 
-0000       1.11
+++ testsuite/misc-ming.all/NetStream-SquareTest.c      4 Jun 2007 19:21:21 
-0000       1.12
@@ -112,10 +112,10 @@
   if(a == NULL) return -1;
   SWFMovie_add(mo, (SWFBlock)a);
 
-  xcheck_equals(mo, "video._xscale", "100");
-  xcheck_equals(mo, "video._yscale", "100");
-  xcheck_equals(mo, "video._rotation", "0");
-  xcheck_equals(mo, "video._target", "'/video'");
+  check_equals(mo, "video._xscale", "100");
+  check_equals(mo, "video._yscale", "100");
+  check_equals(mo, "video._rotation", "0");
+  check_equals(mo, "video._target", "'/video'");
 
   add_actions(mo,
                "video._x = 100;"
@@ -124,9 +124,9 @@
                "video._rotation = 45;");
 
   check_equals(mo, "video._x", "100")  ;
-  check_equals(mo, "video._xscale", "120");
-  check_equals(mo, "video._yscale", "120");
-  check_equals(mo, "video._rotation", "45");
+  check_equals(mo, "Math.round(video._xscale*100)/100", "120");
+  check_equals(mo, "Math.round(video._yscale*100)/100", "120");
+  check_equals(mo, "Math.round(video._rotation*100)/100", "45");
 
 
   // How can I test props here ?

Index: server/asobj/Video.cpp
===================================================================
RCS file: server/asobj/Video.cpp
diff -N server/asobj/Video.cpp
--- server/asobj/Video.cpp      26 Apr 2007 07:00:29 -0000      1.10
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,108 +0,0 @@
-// Video.cpp:  ActionScript "Video" class, for Gnash.
-// 
-//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "Video.h"
-#include "as_object.h" // for inheritance
-#include "log.h"
-#include "fn_call.h"
-#include "smart_ptr.h" // for boost intrusive_ptr
-#include "builtin_function.h" // need builtin_function
-
-namespace gnash {
-
-as_value video_attachvideo(const fn_call& fn);
-as_value video_clear(const fn_call& fn);
-as_value video_ctor(const fn_call& fn);
-
-static void
-attachVideoInterface(as_object& o)
-{
-       o.init_member("attachVideo", new builtin_function(video_attachvideo));
-       o.init_member("clear", new builtin_function(video_clear));
-}
-
-static as_object*
-getVideoInterface()
-{
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
-       {
-               o = new as_object();
-               attachVideoInterface(*o);
-       }
-       return o.get();
-}
-
-class video_as_object: public as_object
-{
-
-public:
-
-       video_as_object()
-               :
-               as_object(getVideoInterface())
-       {}
-
-       // override from as_object ?
-       //std::string get_text_value() const { return "Video"; }
-
-       // override from as_object ?
-       //double get_numeric_value() const { return 0; }
-};
-
-as_value video_attachvideo(const fn_call& /*fn*/) {
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-as_value video_clear(const fn_call& /*fn*/) {
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-video_ctor(const fn_call& /* fn */)
-{
-       boost::intrusive_ptr<as_object> obj = new video_as_object;
-       
-       return as_value(obj.get()); // will keep alive
-}
-
-// extern (used by Global.cpp)
-void video_class_init(as_object& global)
-{
-       // This is going to be the global Video "class"/"function"
-       static boost::intrusive_ptr<builtin_function> cl;
-
-       if ( cl == NULL )
-       {
-               cl=new builtin_function(&video_ctor, getVideoInterface());
-               // replicate all interface to class, to be able to access
-               // all methods as static functions
-               attachVideoInterface(*cl);
-       }
-
-       // Register _global.Video
-       global.init_member("Video", cl.get());
-}
-
-} // end of gnash namespace

Index: server/asobj/Video.h
===================================================================
RCS file: server/asobj/Video.h
diff -N server/asobj/Video.h
--- server/asobj/Video.h        28 May 2007 14:59:36 -0000      1.6
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-// 
-//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-
-#ifndef __GNASH_ASOBJ_VIDEO_H__
-#define __GNASH_ASOBJ_VIDEO_H__
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <memory> // for auto_ptr
-
-namespace gnash {
-
-class as_object;
-
-/// Initialize the global Video class
-void video_class_init(as_object& global);
-
-/// Return a Video instance (in case the core lib needs it)
-//std::auto_ptr<as_object> init_video_instance();
-  
-} // end of gnash namespace
-
-// __GNASH_ASOBJ_VIDEO_H__
-#endif
-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]