gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11337: updated testsuites and funct


From: Ben Limmer
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11337: updated testsuites and functionality in VideoInputGst.cpp and started working with AS implementation (not final at all)
Date: Wed, 29 Jul 2009 16:28:58 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11337
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-29 16:28:58 -0600
message:
  updated testsuites and functionality in VideoInputGst.cpp and started working 
with AS implementation (not final at all)
modified:
  libcore/asobj/flash/media/Camera_as.cpp
  libmedia/gst/VideoInputGst.cpp
  libmedia/gst/VideoInputGst.h
  testsuite/libmedia.all/test_videoinput.cpp
  testsuite/misc-haxe.all/classes.all/media/Camera_as.hx
    ------------------------------------------------------------
    revno: 11325.2.1
    committer: Ben Limmer <address@hidden>
    branch nick: cam_mic_as_migration
    timestamp: Wed 2009-07-29 16:25:15 -0600
    message:
      updated testsuites and functionality in VideoInputGst.cpp and started 
working with AS implementation (not final at all)
    modified:
      libcore/asobj/flash/media/Camera_as.cpp
      libmedia/gst/VideoInputGst.cpp
      libmedia/gst/VideoInputGst.h
      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-29 05:40:20 +0000
+++ b/libcore/asobj/flash/media/Camera_as.cpp   2009-07-29 22:28:58 +0000
@@ -29,60 +29,101 @@
 #include "smart_ptr.h" // for boost intrusive_ptr
 #include "builtin_function.h" // need builtin_function
 #include "Object.h" // for getObjectInterface
+#include "gst/VideoInputGst.h"
+
 
 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);
 
 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));
+    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));
 }
 
 static as_object*
 getCameraInterface()
 {
-       static boost::intrusive_ptr<as_object> o;
-       if ( ! o )
-       {
-               o = new as_object(getObjectInterface());
-               attachCameraInterface(*o);
-       }
-       return o.get();
+    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
+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; }
+    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__);
+// 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__);
+    } else {
+        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__);
+    } else {
+        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;
+    if (numargs == 0) {
+        log_debug("%s: no arguments passed, using default values", 
__FUNCTION__);
+        if (ptr->getXResolution() != 160) {
+            ptr->setXResolution(160);
+        }
+        if (ptr->getYResolution() != 120) {
+            ptr->setYResolution(160);
+        }
+        if (ptr->getFps() != 15) {
+            ptr->setFps(15);
+        }
+    }
+    
     return as_value();
 }
 as_value camera_setmotionlevel(const fn_call& /*fn*/) {
@@ -95,33 +136,30 @@
     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& 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 (vm.getSWFVersion() <= 8) {
+            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/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp    2009-07-28 18:37:36 +0000
+++ b/libmedia/gst/VideoInputGst.cpp    2009-07-29 22:25:15 +0000
@@ -27,6 +27,7 @@
 #include <gst/interfaces/propertyprobe.h>
 #include <vector>
 #include "rc.h"
+#include "math.h"
 
 
 namespace {
@@ -41,6 +42,14 @@
     //initializes the Gstreamer interface
     VideoInputGst::VideoInputGst() {
         gst_init(NULL,NULL);
+        int devSelection;
+        findVidDevs();
+        devSelection = makeWebcamDeviceSelection();
+        _devSelection = devSelection;
+        transferToPrivate(devSelection);
+        webcamCreateMainBin(_globalWebcam);
+        webcamCreateDisplayBin(_globalWebcam);
+        webcamCreateSaveBin(_globalWebcam);
     }
     
     VideoInputGst::~VideoInputGst() {
@@ -146,6 +155,7 @@
         }
     }
     
+    
     //called by addSupportedFormat. finds the highest possible framerate
     //to record at (can be shaped down by a filter for performance)
     void
@@ -170,7 +180,7 @@
         //set highest found above
         format->highestFramerate.numerator = framerate_numerator;
         format->highestFramerate.denominator = framerate_denominator;
-    }
+    } 
     
     //find the framerates at which the selected format can handle input
     void
