[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11365: completed Camera_as and Micr
From: |
Ben Limmer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11365: completed Camera_as and Microphone_as basic implementation |
Date: |
Tue, 04 Aug 2009 11:48:09 -0600 |
User-agent: |
Bazaar (1.16.1) |
------------------------------------------------------------
revno: 11365 [merge]
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Tue 2009-08-04 11:48:09 -0600
message:
completed Camera_as and Microphone_as basic implementation
added:
libmedia/AudioInput.cpp
modified:
configure.ac
libcore/asobj/flash/media/Camera_as.cpp
libcore/asobj/flash/media/Microphone_as.cpp
libmedia/AudioInput.h
libmedia/Makefile.am
libmedia/VideoInput.cpp
libmedia/VideoInput.h
libmedia/gst/AudioInputGst.cpp
libmedia/gst/AudioInputGst.h
libmedia/gst/VideoInputGst.cpp
testsuite/libmedia.all/test_audioinput.cpp
testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
=== modified file 'configure.ac'
--- a/configure.ac 2009-08-04 17:39:22 +0000
+++ b/configure.ac 2009-08-04 17:48:09 +0000
@@ -1477,6 +1477,7 @@
dnl on most machines without it. While it isn't diretly used by Gnash at all,
dnl it's to work around an Ubuntu packaging bug.
AC_CHECK_LIB(lber, ber_free)
+AC_CHECK_LIB(bz2, BZ2_bzopen)
AC_CHECK_LIB(c, getpwnam, AC_DEFINE(HAVE_GETPWNAM, 1, [Has getpwnam] ))
dnl X11 is needed for fltk (at least),
=== modified file 'libcore/asobj/flash/media/Camera_as.cpp'
--- a/libcore/asobj/flash/media/Camera_as.cpp 2009-07-31 21:06:37 +0000
+++ b/libcore/asobj/flash/media/Camera_as.cpp 2009-08-04 17:46:54 +0000
@@ -29,6 +29,7 @@
#include "smart_ptr.h" // for boost intrusive_ptr
#include "builtin_function.h" // need builtin_function
#include "Object.h" // for getObjectInterface
+#include "Array_as.h"
#ifdef USE_GST
#include "gst/VideoInputGst.h"
@@ -57,7 +58,7 @@
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_names(const fn_call& fn);
as_value camera_quality(const fn_call& fn);
as_value camera_width(const fn_call& fn);
@@ -69,9 +70,9 @@
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));
+ 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);
@@ -96,8 +97,8 @@
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_names);
+ o.init_property("names", *getset, *getset);
getset = gl->createFunction(camera_quality);
o.init_property("quality", *getset, *getset);
getset = gl->createFunction(camera_width);
@@ -180,10 +181,6 @@
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;
@@ -247,14 +244,93 @@
return as_value();
}
as_value
-camera_setmotionlevel(const fn_call& /*fn*/) {
- log_unimpl (__FUNCTION__);
+camera_setmotionlevel(const fn_call& fn) {
+ log_unimpl ("Camera::motionLevel can be set, but it's not implemented");
+ boost::intrusive_ptr<camera_as_object> ptr = ensureType<camera_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ if (numargs > 2) {
+ log_error("%s: Too many arguments", __FUNCTION__);
+ } else {
+ switch (numargs) {
+ case 0:
+ log_debug("%s: no args passed, using defaults", __FUNCTION__);
+ if (ptr->get_motionLevel() != 50) {
+ ptr->set_motionLevel(50);
+ }
+ if (ptr->get_motionTimeout() != 2000) {
+ ptr->set_motionTimeout(2000);
+ }
+ break;
+ case 1:
+ {
+ double argument = fn.arg(0).to_number();
+ if ((argument >= 0) && (argument <= 100)) {
+ ptr->set_motionLevel(argument);
+ } else {
+ log_error("%s: bad value passed for first argument",
__FUNCTION__);
+ }
+ if (ptr->get_motionTimeout() != 2000) {
+ ptr->set_motionTimeout(2000);
+ }
+ break;
+ }
+ case 2:
+ {
+ double argument1 = fn.arg(0).to_number();
+ if ((argument1 >= 0) && (argument1 <= 100)) {
+ ptr->set_motionLevel(argument1);
+ } else {
+ log_error("%s: bad value passed for first argument",
__FUNCTION__);
+ }
+ ptr->set_motionTimeout(fn.arg(1).to_number());
+ break;
+ }
+ }
+ }
return as_value();
}
-as_value
-camera_setquality(const fn_call& /*fn*/) {
- log_unimpl (__FUNCTION__);
+as_value
+camera_setquality(const fn_call& fn) {
+ log_unimpl ("Camera::quality can be set, but it's not implemented");
+ boost::intrusive_ptr<camera_as_object> ptr = ensureType<camera_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ if (numargs > 2) {
+ log_error("%s: Too many arguments", __FUNCTION__);
+ } else {
+ switch (numargs) {
+ case 0:
+ log_debug("%s: No arguments passed, using defaults",
__FUNCTION__);
+ if (ptr->get_bandwidth() != 16384) {
+ ptr->set_bandwidth(16384);
+ }
+ if (ptr->get_quality() != 0) {
+ ptr->set_quality(0);
+ }
+ break;
+ case 1:
+ ptr->set_bandwidth(fn.arg(0).to_number());
+ if (ptr->get_quality() != 0) {
+ ptr->set_quality(0);
+ }
+ break;
+ case 2:
+ {
+ double argument2 = fn.arg(1).to_number();
+ ptr->set_bandwidth(fn.arg(0).to_number());
+ if ((argument2 <= 0) && (argument2 >= 100)) {
+ ptr->set_quality(fn.arg(1).to_number());
+ } else {
+ log_error("%s: Second argument not in range 0-100",
__FUNCTION__);
+ }
+ break;
+ }
+ }
+ }
return as_value();
}
as_value
@@ -264,9 +340,7 @@
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
{
@@ -284,9 +358,7 @@
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
{
@@ -304,9 +376,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_currentFPS());
-#endif
}
else // setter
{
@@ -325,9 +395,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_currentFPS());
-#endif
}
else // setter
{
@@ -345,9 +413,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_fps());
-#endif
}
else // setter
{
@@ -365,9 +431,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_height());
-#endif
}
else // setter
{
@@ -385,9 +449,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_index());
-#endif
}
else // setter
{
@@ -406,9 +468,7 @@
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
{
@@ -427,9 +487,7 @@
if ( fn.nargs == 0 ) // getter
{
log_unimpl("Camera::motionTimeout");
-#ifdef USE_GST
return as_value(ptr->get_motionTimeout());
-#endif
}
else // setter
{
@@ -448,9 +506,7 @@
if ( fn.nargs == 0 ) // getter
{
log_unimpl("Camera::muted");
-#ifdef USE_GST
return as_value(ptr->get_muted());
-#endif
}
else // setter
{
@@ -468,9 +524,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_name());
-#endif
}
else // setter
{
@@ -482,8 +536,6 @@
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);
@@ -493,16 +545,18 @@
vect = ptr->get_names();
int size = vect.size();
- std::string data[size];
+
+ boost::intrusive_ptr<Array_as> data = new Array_as;
+
+ //std::string data[size];
int i;
for (i = 0; i < size; ++i) {
- data[i] = vect[i];
+ data->push(vect[i]);
}
if ( fn.nargs == 0 ) // getter
{
- log_trace("holld.....");
- return as_value(data);
+ return as_value(data.get());
}
else // setter
{
@@ -513,7 +567,7 @@
return as_value();
}
-*/
+
as_value
camera_quality(const fn_call& fn) {
@@ -522,9 +576,7 @@
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
{
@@ -542,9 +594,7 @@
if ( fn.nargs == 0 ) // getter
{
-#ifdef USE_GST
return as_value(ptr->get_width());
-#endif
}
else // setter
{
@@ -571,9 +621,9 @@
//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_getCamera, getCameraInterface());
+ } else {
cl = gl->createClass(&camera_get, getCameraInterface());
- } else {
- cl = gl->createClass(&camera_getCamera, getCameraInterface());
}
attachCameraInterface(*cl);
=== modified file 'libcore/asobj/flash/media/Microphone_as.cpp'
--- a/libcore/asobj/flash/media/Microphone_as.cpp 2009-07-29 05:40:20
+0000
+++ b/libcore/asobj/flash/media/Microphone_as.cpp 2009-08-04 17:46:54
+0000
@@ -29,25 +29,68 @@
#include "smart_ptr.h" // for boost intrusive_ptr
#include "builtin_function.h" // need builtin_function
#include "Object.h" // for getObjectInterface
+#include "Array_as.h"
+
+#ifdef USE_GST
+#include "gst/AudioInputGst.h"
+#endif
+
+#ifdef USE_FFMPEG
+#include "AudioInput.h"
+#endif
namespace gnash {
as_value microphone_get(const fn_call& fn);
+as_value microphone_getMicrophone(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);
+as_value microphone_activityLevel(const fn_call& fn);
+as_value microphone_gain(const fn_call& fn);
+as_value microphone_index(const fn_call& fn);
+as_value microphone_muted(const fn_call& fn);
+as_value microphone_name(const fn_call& fn);
+as_value microphone_names(const fn_call& fn);
+as_value microphone_rate(const fn_call& fn);
+as_value microphone_silenceLevel(const fn_call& fn);
+as_value microphone_silenceTimeout(const fn_call& fn);
+as_value microphone_useEchoSuppression(const fn_call& fn);
static void
attachMicrophoneInterface(as_object& o)
{
Global_as* gl = getGlobal(o);
+ boost::intrusive_ptr<builtin_function> getset;
+
o.init_member("get", gl->createFunction(microphone_get));
+ o.init_member("getMicrophone",
gl->createFunction(microphone_getMicrophone));
o.init_member("setGain", gl->createFunction(microphone_setgain));
o.init_member("setRate", gl->createFunction(microphone_setrate));
o.init_member("setSilenceLevel",
gl->createFunction(microphone_setsilencelevel));
o.init_member("setUseEchoSuppression",
gl->createFunction(microphone_setuseechosuppression));
+
+ getset = gl->createFunction(microphone_activityLevel);
+ o.init_property("activityLevel", *getset, *getset);
+ getset = gl->createFunction(microphone_gain);
+ o.init_property("gain", *getset, *getset);
+ getset = gl->createFunction(microphone_index);
+ o.init_property("index", *getset, *getset);
+ getset = gl->createFunction(microphone_muted);
+ o.init_property("muted", *getset, *getset);
+ getset = gl->createFunction(microphone_name);
+ o.init_property("name", *getset, *getset);
+ getset = gl->createFunction(microphone_names);
+ o.init_property("names", *getset, *getset);
+ getset = gl->createFunction(microphone_rate);
+ o.init_property("rate", *getset, *getset);
+ getset = gl->createFunction(microphone_silenceLevel);
+ o.init_property("silenceLevel", *getset, *getset);
+ getset = gl->createFunction(microphone_silenceTimeout);
+ o.init_property("silenceTimeOut", *getset, *getset);
+ getset = gl->createFunction(microphone_useEchoSuppression);
+ o.init_property("useEchoSuppression", *getset, *getset);
}
static as_object*
@@ -62,50 +105,360 @@
return o.get();
}
-class microphone_as_object: public as_object
-{
-
-public:
-
- 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
+#ifdef USE_GST
+class microphone_as_object: public as_object, public media::gst::AudioInputGst
+{
+
+public:
+
+ 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; }
+};
+#endif
+
+#ifdef USE_FFMPEG
+class microphone_as_object: public as_object, public media::AudioInput
+{
+
+public:
+
+ 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; }
+};
+#endif
+
+//as2 ctor
+as_value
+microphone_get(const fn_call& fn) {
+ boost::intrusive_ptr<as_object> obj = new microphone_as_object;
+
+ int numargs = fn.nargs;
+ if (numargs > 0) {
+ log_debug("%s: the mic is automatically chosen from gnashrc",
__FUNCTION__);
+ }
+ return as_value(obj.get()); //will keep alive
+}
+
+//as3 ctor
+as_value
+microphone_getMicrophone(const fn_call& fn) {
+ boost::intrusive_ptr<as_object> obj = new microphone_as_object;
+
+ int numargs = fn.nargs;
+ if (numargs > 0) {
+ log_debug("%s: the mic is automatically chosen from gnashrc",
__FUNCTION__);
+ }
+ return as_value(obj.get()); //will keep alive
+}
+
+
+as_value
+microphone_setgain(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ if (numargs != 1) {
+ log_error("%s: wrong number of parameters passed", __FUNCTION__);
+ } else {
+#ifdef USE_GST
+ //gstreamer's gain values can be between -60 and 60, whereas
actionscript
+ //uses values between 0 and 100. this conversion is made here and the
proper
+ //value is passed to gstreamer. so, plug the argument into this
equation
+ //and then send the new value for use with gstreamer
+ const int32_t argument = fn.arg(0).to_int();
+ ptr->set_gain((argument - 50) * 1.2);
+ ptr->audioChangeSourceBin(ptr->getGlobalAudio());
+#endif
+#ifdef USE_FFMPEG
+ //haven't yet implemented FFMPEG support for this, so we might need to
do
+ //a conversion similar to the one above for Gstreamer
+ ptr->set_gain(fn.arg(0).to_int());
+#endif
+ }
+ return as_value();
+}
+
+
+as_value
+microphone_setrate(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ const int32_t argument = fn.arg(0).to_int();
+
+ if (numargs != 1) {
+ log_error("%s: wrong number of parameters passed", __FUNCTION__);
+ } else if ((argument != 5) || (argument != 8) || (argument != 11) ||
+ (argument != 22) || (argument != 44)) {
+ log_error("%s: invalid rate argument (%d) passed", fn.arg(0).to_int(),
+ __FUNCTION__);
+ } else {
+ int32_t gstarg = argument * 1000;
+ ptr->set_rate(gstarg);
+#ifdef USE_GST
+ ptr->audioChangeSourceBin(ptr->getGlobalAudio());
+#endif
+ }
+ return as_value();
+}
+
+as_value
+microphone_activityLevel(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Microphone::activityLevel only has default value (-1)");
+ return as_value(ptr->get_activityLevel());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set activity property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_gain(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(ptr->get_gain());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set gain property of Microphone, use
setGain()"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_index(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(ptr->get_index());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set index property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_muted(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Microphone::muted is always false (always allows access)");
+ return as_value(ptr->get_muted());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set muted property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_name(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(ptr->get_name());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set name property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+
+as_value
+microphone_names(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ //transfer from internal vector to AS array
+ std::vector<std::string> vect;
+ vect = ptr->get_names();
+
+ int size = vect.size();
+
+ boost::intrusive_ptr<Array_as> data = new Array_as;
+
+ int i;
+ for (i=0; i < size; ++i) {
+ data->push(vect[i]);
+ }
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(data.get());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set names property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+
+as_value
+microphone_rate(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ return as_value(ptr->get_rate());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set rate property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_silenceLevel(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Microphone::silenceLevel only has default value");
+ return as_value(ptr->get_silenceLevel());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set silenceLevel property of Microphone, use
setSilenceLevel"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_silenceTimeout(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Microphone::silenceTimeout has only default values");
+ return as_value(ptr->get_silenceTimeout());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set silenceTimeout property of Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+as_value
+microphone_useEchoSuppression(const fn_call& fn) {
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ if ( fn.nargs == 0 ) // getter
+ {
+ log_unimpl("Microphone::useEchoSuppression has only default value");
+ return as_value(ptr->get_useEchoSuppression());
+ }
+ else // setter
+ {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror(_("Attempt to set useEchoSuppression property of
Microphone"));
+ );
+ }
+
+ return as_value();
+}
+
+
+as_value
+microphone_setsilencelevel(const fn_call& fn) {
+ log_unimpl ("Microphone::setSilenceLevel can be set, but it's not
implemented");
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ if (numargs > 1) {
+ log_error("%s: Too many arguments", __FUNCTION__);
+ } else {
+ ptr->set_silenceLevel(fn.arg(0).to_number());
+ }
+ return as_value();
+}
+
+as_value
+microphone_setuseechosuppression(const fn_call& fn) {
+ log_unimpl ("Microphone::setUseEchoSuppression can be set, but it's not
implemented");
+ boost::intrusive_ptr<microphone_as_object> ptr =
ensureType<microphone_as_object>
+ (fn.this_ptr);
+
+ int numargs = fn.nargs;
+ if (numargs > 1) {
+ log_error("%s: Too many arguments", __FUNCTION__);
+ } else {
+ ptr->set_useEchoSuppression(fn.arg(0).to_bool());
+ }
+ return as_value();
}
// extern (used by Global.cpp)
@@ -118,8 +471,14 @@
{
Global_as* gl = getGlobal(where);
as_object* proto = getMicrophoneInterface();
- cl = gl->createClass(µphone_ctor, proto);
- // replicate all interface to class, to be able to access
+
+ if (isAS3(getVM(where))) {
+ cl = gl->createClass(µphone_getMicrophone, proto);
+ } else {
+ cl = gl->createClass(µphone_get, proto);
+ }
+
+ // replicate all interface to class, to be able to access
// all methods as static functions
attachMicrophoneInterface(*cl);
}
=== added file 'libmedia/AudioInput.cpp'
--- a/libmedia/AudioInput.cpp 1970-01-01 00:00:00 +0000
+++ b/libmedia/AudioInput.cpp 2009-08-04 17:46:54 +0000
@@ -0,0 +1,36 @@
+// AudioInput.cpp: Audio input base class source file.
+//
+// Copyright (C) 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
+// the Free Software Foundation; either version 3 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
+
+#include "AudioInput.h"
+
+namespace gnash {
+namespace media {
+
+ //constructor
+ AudioInput::AudioInput() {
+ //actionscript default values
+ _rate = 8000;
+ _activityLevel = -1;
+ _gain = 50;
+ _silenceLevel = 10;
+ _silenceTimeout = 2000; //in milliseconds
+ _useEchoSuppression = false;
+ }
+
+} //media namespace
+} //gnash namespace
=== modified file 'libmedia/AudioInput.h'
--- a/libmedia/AudioInput.h 2009-07-13 21:12:51 +0000
+++ b/libmedia/AudioInput.h 2009-08-04 17:46:54 +0000
@@ -30,20 +30,11 @@
public:
- AudioInput() {}
+ AudioInput();
// virtual classes need a virtual destructor !
virtual ~AudioInput() {}
- //need to figure out how to properly write this
- //static Microphone* getMicrophone(std::string name)
-
- void setLoopBack(bool state);
-
- void setSilenceLevel(double silenceLevel, int timeout);
-
- void setUseEchoSuppression(bool useEchoSuppression);
-
//setters and getters
void set_activityLevel(double a) {_activityLevel = a; };
double get_activityLevel() {return _activityLevel;};
@@ -60,7 +51,7 @@
void set_name(std::string name) {_name = name;};
std::string get_name() {return _name;};
- //figure out vector setter and getter
+ std::vector<std::string> get_names() {return _names;}
void set_rate(int r) {_rate = r;};
int get_rate() {return _rate;};
@@ -74,7 +65,7 @@
void set_useEchoSuppression(bool e) {_useEchoSuppression = e;};
bool get_useEchoSuppression() {return _useEchoSuppression;};
-private:
+protected:
double _activityLevel;
double _gain;
int _index;
@@ -84,8 +75,6 @@
int _rate;
double _silenceLevel;
int _silenceTimeout;
- //figure out how to properly do thi
- //soundTransform _soundtransform;
bool _useEchoSuppression;
};
=== modified file 'libmedia/Makefile.am'
--- a/libmedia/Makefile.am 2009-07-24 20:42:41 +0000
+++ b/libmedia/Makefile.am 2009-08-04 17:46:54 +0000
@@ -69,6 +69,7 @@
MediaParser.cpp \
FLVParser.cpp \
AudioResampler.cpp \
+ AudioInput.cpp \
VideoInput.cpp \
$(NULL)
=== modified file 'libmedia/VideoInput.cpp'
--- a/libmedia/VideoInput.cpp 2009-07-31 21:06:37 +0000
+++ b/libmedia/VideoInput.cpp 2009-08-04 17:46:54 +0000
@@ -18,8 +18,6 @@
#include "VideoInput.h"
-//IMPORTANT: This file has not been worked on yet!
-
namespace gnash {
namespace media {
@@ -27,7 +25,7 @@
VideoInput::VideoInput() {
//initialize variables
_activityLevel = -1.0;
- _bandwidth = 0;
+ _bandwidth = 16384;
_currentFPS = 0;
_fps = 15.0;
_height = 120;
=== modified file 'libmedia/VideoInput.h'
--- a/libmedia/VideoInput.h 2009-07-31 21:06:37 +0000
+++ b/libmedia/VideoInput.h 2009-08-04 17:46:54 +0000
@@ -23,9 +23,6 @@
#include <string>
#include <vector>
-//IMPORTANT: I have only simply copied over the AS API into this
-// file. No real implementation has actually happened here yet.
-
namespace gnash {
namespace media {
@@ -38,14 +35,6 @@
// virtual classes need a virtual destructor !
virtual ~VideoInput() {}
-
- void setKeyFramInterval(int keyFrameInterval);
-
- void setLoopback(bool compress);
-
- void setMode(int width, int height, double fps, bool favorArea);
-
- void setQuality(int bandwidth, int quality);
//setters and getters
void set_activityLevel(double a) {_activityLevel = a;};
=== modified file 'libmedia/gst/AudioInputGst.cpp'
--- a/libmedia/gst/AudioInputGst.cpp 2009-07-28 18:37:36 +0000
+++ b/libmedia/gst/AudioInputGst.cpp 2009-08-04 17:46:54 +0000
@@ -37,8 +37,22 @@
namespace gst {
AudioInputGst::AudioInputGst() {
gst_init(NULL,NULL);
- _numdevs = 0;
- log_unimpl("Audio Input constructor");
+
+ findAudioDevs();
+
+ //enumerate names array for actionscript accessibility
+ int i;
+ for (i = 0; i < _audioVect.size(); ++i) {
+ _names.push_back(_audioVect[i]->getProductName());
+ }
+
+ int devSelection = makeAudioDevSelection();
+ _index = devSelection;
+
+ transferToPrivate(devSelection);
+ audioCreateMainBin(_globalAudio);
+ audioCreatePlaybackBin(_globalAudio);
+ audioCreateSaveBin(_globalAudio);
}
AudioInputGst::~AudioInputGst() {
@@ -54,7 +68,7 @@
element = gst_element_factory_make ("audiotestsrc", "audtestsrc");
if (element == NULL) {
- log_error("%s: Could not create audio test source.\n",
__FUNCTION__);
+ log_error("%s: Could not create audio test source", __FUNCTION__);
_audioVect.push_back(NULL);
_numdevs += 1;
} else {
@@ -214,6 +228,10 @@
GnashAudioPrivate*
AudioInputGst::transferToPrivate(int devselect) {
+ if ((devselect > (_audioVect.size() - 1)) || devselect < 0) {
+ log_error("%s: Passed a bad devselect value", __FUNCTION__);
+ exit (EXIT_FAILURE);
+ }
GnashAudioPrivate *audio = new GnashAudioPrivate;
if (audio != NULL) {
audio->setAudioDevice(_audioVect[devselect]);
@@ -226,11 +244,20 @@
}
gboolean
- AudioInputGst::audioCreateSourceBin(GnashAudioPrivate *audio) {
+ AudioInputGst::audioChangeSourceBin(GnashAudioPrivate *audio) {
GError *error = NULL;
gchar *command = NULL;
+
+ if (audio->_pipelineIsPlaying == true) {
+ audioStop(audio);
+ }
+
+ //delete the old source bin
+ gst_bin_remove(GST_BIN(audio->_audioMainBin), audio->_audioSourceBin);
+ audio->_audioSourceBin = NULL;
+
if(g_strcmp0(audio->_deviceName, "audiotest") == 0) {
- log_trace("%s: You don't have any webcams chosen, using
audiotestsrc",
+ log_trace("%s: You don't have any mics chosen, using audiotestsrc",
__FUNCTION__);
audio->_audioSourceBin = gst_parse_bin_from_description (
"audiotestsrc name=audioSource",
@@ -240,9 +267,11 @@
"audioSource");
return true;
} else {
- command = g_strdup_printf ("%s name=audioSource device=%s ! capsfilter
name=capsfilter
caps=audio/x-raw-int,signed=true,channels=2,rate=44100;audio/x-raw-float,channels=2,rate=44100",
+ command = g_strdup_printf ("%s name=audioSource device=%s ! capsfilter
name=capsfilter
caps=audio/x-raw-int,signed=true,channels=2,rate=%i;audio/x-raw-float,channels=2,rate=%i
! rgvolume pre-amp=%d",
audio->_audioDevice->getGstreamerSrc(),
- audio->_audioDevice->getDevLocation());
+ audio->_audioDevice->getDevLocation(),
+ gnash::media::AudioInput::_rate, gnash::media::AudioInput::_rate,
+ gnash::media::AudioInput::_gain);
log_debug ("GstPipeline command is: %s\n", command);
@@ -257,6 +286,61 @@
g_free(command);
audio->audioSource = gst_bin_get_by_name (GST_BIN
(audio->_audioSourceBin),
"audioSource");
+
+ gboolean result;
+ result = gst_bin_add(GST_BIN(audio->_audioMainBin),
audio->_audioSourceBin);
+ if (result != true) {
+ log_error("%s: couldn't drop the sourcebin back into the main bin",
+ __FUNCTION__);
+ } else {
+ GstElement *tee =
gst_bin_get_by_name(GST_BIN(audio->_audioMainBin),
+ "tee");
+ result = gst_element_link(audio->_audioSourceBin, tee);
+ if (result != true) {
+ log_error("%s: couldn't link up sourcebin and tee",
__FUNCTION__);
+ return false;
+ } else {
+ _globalAudio = audio;
+ return true;
+ }
+ }
+ }
+ }
+
+ gboolean
+ AudioInputGst::audioCreateSourceBin(GnashAudioPrivate *audio) {
+ GError *error = NULL;
+ gchar *command = NULL;
+ if(g_strcmp0(audio->_deviceName, "audiotest") == 0) {
+ log_trace("%s: You don't have any mics chosen, using audiotestsrc",
+ __FUNCTION__);
+ audio->_audioSourceBin = gst_parse_bin_from_description (
+ "audiotestsrc name=audioSource",
+ TRUE, &error);
+ log_debug("Command: audiotestsrc name=audioSource");
+ audio->audioSource = gst_bin_get_by_name (GST_BIN
(audio->_audioSourceBin),
+ "audioSource");
+ return true;
+ } else {
+ command = g_strdup_printf ("%s name=audioSource device=%s ! capsfilter
name=capsfilter
caps=audio/x-raw-int,signed=true,channels=2,rate=%i;audio/x-raw-float,channels=2,rate=%i
! rgvolume pre-amp=%d",
+ audio->_audioDevice->getGstreamerSrc(),
+ audio->_audioDevice->getDevLocation(),
+ gnash::media::AudioInput::_rate, gnash::media::AudioInput::_rate,
+ gnash::media::AudioInput::_gain);
+
+ log_debug ("GstPipeline command is: %s", command);
+
+ audio->_audioSourceBin = gst_parse_bin_from_description(command, TRUE,
+ &error);
+ if (audio->_audioSourceBin == NULL) {
+ log_error ("%s: Creation of the audioSourceBin failed",
+ __FUNCTION__);
+ log_error ("the error was %s", error->message);
+ return false;
+ }
+ g_free(command);
+ audio->audioSource = gst_bin_get_by_name (GST_BIN
(audio->_audioSourceBin),
+ "audioSource");
return true;
}
}
@@ -275,8 +359,7 @@
ok = audioCreateSourceBin(audio);
if (ok != true) {
log_error("%s: audioCreateSourceBin failed!", __FUNCTION__);
- } else {
- ok = false;
+ return false;
}
if ((tee = gst_element_factory_make ("tee", "tee")) == NULL) {
log_error("%s: problem creating tee element", __FUNCTION__);
@@ -335,6 +418,8 @@
if (!ok) {
log_error("%s: Unable to create main pipeline", __FUNCTION__);
return false;
+ } else {
+ return true;
}
}
@@ -436,7 +521,6 @@
case GST_MESSAGE_EOS:
log_trace ("End of stream\n");
- g_main_loop_quit (((class GnashAudioPrivate *)data)->_loop);
break;
case GST_MESSAGE_ERROR: {
@@ -448,8 +532,6 @@
log_error ("Error: %s\n", error->message);
g_error_free (error);
-
- g_main_loop_quit (((class GnashAudioPrivate *)data)->_loop);
break;
}
default:
@@ -606,17 +688,27 @@
int devselect = -1;
devselect = rcfile.getAudioInputDevice();
if (devselect == -1) {
- log_trace("No default audio input device specified, setting to
testsrc\n");
+ log_trace("No default audio input device specified, setting to
testsrc");
rcfile.setAudioInputDevice(0);
devselect = rcfile.getAudioInputDevice();
} else {
- log_trace("You've specified audio input %d in gnashrc, using that
one\n",
+ log_trace("You've specified audio input %d in gnashrc, using that
one",
devselect);
}
- getSelectedCaps(devselect);
+ //make sure device selection is a valid input device
+ if ((rcfile.getAudioInputDevice() > (_audioVect.size() -1)) ||
+ rcfile.getAudioInputDevice() < 0) {
+ log_error("You have an invalid microphone selected. Check your
gnashrc file");
+ exit(EXIT_FAILURE);
+ } else {
+ //set _name value for actionscript
+ _name = _audioVect[devselect]->getProductName();
+
+ getSelectedCaps(devselect);
- return devselect;
+ return devselect;
+ }
}
} //gst namespace
=== modified file 'libmedia/gst/AudioInputGst.h'
--- a/libmedia/gst/AudioInputGst.h 2009-07-28 18:37:36 +0000
+++ b/libmedia/gst/AudioInputGst.h 2009-08-04 17:46:54 +0000
@@ -229,10 +229,6 @@
/// \brief A boolean value which stores whether or not the _pipeline
/// element is currently in it's 'playing' state or not
gboolean _pipelineIsPlaying;
-
- /// \var _loop
- /// \brief A GMainLoop to keep recording input from the device.
- GMainLoop* _loop;
};
GnashAudioPrivate::GnashAudioPrivate() {
@@ -241,10 +237,11 @@
_audioDevice = NULL;
_deviceName = NULL;
_pipeline = NULL;
+ _audioMainBin = NULL;
+ _audioPlaybackBin = NULL;
_audioSourceBin = NULL;
_audioSaveBin = NULL;
_pipelineIsPlaying = false;
- _loop = g_main_loop_new(NULL, false);
_mux = NULL;
};
@@ -386,6 +383,16 @@
/// @return True if the pipeline successfully stopped, false otherwise.
bool audioStop(GnashAudioPrivate *audio);
+ /// This function applies changes made to one of the following items:
+ /// Gstreamer source, device location, gain, rate
+ /// When any of these above listed items are changed, you must call
+ /// audioChangeSourceBin to delete the old source bin, recreate and link
the
+ /// source bin up with new values.
+ /// @param audio A pointer to the GnashAudioPrivate structure containing
+ /// the information about the device with the changed values.
+ /// @return True if the new changes were applied succesfully, false
otherwise
+ gboolean audioChangeSourceBin (GnashAudioPrivate *audio);
+
/// \brief Function returns the total number of devices detected (useful in
/// iterating through the _audioVect vector.
/// @return The _numdevs private variable from the AudioInputGst class.
@@ -401,6 +408,8 @@
/// AudioInputGst class.
std::vector<GnashAudio*>* getAudioVect() {return &_audioVect;}
+ /// \brief Accessor to get the reference to the GnashAudioPrivate data
+ /// structure currently being worked with.
GnashAudioPrivate* getGlobalAudio() {return _globalAudio;}
=== modified file 'libmedia/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp 2009-07-31 21:06:37 +0000
+++ b/libmedia/gst/VideoInputGst.cpp 2009-08-04 17:46:54 +0000
@@ -43,11 +43,6 @@
VideoInputGst::VideoInputGst() {
gst_init(NULL,NULL);
- //actionscript default values
- _width = 160;
- _height = 120;
- _fps = 15;
-
int devSelection;
findVidDevs();
=== modified file 'testsuite/libmedia.all/test_audioinput.cpp'
--- a/testsuite/libmedia.all/test_audioinput.cpp 2009-07-31 21:06:37
+0000
+++ b/testsuite/libmedia.all/test_audioinput.cpp 2009-08-04 17:46:54
+0000
@@ -47,7 +47,7 @@
LogFile& dbglogfile = LogFile::getDefaultInstance();
int
-main(int argc, char *argv[])
+main()
{
test_client();
return 0;
@@ -245,6 +245,13 @@
g_print(" NOTE: deleting output file...\n");
}
+ ok = aud.makeAudioSourcePlaybackLink(audio);
+ if (ok != true) {
+ runtest.fail("makeAudioSourcePlaybackLink reported an error");
+ } else {
+ runtest.pass("makeAudioSourcePlaybackLink reported no errors");
+ }
+
ok = aud.breakAudioSourceSaveLink(audio);
if (ok != true) {
runtest.fail("breakAudioSourceSaveLink() reported an error");
@@ -268,7 +275,7 @@
} else {
runtest.pass("audioStop() reported no errors");
}
-
+
if (stat(file.c_str(), &st) == 0) {
runtest.fail("an output file was created and it shouldn't have");
if (unlink(file.c_str()) == 0) {
@@ -278,14 +285,6 @@
runtest.pass("no output file was created");
}
-
- ok = aud.makeAudioSourcePlaybackLink(audio);
- if (ok != true) {
- runtest.fail("couldn't remake the link audiosource->playback link");
- } else {
- runtest.pass("successfully remade the audiosource->playback link");
- }
-
ok = aud.makeAudioSourceSaveLink(audio);
if (ok != true) {
runtest.fail("couldn't remake the audiosource->save link");
@@ -347,6 +346,108 @@
}
} else {
runtest.fail("there's no output audio file in testsuite/libmedia.all");
+ }
+ //end 'building block' tests
+
+ //tests more similar to execution flow
+ gst::AudioInputGst *audioObj = new AudioInputGst;
+ if (audioObj == NULL) {
+ runtest.fail("couldn't create new AudioInputGst object");
+ } else {
+ runtest.pass("got a reference to a new AudioInputGst object");
+ }
+
+ //get a reference to the global GnashAudioPrivate structure
+ GnashAudioPrivate *global;
+ global = audioObj->getGlobalAudio();
+ if (global == NULL) {
+ runtest.fail("couldn't get a global GnashAudioPrivate reference");
+ } else {
+ runtest.pass("got a global GnashAudioPrivate reference");
+ }
+
+ if (global->_pipeline == NULL) {
+ runtest.fail("audioObj->_globalAudio->_pipeline has null reference");
+ } else {
+ runtest.pass("audioObj->_globalAudio->_pipeline is initialized");
+ }
+
+ if (global->_audioSourceBin == NULL) {
+ runtest.fail("audioObj->_globalAudio->_audioSourceBin has a null
reference");
+ } else {
+ runtest.pass("audioObj->_globalAudio->_audioSourceBin was
initialized");
+ }
+
+ if (global->_audioMainBin == NULL) {
+ runtest.fail("audioObj->_globalAudio->_audioMainBin has a null
reference");
+ } else {
+ runtest.pass("audioObj->_globalAudio->_audioMainBin was initialized");
+ }
+
+ if (global->_audioPlaybackBin == NULL) {
+ runtest.fail("audioObj->_globalAudio->_audioPlaybackBin has a null
reference");
+ } else {
+ runtest.pass("audioObj->_globalAudio->_audioPlaybackBin was
initialized");
+ }
+
+ if (global->_audioSaveBin == NULL) {
+ runtest.fail("audioObj->_globalAudio->_audioSaveBin has a null
reference");
+ } else {
+ runtest.pass("audioObj->_globalAudio->_audioSaveBin was initialized");
+ }
+
+ //gboolean ok;
+ ok = audioObj->makeAudioSourcePlaybackLink(global);
+ if (ok != true) {
+ runtest.fail("makeAudioSourcePlaybackLink failed");
+ } else {
+ runtest.pass("makeAudioSourcePlaybackLink reported no errors");
+ }
+
+ ok = audioObj->audioPlay(global);
+ if (ok != true) {
+ runtest.fail("audioPlay reported errors");
+ } else {
+ runtest.pass("audioPlay reported no errors");
+ }
+
+ //sleep to record a few seconds of audio (from mic or test source)
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ ok = audioObj->audioStop(global);
+ if (ok != true) {
+ runtest.fail("audioStop reported errors");
+ } else {
+ runtest.pass("audioStop reported no errors");
+ }
+
+ //change some vals and test changeSourceBin
+ audioObj->set_rate(44100);
+ audioObj->set_gain(100);
+ ok = audioObj->audioChangeSourceBin(global);
+ if (ok != true) {
+ runtest.fail("audioChangeSourceBin reported errors");
+ } else {
+ runtest.pass("audioChangeSourceBin reported no errors");
+ }
+
+ ok = audioObj->audioPlay(global);
+ if (ok != true) {
+ runtest.fail("audioPlay reported errors");
+ } else {
+ runtest.pass("audioPlay reported no errors");
+ }
+
+ //sleep to record a few seconds of audio (from mic or test source)
+ g_print(" NOTE: sleeping for 5 seconds here....\n");
+ sleep(5);
+
+ ok = audioObj->audioStop(global);
+ if (ok != true) {
+ runtest.fail("audioStop reported errors");
+ } else {
+ runtest.pass("audioStop reported no errors");
}
}
=== modified file 'testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
2009-06-15 15:52:35 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Microphone_as.hx
2009-08-04 17:46:54 +0000
@@ -41,6 +41,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 Microphone_as {
+ static function typeof(thing:Dynamic) {
+ return ("" + untyped __typeof__(thing));
+ }
+
static function main() {
#if flash9
var x1:Microphone = Microphone.getMicrophone();
@@ -57,15 +61,10 @@
// Tests to see if all the properties exist. All these do is test for
// existance of a property, and don't test the functionality at all. This
// is primarily useful only to test completeness of the API implementation.
- if (Std.is(Microphone.names, Array)) {
- DejaGnu.pass("Microphone.names property exists");
- } else {
- DejaGnu.xfail("Microphone.names property doesn't exist");
- }
- if (Type.typeof(x1.activityLevel) == ValueType.TInt) {
+ if (typeof(x1.activityLevel) == "number") {
DejaGnu.pass("Microphone.activityLevel property exists");
} else {
- DejaGnu.xfail("Microphone.activityLevel property doesn't exist");
+ DejaGnu.fail("Microphone.activityLevel property doesn't exist");
}
@@ -89,36 +88,36 @@
//}
- if (Type.typeof(x1.gain) == ValueType.TInt) {
+ if (typeof(x1.gain) == "number") {
DejaGnu.pass("Microphone::gain property exists");
} else {
- DejaGnu.xfail("Microphone::gain property doesn't exist");
+ DejaGnu.fail("Microphone::gain property doesn't exist");
}
- if (Type.typeof(x1.index) == ValueType.TInt) {
+ if (typeof(x1.index) == "number") {
DejaGnu.pass("Microphone::index property exists");
} else {
- DejaGnu.xfail("Microphone::index property doesn't exist");
+ DejaGnu.fail("Microphone::index property doesn't exist");
}
- if (Std.is(x1.muted, Bool)) {
+ if (typeof(x1.muted) == "boolean") {
DejaGnu.pass("Microphone::muted property exists");
} else {
- DejaGnu.xfail("Microphone::muted property doesn't exist");
+ DejaGnu.fail("Microphone::muted property doesn't exist");
}
//FIXME: it would be nice if this parsed and checked the name string
- if (Std.is(x1.name, String)) {
+ if (typeof(x1.name) == "string") {
DejaGnu.pass("Microphone::name property exists");
} else {
- DejaGnu.xfail("Microphone::name property doesn't exist");
+ DejaGnu.fail("Microphone::name property doesn't exist");
}
- if (Type.typeof(x1.rate) == ValueType.TInt) {
+ if (typeof(x1.rate) == "number") {
DejaGnu.pass("Microphone::rate property exists");
} else {
- DejaGnu.xfail("Microphone::rate property doesn't exist");
+ DejaGnu.fail("Microphone::rate property doesn't exist");
}
- if (Type.typeof(x1.silenceLevel) == ValueType.TInt) {
+ if (typeof(x1.silenceLevel) == "number") {
DejaGnu.pass("Microphone::silenceLevel property exists");
} else {
- DejaGnu.xfail("Microphone::silenceLevel property doesn't exist");
+ DejaGnu.fail("Microphone::silenceLevel property doesn't exist");
}
#if flash9
if (Std.is(x1.soundTransform, SoundTransform)) {
@@ -132,16 +131,16 @@
DejaGnu.xfail("Microphone::silenceTimeout property doesn't exist");
}
#else
- if (Type.typeof(x1.silenceTimeOut) == ValueType.TInt) {
+ if (typeof(x1.silenceTimeOut) == "number") {
DejaGnu.pass("Microphone::silenceTimeOut property exists");
} else {
- DejaGnu.xfail("Microphone::silenceTimeOut property doesn't exist");
+ DejaGnu.fail("Microphone::silenceTimeOut property doesn't exist");
}
#end
- if (Std.is(x1.useEchoSuppression, Bool)) {
+ if (typeof(x1.useEchoSuppression) == "boolean") {
DejaGnu.pass("Microphone::useEchoSuppression property exists");
} else {
- DejaGnu.xfail("Microphone::useEchoSuppression property doesn't
exist");
+ DejaGnu.fail("Microphone::useEchoSuppression property doesn't
exist");
}
// Tests to see if all the methods exist. All these do is test for
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11365: completed Camera_as and Microphone_as basic implementation,
Ben Limmer <=