gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11063: fixed bug that was causing m


From: Ben Limmer
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11063: fixed bug that was causing microphone and camera class tests from completing
Date: Wed, 10 Jun 2009 14:04:51 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11063
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Wed 2009-06-10 14:04:51 -0600
message:
  fixed bug that was causing microphone and camera class tests from completing
modified:
  libcore/ClassHierarchy.cpp
  libcore/asobj/flash/media/Camera_as.cpp
  libcore/asobj/flash/media/Camera_as.h
  libcore/asobj/flash/media/Microphone_as.cpp
  libcore/asobj/flash/media/Microphone_as.h
  libcore/asobj/flash/media/mediaclasses.h
  testsuite/actionscript.all/Microphone.as
=== modified file 'libcore/ClassHierarchy.cpp'
--- a/libcore/ClassHierarchy.cpp        2009-06-10 19:54:27 +0000
+++ b/libcore/ClassHierarchy.cpp        2009-06-10 20:04:51 +0000
@@ -319,14 +319,13 @@
         NSV::NS_FLASH_TEXT, 5 },
     { video_class_init, NSV::CLASS_VIDEO, NSV::CLASS_OBJECT,
         NSV::NS_FLASH_MEDIA, 6 },
-    { camera_class_init, NSV::CLASS_CAMERA, NSV::CLASS_OBJECT,
-        NSV::NS_FLASH_UI, 6 },
-    { microphone_class_init, NSV::CLASS_MICROPHONE, NSV::CLASS_OBJECT,
-        NSV::NS_FLASH_UI, 6 },
-    { sharedobject_class_init, NSV::CLASS_SHARED_OBJECT, NSV::CLASS_OBJECT,
+       { camera_class_init, NSV::CLASS_CAMERA, NSV::CLASS_OBJECT,
+        NSV::NS_FLASH_MEDIA, 6 },
+       { microphone_class_init, NSV::CLASS_MICROPHONE, NSV::CLASS_OBJECT,
+        NSV::NS_FLASH_MEDIA, 6 },
+       { sharedobject_class_init, NSV::CLASS_SHARED_OBJECT, NSV::CLASS_OBJECT,
         NSV::NS_FLASH_NET, 6 },
-    { loadvars_class_init, NSV::CLASS_LOAD_VARS, NSV::CLASS_OBJECT, NS_GLOBAL,
-        6 },
+       { loadvars_class_init, NSV::CLASS_LOAD_VARS, NSV::CLASS_OBJECT, 
NS_GLOBAL, 6 },
     { LocalConnection_as::init, NSV::CLASS_LOCALCONNECTION, NSV::CLASS_OBJECT,
         NS_GLOBAL, 6 },
     { customactions_class_init, NSV::CLASS_CUSTOM_ACTIONS, NSV::CLASS_OBJECT,

=== modified file 'libcore/asobj/flash/media/Camera_as.cpp'
--- a/libcore/asobj/flash/media/Camera_as.cpp   2009-05-28 17:12:07 +0000
+++ b/libcore/asobj/flash/media/Camera_as.cpp   2009-06-10 20:04:51 +0000
@@ -21,182 +21,106 @@
 #include "gnashconfig.h"
 #endif
 
-#include "media/Camera_as.h"
+#include "flash/media/Camera_as.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
-#include "GnashException.h" // for ActionException
+#include "Object.h" // for getObjectInterface
 
 namespace gnash {
 
-// Forward declarations
-namespace {
-    as_value camera_getCamera(const fn_call& fn);
-    as_value camera_setKeyFrameInterval(const fn_call& fn);
-    as_value camera_setLoopback(const fn_call& fn);
-    as_value camera_setMode(const fn_call& fn);
-    as_value camera_setMotionLevel(const fn_call& fn);
-    as_value camera_setQuality(const fn_call& fn);
-    as_value camera_activity(const fn_call& fn);
-    as_value camera_status(const fn_call& fn);
-    as_value camera_ctor(const fn_call& fn);
-    void attachCameraInterface(as_object& o);
-    void attachCameraStaticInterface(as_object& o);
-    as_object* getCameraInterface();
-
-}
-
-class Camera_as : public as_object
+as_value camera_get(const fn_call& fn);
+as_value camera_setmode(const fn_call& fn);
+as_value camera_setmotionlevel(const fn_call& fn);
+as_value camera_setquality(const fn_call& fn);
+as_value camera_ctor(const fn_call& fn);
+
+static void
+attachCameraInterface(as_object& o)
+{
+       o.init_member("get", new builtin_function(camera_get));
+       o.init_member("setmode", new builtin_function(camera_setmode));
+       o.init_member("setmotionlevel", new 
builtin_function(camera_setmotionlevel));
+       o.init_member("setquality", new builtin_function(camera_setquality));
+}
+
+static as_object*
+getCameraInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( ! o )
+       {
+               o = new as_object(getObjectInterface());
+               attachCameraInterface(*o);
+       }
+       return o.get();
+}
+
+class camera_as_object: public as_object
 {
 
 public:
 
-    Camera_as()
-        :
-        as_object(getCameraInterface())
-    {}
+       camera_as_object()
+               :
+               as_object(getCameraInterface())
+       {}
+
+       // override from as_object ?
+       //const char* get_text_value() const { return "Camera"; }
+
+       // override from as_object ?
+       //double get_numeric_value() const { return 0; }
 };
 
+as_value camera_get(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value camera_setmode(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value camera_setmotionlevel(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value camera_setquality(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+
+    return as_value();
+}
+
+as_value
+camera_ctor(const fn_call& /* fn */)
+{
+       boost::intrusive_ptr<as_object> obj = new camera_as_object;
+       
+       return as_value(obj.get()); // will keep alive
+}
+
 // extern (used by Global.cpp)
 void camera_class_init(as_object& global)
 {
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if (!cl) {
-        cl = new builtin_function(&camera_ctor, getCameraInterface());
-        attachCameraStaticInterface(*cl);
-    }
-
-    // Register _global.Camera
-    global.init_member("Camera", cl.get());
-}
-
-namespace {
-
-void
-attachCameraInterface(as_object& o)
-{
-    o.init_member("getCamera", new builtin_function(camera_getCamera));
-    o.init_member("setKeyFrameInterval", new 
builtin_function(camera_setKeyFrameInterval));
-    o.init_member("setLoopback", new builtin_function(camera_setLoopback));
-    o.init_member("setMode", new builtin_function(camera_setMode));
-    o.init_member("setMotionLevel", new 
builtin_function(camera_setMotionLevel));
-    o.init_member("setQuality", new builtin_function(camera_setQuality));
-    o.init_member("activity", new builtin_function(camera_activity));
-    o.init_member("status", new builtin_function(camera_status));
-}
-
-void
-attachCameraStaticInterface(as_object& o)
-{
-
-}
-
-as_object*
-getCameraInterface()
-{
-    static boost::intrusive_ptr<as_object> o;
-    if ( ! o ) {
-        o = new as_object();
-        attachCameraInterface(*o);
-    }
-    return o.get();
-}
-
-as_value
-camera_getCamera(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_setKeyFrameInterval(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_setLoopback(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_setMode(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_setMotionLevel(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_setQuality(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_activity(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_status(const fn_call& fn)
-{
-    boost::intrusive_ptr<Camera_as> ptr =
-        ensureType<Camera_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-camera_ctor(const fn_call& fn)
-{
-    boost::intrusive_ptr<as_object> obj = new Camera_as;
-
-    return as_value(obj.get()); // will keep alive
-}
-
-} // anonymous namespace 
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
+       // This is going to be the global Camera "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl;
+
+       if ( cl == NULL )
+       {
+               cl=new builtin_function(&camera_ctor, getCameraInterface());
+               // replicate all interface to class, to be able to access
+               // all methods as static functions
+               attachCameraInterface(*cl);
+                    
+       }
+
+       // Register _global.Camera
+       global.init_member("Camera", cl.get());
+
+}
+
+
+} // end of gnash namespace
 

=== modified file 'libcore/asobj/flash/media/Camera_as.h'
--- a/libcore/asobj/flash/media/Camera_as.h     2009-05-28 17:29:17 +0000
+++ b/libcore/asobj/flash/media/Camera_as.h     2009-06-10 20:04:51 +0000
@@ -17,29 +17,24 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef GNASH_ASOBJ3_CAMERA_H
-#define GNASH_ASOBJ3_CAMERA_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
+#ifndef __GNASH_ASOBJ_CAMERA_H__
+#define __GNASH_ASOBJ_CAMERA_H__
+
+#include <memory> // for auto_ptr
 
 namespace gnash {
 
-// Forward declarations
 class as_object;
 
 /// Initialize the global Camera class
 void camera_class_init(as_object& global);
 
-} // gnash namespace
+/// Return a Camera instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_camera_instance();
+  
+} // end of gnash namespace
 
-// GNASH_ASOBJ3_CAMERA_H
+// __GNASH_ASOBJ_CAMERA_H__
 #endif
 
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
 

=== modified file 'libcore/asobj/flash/media/Microphone_as.cpp'
--- a/libcore/asobj/flash/media/Microphone_as.cpp       2009-05-28 17:12:07 
+0000
+++ b/libcore/asobj/flash/media/Microphone_as.cpp       2009-06-10 20:04:51 
+0000
@@ -21,146 +21,109 @@
 #include "gnashconfig.h"
 #endif
 
-#include "media/Microphone_as.h"
+#include "flash/media/Microphone_as.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
-#include "GnashException.h" // for ActionException
+#include "Object.h" // for getObjectInterface
 
 namespace gnash {
 
-// Forward declarations
-namespace {
-    as_value microphone_setLoopBack(const fn_call& fn);
-    as_value microphone_setSilenceLevel(const fn_call& fn);
-    as_value microphone_setUseEchoSuppression(const fn_call& fn);
-    as_value microphone_activity(const fn_call& fn);
-    as_value microphone_status(const fn_call& fn);
-    as_value microphone_ctor(const fn_call& fn);
-    void attachMicrophoneInterface(as_object& o);
-    void attachMicrophoneStaticInterface(as_object& o);
-    as_object* getMicrophoneInterface();
-
-}
-
-class Microphone_as : public as_object
+as_value microphone_get(const fn_call& fn);
+as_value microphone_setgain(const fn_call& fn);
+as_value microphone_setrate(const fn_call& fn);
+as_value microphone_setsilencelevel(const fn_call& fn);
+as_value microphone_setuseechosuppression(const fn_call& fn);
+as_value microphone_ctor(const fn_call& fn);
+
+static void
+attachMicrophoneInterface(as_object& o)
+{
+       o.init_member("get", new builtin_function(microphone_get));
+       o.init_member("setGain", new builtin_function(microphone_setgain));
+       o.init_member("setRate", new builtin_function(microphone_setrate));
+       o.init_member("setSilenceLevel", new 
builtin_function(microphone_setsilencelevel));
+       o.init_member("setUseEchoSuppression", new 
builtin_function(microphone_setuseechosuppression));
+}
+
+static as_object*
+getMicrophoneInterface()
+{
+       static boost::intrusive_ptr<as_object> o;
+       if ( ! o )
+       {
+               o = new as_object(getObjectInterface());
+               attachMicrophoneInterface(*o);
+       }
+       return o.get();
+}
+
+class microphone_as_object: public as_object
 {
 
 public:
 
-    Microphone_as()
-        :
-        as_object(getMicrophoneInterface())
-    {}
+       microphone_as_object()
+               :
+               as_object(getMicrophoneInterface())
+       {}
+
+       // override from as_object ?
+       //std::string get_text_value() const { return "Microphone"; }
+
+       // override from as_object ?
+       //double get_numeric_value() const { return 0; }
 };
 
+as_value microphone_get(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value microphone_setgain(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value microphone_setrate(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value microphone_setsilencelevel(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+as_value microphone_setuseechosuppression(const fn_call& /*fn*/) {
+    log_unimpl (__FUNCTION__);
+    return as_value();
+}
+
+as_value
+microphone_ctor(const fn_call& /* fn */)
+{
+       boost::intrusive_ptr<as_object> obj = new microphone_as_object;
+       
+       return as_value(obj.get()); // will keep alive
+}
+
 // extern (used by Global.cpp)
 void microphone_class_init(as_object& global)
 {
-    static boost::intrusive_ptr<builtin_function> cl;
-
-    if (!cl) {
-        cl = new builtin_function(&microphone_ctor, getMicrophoneInterface());
-        attachMicrophoneStaticInterface(*cl);
-    }
-
-    // Register _global.Microphone
-    global.init_member("Microphone", cl.get());
-}
-
-namespace {
-
-void
-attachMicrophoneInterface(as_object& o)
-{
-    o.init_member("setLoopBack", new builtin_function(microphone_setLoopBack));
-    o.init_member("setSilenceLevel", new 
builtin_function(microphone_setSilenceLevel));
-    o.init_member("setUseEchoSuppression", new 
builtin_function(microphone_setUseEchoSuppression));
-    o.init_member("activity", new builtin_function(microphone_activity));
-    o.init_member("status", new builtin_function(microphone_status));
-}
-
-void
-attachMicrophoneStaticInterface(as_object& o)
-{
-
-}
-
-as_object*
-getMicrophoneInterface()
-{
-    static boost::intrusive_ptr<as_object> o;
-    if ( ! o ) {
-        o = new as_object();
-        attachMicrophoneInterface(*o);
-    }
-    return o.get();
-}
-
-as_value
-microphone_setLoopBack(const fn_call& fn)
-{
-    boost::intrusive_ptr<Microphone_as> ptr =
-        ensureType<Microphone_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-microphone_setSilenceLevel(const fn_call& fn)
-{
-    boost::intrusive_ptr<Microphone_as> ptr =
-        ensureType<Microphone_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-microphone_setUseEchoSuppression(const fn_call& fn)
-{
-    boost::intrusive_ptr<Microphone_as> ptr =
-        ensureType<Microphone_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-microphone_activity(const fn_call& fn)
-{
-    boost::intrusive_ptr<Microphone_as> ptr =
-        ensureType<Microphone_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-microphone_status(const fn_call& fn)
-{
-    boost::intrusive_ptr<Microphone_as> ptr =
-        ensureType<Microphone_as>(fn.this_ptr);
-    UNUSED(ptr);
-    log_unimpl (__FUNCTION__);
-    return as_value();
-}
-
-as_value
-microphone_ctor(const fn_call& fn)
-{
-    boost::intrusive_ptr<as_object> obj = new Microphone_as;
-
-    return as_value(obj.get()); // will keep alive
-}
-
-} // anonymous namespace 
-} // gnash namespace
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-
+       // This is going to be the global Microphone "class"/"function"
+       static boost::intrusive_ptr<builtin_function> cl;
+
+       if ( cl == NULL )
+       {
+               cl=new builtin_function(&microphone_ctor, 
getMicrophoneInterface());
+               // replicate all interface to class, to be able to access
+               // all methods as static functions
+               attachMicrophoneInterface(*cl);
+       }
+
+       // Register _global.Microphone
+       global.init_member("Microphone", cl.get());
+
+}
+
+
+} // end of gnash namespace

=== modified file 'libcore/asobj/flash/media/Microphone_as.h'
--- a/libcore/asobj/flash/media/Microphone_as.h 2009-05-28 17:29:17 +0000
+++ b/libcore/asobj/flash/media/Microphone_as.h 2009-06-10 20:04:51 +0000
@@ -1,6 +1,5 @@
-// Microphone_as.h:  ActionScript 3 "Microphone" class, for Gnash.
-//
-//   Copyright (C) 2009 Free Software Foundation, Inc.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009 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
@@ -17,29 +16,22 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#ifndef GNASH_ASOBJ3_MICROPHONE_H
-#define GNASH_ASOBJ3_MICROPHONE_H
-
-#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
-#endif
-
+#ifndef __GNASH_ASOBJ_MICROPHONE_H__
+#define __GNASH_ASOBJ_MICROPHONE_H__
+
+#include <memory> // for auto_ptr
 
 namespace gnash {
 
-// Forward declarations
 class as_object;
 
 /// Initialize the global Microphone class
 void microphone_class_init(as_object& global);
 
-} // gnash namespace
+/// Return a Microphone instance (in case the core lib needs it)
+//std::auto_ptr<as_object> init_microphone_instance();
+  
+} // end of gnash namespace
 
-// GNASH_ASOBJ3_MICROPHONE_H
+// __GNASH_ASOBJ_MICROPHONE_H__
 #endif
-
-// local Variables:
-// mode: C++
-// indent-tabs-mode: t
-// End:
-

=== modified file 'libcore/asobj/flash/media/mediaclasses.h'
--- a/libcore/asobj/flash/media/mediaclasses.h  2009-06-07 00:49:02 +0000
+++ b/libcore/asobj/flash/media/mediaclasses.h  2009-06-10 20:04:51 +0000
@@ -1,9 +1,10 @@
-// Generated by Makefile, don't hand edit!
 #ifndef GNASH_ASOBJ_FLASH_MEDIA_H
 #define GNASH_ASOBJ_FLASH_MEDIA_H 1
 #include "sharedlib.h"
 static gnash::SharedLib::initentry *as3mediaclasses[] = {
        gnash::id3info_class_init,
+       gnash::microphone_class_init,
+       gnash::camera_class_init,
        gnash::soundchannel_class_init,
        gnash::soundloadercontext_class_init,
        gnash::soundmixer_class_init,

=== modified file 'testsuite/actionscript.all/Microphone.as'
--- a/testsuite/actionscript.all/Microphone.as  2009-02-25 22:33:03 +0000
+++ b/testsuite/actionscript.all/Microphone.as  2009-06-10 20:04:51 +0000
@@ -35,7 +35,6 @@
 check_equals ( typeof(Microphone.prototype.setSilenceLevel), 'function' );
 check_equals ( typeof(Microphone.prototype.setUseEchoSuppression), 'function' 
);
 
-
 check(Microphone.prototype.hasOwnProperty("setGain"));
 check(Microphone.prototype.hasOwnProperty("setRate"));
 check(Microphone.prototype.hasOwnProperty("setSilenceLevel"));


reply via email to

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