@@ -292,7 +302,7 @@
         int dev_select;
         dev_select = rcfile.getWebcamDevice();
         if (dev_select == -1) {
-            log_error("%s: No webcam selected in rc file, setting to 
videotestsource",
+            log_trace("%s: No webcam selected in rc file, setting to 
videotestsource",
                 __FUNCTION__);
             rcfile.setWebcamDevice(0);
             dev_select = rcfile.getWebcamDevice();
@@ -593,26 +603,207 @@
                   format->highestFramerate.denominator);
                 
                 //debug
-                log_debug ("GstPipeline command is: %s\n", 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);
-                    return false;
-                }
-                
-                g_free(command);
-                
-                webcam->_videoSource = 
-                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
-                    "video_source");
-                webcam->_capsFilter =
-                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
-                    "capsfilter");
-                return true;
+                g_print ("GstPipeline command is: %s\n", 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);
+                    return false;
+                }
+                
+                g_free(command);
+                
+                webcam->_videoSource = 
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "video_source");
+                webcam->_capsFilter =
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "capsfilter");
+                return true;
+            }
+        }
+        return true;
+    }
+    
+    gboolean
+    VideoInputGst::checkForSupportedFramerate (GnashWebcamPrivate *webcam, int 
fps) {
+        gint fNum, fDenom, i, val;
+        
+        for (i = 0; i < webcam->_currentFormat->numFramerates; ++i) {
+            val = ceil(webcam->_currentFormat->framerates[i].numerator /
+                       webcam->_currentFormat->framerates[i].denominator);
+            if (val == fps) {
+                return true;
+            } else {
+                continue;
+            }
+        }
+        return false;
+    }
+    
+    gboolean
+    VideoInputGst::webcamChangeSourceBin(GnashWebcamPrivate *webcam) {
+        GError *error = NULL;
+        gchar *command = NULL;
+        
+        if(webcam->_pipelineIsPlaying == true) {
+            webcamStop(webcam);
+        }
+
+        //delete the old source bin
+        gst_bin_remove(GST_BIN(webcam->_webcamMainBin), 
webcam->_webcamSourceBin);
+        webcam->_webcamSourceBin = NULL;
+        
+        if(webcam->_webcamDevice == NULL) {
+            log_trace("%s: You don't have any webcams chosen, using 
videotestsrc",
+                __FUNCTION__);
+            webcam->_webcamSourceBin = gst_parse_bin_from_description (
+                "videotestsrc name=video_source ! capsfilter name=capsfilter",
+                TRUE, &error);
+            log_debug("Command: videotestsrc name=video_source ! \
+                capsfilter name=capsfilter");
+        }
+        else {
+            WebcamVidFormat *format = NULL;
+            gint i;
+            gchar *resolution;
+            
+            resolution = g_strdup_printf("%ix%i", webcam->_xResolution,
+                                      webcam->_yResolution);
+                                      
+            //use these resolutions determined above if the camera supports it
+            if (webcam->_xResolution != 0 && webcam->_yResolution != 0) {
+                
+                i = GPOINTER_TO_INT(g_hash_table_lookup
+                    (webcam->_webcamDevice->supportedResolutions, resolution));
+                //the selected res is supported if i
+                if (i) {
+                    format = &g_array_index 
(webcam->_webcamDevice->videoFormats,
+                             WebcamVidFormat, i - 1);
+                }
+            }
+            
+            //if format didn't get set, something went wrong. try picking
+            //the first supported format and a different supported resolution
+            if (!format) {
+                log_error("%s: the resolution you chose isn't supported, 
picking \
+                    a supported value", __FUNCTION__);
+                format = &g_array_index (webcam->_webcamDevice->videoFormats,
+                     WebcamVidFormat, 0);
+                for (i = 1; i < webcam->_webcamDevice->numVideoFormats; i++) {
+                    if (g_array_index (webcam->_webcamDevice->videoFormats,
+                               WebcamVidFormat, i).width <= format->width){
+                        format = &g_array_index 
(webcam->_webcamDevice->videoFormats,
+                             WebcamVidFormat, i);
+                    }
+                }
+            }
+            
+            //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;
+                if (checkForSupportedFramerate(webcam, newFps)) {
+                    g_print("checkforsupportedfr returned true\n");
+                    format->highestFramerate.numerator = newFps;
+                    format->highestFramerate.denominator = 1;
+                } else {
+                    g_print("checkforsupportedfr returned false\n");
+                    
+                    //currently chooses the ActionScript default of 15 fps in 
case
+                    //you pass in an unsupported framerate value
+                    format->highestFramerate.numerator = 15;
+                    format->highestFramerate.denominator = 1;
+                }
+            }
+            webcam->_currentFormat = format;
+            g_free(resolution);
+            
+            //if format isn't set, something is still going wrong, make generic
+            //components and see if they work!
+            if (format == NULL) {
+                if (error != NULL) {
+                    g_error_free (error);
+                    error = NULL;
+                }
+                webcam->_webcamSourceBin = 
+                    gst_parse_bin_from_description ("videotestsrc 
name=video_source",
+                    TRUE, &error);
+                webcam->_videoSource = 
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "video_source");
+                
+                //if there are still errors, something's up, return out of 
function
+                if (error != NULL) {
+                    g_error_free (error);
+                    return false;
+                }
+                webcam->_capsFilter = 
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "capsfilter");
+                return true;
+            }
+            
+            //execution here means we're good to make the pipeline
+            else {
+                //can't reduce this to 80 line limit without causing problems
+                command = g_strdup_printf (
+                  "%s name=video_source device=%s ! capsfilter name=capsfilter 
caps=video/x-raw-rgb,width=%d,height=%d,framerate=%d/%d;video/x-raw-yuv,width=%d,height=%d,framerate=%d/%d",
+                  webcam->_webcamDevice->getGstreamerSrc(),
+                  webcam->_webcamDevice->getDevLocation(),
+                  format->width,
+                  format->height,
+                  format->highestFramerate.numerator,
+                  format->highestFramerate.denominator,
+                  format->width,
+                  format->height,
+                  format->highestFramerate.numerator,
+                  format->highestFramerate.denominator);
+                
+                //debug
+                g_print ("GstPipeline command is: %s\n", 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);
+                    return false;
+                }
+                
+                g_free(command);
+                
+                webcam->_videoSource = 
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "video_source");
+                webcam->_capsFilter =
+                    gst_bin_get_by_name (GST_BIN (webcam->_webcamSourceBin),
+                    "capsfilter");
+                
+                //drop the new source bin back into the main bin
+                gboolean result;
+                result = gst_bin_add(GST_BIN(webcam->_pipeline),
+                    webcam->_webcamSourceBin);
+                if (result != true) {
+                    log_error("%s: couldn't drop the sourcebin back into the 
main bin",
+                        __FUNCTION__);
+                    return false;
+                } else {
+                    //get the tee from main bin
+                    GstElement *tee = 
gst_bin_get_by_name(GST_BIN(webcam->_webcamMainBin),
+                        "tee");
+                    result = gst_element_link(webcam->_webcamSourceBin, tee);
+                    if (result != true) {
+                        log_error("%s: couldn't link up sourcebin and tee", 
__FUNCTION__);
+                        return false;
+                    } else {
+                        return true;
+                    }
+                }
             }
         }
         return true;

