[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11359: completed basic implementati
From: |
Ben Limmer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11359: completed basic implementation of Camera actionscript class. Still some work to be done, testsuites now pass instead of xfail |
Date: |
Fri, 31 Jul 2009 15:12:01 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11359
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Fri 2009-07-31 15:12:01 -0600
message:
completed basic implementation of Camera actionscript class. Still some work
to be done, testsuites now pass instead of xfail
modified:
libcore/asobj/flash/media/Camera_as.cpp
libmedia/VideoInput.cpp
libmedia/VideoInput.h
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_audioinput.cpp
testsuite/libmedia.all/test_videoinput.cpp
testsuite/misc-haxe.all/classes.all/media/Camera_as.hx
------------------------------------------------------------
revno: 11342.3.1
committer: Ben Limmer <address@hidden>
branch nick: cam_mic_as_migration
timestamp: Fri 2009-07-31 15:06:37 -0600
message:
completed basic implementation of Camera actionscript class. Still some
work to be done, testsuites now pass instead of xfail
modified:
libcore/asobj/flash/media/Camera_as.cpp
libmedia/VideoInput.cpp
libmedia/VideoInput.h
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_audioinput.cpp
testsuite/libmedia.all/test_videoinput.cpp
testsuite/misc-haxe.all/classes.all/media/Camera_as.hx
=== modified file 'libcore/asobj/flash/media/Camera_as.cpp'
--- a/libcore/asobj/flash/media/Camera_as.cpp 2009-07-30 06:46:52 +0000
+++ b/libcore/asobj/flash/media/Camera_as.cpp 2009-07-31 21:06:37 +0000
@@ -30,98 +30,557 @@
#include "builtin_function.h" // need builtin_function
#include "Object.h" // for getObjectInterface
+#ifdef USE_GST
+#include "gst/VideoInputGst.h"
+#endif
+
+#ifdef USE_FFMPEG
+#include "VideoInput.h"
+#endif
+
namespace gnash {
as_value camera_get(const fn_call& fn);
+as_value camera_getCamera(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);
+
+as_value camera_activitylevel(const fn_call& fn);
+as_value camera_bandwidth(const fn_call& fn);
+as_value camera_currentFPS(const fn_call& fn); //as3
+as_value camera_currentFps(const fn_call& fn); //as2
+as_value camera_fps(const fn_call& fn);
+as_value camera_height(const fn_call& fn);
+as_value camera_index(const fn_call& fn);
+as_value camera_motionLevel(const fn_call& fn);
+as_value camera_motionTimeout(const fn_call& fn);
+as_value camera_muted(const fn_call& fn);
+as_value camera_name(const fn_call& fn);
+//as_value camera_names(const fn_call& fn);
+as_value camera_quality(const fn_call& fn);
+as_value camera_width(const fn_call& fn);
static void
attachCameraInterface(as_object& o)
{
Global_as* gl = getGlobal(o);
- o.init_member("get", gl->createFunction(camera_get));
- o.init_member("setmode", gl->createFunction(camera_setmode));
- o.init_member("setmotionlevel",
gl->createFunction(camera_setmotionlevel));
- o.init_member("setquality", gl->createFunction(camera_setquality));
+ boost::intrusive_ptr<builtin_function> getset;
+
+ o.init_member("get", gl->createFunction(camera_get));
+ o.init_member("getCamera", gl->createFunction(camera_getCamera));
+ o.init_member("setmode", gl->createFunction(camera_setmode));
+ o.init_member("setmotionlevel", gl->createFunction(camera_setmotionlevel));
+ o.init_member("setquality", gl->createFunction(camera_setquality));
+
+
+ getset = gl->createFunction(camera_activitylevel);
+ o.init_property("activityLevel", *getset, *getset);
+ getset = gl->createFunction(camera_bandwidth);
+ o.init_property("bandwidth", *getset, *getset);
+ getset = gl->createFunction(camera_currentFPS);
+ o.init_property("currentFPS", *getset, *getset);
+ getset = gl->createFunction(camera_currentFps);
+ o.init_property("currentFps", *getset, *getset);
+ getset = gl->createFunction(camera_fps);
+ o.init_property("fps", *getset, *getset);
+ getset = gl->createFunction(camera_height);
+ o.init_property("height", *getset, *getset);
+ getset = gl->createFunction(camera_index);
+ o.init_property("index", *getset, *getset);
+ getset = gl->createFunction(camera_motionLevel);
+ o.init_property("motionLevel", *getset, *getset);
+ getset = gl->createFunction(camera_motionTimeout);
+ o.init_property("motionTimeout", *getset, *getset);
+ getset = gl->createFunction(camera_muted);
+ o.init_property("muted", *getset, *getset);
+ getset = gl->createFunction(camera_name);
+ o.init_property("name", *getset, *getset);
+ //getset = gl->createFunction(camera_names); //need to figure out how to
+ //o.init_property("names", *getset, *getset); //implement this
+ getset = gl->createFunction(camera_quality);
+ o.init_property("quality", *getset, *getset);
+ getset = gl->createFunction(camera_width);
+ o.init_property("width", *getset, *getset);
}
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_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
-}
+ static boost::intrusive_ptr<as_object> o;
+ if ( ! o )
+ {
+ o = new as_object(getObjectInterface());
+ attachCameraInterface(*o);
+ }
+ return o.get();
+}
+
+#ifdef USE_GST
+class camera_as_object: public as_object, public media::gst::VideoInputGst
+{
+
+public:
+
+ 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; }
+};
+#endif
+
+#ifdef USE_FFMPEG
+class camera_as_object: public as_object, public media::VideoInput
+{
+
+public:
+
+ 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; }
+};
+#endif
+
+// AS2 ctor
+as_value
+camera_get(const fn_call& fn) {
+ boost::intrusive_ptr<as_object> obj = new camera_as_object;
+
+ int numargs = fn.nargs;
+ if (numargs > 0) {
+ log_debug("%s: the camera is automatically chosen from gnashrc",
__FUNCTION__);
+ }
+ return as_value(obj.get()); // will keep alive
+}
+
+// AS3 ctor
+as_value
+camera_getCamera(const fn_call& fn) {
+ boost::intrusive_ptr<as_object> obj = new camera_as_object;
+
+ int numargs = fn.nargs;
+ if (numargs > 0) {
+ log_debug("%s: the camera is automatically chosen from gnashrc",
__FUNCTION__);
+ }
+ return as_value(obj.get()); // will keep alive
+}
+
+as_value
+camera_setmode(const fn_call& fn) {
+
+ //this will need to go through the arguments and set the proper values
+ //...which will also mean changing up some things in the VideoInputGst
+ //implementation (e.g. be able to set the fps values, etc.)
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ int numargs = fn.nargs;
+ switch (numargs) {
+ case 4:
+ ptr->set_width(fn.arg(0).to_int());
+ ptr->set_height(fn.arg(1).to_int());
+ ptr->set_fps(fn.arg(2).to_int());
+ log_unimpl("Camera_as::setmode argument 4 (favorArea)");
+#ifdef USE_GST
+ ptr->webcamChangeSourceBin(ptr->getGlobalWebcam());
+#endif
+ break;
+ case 3:
+ ptr->set_width(fn.arg(0).to_int());
+ ptr->set_height(fn.arg(1).to_int());
+ ptr->set_fps(fn.arg(2).to_int());
+#ifdef USE_GST
+ ptr->webcamChangeSourceBin(ptr->getGlobalWebcam());
+#endif
+ break;
+ case 2:
+ ptr->set_width(fn.arg(0).to_int());
+ ptr->set_height(fn.arg(1).to_int());
+ if (ptr->get_fps() != 15) {
+ ptr->set_fps(15);
+ }
+#ifdef USE_GST
+ ptr->webcamChangeSourceBin(ptr->getGlobalWebcam());
+#endif
+ break;
+ case 1:
+ ptr->set_width(fn.arg(0).to_int()); //set to the specified width
argument
+ if (ptr->get_height() != 120) {
+ ptr->set_height(120);
+ }
+ if (ptr->get_fps() != 15) {
+ ptr->set_fps(15);
+ }
+#ifdef USE_GST
+ ptr->webcamChangeSourceBin(ptr->getGlobalWebcam());
+#endif
+ break;
+ case 0:
+ log_debug("%s: no arguments passed, using default values",
__FUNCTION__);
+ if (ptr->get_width() != 160) {
+ ptr->set_width(160);
+ }
+ if (ptr->get_height() != 120) {
+ ptr->set_height(120);
+ }
+ if (ptr->get_fps() != 15) {
+ ptr->set_fps(15);
+ }
+#ifdef USE_GST
+ ptr->webcamChangeSourceBin(ptr->getGlobalWebcam());
+#endif
+ break;
+ }
+
+ 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_activitylevel(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::activityLevel only has default value");
+#ifdef USE_GST
+ return as_value(ptr->get_activityLevel());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set activity property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+as_value
+camera_bandwidth(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::bandwidth only has default value");
+#ifdef USE_GST
+ return as_value(ptr->get_bandwidth());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set bandwidth property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+//as3 capitalization
+as_value
+camera_currentFPS(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_currentFPS());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set currentFPS property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+//as3 capitalization
+as_value
+camera_currentFps(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_currentFPS());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set currentFPS property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_fps(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_fps());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set fps property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_height(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_height());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set height property of Camera, use
setMode"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_index(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_index());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set index property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_motionLevel(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::motionLevel only has default value");
+#ifdef USE_GST
+ return as_value(ptr->get_motionLevel());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set motionLevel property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_motionTimeout(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::motionTimeout");
+#ifdef USE_GST
+ return as_value(ptr->get_motionTimeout());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set motionTimeout property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_muted(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::muted");
+#ifdef USE_GST
+ return as_value(ptr->get_muted());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set muted property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_name(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_name());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set name property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+//can gnash return a static array as an as_value(array)?
+/*
+as_value
+camera_names(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ //transfer from vector to an array
+ std::vector<std::string> vect;
+ vect = ptr->get_names();
+
+ int size = vect.size();
+ std::string data[size];
+ int i;
+ for (i = 0; i < size; ++i) {
+ data[i] = vect[i];
+ }
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_trace("holld.....");
+ return as_value(data);
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set names property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+*/
+
+as_value
+camera_quality(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Camera::quality has only default values");
+#ifdef USE_GST
+ return as_value(ptr->get_quality());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set quality property of Camera"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+camera_width(const fn_call& fn) {
+ boost::intrusive_ptr<camera_as_object> ptr =
ensureType<camera_as_object>(fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+#ifdef USE_GST
+ return as_value(ptr->get_width());
+#endif
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set width property of Camera, use setMode"));
+ );
+ }
+
+ return as_value();
+}
+
// extern (used by Global.cpp)
void camera_class_init(as_object& where, const ObjectURI& uri)
{
- // This is going to be the global Camera "class"/"function"
- static boost::intrusive_ptr<as_object> cl;
+ // This is going to be the global Camera "class"/"function"
+ static boost::intrusive_ptr<as_object> cl;
- if ( cl == NULL )
- {
+ if ( cl == NULL )
+ {
+ VM& vm = getVM(where);
Global_as* gl = getGlobal(where);
- as_object* proto = getCameraInterface();
- cl = gl->createClass(&camera_ctor, proto);
- // replicate all interface to class, to be able to access
- // all methods as static functions
- attachCameraInterface(*cl);
-
- }
+
+ //for versions lower than 8, the ctor call was get(), for 9 and higher
+ //the ctor was getCamera()
+ if (isAS3(getVM(where))) {
+ cl = gl->createClass(&camera_get, getCameraInterface());
+ } else {
+ cl = gl->createClass(&camera_getCamera, getCameraInterface());
+ }
+
+ attachCameraInterface(*cl);
+ }
- // Register _global.Camera
- where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
+ // Register _global.Camera
+ where.init_member(getName(uri), cl.get(), as_object::DefaultFlags,
getNamespace(uri));
}
=== modified file 'libmedia/VideoInput.cpp'
--- a/libmedia/VideoInput.cpp 2009-07-17 21:38:26 +0000
+++ b/libmedia/VideoInput.cpp 2009-07-31 21:06:37 +0000
@@ -22,17 +22,24 @@
namespace gnash {
namespace media {
- /*
+
//constructor
VideoInput::VideoInput() {
- //first call the Gst find_vid_devs to get an array of information
- //about devices attached to the machine
- std::vector<GnashWebcam*> vid_vect = gst::find_vid_devs();
- int i;
- for (i = 0; i != vid_vect.size(); i++) {
- _names.push_back(vid_vect[i]->get_product_name)
- }
- } */
+ //initialize variables
+ _activityLevel = -1.0;
+ _bandwidth = 0;
+ _currentFPS = 0;
+ _fps = 15.0;
+ _height = 120;
+ _index = 0;
+ _keyFrameInterval = 15;
+ _loopback = false;
+ _motionLevel = 50;
+ _motionTimeout = 2000; //millisecs
+ _muted = false; //security (false = allow, true = decline)
+ _quality = 0;
+ _width = 160;
+ }
} //media namespace
} //gnash namespace
=== modified file 'libmedia/VideoInput.h'
--- a/libmedia/VideoInput.h 2009-07-17 21:38:26 +0000
+++ b/libmedia/VideoInput.h 2009-07-31 21:06:37 +0000
@@ -34,7 +34,7 @@
public:
- VideoInput() {}
+ VideoInput();
// virtual classes need a virtual destructor !
virtual ~VideoInput() {}
@@ -46,10 +46,7 @@
void setMode(int width, int height, double fps, bool favorArea);
void setQuality(int bandwidth, int quality);
-
- //need to figure out how to properly write this
- //static Camera* getCamera(std::string name);
-
+
//setters and getters
void set_activityLevel(double a) {_activityLevel = a;};
double get_activityLevel () {return _activityLevel;};
@@ -85,16 +82,16 @@
void set_name(std::string name) {_name = name;};
std::string get_name() {return _name;};
-
- //figure out how to implement vector
-
+
+ std::vector<std::string> get_names() {return _names;};
+
void set_quality(int q) {_quality = q;};
int get_quality() {return _quality;};
void set_width(int w) {_width = w;};
int get_width() {return _width;};
-private:
+protected:
//specified in AS livedocs
double _activityLevel;
int _bandwidth;
@@ -111,9 +108,6 @@
std::vector<std::string> _names;
int _quality;
int _width;
-
- //gnash specific
- //std::vector<gst::GnashWebcam*> vid_vect;
};
=== modified file 'libmedia/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp 2009-07-29 22:25:15 +0000
+++ b/libmedia/gst/VideoInputGst.cpp 2009-07-31 21:06:37 +0000
@@ -27,7 +27,7 @@
#include <gst/interfaces/propertyprobe.h>
#include <vector>
#include "rc.h"
-#include "math.h"
+#include <cmath>
namespace {
@@ -42,10 +42,26 @@
//initializes the Gstreamer interface
VideoInputGst::VideoInputGst() {
gst_init(NULL,NULL);
+
+ //actionscript default values
+ _width = 160;
+ _height = 120;
+ _fps = 15;
+
int devSelection;
findVidDevs();
+
+ //enumerate names array for actionscript accessibility
+ int i;
+ for (i=0; i < _vidVect.size(); ++i) {
+ _names.push_back(_vidVect[i]->getProductName());
+ }
+
devSelection = makeWebcamDeviceSelection();
_devSelection = devSelection;
+ //also set _index for actionscript accessibility
+ _index = devSelection;
+
transferToPrivate(devSelection);
webcamCreateMainBin(_globalWebcam);
webcamCreateDisplayBin(_globalWebcam);
@@ -68,7 +84,7 @@
element = gst_element_factory_make ("videotestsrc", "vidtestsrc");
if (element == NULL) {
- log_error("%s: Could not create video test source.\n",
__FUNCTION__);
+ log_error("%s: Could not create video test source.", __FUNCTION__);
_vidVect.push_back(NULL);
_numdevs += 1;
} else {
@@ -98,7 +114,7 @@
g_object_get (element, "device-name", &dev_name, NULL);
gst_element_set_state (element, GST_STATE_NULL);
if (dev_name == "null") {
- log_trace("No v4l video sources. Checking for other vid
inputs\n");
+ log_trace("No v4l video sources. Checking for other vid
inputs");
}
else {
_vidVect.push_back(new GnashWebcam);
@@ -135,7 +151,7 @@
g_object_get (element, "device-name", &dev_name, NULL);
gst_element_set_state (element, GST_STATE_NULL);
if (dev_name == "null") {
- g_print("no v4l2 video sources found.\n");
+ log_trace("no v4l2 video sources found.");
}
else {
_vidVect.push_back(new GnashWebcam);
@@ -231,7 +247,7 @@
gst_value_get_fraction_numerator (fraction_range_max);
denominator_max =
gst_value_get_fraction_denominator (fraction_range_max);
- g_print ("FractionRange: %d/%d - %d/%d\n",
+ log_trace ("FractionRange: %d/%d - %d/%d",
numerator_min, denominator_min, numerator_max,
denominator_max);
video_format->numFramerates =
@@ -279,7 +295,7 @@
gfloat curr_framerate =
(float)(curr_format->highestFramerate.numerator /
curr_format->highestFramerate.denominator);
if (new_framerate > curr_framerate) {
- log_debug("higher framerate replacing existing format\n");
+ log_debug("higher framerate replacing existing format");
*curr_format = *video_format;
}
@@ -307,7 +323,7 @@
rcfile.setWebcamDevice(0);
dev_select = rcfile.getWebcamDevice();
} else {
- log_trace("Camera %d specified in gnashrc file, using that one.\n",
+ log_trace("Camera %d specified in gnashrc file, using that one.",
dev_select);
}
//make sure that the device selected is actually valid
@@ -315,6 +331,10 @@
log_error("You have an invalid camera selected. Please check your
gnashrc file");
exit(EXIT_FAILURE);
} else {
+
+ //set _name value for actionscript
+ _name = _vidVect[dev_select]->getProductName();
+
//now that a selection has been made, get capabilities of that
device
getSelectedCaps(rcfile.getWebcamDevice());
return rcfile.getWebcamDevice();
@@ -529,11 +549,10 @@
gint i;
gchar *resolution;
- resolution = g_strdup_printf("%ix%i", webcam->_xResolution,
- webcam->_yResolution);
+ resolution = g_strdup_printf("%ix%i", _width, _height);
//use these resolutions determined above if the camera supports it
- if (webcam->_xResolution != 0 && webcam->_yResolution != 0) {
+ if (_width != 0 && _height != 0) {
i = GPOINTER_TO_INT(g_hash_table_lookup
(webcam->_webcamDevice->supportedResolutions, resolution));
@@ -603,17 +622,21 @@
format->highestFramerate.denominator);
//debug
- g_print ("GstPipeline command is: %s\n", command);
+ log_debug("GstPipeline command is: %s", command);
webcam->_webcamSourceBin =
gst_parse_bin_from_description (command, TRUE, &error);
if (webcam->_webcamSourceBin == NULL) {
log_error ("%s: Creation of the webcam_source_bin failed",
__FUNCTION__);
- g_print ("the error was %s\n", error->message);
+ log_error ("the error was %s", error->message);
return false;
}
+ //set _currentFps value for actionscript
+ _currentFPS = (format->highestFramerate.numerator /
+ format->highestFramerate.denominator);
+
g_free(command);
webcam->_videoSource =
@@ -633,7 +656,7 @@
gint fNum, fDenom, i, val;
for (i = 0; i < webcam->_currentFormat->numFramerates; ++i) {
- val = ceil(webcam->_currentFormat->framerates[i].numerator /
+ val = std::ceil(webcam->_currentFormat->framerates[i].numerator /
webcam->_currentFormat->framerates[i].denominator);
if (val == fps) {
return true;
@@ -671,11 +694,10 @@
gint i;
gchar *resolution;
- resolution = g_strdup_printf("%ix%i", webcam->_xResolution,
- webcam->_yResolution);
+ resolution = g_strdup_printf("%ix%i", _width, _height);
//use these resolutions determined above if the camera supports it
- if (webcam->_xResolution != 0 && webcam->_yResolution != 0) {
+ if (_width != 0 && _height != 0) {
i = GPOINTER_TO_INT(g_hash_table_lookup
(webcam->_webcamDevice->supportedResolutions, resolution));
@@ -705,13 +727,13 @@
//check here to make sure the fps value is supported (only valid
for
//non test sources)
if (! g_strcmp0(webcam->_webcamDevice->getGstreamerSrc(),
"videotestsrc") == 0) {
- int newFps = webcam->_fps;
+ int newFps = _fps;
if (checkForSupportedFramerate(webcam, newFps)) {
- g_print("checkforsupportedfr returned true\n");
+ log_debug("checkforsupportedfr returned true");
format->highestFramerate.numerator = newFps;
format->highestFramerate.denominator = 1;
} else {
- g_print("checkforsupportedfr returned false\n");
+ log_debug("checkforsupportedfr returned false");
//currently chooses the ActionScript default of 15 fps in
case
//you pass in an unsupported framerate value
@@ -764,19 +786,23 @@
format->highestFramerate.denominator);
//debug
- g_print ("GstPipeline command is: %s\n", command);
+ log_debug ("GstPipeline command is: %s", command);
webcam->_webcamSourceBin =
gst_parse_bin_from_description (command, TRUE, &error);
if (webcam->_webcamSourceBin == NULL) {
log_error ("%s: Creation of the webcam_source_bin failed",
__FUNCTION__);
- g_print ("the error was %s\n", error->message);
+ log_error ("the error was %s", error->message);
return false;
}
g_free(command);
+ //set _currentFps for actionscript
+ _currentFPS = (format->highestFramerate.numerator /
+ format->highestFramerate.denominator);
+
webcam->_videoSource =
gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
"video_source");
@@ -786,7 +812,7 @@
//drop the new source bin back into the main bin
gboolean result;
- result = gst_bin_add(GST_BIN(webcam->_pipeline),
+ result = gst_bin_add(GST_BIN(webcam->_webcamMainBin),
webcam->_webcamSourceBin);
if (result != true) {
log_error("%s: couldn't drop the sourcebin back into the
main bin",
@@ -892,7 +918,6 @@
log_error("%s: Unable to create main pipeline", __FUNCTION__);
return false;
}
-
return true;
}
@@ -927,10 +952,6 @@
//add created elements to a bin
gst_bin_add_many (GST_BIN (webcam->_videoDisplayBin), video_scale,
video_sink, NULL);
- //drop the display bin into the pipeline
- //gst_bin_add (GST_BIN (webcam->_webcamMainBin),
webcam->_videoDisplayBin);
- //gst_bin_add (GST_BIN (webcam->_pipeline), webcam->_videoDisplayBin);
-
ok = gst_element_link_many(video_scale, video_sink, NULL);
if (ok != true) {
log_error("%s: something went wrong in linking elements in
video_display_bin",
@@ -1147,8 +1168,7 @@
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_EOS:
- log_trace ("End of stream\n");
- g_main_loop_quit (((class GnashWebcamPrivate *)data)->_loop);
+ log_trace ("End of stream");
break;
case GST_MESSAGE_ERROR: {
@@ -1158,10 +1178,9 @@
gst_message_parse_error (msg, &error, &debug);
g_free (debug);
- g_printerr ("Error: %s\n", error->message);
+ log_error ("Error: %s", error->message);
g_error_free (error);
- g_main_loop_quit (((class GnashWebcamPrivate *)data)->_loop);
break;
}
default:
@@ -1183,7 +1202,6 @@
ret = gst_bus_add_watch (bus, bus_call, webcam);
gst_object_unref (bus);
- //tfthen = gst_util_get_timestamp ();
state = gst_element_set_state (webcam->_pipeline,
GST_STATE_PLAYING);
if (state != GST_STATE_CHANGE_FAILURE) {
=== modified file 'libmedia/gst/VideoInputGst.h'
--- a/libmedia/gst/VideoInputGst.h 2009-07-29 22:25:15 +0000
+++ b/libmedia/gst/VideoInputGst.h 2009-07-31 21:06:37 +0000
@@ -266,38 +266,6 @@
/// @param n A gchar* describing the name of the hardware device
/// (e.g. Built-In Webcam or Microsoft LifeCam VX500).
void setDeviceName(gchar *n) {_deviceName = n;}
-
- /// \brief Accessor to set the private _xResolution variable in the
- /// GnashWebcamPrivate class.
- /// @param r The desired X Resolution value
- void setXResolution(int r) {_xResolution = r;}
-
- /// \brief Accessor to get the private _xResolution variable in the
- /// GnashWebcamPrivate class.
- /// @return The integer value of the _xResolution variable
- int getXResolution() {return _xResolution;}
-
- /// \brief Accessor to set the private _yResolution variable in the
- /// GnashWebcamPrivate class.
- /// @param r The desired Y Resolution value
- void setYResolution(int r) {_yResolution = r;}
-
- /// \brief Accessor to get the private _yResolution variable in the
- /// GnashWebcamPrivate class.
- /// @return The integer value of the _yResolution variable
- int getYResolution() {return _yResolution;}
-
- /// \brief Accessor to set the private _fps variable in the
- /// GnashWebcamPrivate class.
- /// @param f The desired frames per second variable. If the camera
- /// doesn't support the framerate, another will be chosen from
- /// an array of available framerates
- void setFps(int f) {_fps = f;}
-
- /// \brief Accessor to get the private _fps variable in the
- /// GnashWebcamPrivate class.
- /// @return The integer _fps value stored in the GnashWebcamPrivate
class
- int getFps() {return _fps;}
//FIXME: this should eventually be a private or protected data field
//protected:
@@ -398,31 +366,10 @@
/// hardware.
GnashWebcam *_webcamDevice;
- /// \var GnashWebcamPrivate::_xResolution
- /// \brief Contains the integer x_resolution variable (the first
- /// value when resolution is written as INTxINT)
- gint _xResolution;
-
- /// \var GnashWebcamPrivate::_yResolution
- /// \brief Contains the integer y_resolution variable (the second
- /// value when resolution is written as INTxINT)
- gint _yResolution;
-
- /// \var GnashWebcamPrivate::_fps
- /// \brief Contains the integer value of the desired frames per second
- /// value.
- gint _fps;
-
/// \var GnashWebcamPrivate::_currentFormat
/// \brief Contains a pointer to the WebcamVidFormat data structure
/// selected to be used with this pipeline.
WebcamVidFormat *_currentFormat;
-
- /// \var GnashWebcamPrivate::_loop
- /// \brief Contains a pointer to a GMainLoop which runs to keep
- /// Gstreamer capturing information from the raw data
- /// stream coming in from the hardware input device.
- GMainLoop *_loop;
/// \var GnashWebcamPrivate::_eosTimeoutId
/// \brief This variable is not currently used, but will eventually
@@ -446,15 +393,8 @@
_deviceName = NULL;
- _loop = g_main_loop_new(NULL, false);
-
_pipelineIsPlaying = false;
-
- //these default values are per the AS livedocs defaults
- _xResolution = 160;
- _yResolution = 120;
- _fps = 15;
-
+
_currentFormat = NULL;
_eosTimeoutId = 0;
};
=== modified file 'testsuite/libmedia.all/test_audioinput.cpp'
--- a/testsuite/libmedia.all/test_audioinput.cpp 2009-07-28 18:37:36
+0000
+++ b/testsuite/libmedia.all/test_audioinput.cpp 2009-07-31 21:06:37
+0000
@@ -320,6 +320,34 @@
} else {
runtest.fail("there's no output audio file in testsuite/libmedia.all");
}
+
+ ok = aud.audioPlay(audio);
+ if (ok != true) {
+ runtest.fail("audioPlay() reported an error");
+ } else {
+ runtest.pass("audioPlay() reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 10 seconds here....\n");
+ sleep(10);
+
+ ok = aud.audioStop(audio);
+ if (ok != true) {
+ runtest.fail("audioStop() reported an error");
+ } else {
+ runtest.pass("audioStop() reported no errors");
+ }
+
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.pass("audioOut.ogg file is in testsuite/libmedia.all");
+ if (st.st_blocks == 0) {
+ runtest.xfail("the output file is there, but there's no data in
it!");
+ } else {
+ runtest.pass("the output file has data in it");
+ }
+ } else {
+ runtest.fail("there's no output audio file in testsuite/libmedia.all");
+ }
}
=== modified file 'testsuite/libmedia.all/test_videoinput.cpp'
--- a/testsuite/libmedia.all/test_videoinput.cpp 2009-07-30 21:34:40
+0000
+++ b/testsuite/libmedia.all/test_videoinput.cpp 2009-07-31 21:12:01
+0000
@@ -57,10 +57,10 @@
{
//create a test class, call constructor
gst::VideoInputGst vig;
- vig.findVidDevs();
-
+
+ vig.findVidDevs();
std::vector<GnashWebcam*> *vid_vect = vig.getVidVect();
-
+
if (vid_vect->empty() == true) {
runtest.fail("the video vector was not created by
find_vid_devs");
} else {
@@ -391,6 +391,288 @@
} else {
runtest.fail("there's no new vidoutput.ogg file!");
}
+ //delete the old vidoutput.ogg file
+ if (unlink(file.c_str()) == 0) {
+ g_print(" NOTE: deleting output file...\n");
+ }
+
+ //end unit tests
+
+ //tests more similar to execution flow
+ gst::VideoInputGst *video = new VideoInputGst;
+ if (video == NULL) {
+ runtest.fail("new VideoInputGst didn't work");
+ } else {
+ runtest.pass("new VideoInputGst returned a value");
+ }
+
+ //get global webcam reference for use below
+ GnashWebcamPrivate *global;
+ global = video->getGlobalWebcam();
+ if (global == NULL) {
+ runtest.fail("couldn't get a globalwebcam video reference");
+ } else {
+ runtest.pass("got a globalWebcam reference");
+ }
+
+ if (global->_pipeline == NULL) {
+ runtest.fail("video->_globalWebcam->_pipeline isn't there");
+ } else {
+ runtest.pass("video->_globalWebcam->_pipeline is initialized");
+ }
+ if (global->_webcamSourceBin == NULL) {
+ runtest.fail("webcamSourceBin isn't there");
+ } else {
+ runtest.pass("webcamSourceBin was made by the initializer");
+ }
+ if (global->_webcamMainBin == NULL) {
+ runtest.fail("webcamMainBin isn't there");
+ } else {
+ runtest.pass("webcamMainBin was made by the initializer");
+ }
+ if (global->_videoDisplayBin == NULL) {
+ runtest.fail("videoDisplayBin isn't there");
+ } else {
+ runtest.pass("videoDisplayBin was made by the initializer");
+ }
+ if (global->_videoSaveBin == NULL) {
+ runtest.fail("videoSaveBin isn't there");
+ } else {
+ runtest.pass("videoSaveBin was made by the initializer");
+ }
+
+ result = video->webcamMakeVideoDisplayLink(global);
+ if (result != true) {
+ runtest.fail("webcamMakeVideoDisplayLink reported errors");
+ } else {
+ runtest.pass("webcamMakeVideoDisplayLink reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+
+ g_print(" NOTE: changing values (display window should be
bigger)....\n");
+ video->set_fps(30);
+ video->set_width(800);
+ video->set_height(600);
+ result = video->webcamChangeSourceBin(global);
+ if (result != true) {
+ runtest.fail("webcamChangeSourceBin reported an error");
+ } else {
+ runtest.pass("webcamChangeSourceBin reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+
+ result = video->webcamMakeVideoSaveLink(global);
+ if (result != true) {
+ runtest.fail("webcamMakeVideoSaveLink reported errors");
+ } else {
+ runtest.pass("webcamMakeVideoSaveLink reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.pass("the a new vidoput.ogg file was created");
+ } else {
+ runtest.fail("there's no new vidoutput.ogg file!");
+ }
+ //delete the old vidoutput.ogg file
+ if (unlink(file.c_str()) == 0) {
+ g_print(" NOTE: deleting output file...\n");
+ }
+
+ result = video->webcamBreakVideoDisplayLink(global);
+ if (result != true) {
+ runtest.fail("webcamBreakVideoDisplayLink reported errors");
+ } else {
+ runtest.pass("webcamBreakVideoDisplayLink reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.pass("the a new vidoput.ogg file was created");
+ } else {
+ runtest.fail("there's no new vidoutput.ogg file!");
+ }
+
+ //delete the old vidoutput.ogg file
+ if (unlink(file.c_str()) == 0) {
+ g_print(" NOTE: deleting output file...\n");
+ }
+
+ result = video->webcamMakeVideoDisplayLink(global);
+ if (result != true) {
+ runtest.fail("webcamMakeVideoDisplayLink failed after breaking the
link");
+ } else {
+ runtest.pass("webcamMakeVideoDisplayLink reported no errors");
+ }
+
+ result = video->webcamBreakVideoSaveLink(global);
+ if (result != true) {
+ runtest.fail("webcamBreakVideoSaveLink function reported errors");
+ } else {
+ runtest.pass("webcamBreakVideoSaveLink function reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.fail("a vidoutput.ogg file was created, and it shouldn't be");
+ } else {
+ runtest.pass("no vidoutput.ogg file wasn't created");
+ }
+
+ //pass bad values
+ g_print(" NOTE: changing values to bad vals....\n");
+ video->set_fps(200);
+ video->set_width(8000);
+ video->set_height(6000);
+ result = video->webcamChangeSourceBin(global);
+ if (result != true) {
+ runtest.fail("webcamChangeSourceBin reported an error");
+ } else {
+ runtest.pass("webcamChangeSourceBin reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.fail("a vidoutput.ogg file was created, and it shouldn't be");
+ } else {
+ runtest.pass("no vidoutput.ogg file wasn't created");
+ }
+
+ //reset to good vals
+ g_print(" NOTE: changing back to legit vals....\n");
+ video->set_fps(30);
+ video->set_width(320);
+ video->set_height(240);
+
+ result = video->webcamMakeVideoSaveLink(global);
+ if (result != true) {
+ runtest.fail("webcamMakeVideoSaveLink reported an error");
+ } else {
+ runtest.pass("webcamMakeVideoSaveLink reported no errors");
+ }
+ result = video->webcamChangeSourceBin(global);
+ if (result != true) {
+ runtest.fail("webcamChangeSourceBin reported an error");
+ } else {
+ runtest.pass("webcamChangeSourceBin reported no errors");
+ }
+
+ result = video->webcamPlay(global);
+ if (result != true) {
+ runtest.fail("webcamPlay reported errors");
+ } else {
+ runtest.pass("webcamPlay reported no errors");
+ }
+
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ result = video->webcamStop(global);
+ if (result != true) {
+ runtest.fail("webcamStop reported errors");
+ } else {
+ runtest.pass("webcamStop reported no errors");
+ }
+
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.pass("the a new vidoput.ogg file was created");
+ } else {
+ runtest.fail("there's no new vidoutput.ogg file!");
+ }
}
=== modified file 'testsuite/misc-haxe.all/classes.all/media/Camera_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx 2009-07-29
22:25:15 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx 2009-07-31
21:06:37 +0000
@@ -39,6 +39,10 @@
// Class must be named with the PP prefix, as that's the name the
// file passed to haxe will have after the preprocessing step
class Camera_as {
+ static function typeof(thing:Dynamic) {
+ return ("" + untyped __typeof__(thing));
+ }
+
static function main() {
#if flash9
var x1:Camera = Camera.getCamera();
@@ -118,7 +122,7 @@
if (Type.typeof(x1.name) == ValueType.TObject) {
DejaGnu.pass("Camera::name property exists");
} else {
- DejaGnu.xfail("Camera::name property doesn't exist");
+ DejaGnu.fail("Camera::name property doesn't exist");
}
if (Type.typeof(x1.quality) == ValueType.TInt) {
DejaGnu.pass("Camera::quality property exists");
@@ -132,83 +136,68 @@
}
#end
#if !flash9
- if (Type.typeof(x1.activityLevel) == ValueType.TFloat) {
+ if (typeof(x1.activityLevel) == "number") {
DejaGnu.pass("Camera::activityLevel property exists");
} else {
- DejaGnu.xfail("Camera::activityLevel property doesn't exist");
+ DejaGnu.fail("Camera::activityLevel property doesn't exist");
}
- if (Type.typeof(x1.bandwidth) == ValueType.TInt) {
+ if (typeof(x1.bandwidth) == "number") {
DejaGnu.pass("Camera::bandwidth property exists");
} else {
- DejaGnu.xfail("Camera::bandwidth property doesn't exist");
+ DejaGnu.fail("Camera::bandwidth property doesn't exist");
}
- if (Type.typeof(x1.currentFps) == ValueType.TFloat) {
+ if (typeof(x1.currentFps) == "number") {
DejaGnu.pass("Camera::currentFPS property exists");
} else {
- DejaGnu.xfail("Camera::currentFPS property doesn't exist");
+ DejaGnu.fail("Camera::currentFPS property doesn't exist");
}
- if (Type.typeof(x1.fps) == ValueType.TFloat) {
+ if (typeof(x1.fps) == "number") {
DejaGnu.pass("Camera::fps property exists");
} else {
- DejaGnu.xfail("Camera::fps property doesn't exist");
+ DejaGnu.fail("Camera::fps property doesn't exist");
}
- if (Type.typeof(x1.height) == ValueType.TFloat) {
+ if (typeof(x1.height) == "number") {
DejaGnu.pass("Camera::height property exists");
} else {
- DejaGnu.xfail("Camera::height property doesn't exist");
+ DejaGnu.fail("Camera::height property doesn't exist");
}
- //FIXME: it would be nice to check that this is returning the
- //proper string
- if (Type.typeof(x1.index) == ValueType.TObject) {
+ if (typeof(x1.index) == "number") {
DejaGnu.pass("Camera::index property exists");
} else {
- DejaGnu.xfail("Camera::index property doesn't exist");
- }
- if (Type.typeof(x1.keyFrameInterval) == ValueType.TFloat) {
- DejaGnu.pass("Camera::keyFrameInterval property exists");
- } else {
- DejaGnu.xfail("Camera::keyFrameInterval property doesn't exist");
- }
- if (x1.loopback == (false||true)) {
- DejaGnu.pass("Camera::loopback property exists");
- } else {
- DejaGnu.xfail("Camera::loopback property doesn't exist");
- }
- if (Type.typeof(x1.motionLevel) == ValueType.TFloat) {
+ DejaGnu.fail("Camera::index property doesn't exist");
+ }
+ if (typeof(x1.motionLevel) == "number") {
DejaGnu.pass("Camera::motionLevel property exists");
} else {
- DejaGnu.xfail("Camera::motionLevel property doesn't exist");
+ DejaGnu.fail("Camera::motionLevel property doesn't exist");
}
- if (x1.muted == (false || true)) {
+ if (typeof(x1.muted) == "boolean") {
DejaGnu.pass("Camera::muted property exists");
} else {
- DejaGnu.xfail("Camera::muted property doesn't exist");
+ DejaGnu.fail("Camera::muted property doesn't exist");
}
-// FIXME: this returns an array
-// if (x1.names == 0) {
-// DejaGnu.pass("Camera::names property exists");
-// } else {
-// DejaGnu.fail("Camera::names property doesn't exist");
-// }
- if (Type.typeof(x1.quality) == ValueType.TFloat) {
+ if (typeof(x1.name) == "string") {
+ DejaGnu.pass("Camera::name property exists");
+ } else {
+ DejaGnu.fail("Camera::name property doesn't exist");
+ }
+
+ if (typeof(x1.quality) == "number") {
DejaGnu.pass("Camera::quality property exists");
} else {
- DejaGnu.xfail("Camera::quality property doesn't exist");
+ DejaGnu.fail("Camera::quality property doesn't exist");
}
- if (Type.typeof(x1.width) == ValueType.TFloat) {
+ if (typeof(x1.width) == "number") {
DejaGnu.pass("Camera::width property exists");
} else {
- DejaGnu.xfail("Camera::width property doesn't exist");
+ DejaGnu.fail("Camera::width property doesn't exist");
}
+
+ x1.setMode(800, 600, 30);
#end
// Tests to see if all the methods exist. All these do is test for
// existance of a method, and don't test the functionality at all. This
// is primarily useful only to test completeness of the API implementation.
-// if (flash.media.Camera.getCamera() == Camera) {
-// DejaGnu.pass("Camera::getCamera() method exists");
-// } else {
-// DejaGnu.fail("Camera::getCamera() method doesn't exist");
-// }
#if flash9
if (Type.typeof(x1.setKeyFrameInterval) == ValueType.TFunction) {
DejaGnu.pass("Camera::setKeyFrameInterval() method exists");
@@ -238,11 +227,6 @@
//FIXME: we should add tests to check that Events in this class are
//being properly handled.
- var vid:Video = new Video(x1.width, x1.height);
- vid.x = 10;
- vid.y = 10;
- vid.attachCamera(x1);
-
#end
// Call this after finishing all tests. It prints out the totals.
DejaGnu.done();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11359: completed basic implementation of Camera actionscript class. Still some work to be done, testsuites now pass instead of xfail,
Ben Limmer <=