=== modified file 'libmedia/gst/VideoInputGst.h'
--- a/libmedia/gst/VideoInputGst.h      2009-07-27 18:48:53 +0000
+++ b/libmedia/gst/VideoInputGst.h      2009-07-29 22:25:15 +0000
@@ -266,6 +266,38 @@
         /// @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:
@@ -376,6 +408,11 @@
         ///       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.
@@ -413,11 +450,11 @@
     
     _pipelineIsPlaying = false;
     
-    //FIXME: the resolution here should be able to either
-    //a. be determined by the user (or)
-    //b. be determined by network latency/bandwidth availability
-    _xResolution = 320;
-    _yResolution = 240;
+    //these default values are per the AS livedocs defaults
+    _xResolution = 160; 
+    _yResolution = 120; 
+    _fps = 15;
+    
     _currentFormat = NULL;
     _eosTimeoutId = 0;
 };
@@ -506,6 +543,14 @@
     /// @return Nothing. All pertantent information is stored in a 
WebcamVidFormat class.
     void getSupportedFramerates(WebcamVidFormat *video_format, GstStructure 
*structure);
 
+    /// \brief This function checks to see if the current format selected for 
the
+    ///     webcam supports the framerate passed in as the second argument
+    /// @param webcam A pointer to the selected GnashWebcamPrivate structure to
+    ///     check for the supported framerate value
+    /// @param fps An integer value to check for support
+    /// @return True if the framerate is supported, false otherwise
+    gboolean checkForSupportedFramerate (GnashWebcamPrivate *webcam, int fps);
+
     /// \brief This function runs through the list of framerates determined by
     ///       getSupportedFramerates() and finds the highest supported 
framerate
     ///       less than 30fps.
@@ -544,6 +589,15 @@
     ///        into bins and linking elements), false otherwise.
     gboolean webcamCreateSourceBin(GnashWebcamPrivate *webcam);
     
+    /// \brief Function is called when changes have been made to certain 
variables
+    ///      that effect the video source's capabilities (specifically 
resolution
+    ///      and fps values)
+    /// @param webcam A pointer to the GnashWebcamPrivate data structure where
+    ///      changes have been made to resolution or fps variables
+    /// @return True if the changes to the source's capabilities happened 
succesfully
+    ///      false otherwise.
+    gboolean webcamChangeSourceBin(GnashWebcamPrivate *webcam);
+    
     /// \brief Function creates the main bin. For more information on pipeline
     ///       implementation and this function in general see the definition of
     ///       the _webcamMainBin variable in the GnashWebcamPrivate structure
@@ -653,11 +707,21 @@
     ///       attached to the machine.
     void incrementNumdevs() {_numdevs += 1;}
     
+    /// \brief Accessor to return a pointer to the global GnashWebcamPrivate
+    ///    variable
+    /// @return A pointer to the global GnashWebcamPrivate pointer
+    GnashWebcamPrivate* getGlobalWebcam() {return _globalWebcam;}
+    
 private:
     /// \var VideoInputGst::_vidVect
     /// \brief A vector containing pointers to GnashWebcam classes.
     std::vector<GnashWebcam*> _vidVect;
     
+    /// \var VideoInputGst::_devSelection
+    /// \brief An integer value representing the original GnashWebcam data 
struct
+    ///     _vidVect
+    int _devSelection;
+    
     /// \var VideoInputGst::_numdevs
     /// \brief An integer value containing the number of devices attached
     ///       to the machine.

=== modified file 'testsuite/libmedia.all/test_videoinput.cpp'
--- a/testsuite/libmedia.all/test_videoinput.cpp        2009-07-28 18:37:36 
+0000
+++ b/testsuite/libmedia.all/test_videoinput.cpp        2009-07-29 22:25:15 
+0000
@@ -391,6 +391,136 @@
     } 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");
+    global->_fps = 30;
+    global->_xResolution = 800;
+    global->_yResolution = 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!");
+    }
 }
 
 

=== modified file 'testsuite/misc-haxe.all/classes.all/media/Camera_as.hx'
--- a/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx    2009-06-10 
21:04:48 +0000
+++ b/testsuite/misc-haxe.all/classes.all/media/Camera_as.hx    2009-07-29 
22:25:15 +0000
@@ -26,6 +26,7 @@
 #if flash9
 import flash.media.Camera;
 import flash.display.MovieClip;
+import flash.media.Video;
 #else
 import flash.Camera;
 import flash.MovieClip;
@@ -236,6 +237,12 @@
        }
        //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();


reply via email to

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