gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] /srv/bzr/gnash/trunk r11280: brought VideoInput and findw


From: Ben Limmer
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11280: brought VideoInput and findwebcam files up to coding style requirements
Date: Fri, 17 Jul 2009 15:38:26 -0600
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11280
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Fri 2009-07-17 15:38:26 -0600
message:
  brought VideoInput and findwebcam files up to coding style requirements
modified:
  libmedia/VideoInput.cpp
  libmedia/VideoInput.h
  libmedia/gst/VideoInputGst.cpp
  libmedia/gst/VideoInputGst.h
  utilities/findwebcams.cpp
=== modified file 'libmedia/VideoInput.cpp'
--- a/libmedia/VideoInput.cpp   2009-07-16 18:44:25 +0000
+++ b/libmedia/VideoInput.cpp   2009-07-17 21:38:26 +0000
@@ -18,19 +18,21 @@
 
 #include "VideoInput.h"
 
+//IMPORTANT: This file has not been worked on yet!
+
 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)
-               }
-       } */
-       
+    /*
+    //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)
+        }
+    } */
+    
 } //media namespace
 } //gnash namespace

=== modified file 'libmedia/VideoInput.h'
--- a/libmedia/VideoInput.h     2009-07-16 18:44:25 +0000
+++ b/libmedia/VideoInput.h     2009-07-17 21:38:26 +0000
@@ -23,99 +23,101 @@
 #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 {
 
 
 class VideoInput {
-       
+    
 public:
 
-       VideoInput() {}
+    VideoInput() {}
 
-       // 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);
-       
-       //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;};
-       
-       void set_bandwidth(int b) {_bandwidth = b;};
-       int get_bandwidth() {return _bandwidth;};
-       
-       void set_currentFPS(double f) {_currentFPS=f;};
-       double get_currentFPS() {return _currentFPS;};
-       
-       void set_fps(double f) {_fps = f;};
-       double get_fps() {return _fps;};
-       
-       void set_height(int h) {_height = h;};
-       int get_height() {return _height;};
-       
-       void set_index(int i) {_index = i;};
-       int get_index() {return _index;};
-       
-       void set_keyFrameInterval(int i) {_keyFrameInterval = i;};
-       int get_keyFrameInterval() {return _keyFrameInterval;};
-       
-       bool get_loopback() {return _loopback;};
-       
-       void set_motionLevel(int m) {_motionLevel = m;};
-       int get_motionLevel() {return _motionLevel;};
-       
-       void set_motionTimeout(int m) {_motionTimeout = m;};
-       int get_motionTimeout() {return _motionTimeout;};
-       
-       void set_muted(bool m) {_muted = m;};
-       bool get_muted() {return _muted;};
-       
-       void set_name(std::string name) {_name = name;};
-       std::string get_name() {return _name;};
-       
-       //figure out how to implement vector
-       
-       void set_quality(int q) {_quality = q;};
-       int get_quality() {return _quality;};
-       
-       void set_width(int w) {_width = w;};
-       int get_width() {return _width;};
+    // 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);
+    
+    //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;};
+    
+    void set_bandwidth(int b) {_bandwidth = b;};
+    int get_bandwidth() {return _bandwidth;};
+    
+    void set_currentFPS(double f) {_currentFPS=f;};
+    double get_currentFPS() {return _currentFPS;};
+    
+    void set_fps(double f) {_fps = f;};
+    double get_fps() {return _fps;};
+    
+    void set_height(int h) {_height = h;};
+    int get_height() {return _height;};
+    
+    void set_index(int i) {_index = i;};
+    int get_index() {return _index;};
+    
+    void set_keyFrameInterval(int i) {_keyFrameInterval = i;};
+    int get_keyFrameInterval() {return _keyFrameInterval;};
+    
+    bool get_loopback() {return _loopback;};
+    
+    void set_motionLevel(int m) {_motionLevel = m;};
+    int get_motionLevel() {return _motionLevel;};
+    
+    void set_motionTimeout(int m) {_motionTimeout = m;};
+    int get_motionTimeout() {return _motionTimeout;};
+    
+    void set_muted(bool m) {_muted = m;};
+    bool get_muted() {return _muted;};
+    
+    void set_name(std::string name) {_name = name;};
+    std::string get_name() {return _name;};
+    
+    //figure out how to implement vector
+    
+    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:
-       //specified in AS livedocs
-       double _activityLevel;
-       int _bandwidth;
-       double _currentFPS;
-       double _fps;
-       int _height;
-       int _index;
-       int _keyFrameInterval;
-       bool _loopback;
-       int _motionLevel;
-       int _motionTimeout;
-       bool _muted;
-       std::string _name;
-       std::vector<std::string> _names;
-       int _quality;
-       int _width;
-       
-       //gnash specific
-       //std::vector<gst::GnashWebcam*> vid_vect;
+    //specified in AS livedocs
+    double _activityLevel;
+    int _bandwidth;
+    double _currentFPS;
+    double _fps;
+    int _height;
+    int _index;
+    int _keyFrameInterval;
+    bool _loopback;
+    int _motionLevel;
+    int _motionTimeout;
+    bool _muted;
+    std::string _name;
+    std::vector<std::string> _names;
+    int _quality;
+    int _width;
+    
+    //gnash specific
+    //std::vector<gst::GnashWebcam*> vid_vect;
 
 };
 
-       
+    
 } // gnash.media namespace 
 } // gnash namespace
 

=== modified file 'libmedia/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp    2009-07-16 20:32:49 +0000
+++ b/libmedia/gst/VideoInputGst.cpp    2009-07-17 21:38:26 +0000
@@ -30,877 +30,934 @@
 
 
 namespace {
-       //get rc file for webcam selection
-       gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+    //get rc file for webcam selection
+    gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
 }
 
 namespace gnash {
 namespace media {
 namespace gst {
-       
-       //initializes the Gstreamer interface
-       VideoInputGst::VideoInputGst() {
-               gst_init(NULL,NULL);
-       }
-       
-       VideoInputGst::~VideoInputGst() {
-               log_unimpl("Video Input destructor");
-       }
-       
-       //populates video devices to a vector of GnashWebcam pointers
-       //which contain important information about the hardware camera
-       //inputs available on the machine
-       void
-       VideoInputGst::find_vid_devs() {
-               _numdevs = 0;
-               
-               //find video test sources
-               GstElement *element;
-               element = gst_element_factory_make ("videotestsrc", 
"vidtestsrc");
-               
-               if (element == NULL) {
-                       log_error("%s: Could not create video test source. do 
you have gst-base-plugins installed?", __FUNCTION__);
-                       _vid_vect.push_back(NULL);
-                       _numdevs += 1;
-               } else {
-                       _vid_vect.push_back(new GnashWebcam);
-                       _vid_vect[_numdevs]->set_element_ptr(element);
-                       
_vid_vect[_numdevs]->set_gstreamer_src(g_strdup_printf("videotestsrc"));
-                       
_vid_vect[_numdevs]->set_product_name(g_strdup_printf("videotest"));
-                       _numdevs += 1;
-               }
-               
-               //find v4l devices
-               GstPropertyProbe *probe;
-               GValueArray *devarr;
-               element = NULL;
-               gint i;
-               
-               element = gst_element_factory_make ("v4lsrc", "v4lvidsrc");
-               probe = GST_PROPERTY_PROBE (element);
-               devarr = gst_property_probe_probe_and_get_values_name (probe, 
"device");
-               for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
-                       GValue *val;
-                       gchar *dev_name = NULL;
-                       
-                       val = g_value_array_get_nth (devarr, i);
-                       g_object_set (element, "device", g_value_get_string 
(val), NULL);
-                       gst_element_set_state (element, GST_STATE_PLAYING);
-                       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 
found...checking for other vid inputs\n");
-                       }
-                       else { 
-                               _vid_vect.push_back(new GnashWebcam);
-                               _vid_vect[_numdevs]->set_element_ptr(element);
-                               
_vid_vect[_numdevs]->set_gstreamer_src(g_strdup_printf("v4lsrc"));
-                               _vid_vect[_numdevs]->set_product_name(dev_name);
-                               
-                               //set device location information (e.g. 
/dev/video0)
-                               gchar *location;
-                               g_object_get (element, "device", &location , 
NULL);
-                               _vid_vect[_numdevs]->set_dev_location(location);
-                               _numdevs += 1;
-                       }
-               }
-               if (devarr) {
-                       g_value_array_free (devarr);
-               }
-               
-               //find v4l2 devices
-               probe = NULL;
-               devarr = NULL;
-               element = NULL;
-               
-               element = gst_element_factory_make ("v4l2src", "v4l2vidsrc");
-               probe = GST_PROPERTY_PROBE (element);
-               devarr = gst_property_probe_probe_and_get_values_name (probe, 
"device");
-               for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
-                       GValue *val;
-                       gchar *dev_name = NULL;
-                       
-                       val = g_value_array_get_nth (devarr, i);
-                       g_object_set (element, "device", g_value_get_string 
(val), NULL);
-                       gst_element_set_state (element, GST_STATE_PLAYING);
-                       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");
-                       }
-                       else { 
-                               _vid_vect.push_back(new GnashWebcam);
-                               _vid_vect[_numdevs]->set_element_ptr(element);
-                               
_vid_vect[_numdevs]->set_gstreamer_src(g_strdup_printf("v4l2src"));
-                               _vid_vect[_numdevs]->set_product_name(dev_name);
-                               
-                               //set device location information (e.g. 
/dev/video0)
-                               gchar *location;
-                               g_object_get (element, "device", &location , 
NULL);
-                               _vid_vect[_numdevs]->set_dev_location(location);
-                               _numdevs += 1;
-                       }
-               }
-               if (devarr) {
-                       g_value_array_free (devarr);
-               }
-       }
-       
-       //called by add_supported_format. finds the highest possible framerate
-       //to record at (can be shaped down by a filter for performance)
-       void
-       VideoInputGst::find_highest_framerate(WebcamVidFormat *format)
-       {
-               gint framerate_numerator;
-               gint framerate_denominator;
-               gint i;
-
-               //Select the highest framerate up to less than or equal to 30 Hz
-               framerate_numerator   = 1;
-               framerate_denominator = 1;
-               for (i = 0; i < format->num_framerates; i++) {
-                       gfloat framerate = format->framerates[i].numerator / 
format->framerates[i].denominator;
-                       if (framerate > ((float) framerate_numerator / 
framerate_denominator)
-                          && framerate <= 30) {
-                               framerate_numerator   = 
format->framerates[i].numerator;
-                               framerate_denominator = 
format->framerates[i].denominator;
-                       }
-               }
-               //set highest found above
-               format->highest_framerate.numerator = framerate_numerator;
-               format->highest_framerate.denominator = framerate_denominator;
-       }
-       
-       //find the framerates at which the selected format can handle input
-       void
-       VideoInputGst::get_supported_framerates(WebcamVidFormat *video_format, 
GstStructure *structure)
-       {
-               const GValue *framerates;
-               gint i, j;
-               
-               //note that framerates may contain one value, a list, or a range
-               framerates = gst_structure_get_value (structure, "framerate");
-               if (GST_VALUE_HOLDS_FRACTION (framerates)) {
-                       video_format->num_framerates = 1;
-                       video_format->framerates = g_new0 (FramerateFraction, 
video_format->num_framerates);
-                       video_format->framerates[0].numerator = 
gst_value_get_fraction_numerator (framerates);
-                       video_format->framerates[0].denominator = 
gst_value_get_fraction_denominator (framerates);
-               }
-               else if (GST_VALUE_HOLDS_LIST (framerates)) {
-                       video_format->num_framerates = gst_value_list_get_size 
(framerates);
-                       video_format->framerates = g_new0 (FramerateFraction, 
video_format->num_framerates);
-                       for (i = 0; i < video_format->num_framerates; i++) {
-                               const GValue *value;
-                               value = gst_value_list_get_value (framerates, 
i);
-                               video_format->framerates[i].numerator = 
gst_value_get_fraction_numerator (value);
-                               video_format->framerates[i].denominator = 
gst_value_get_fraction_denominator (value);
-                       }
-               }
-               else if (GST_VALUE_HOLDS_FRACTION_RANGE (framerates)) {
-                       gint numerator_min, denominator_min, numerator_max, 
denominator_max;
-                       const GValue *fraction_range_min;
-                       const GValue *fraction_range_max;
-
-                       fraction_range_min = gst_value_get_fraction_range_min 
(framerates);
-                       numerator_min      = gst_value_get_fraction_numerator 
(fraction_range_min);
-                       denominator_min    = gst_value_get_fraction_denominator 
(fraction_range_min);
-
-                       fraction_range_max = gst_value_get_fraction_range_max 
(framerates);
-                       numerator_max      = 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", 
numerator_min, denominator_min, numerator_max, denominator_max);
-
-                       video_format->num_framerates = (numerator_max - 
numerator_min + 1) * (denominator_max - denominator_min + 1);
-                       video_format->framerates = g_new0 (FramerateFraction, 
video_format->num_framerates);
-                       int k = 0;
-                       for (i = numerator_min; i <= numerator_max; i++) {
-                               for (j = denominator_min; j <= denominator_max; 
j++) {
-                                       video_format->framerates[k].numerator   
= i;
-                                       video_format->framerates[k].denominator 
= j;
-                                       k++;
-                               }
-                       }
-               }
-               else {
-                       g_critical ("GValue type %s, cannot be handled for 
framerates", G_VALUE_TYPE_NAME (framerates));
-               }
-       }
-       
-       //we found a supported framerate and want to add the information to 
-       //the GnashWebcam structure
-       void
-       VideoInputGst::add_supported_format(GnashWebcam *cam, WebcamVidFormat 
*video_format,
-               GstStructure *format_structure)
-       {
-               gint i;
-               gchar *resolution;
-               
-               get_supported_framerates(video_format, format_structure);
-               find_highest_framerate(video_format);
-               
-               resolution = g_strdup_printf ("%ix%i", video_format->width,
-                         video_format->height);
-               i = GPOINTER_TO_INT(g_hash_table_lookup 
(cam->supported_resolutions, resolution));
-               
-               //if i returns a value, maybe this resolution has been added 
previously?
-               if(i) {
-                       WebcamVidFormat *curr_format = 
&g_array_index(cam->video_formats, WebcamVidFormat, i - 1);
-                       gfloat new_framerate = 
(float)(video_format->highest_framerate.numerator / 
-                                 video_format->highest_framerate.denominator);
-                       gfloat curr_framerate = 
(float)(curr_format->highest_framerate.numerator /
-                                                                         
curr_format->highest_framerate.denominator);
-                       if (new_framerate > curr_framerate) {
-                               log_debug("higher framerate replacing existing 
format\n");
-                               *curr_format = *video_format;
-                       }
-                       
-                       g_free (resolution);
-                       
-                       return;
-               }
-               
-               g_array_append_val (cam->video_formats, *video_format);
-               g_hash_table_insert (cam->supported_resolutions, resolution,
-                         GINT_TO_POINTER(cam->num_video_formats + 1));
-
-               cam->num_video_formats++;
-       }
-       
-       //pulls webcam device selection from gnashrc (will eventually tie into
-       //gui)
-       void
-       VideoInputGst::make_webcamDevice_selection() {
-               int dev_select;
-               dev_select = rcfile.getWebcamDevice();
-               if (dev_select == -1) {
-                       log_error("%s: No webcam selected in rc file, setting 
to videotestsource", __FUNCTION__);
-                       rcfile.setWebcamDevice(0);
-                       dev_select = rcfile.getWebcamDevice();
-               } else {
-                       log_trace("Camera %d specified in gnashrc file, using 
that one.\n", dev_select);
-               }
-               //now that a selection has been made, get capabilities of that 
device
-               get_selected_caps(rcfile.getWebcamDevice());
-               
-               //now transfer gathered information over to the structure that 
will hold
-               //pipelining information
-               GnashWebcamPrivate *webcam = NULL;
-               webcam = transfer_to_private(dev_select);
-               if (webcam == NULL) {
-                       log_error("%s: GnashWebcamPrivate transfer didn't work 
as intended", __FUNCTION__);
-               }
-               
-               //now create the main bin (also calls webcam_create_source_bin)
-               gboolean result = false;
-               result = webcam_create_main_bin(webcam);
-               if (result != true) {
-                       log_error("%s: webcam_create_main_bin reported an error 
(returned false)", __FUNCTION__);
-               } else {
-                       result = false;
-               }
-               
-               //now create video display bin
-               result = webcam_create_display_bin(webcam);
-               if (result != true) {
-                       log_error("%s: webcam_create_display_bin reported an 
error (returned false)", __FUNCTION__);
-               } else {
-                       result = false;
-               }
-               
-               //try to link up the main and display bins
-               result = webcam_make_video_display_link(webcam);
-               if (result != true) {
-                       log_error("%s: webcam_make_video_display_link reported 
an error (returned false)", __FUNCTION__);
-               } else {
-                       result = false;
-               }
-               
-               //now create the save bin
-               result = webcam_create_save_bin(webcam);
-               if (result != true) {
-                       log_error("%s: webcam_create_save_bin reported an error 
(returned false)", __FUNCTION__);
-               } else {
-                       result = false;
-               }
-               
-               //start up the pipeline
-               webcam_play(webcam);
-       }
-
-       //called after a device selection, this starts enumerating the device's
-       //capabilities
-       void
-       VideoInputGst::get_selected_caps(gint dev_select)
-       {
-               GstElement *pipeline;
-               gchar *command;
-               GError *error = NULL;
-               GstStateChangeReturn return_val;
-               GstBus *bus;
-               GstMessage *message;
-               
-               GnashWebcam *data_struct = _vid_vect[dev_select];
-               GstElement *element;
-               element = data_struct->get_element_ptr();
-               
-               //create tester pipeline to enumerate properties
-               command = g_strdup_printf ("%s name=src device=%s ! fakesink",
-                       data_struct->get_gstreamer_src(), 
data_struct->get_dev_location());
-               pipeline = gst_parse_launch(command, &error);
-               if ((pipeline != NULL) && (error == NULL)) {
-                       //Wait at most 5 seconds for the pipeline to start 
playing
-                       gst_element_set_state (pipeline, GST_STATE_PLAYING);
-                       return_val = gst_element_get_state (pipeline, NULL, 
NULL, 5 * GST_SECOND);
-                       
-                       //errors on bus?
-                       bus = gst_element_get_bus (pipeline);
-                       message = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
-                       
-                       if (GST_IS_OBJECT(bus)){
-                               gst_object_unref (bus);
-                       } else {
-                               log_error("%s: Pipeline bus isn't an object for 
some reason", __FUNCTION__);
-                       }
-                       
-                       //if everything above worked properly, begin probing 
for values
-                       if ((return_val == GST_STATE_CHANGE_SUCCESS) && 
(message == NULL)) {
-                               GstElement *src;
-                               GstPad *pad;
-                               gchar *name;
-                               GstCaps *caps;
-                               
-                               gst_element_set_state(pipeline, 
GST_STATE_PAUSED);
-                               
-                               src = gst_bin_get_by_name(GST_BIN(pipeline), 
"src");
-                               
-                               //get the pad, find the capabilities for 
probing in supported vid formats
-                               pad  = gst_element_get_pad (src, "src");
-                               caps = gst_pad_get_caps (pad);
-                               if (GST_IS_OBJECT(pad)) {
-                                       gst_object_unref (pad);
-                               } else {
-                                       log_error("%s: Template pad isn't an 
object for some reason", __FUNCTION__);
-                               }
-                               
-                               get_supported_formats(data_struct, caps);
-                               
-                               gst_caps_unref (caps);
-                       }
-                       gst_element_set_state (pipeline, GST_STATE_NULL);
-                       if (GST_IS_OBJECT(pipeline)){
-                               gst_object_unref (pipeline);
-                       } else {
-                               log_error("%s: pipeline isn't an object for 
some reason", __FUNCTION__);
-                       }
-               }
-          
-               if (error) {
-                 g_error_free (error);
-               }
-               g_free (command);
-       }
-
-       //probe the selected camera for the formats it supports
-       void
-       VideoInputGst::get_supported_formats(GnashWebcam *cam, GstCaps *caps) {
-               gint i;
-               gint num_structs;
-               
-               num_structs = gst_caps_get_size (caps);
-               
-               for (i=0; i < num_structs; i++) {
-                       GstStructure *structure;
-                       const GValue *width, *height;
-                       
-                       //this structure is used to probe the source for 
information
-                       structure = gst_caps_get_structure (caps, i);
-                       
-                       //we just want to enumerate raw formats to keep things 
consistent
-                       //so if the strcuture we're currently looking at isn't 
either of
-                       //the standard raw formats, keep iterating through the 
loop
-                       if (!gst_structure_has_name (structure, 
"video/x-raw-yuv") &&
-                               !gst_structure_has_name (structure, 
"video/x-raw-rgb")) 
-                       {
-                         continue;
-                       }
-                       
-                       width  = gst_structure_get_value (structure, "width");
-                       height = gst_structure_get_value (structure, "height");
-                       
-                       if (G_VALUE_HOLDS_INT (width)) {
-                                 WebcamVidFormat video_format;
-
-                                 video_format.mimetype = g_strdup 
(gst_structure_get_name (structure));
-                                 gst_structure_get_int (structure, "width", 
&(video_format.width));
-                                 gst_structure_get_int (structure, "height", 
&(video_format.height));
-                                 add_supported_format(cam, &video_format, 
structure);
-                       }
-                       else if (GST_VALUE_HOLDS_INT_RANGE (width)) {
-                               int min_width, max_width, min_height, 
max_height;
-                               int cur_width, cur_height;
-
-                               min_width  = gst_value_get_int_range_min 
(width);
-                               max_width  = gst_value_get_int_range_max 
(width);
-                               min_height = gst_value_get_int_range_min 
(height);
-                               max_height = gst_value_get_int_range_max 
(height);
-
-                               cur_width  = min_width;
-                               cur_height = min_height;
-                               while (cur_width <= max_width && cur_height <= 
max_height) {
-                                       WebcamVidFormat video_format;
-
-                                       video_format.mimetype = g_strdup 
(gst_structure_get_name (structure));
-                                       video_format.width    = cur_width;
-                                       video_format.height   = cur_height;
-                                       add_supported_format(cam, 
&video_format, structure);
-                                       cur_width  *= 2;
-                                       cur_height *= 2;
-                               }
-
-                               cur_width  = max_width;
-                               cur_height = max_height;
-                               while (cur_width > min_width && cur_height > 
min_height) {
-                                       WebcamVidFormat video_format;
-
-                                       video_format.mimetype = g_strdup 
(gst_structure_get_name (structure));
-                                       video_format.width    = cur_width;
-                                       video_format.height   = cur_height;
-                                       add_supported_format(cam, 
&video_format, structure);
-                                       cur_width  /= 2;
-                                       cur_height /= 2;
-                               }
-                       }
-                       else {
-                               log_error("%s: GValue type %s, cannot be 
handled for resolution width", __FUNCTION__, G_VALUE_TYPE_NAME (width));
-                       }
-               }
-       }
-
-       //move the selected camera information to a more robust data structure
-       //to store pipeline-ing information
-       GnashWebcamPrivate*
-       VideoInputGst::transfer_to_private(gint dev_select)
-       {
-               GnashWebcamPrivate *webcam = new GnashWebcamPrivate;
-               if (webcam != NULL) {
-                       webcam->set_webcam_device(_vid_vect[dev_select]);
-                       
webcam->set_device_name(_vid_vect[dev_select]->get_product_name());
-                       _global_webcam = webcam;
-               } else {
-                       log_error("%s: was passed a NULL pointer (supposed to 
point to a GnashWebcamPrivate struct)", __FUNCTION__);
-               }
-               return webcam;
-       }
-
-       //create a bin containing the source and a connector ghostpad
-       gboolean
-       VideoInputGst::webcam_create_source_bin(GnashWebcamPrivate *webcam) {
-               GError *error = NULL;
-               gchar *command = NULL;
-               
-               if(webcam->_webcam_device == NULL) {
-                       log_trace("%s: looks like you don't have any webcams 
chosen, using videotestsrc", __FUNCTION__);
-                       webcam->_webcam_source_bin = 
gst_parse_bin_from_description (
-                               "videotestsrc name=video_source ! capsfilter 
name=capsfilter",
-                               TRUE, &error);
-                       log_debug("GstPipeline command: videotestsrc 
name=video_source ! capsfilter name=capsfilter");
-               }
-               else {
-                       WebcamVidFormat *format = NULL;
-                       gint i;
-                       gchar *resolution;
-                       
-                       resolution = g_strdup_printf("%ix%i", 
webcam->_x_resolution,
-                                                                         
webcam->_y_resolution);
-                                                                         
-                       //use these resolutions determined above if the camera 
supports it
-                       if (webcam->_x_resolution != 0 && webcam->_y_resolution 
!= 0) {
-                               
-                               i = GPOINTER_TO_INT(g_hash_table_lookup 
(webcam->_webcam_device->supported_resolutions, resolution));
-                               //the selected res is supported if i
-                               if (i) {
-                                       format = &g_array_index 
(webcam->_webcam_device->video_formats,
-                                                        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) {
-                               format = &g_array_index 
(webcam->_webcam_device->video_formats,
-                                        WebcamVidFormat, 0);
-                               for (i = 1; i < 
webcam->_webcam_device->num_video_formats; i++) {
-                                       //debug
-                                       //g_print("value from vid format is: %d 
\n", g_array_index(webcam->_webcam_device->video_formats, WebcamVidFormat, 
i).width);
-                                       //g_print("value from format var is: %d 
\n", format->width);
-                                       if (g_array_index 
(webcam->_webcam_device->video_formats,
-                                                          WebcamVidFormat, 
i).width <= format->width){
-                                               format = &g_array_index 
(webcam->_webcam_device->video_formats,
-                                                        WebcamVidFormat, i);
-                                       }
-                               }
-                       }
-                       
-                       webcam->_current_format = 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->_webcam_source_bin = 
gst_parse_bin_from_description ("videotestsrc name=video_source",
-                                                                               
                                                TRUE, &error);
-                               webcam->_video_source = gst_bin_get_by_name 
(GST_BIN (webcam->_webcam_source_bin), "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->_webcam_source_bin),
-                                                                               
          "capsfilter");
-                               return true;
-                       }
-                       
-                       //execution here means we're good to make the pipeline
-                       else {
-                               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->_webcam_device->get_gstreamer_src(),
-                                 webcam->_webcam_device->get_dev_location(),
-                                 format->width,
-                                 format->height,
-                                 format->highest_framerate.numerator,
-                                 format->highest_framerate.denominator,
-                                 format->width,
-                                 format->height,
-                                 format->highest_framerate.numerator,
-                                 format->highest_framerate.denominator);
-                               
-                               //debug
-                               log_debug ("GstPipeline command is: %s\n", 
command);
-                               
-                               webcam->_webcam_source_bin = 
gst_parse_bin_from_description (command, TRUE, &error);
-                               if (webcam->_webcam_source_bin == 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->_video_source = gst_bin_get_by_name 
(GST_BIN (webcam->_webcam_source_bin), "video_source");
-                               webcam->_capsfilter = gst_bin_get_by_name 
(GST_BIN (webcam->_webcam_source_bin), "capsfilter");
-                               return true;
-                       }
-               }
-               return true;
-       }
-       
-       //create a display bin that has ghostpads which allow display-to-screen
-       //capabilities as well as save-to-file or buffer capabilities (both
-       //implemented as bin ghostpads)
-       gboolean
-       VideoInputGst::webcam_create_main_bin(GnashWebcamPrivate *webcam) {
-               GstElement *tee, *video_display_queue, *save_queue;
-               gboolean ok;
-               GstPad  *pad;
-               
-               //initialize a new GST pipeline
-               webcam->_pipeline = gst_pipeline_new("pipeline");
-               
-               webcam->_webcam_main_bin = gst_bin_new ("webcam_main_bin");
-               
-               ok = webcam_create_source_bin(webcam);
-               if (ok != true) {
-                       log_error("%s: problem creating source bin", 
__FUNCTION__);
-                       return false;
-               }
-               
-               if ((tee = gst_element_factory_make ("tee", "tee")) == NULL) {
-                       log_error("%s: problem creating tee element", 
__FUNCTION__);
-                       return false;
-               }
-               if ((save_queue = gst_element_factory_make("queue", 
"save_queue")) == NULL) {
-                       log_error("%s: problem creating save_queue element", 
__FUNCTION__);
-                       return false;
-               }
-               if ((video_display_queue = gst_element_factory_make("queue", 
"video_display_queue")) == NULL) {
-                       log_error("%s: problem creating video_display_queue 
element", __FUNCTION__);
-                       return false;
-               }
-               
-               //add created elements to a bin
-               gst_bin_add_many (GST_BIN (webcam->_webcam_main_bin), 
webcam->_webcam_source_bin,
-                                               tee, save_queue, 
video_display_queue, NULL);
-                                               
-               ok = gst_element_link(webcam->_webcam_source_bin, tee);
-               if (ok != true) {
-                       log_error("%s: couldn't link webcam_source_bin and 
tee", __FUNCTION__);
-                       return false;
-               }
-               
-               ok &= gst_element_link_many (tee, save_queue, NULL);
-               if (ok != true) {
-                       log_error("%s: couldn't link tee and save_queue", 
__FUNCTION__);
-                       return false;
-               }
-               
-               ok &= gst_element_link_many (tee, video_display_queue, NULL);
-               if (ok != true) {
-                       log_error("%s: couldn't link tee and 
video_display_queue", __FUNCTION__);
-                       return false;
-               }
-               
-               gst_bin_add (GST_BIN(webcam->_pipeline), 
webcam->_webcam_main_bin);
-               
-               //add ghostpad to save_queue (allows connections between bins)
-               pad = gst_element_get_pad (save_queue, "src");
-               if (pad == NULL) {
-                       log_error("%s: couldn't get save_queue_src_pad", 
__FUNCTION__);
-                       return false;
-               }
-               gst_element_add_pad (webcam->_webcam_main_bin, 
gst_ghost_pad_new ("save_queue_src", pad));
-               gst_object_unref (GST_OBJECT (pad));
-               
-               //add ghostpad to video_display_queue
-               pad = gst_element_get_pad (video_display_queue, "src");
-               if (pad == NULL) {
-                       log_error("%s: couldn't get video_display_queue_pad", 
__FUNCTION__);
-                       return false;
-               }
-               gst_element_add_pad (webcam->_webcam_main_bin, 
gst_ghost_pad_new ("video_display_queue_src", pad));
-               gst_object_unref (GST_OBJECT (pad));
-
-
-               if (!ok) {
-                       log_error("%s: Unable to create main pipeline", 
__FUNCTION__);
-                       return false;
-               }
-
-               return true;
-       }
-
-       gboolean
-       VideoInputGst::webcam_create_display_bin(GnashWebcamPrivate *webcam) {
-               GstElement *video_scale, *video_sink;
-               gboolean ok;
-               GstPad  *pad;
-               
-               webcam->_video_display_bin = gst_bin_new("video_display_bin");
-               
-               if (webcam->_video_display_bin == NULL) {
-                       log_error("%s: something went wrong creating the new 
video_display_bin", __FUNCTION__);
-                       return false;
-               }
-               
-               if ((video_scale = gst_element_factory_make("videoscale", 
"video_scale")) == NULL) {
-                       log_error("%s: problem creating video_scale element", 
__FUNCTION__);
-                       return false;
-               }
-               else {
-                       //set bilinear scaling
-                       g_object_set (video_scale, "method", 1, NULL);
-               }
-               
-               if ((video_sink = gst_element_factory_make("autovideosink", 
"video_sink")) == NULL) {
-                       log_error("%s: problem creating the video_sink 
element", __FUNCTION__);
-                       return false;
-               }
-               
-               //add created elements to a bin
-               gst_bin_add_many (GST_BIN (webcam->_video_display_bin), 
video_scale, video_sink, NULL);
-               
-               //drop the display bin into the pipeline
-               //gst_bin_add (GST_BIN (webcam->_webcam_main_bin), 
webcam->_video_display_bin);
-               gst_bin_add (GST_BIN (webcam->_pipeline), 
webcam->_video_display_bin);
-               
-               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", __FUNCTION__);
-                       return false;
-               }
-               
-               //create ghostpad which can be used to connect this bin to the
-               //video_display_queue src ghostpad
-               pad = gst_element_get_pad (video_scale, "sink");
-               gst_element_add_pad (webcam->_video_display_bin, 
gst_ghost_pad_new ("sink", pad));
-               gst_object_unref (GST_OBJECT (pad));
-               
-               return true;
-       }
-       
-       //make link between display_queue src ghostpad in main_bin and
-       //the elements necessary to display video to screen (_video_display_bin)
-       gboolean
-       VideoInputGst::webcam_make_video_display_link(GnashWebcamPrivate 
*webcam) {
-               gboolean ok;
-               GstPad *video_display_queue_src, *video_display_bin_sink;
-               
-               video_display_queue_src = 
gst_element_get_pad(webcam->_webcam_main_bin, "video_display_queue_src");
-               video_display_bin_sink = 
gst_element_get_pad(webcam->_video_display_bin, "sink");
-               
-               GstPadLinkReturn padreturn;
-               padreturn = gst_pad_link(video_display_queue_src, 
video_display_bin_sink);
-               
-               if (padreturn == GST_PAD_LINK_OK) {
-                       return true;
-               } else {
-                       log_error(_("something went wrong in the 
make_video_display_link function"));
-                       return false;
-               }
-       }
-       
-       //create a bin to take the video stream and dump it out to
-       //an ogg file
-       gboolean
-       VideoInputGst::webcam_create_save_bin(GnashWebcamPrivate *webcam) {
-               GstElement *video_save_csp, *video_save_rate, 
*video_save_scale, *video_enc;
-               GstElement *mux;
-               GstPad     *pad;
-               gboolean    ok;
-               
-               webcam->_video_save_bin = gst_bin_new ("video_save_bin");
-               
-               if ((video_save_csp = 
gst_element_factory_make("ffmpegcolorspace", "video_save_csp")) == NULL) {
-                       log_error("%s: problem with creating video_save_csp 
element", __FUNCTION__);
-                       return false;
-               }
-               if ((video_enc = gst_element_factory_make("theoraenc", 
"video_enc")) == NULL) {
-                       log_error("%s: problem with creating video_enc 
element", __FUNCTION__);
-                       return false;
-               } else {
-                       g_object_set (video_enc, "keyframe-force", 1, NULL);
-               }
-               
-               if ((video_save_rate = gst_element_factory_make("videorate", 
"video_save_rate")) == NULL) {
-                       log_error("%s: problem with creating video_save_rate 
element", __FUNCTION__);
-                       return false;
-               }
-               if ((video_save_scale = gst_element_factory_make("videoscale", 
"video_save_scale")) == NULL) {
-                       log_error("%s: problem with creating video_save_scale 
element", __FUNCTION__);
-                       return false;
-               } else {
-                       //Use bilinear scaling
-                       g_object_set (video_save_scale, "method", 1, NULL);
-               }
-               if ((mux = gst_element_factory_make("oggmux", "mux")) == NULL) {
-                       log_error("%s: problem with creating mux element", 
__FUNCTION__);
-                       return false;
-               }
-               if ((webcam->_video_file_sink = 
gst_element_factory_make("filesink", "video_file_sink")) == NULL) {
-                       log_error("%s: problem with creating video_file_sink 
element", __FUNCTION__);
-                       return false;
-               } else {
-                       g_object_set(webcam->_video_file_sink, "location", 
"vidoutput.ogg", NULL);
-               }
-               
-               //add created elements to the video_save_bin in the 
datastructure
-               gst_bin_add_many (GST_BIN (webcam->_video_save_bin), 
video_save_csp, 
-                               video_save_rate, video_save_scale, video_enc, 
mux, webcam->_video_file_sink,
-                               NULL);
-                                         
-               //add ghostpad
-               pad = gst_element_get_pad (video_save_csp, "sink");
-               gst_element_add_pad (webcam->_video_save_bin, gst_ghost_pad_new 
("sink", pad));
-               gst_object_unref (GST_OBJECT (pad));
-                                                               
-               ok = gst_element_link_many (video_save_csp, video_save_rate, 
video_save_scale, video_enc, mux, webcam->_video_file_sink, NULL);
-               
-               if (ok != true) {
-                       log_error("%s: there was some problem in linking!", 
__FUNCTION__);
-               }
-               
-               //added starting here
-               
-               gst_bin_add (GST_BIN(webcam->_pipeline), 
webcam->_video_save_bin);
-               
-               //linking
-               GstPad *video_save_queue_src, *video_save_sink;
-               
-               video_save_queue_src = 
gst_element_get_pad(webcam->_webcam_main_bin, "save_queue_src");
-               video_save_sink = gst_element_get_pad(webcam->_video_save_bin, 
"sink");
-               
-               GstPadLinkReturn padreturn;
-               padreturn = gst_pad_link(video_save_queue_src, video_save_sink);
-               
-               if (padreturn == GST_PAD_LINK_OK) {
-                       return true;
-               } else {
-                       log_error("%s: something went wrong in the 
make_video_display_link function", __FUNCTION__);
-                       return false;
-               }
-               return true;
-       }
-       
-       //to handle messages while the main capture loop is running
-       gboolean
-       bus_call (GstBus     *bus,
-                         GstMessage *msg,
-                         gpointer data)
-       {
-         switch (GST_MESSAGE_TYPE (msg)) {
-
-               case GST_MESSAGE_EOS:
-                       log_trace ("End of stream\n");
-                       g_main_loop_quit (((class GnashWebcamPrivate 
*)data)->_loop);
-                       break;
-               
-               case GST_MESSAGE_ERROR: {
-                       gchar  *debug;
-                       GError *error;
-
-                       gst_message_parse_error (msg, &error, &debug);
-                       g_free (debug);
-
-                       g_printerr ("Error: %s\n", error->message);
-                       g_error_free (error);
-                       
-                       g_main_loop_quit (((class GnashWebcamPrivate 
*)data)->_loop);
-                       break;
-               }
-               default:
-                       break;
-         }
-
-         return TRUE;
-       }
-       
-       //start the pipeline and run the g_main_loop
-       void
-       VideoInputGst::webcam_play(GnashWebcamPrivate *webcam) {
-               GstStateChangeReturn state;
-               GstBus *bus;
-               GMainLoop *loop;
-               gint ret;
-               
-               //setup bus to watch pipeline for messages
-               bus = gst_pipeline_get_bus (GST_PIPELINE (webcam->_pipeline));
-               ret = gst_bus_add_watch (bus, bus_call, webcam);
-               gst_object_unref (bus);
-
-               //declare clock variables to record time (mainly useful in 
debug)
-               GstClockTime tfthen, tfnow;
-               GstClockTimeDiff diff;
-               
-               tfthen = gst_util_get_timestamp ();
-               state = gst_element_set_state (webcam->_pipeline, 
GST_STATE_PLAYING);
-               
-               if (state == GST_STATE_CHANGE_SUCCESS) {
-                       webcam->_pipeline_is_playing = true;
-               }
-               
-               loop = webcam->_loop;
-               log_trace("running (ctrl-c in terminal to quit).....\n");
-               g_main_loop_run(loop);
-               log_trace("main loop done...\n");
-               tfnow = gst_util_get_timestamp ();
-               diff = GST_CLOCK_DIFF (tfthen, tfnow);
-               log_trace(("Execution ended after %" G_GUINT64_FORMAT " 
ns.\n"), diff);
-       }
+    
+    //initializes the Gstreamer interface
+    VideoInputGst::VideoInputGst() {
+        gst_init(NULL,NULL);
+    }
+    
+    VideoInputGst::~VideoInputGst() {
+        log_unimpl("Video Input destructor");
+    }
+    
+    //populates video devices to a vector of GnashWebcam pointers
+    //which contain important information about the hardware camera
+    //inputs available on the machine
+    void
+    VideoInputGst::findVidDevs() {
+        _numdevs = 0;
+        
+        //find video test sources
+        GstElement *element;
+        element = gst_element_factory_make ("videotestsrc", "vidtestsrc");
+        
+        if (element == NULL) {
+            log_error("%s: Could not create video test source.\n", 
__FUNCTION__);
+            _vidVect.push_back(NULL);
+            _numdevs += 1;
+        } else {
+            _vidVect.push_back(new GnashWebcam);
+            _vidVect[_numdevs]->setElementPtr(element);
+            
_vidVect[_numdevs]->setGstreamerSrc(g_strdup_printf("videotestsrc"));
+            _vidVect[_numdevs]->setProductName(g_strdup_printf("videotest"));
+            _numdevs += 1;
+        }
+        
+        //find v4l devices
+        GstPropertyProbe *probe;
+        GValueArray *devarr;
+        element = NULL;
+        gint i;
+        
+        element = gst_element_factory_make ("v4lsrc", "v4lvidsrc");
+        probe = GST_PROPERTY_PROBE (element);
+        devarr = gst_property_probe_probe_and_get_values_name (probe, 
"device");
+        for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
+            GValue *val;
+            gchar *dev_name = NULL;
+            
+            val = g_value_array_get_nth (devarr, i);
+            g_object_set (element, "device", g_value_get_string (val), NULL);
+            gst_element_set_state (element, GST_STATE_PLAYING);
+            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");
+            }
+            else { 
+                _vidVect.push_back(new GnashWebcam);
+                _vidVect[_numdevs]->setElementPtr(element);
+                _vidVect[_numdevs]->setGstreamerSrc(g_strdup_printf("v4lsrc"));
+                _vidVect[_numdevs]->setProductName(dev_name);
+                
+                //set device location information (e.g. /dev/video0)
+                gchar *location;
+                g_object_get (element, "device", &location , NULL);
+                _vidVect[_numdevs]->setDevLocation(location);
+                _numdevs += 1;
+            }
+        }
+        if (devarr) {
+            g_value_array_free (devarr);
+        }
+        
+        //find v4l2 devices
+        probe = NULL;
+        devarr = NULL;
+        element = NULL;
+        
+        element = gst_element_factory_make ("v4l2src", "v4l2vidsrc");
+        probe = GST_PROPERTY_PROBE (element);
+        devarr = gst_property_probe_probe_and_get_values_name (probe, 
"device");
+        for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
+            GValue *val;
+            gchar *dev_name = NULL;
+            
+            val = g_value_array_get_nth (devarr, i);
+            g_object_set (element, "device", g_value_get_string (val), NULL);
+            gst_element_set_state (element, GST_STATE_PLAYING);
+            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");
+            }
+            else { 
+                _vidVect.push_back(new GnashWebcam);
+                _vidVect[_numdevs]->setElementPtr(element);
+                
_vidVect[_numdevs]->setGstreamerSrc(g_strdup_printf("v4l2src"));
+                _vidVect[_numdevs]->setProductName(dev_name);
+                
+                //set device location information (e.g. /dev/video0)
+                gchar *location;
+                g_object_get (element, "device", &location , NULL);
+                _vidVect[_numdevs]->setDevLocation(location);
+                _numdevs += 1;
+            }
+        }
+        if (devarr) {
+            g_value_array_free (devarr);
+        }
+    }
+    
+    //called by addSupportedFormat. finds the highest possible framerate
+    //to record at (can be shaped down by a filter for performance)
+    void
+    VideoInputGst::findHighestFramerate(WebcamVidFormat *format)
+    {
+        gint framerate_numerator;
+        gint framerate_denominator;
+        gint i;
+
+        //Select the highest framerate up to less than or equal to 30 Hz
+        framerate_numerator   = 1;
+        framerate_denominator = 1;
+        for (i = 0; i < format->numFramerates; i++) {
+            gfloat framerate = format->framerates[i].numerator / 
+                format->framerates[i].denominator;
+            if (framerate > ((float) framerate_numerator / 
framerate_denominator)
+               && framerate <= 30) {
+                framerate_numerator   = format->framerates[i].numerator;
+                framerate_denominator = format->framerates[i].denominator;
+            }
+        }
+        //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
+    VideoInputGst::getSupportedFramerates 
+      (WebcamVidFormat *video_format, GstStructure *structure)
+    {
+        const GValue *framerates;
+        gint i, j;
+        
+        //note that framerates may contain one value, a list, or a range
+        framerates = gst_structure_get_value (structure, "framerate");
+        if (GST_VALUE_HOLDS_FRACTION (framerates)) {
+            video_format->numFramerates = 1;
+            video_format->framerates =
+                g_new0 (FramerateFraction, video_format->numFramerates);
+            video_format->framerates[0].numerator =
+                gst_value_get_fraction_numerator (framerates);
+            video_format->framerates[0].denominator =
+                gst_value_get_fraction_denominator (framerates);
+        }
+        else if (GST_VALUE_HOLDS_LIST (framerates)) {
+            video_format->numFramerates = gst_value_list_get_size (framerates);
+            video_format->framerates =
+                g_new0 (FramerateFraction, video_format->numFramerates);
+            for (i = 0; i < video_format->numFramerates; i++) {
+                const GValue *value;
+                value = gst_value_list_get_value (framerates, i);
+                video_format->framerates[i].numerator =
+                    gst_value_get_fraction_numerator (value);
+                video_format->framerates[i].denominator =
+                    gst_value_get_fraction_denominator (value);
+            }
+        }
+        else if (GST_VALUE_HOLDS_FRACTION_RANGE (framerates)) {
+            gint numerator_min, denominator_min, numerator_max, 
denominator_max;
+            const GValue *fraction_range_min;
+            const GValue *fraction_range_max;
+
+            fraction_range_min =
+                gst_value_get_fraction_range_min (framerates);
+            numerator_min =
+                gst_value_get_fraction_numerator (fraction_range_min);
+            denominator_min =
+                gst_value_get_fraction_denominator (fraction_range_min);
+
+            fraction_range_max = gst_value_get_fraction_range_max (framerates);
+            numerator_max =
+                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",
+                numerator_min, denominator_min, numerator_max, 
denominator_max);
+
+            video_format->numFramerates =
+                (numerator_max - numerator_min + 1) * 
+                (denominator_max - denominator_min + 1);
+            video_format->framerates =
+                g_new0 (FramerateFraction, video_format->numFramerates);
+            int k = 0;
+            for (i = numerator_min; i <= numerator_max; i++) {
+                for (j = denominator_min; j <= denominator_max; j++) {
+                    video_format->framerates[k].numerator   = i;
+                    video_format->framerates[k].denominator = j;
+                    k++;
+                }
+            }
+        }
+        else {
+            g_critical ("GValue type %s, cannot be handled for framerates",
+                G_VALUE_TYPE_NAME (framerates));
+        }
+    }
+    
+    //we found a supported framerate and want to add the information to 
+    //the GnashWebcam structure
+    void
+    VideoInputGst::addSupportedFormat(GnashWebcam *cam, WebcamVidFormat 
*video_format,
+        GstStructure *format_structure)
+    {
+        gint i;
+        gchar *resolution;
+        
+        getSupportedFramerates(video_format, format_structure);
+        findHighestFramerate(video_format);
+        
+        resolution = g_strdup_printf ("%ix%i", video_format->width,
+              video_format->height);
+        i = GPOINTER_TO_INT(g_hash_table_lookup (cam->supportedResolutions, 
resolution));
+        
+        //if i returns a value, maybe this resolution has been added 
previously?
+        if(i) {
+            WebcamVidFormat *curr_format =
+                &g_array_index(cam->videoFormats, WebcamVidFormat, i - 1);
+            gfloat new_framerate = 
(float)(video_format->highestFramerate.numerator / 
+                  video_format->highestFramerate.denominator);
+            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");
+                *curr_format = *video_format;
+            }
+            
+            g_free (resolution);
+            
+            return;
+        }
+        
+        g_array_append_val (cam->videoFormats, *video_format);
+        g_hash_table_insert (cam->supportedResolutions, resolution,
+              GINT_TO_POINTER(cam->numVideoFormats + 1));
+
+        cam->numVideoFormats++;
+    }
+    
+    //pulls webcam device selection from gnashrc (will eventually tie into
+    //gui)
+    void
+    VideoInputGst::makeWebcamDeviceSelection() {
+        int dev_select;
+        dev_select = rcfile.getWebcamDevice();
+        if (dev_select == -1) {
+            log_error("%s: No webcam selected in rc file, setting to 
videotestsource",
+                __FUNCTION__);
+            rcfile.setWebcamDevice(0);
+            dev_select = rcfile.getWebcamDevice();
+        } else {
+            log_trace("Camera %d specified in gnashrc file, using that one.\n",
+                dev_select);
+        }
+        //now that a selection has been made, get capabilities of that device
+        getSelectedCaps(rcfile.getWebcamDevice());
+        
+        //now transfer gathered information over to the structure that will 
hold
+        //pipelining information
+        GnashWebcamPrivate *webcam = NULL;
+        webcam = transferToPrivate(dev_select);
+        if (webcam == NULL) {
+            log_error("%s: GnashWebcamPrivate transfer didn't work as 
intended",
+                __FUNCTION__);
+        }
+        
+        //now create the main bin (also calls webcamCreateSourceBin)
+        gboolean result = false;
+        result = webcamCreateMainBin(webcam);
+        if (result != true) {
+            log_error("%s: webcamCreateMainBin reported an error",
+                __FUNCTION__);
+        } else {
+            result = false;
+        }
+        
+        //now create video display bin
+        result = webcamCreateDisplayBin(webcam);
+        if (result != true) {
+            log_error("%s: webcamCreateDisplayBin reported an error",
+                __FUNCTION__);
+        } else {
+            result = false;
+        }
+        
+        //try to link up the main and display bins
+        result = webcamMakeVideoDisplayLink(webcam);
+        if (result != true) {
+            log_error("%s: webcamMakeVideoDisplayLink reported an error",
+                __FUNCTION__);
+        } else {
+            result = false;
+        }
+        
+        //now create the save bin
+        result = webcamCreateSaveBin(webcam);
+        if (result != true) {
+            log_error("%s: webcamCreateSaveBin reported an error",
+                __FUNCTION__);
+        } else {
+            result = false;
+        }
+        
+        //start up the pipeline
+        webcamPlay(webcam);
+    }
+
+    //called after a device selection, this starts enumerating the device's
+    //capabilities
+    void
+    VideoInputGst::getSelectedCaps(gint dev_select)
+    {
+        GstElement *pipeline;
+        gchar *command;
+        GError *error = NULL;
+        GstStateChangeReturn return_val;
+        GstBus *bus;
+        GstMessage *message;
+        
+        GnashWebcam *data_struct = _vidVect[dev_select];
+        GstElement *element;
+        element = data_struct->getElementPtr();
+        
+        //create tester pipeline to enumerate properties
+        command = g_strdup_printf ("%s name=src device=%s ! fakesink",
+            data_struct->getGstreamerSrc(), data_struct->getDevLocation());
+        pipeline = gst_parse_launch(command, &error);
+        if ((pipeline != NULL) && (error == NULL)) {
+            //Wait at most 5 seconds for the pipeline to start playing
+            gst_element_set_state (pipeline, GST_STATE_PLAYING);
+            return_val = 
+                gst_element_get_state (pipeline, NULL, NULL, 5 * GST_SECOND);
+            
+            //errors on bus?
+            bus = gst_element_get_bus (pipeline);
+            message = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0);
+            
+            if (GST_IS_OBJECT(bus)){
+                gst_object_unref (bus);
+            } else {
+                log_error("%s: Pipeline bus isn't an object for some reason",
+                    __FUNCTION__);
+            }
+            
+            //if everything above worked properly, begin probing for values
+            if ((return_val == GST_STATE_CHANGE_SUCCESS) && (message == NULL)) 
{
+                GstElement *src;
+                GstPad *pad;
+                gchar *name;
+                GstCaps *caps;
+                
+                gst_element_set_state(pipeline, GST_STATE_PAUSED);
+                
+                src = gst_bin_get_by_name(GST_BIN(pipeline), "src");
+                
+                //get the pad, find the capabilities for probing in supported 
formats
+                pad  = gst_element_get_pad (src, "src");
+                caps = gst_pad_get_caps (pad);
+                if (GST_IS_OBJECT(pad)) {
+                    gst_object_unref (pad);
+                } else {
+                    log_error("%s: Template pad isn't an object for some 
reason",
+                        __FUNCTION__);
+                }
+                
+                getSupportedFormats(data_struct, caps);
+                
+                gst_caps_unref (caps);
+            }
+            gst_element_set_state (pipeline, GST_STATE_NULL);
+            if (GST_IS_OBJECT(pipeline)){
+                gst_object_unref (pipeline);
+            } else {
+                log_error("%s: pipeline isn't an object for some reason",
+                    __FUNCTION__);
+            }
+        }
+       
+        if (error) {
+          g_error_free (error);
+        }
+        g_free (command);
+    }
+
+    //probe the selected camera for the formats it supports
+    void
+    VideoInputGst::getSupportedFormats(GnashWebcam *cam, GstCaps *caps) {
+        gint i;
+        gint num_structs;
+        
+        num_structs = gst_caps_get_size (caps);
+        
+        for (i=0; i < num_structs; i++) {
+            GstStructure *structure;
+            const GValue *width, *height;
+            
+            //this structure is used to probe the source for information
+            structure = gst_caps_get_structure (caps, i);
+            
+            //we just want to enumerate raw formats to keep things consistent
+            //so if the strcuture we're currently looking at isn't either of
+            //the standard raw formats, keep iterating through the loop
+            if (!gst_structure_has_name (structure, "video/x-raw-yuv") &&
+                !gst_structure_has_name (structure, "video/x-raw-rgb")) 
+            {
+              continue;
+            }
+            
+            width  = gst_structure_get_value (structure, "width");
+            height = gst_structure_get_value (structure, "height");
+            
+            if (G_VALUE_HOLDS_INT (width)) {
+                  WebcamVidFormat video_format;
+
+                  video_format.mimetype = 
+                    g_strdup (gst_structure_get_name (structure));
+                  gst_structure_get_int (structure, "width", 
&(video_format.width));
+                  gst_structure_get_int (structure, "height", 
&(video_format.height));
+                  addSupportedFormat(cam, &video_format, structure);
+            }
+            else if (GST_VALUE_HOLDS_INT_RANGE (width)) {
+                int min_width, max_width, min_height, max_height;
+                int cur_width, cur_height;
+
+                min_width  = gst_value_get_int_range_min (width);
+                max_width  = gst_value_get_int_range_max (width);
+                min_height = gst_value_get_int_range_min (height);
+                max_height = gst_value_get_int_range_max (height);
+
+                cur_width  = min_width;
+                cur_height = min_height;
+                while (cur_width <= max_width && cur_height <= max_height) {
+                    WebcamVidFormat video_format;
+
+                    video_format.mimetype =
+                        g_strdup (gst_structure_get_name (structure));
+                    video_format.width    = cur_width;
+                    video_format.height   = cur_height;
+                    addSupportedFormat(cam, &video_format, structure);
+                    cur_width  *= 2;
+                    cur_height *= 2;
+                }
+
+                cur_width  = max_width;
+                cur_height = max_height;
+                while (cur_width > min_width && cur_height > min_height) {
+                    WebcamVidFormat video_format;
+
+                    video_format.mimetype = 
+                        g_strdup (gst_structure_get_name (structure));
+                    video_format.width    = cur_width;
+                    video_format.height   = cur_height;
+                    addSupportedFormat(cam, &video_format, structure);
+                    cur_width  /= 2;
+                    cur_height /= 2;
+                }
+            }
+            else {
+                log_error("%s: type %s, cannot be handled for resolution 
width",
+                    __FUNCTION__, G_VALUE_TYPE_NAME (width));
+            }
+        }
+    }
+
+    //move the selected camera information to a more robust data structure
+    //to store pipeline-ing information
+    GnashWebcamPrivate*
+    VideoInputGst::transferToPrivate(gint dev_select)
+    {
+        GnashWebcamPrivate *webcam = new GnashWebcamPrivate;
+        if (webcam != NULL) {
+            webcam->setWebcamDevice(_vidVect[dev_select]);
+            webcam->setDeviceName(_vidVect[dev_select]->getProductName());
+            _globalWebcam = webcam;
+        } else {
+            log_error("%s: was passed a NULL pointer", __FUNCTION__);
+        }
+        return webcam;
+    }
+
+    //create a bin containing the source and a connector ghostpad
+    gboolean
+    VideoInputGst::webcamCreateSourceBin(GnashWebcamPrivate *webcam) {
+        GError *error = NULL;
+        gchar *command = 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) {
+                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);
+                    }
+                }
+            }
+            
+            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
+                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;
+            }
+        }
+        return true;
+    }
+    
+    //create a display bin that has ghostpads which allow display-to-screen
+    //capabilities as well as save-to-file or buffer capabilities (both
+    //implemented as bin ghostpads)
+    gboolean
+    VideoInputGst::webcamCreateMainBin(GnashWebcamPrivate *webcam) {
+        GstElement *tee, *video_display_queue, *save_queue;
+        gboolean ok;
+        GstPad  *pad;
+        
+        //initialize a new GST pipeline
+        webcam->_pipeline = gst_pipeline_new("pipeline");
+        
+        webcam->_webcamMainBin = gst_bin_new ("webcam_main_bin");
+        
+        ok = webcamCreateSourceBin(webcam);
+        if (ok != true) {
+            log_error("%s: problem creating source bin", __FUNCTION__);
+            return false;
+        }
+        
+        if ((tee = gst_element_factory_make ("tee", "tee")) == NULL) {
+            log_error("%s: problem creating tee element", __FUNCTION__);
+            return false;
+        }
+        if ((save_queue = gst_element_factory_make("queue", "save_queue")) == 
NULL) {
+            log_error("%s: problem creating save_queue element", __FUNCTION__);
+            return false;
+        }
+        if ((video_display_queue = 
+            gst_element_factory_make("queue", "video_display_queue")) == NULL) 
{
+            log_error("%s: problem creating video_display_queue element", 
__FUNCTION__);
+            return false;
+        }
+        
+        //add created elements to a bin
+        gst_bin_add_many (GST_BIN (webcam->_webcamMainBin), 
webcam->_webcamSourceBin,
+                        tee, save_queue, video_display_queue, NULL);
+                        
+        ok = gst_element_link(webcam->_webcamSourceBin, tee);
+        if (ok != true) {
+            log_error("%s: couldn't link webcam_source_bin and tee", 
__FUNCTION__);
+            return false;
+        }
+        
+        ok &= gst_element_link_many (tee, save_queue, NULL);
+        if (ok != true) {
+            log_error("%s: couldn't link tee and save_queue", __FUNCTION__);
+            return false;
+        }
+        
+        ok &= gst_element_link_many (tee, video_display_queue, NULL);
+        if (ok != true) {
+            log_error("%s: couldn't link tee and video_display_queue", 
__FUNCTION__);
+            return false;
+        }
+        
+        gst_bin_add (GST_BIN(webcam->_pipeline), webcam->_webcamMainBin);
+        
+        //add ghostpad to save_queue (allows connections between bins)
+        pad = gst_element_get_pad (save_queue, "src");
+        if (pad == NULL) {
+            log_error("%s: couldn't get save_queue_src_pad", __FUNCTION__);
+            return false;
+        }
+        gst_element_add_pad (webcam->_webcamMainBin,
+            gst_ghost_pad_new ("save_queue_src", pad));
+        gst_object_unref (GST_OBJECT (pad));
+        
+        //add ghostpad to video_display_queue
+        pad = gst_element_get_pad (video_display_queue, "src");
+        if (pad == NULL) {
+            log_error("%s: couldn't get video_display_queue_pad", 
__FUNCTION__);
+            return false;
+        }
+        gst_element_add_pad (webcam->_webcamMainBin,
+            gst_ghost_pad_new ("video_display_queue_src", pad));
+        gst_object_unref (GST_OBJECT (pad));
+
+
+        if (!ok) {
+            log_error("%s: Unable to create main pipeline", __FUNCTION__);
+            return false;
+        }
+
+        return true;
+    }
+
+    gboolean
+    VideoInputGst::webcamCreateDisplayBin(GnashWebcamPrivate *webcam) {
+        GstElement *video_scale, *video_sink;
+        gboolean ok;
+        GstPad  *pad;
+        
+        webcam->_videoDisplayBin = gst_bin_new("video_display_bin");
+        
+        if (webcam->_videoDisplayBin == NULL) {
+            log_error("%s: something went wrong creating the new 
video_display_bin",
+                __FUNCTION__);
+            return false;
+        }
+        
+        if ((video_scale = gst_element_factory_make("videoscale", 
"video_scale")) == NULL) {
+            log_error("%s: problem creating video_scale element", 
__FUNCTION__);
+            return false;
+        }
+        else {
+            //set bilinear scaling
+            g_object_set (video_scale, "method", 1, NULL);
+        }
+        
+        if ((video_sink = gst_element_factory_make("autovideosink", 
"video_sink")) == NULL) {
+            log_error("%s: problem creating the video_sink element", 
__FUNCTION__);
+            return false;
+        }
+        
+        //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",
+                __FUNCTION__);
+            return false;
+        }
+        
+        //create ghostpad which can be used to connect this bin to the
+        //video_display_queue src ghostpad
+        pad = gst_element_get_pad (video_scale, "sink");
+        gst_element_add_pad (webcam->_videoDisplayBin, gst_ghost_pad_new 
("sink", pad));
+        gst_object_unref (GST_OBJECT (pad));
+        
+        return true;
+    }
+    
+    //make link between display_queue src ghostpad in main_bin and
+    //the elements necessary to display video to screen (_videoDisplayBin)
+    gboolean
+    VideoInputGst::webcamMakeVideoDisplayLink(GnashWebcamPrivate *webcam) {
+        gboolean ok;
+        GstPad *video_display_queue_src, *video_display_bin_sink;
+        
+        video_display_queue_src = gst_element_get_pad(webcam->_webcamMainBin,
+            "video_display_queue_src");
+        video_display_bin_sink = gst_element_get_pad(webcam->_videoDisplayBin,
+            "sink");
+        
+        GstPadLinkReturn padreturn;
+        padreturn = gst_pad_link(video_display_queue_src, 
video_display_bin_sink);
+        
+        if (padreturn == GST_PAD_LINK_OK) {
+            return true;
+        } else {
+            log_error("something went wrong in the make_video_display_link 
function");
+            return false;
+        }
+    }
+    
+    //create a bin to take the video stream and dump it out to
+    //an ogg file
+    gboolean
+    VideoInputGst::webcamCreateSaveBin(GnashWebcamPrivate *webcam) {
+        GstElement *video_save_csp, *video_save_rate, *video_save_scale, 
*video_enc;
+        GstElement *mux;
+        GstPad     *pad;
+        gboolean    ok;
+        
+        webcam->_videoSaveBin = gst_bin_new ("video_save_bin");
+        
+        if ((video_save_csp =
+            gst_element_factory_make("ffmpegcolorspace", "video_save_csp"))
+                == NULL) {
+            log_error("%s: problem with creating video_save_csp element",
+                __FUNCTION__);
+            return false;
+        }
+        if ((video_enc = gst_element_factory_make("theoraenc", "video_enc")) 
== NULL) {
+            log_error("%s: problem with creating video_enc element", 
__FUNCTION__);
+            return false;
+        } else {
+            g_object_set (video_enc, "keyframe-force", 1, NULL);
+        }
+        
+        if ((video_save_rate = gst_element_factory_make("videorate", 
"video_save_rate")) == NULL) {
+            log_error("%s: problem with creating video_save_rate element", 
__FUNCTION__);
+            return false;
+        }
+        if ((video_save_scale = gst_element_factory_make("videoscale", 
"video_save_scale")) == NULL) {
+            log_error("%s: problem with creating video_save_scale element", 
__FUNCTION__);
+            return false;
+        } else {
+            //Use bilinear scaling
+            g_object_set (video_save_scale, "method", 1, NULL);
+        }
+        if ((mux = gst_element_factory_make("oggmux", "mux")) == NULL) {
+            log_error("%s: problem with creating mux element", __FUNCTION__);
+            return false;
+        }
+        if ((webcam->_videoFileSink = gst_element_factory_make("filesink", 
"video_file_sink")) == NULL) {
+            log_error("%s: problem with creating video_file_sink element", 
__FUNCTION__);
+            return false;
+        } else {
+            g_object_set(webcam->_videoFileSink, "location", "vidoutput.ogg", 
NULL);
+        }
+        
+        //add created elements to the video_save_bin in the datastructure
+        gst_bin_add_many (GST_BIN (webcam->_videoSaveBin), video_save_csp, 
+                video_save_rate, video_save_scale, video_enc, mux, 
webcam->_videoFileSink,
+                NULL);
+                      
+        //add ghostpad
+        pad = gst_element_get_pad (video_save_csp, "sink");
+        gst_element_add_pad (webcam->_videoSaveBin, gst_ghost_pad_new ("sink", 
pad));
+        gst_object_unref (GST_OBJECT (pad));
+                                
+        ok = gst_element_link_many (video_save_csp, video_save_rate,
+            video_save_scale, video_enc, mux, webcam->_videoFileSink, NULL);
+        
+        if (ok != true) {
+            log_error("%s: there was some problem in linking!", __FUNCTION__);
+        }
+        
+        //added starting here
+        
+        gst_bin_add (GST_BIN(webcam->_pipeline), webcam->_videoSaveBin);
+        
+        //linking
+        GstPad *video_save_queue_src, *video_save_sink;
+        
+        video_save_queue_src = gst_element_get_pad(webcam->_webcamMainBin, 
"save_queue_src");
+        video_save_sink = gst_element_get_pad(webcam->_videoSaveBin, "sink");
+        
+        GstPadLinkReturn padreturn;
+        padreturn = gst_pad_link(video_save_queue_src, video_save_sink);
+        
+        if (padreturn == GST_PAD_LINK_OK) {
+            return true;
+        } else {
+            log_error("%s: something went wrong in the make_video_display_link 
function",
+                __FUNCTION__);
+            return false;
+        }
+        return true;
+    }
+    
+    //to handle messages while the main capture loop is running
+    gboolean
+    bus_call (GstBus     *bus,
+              GstMessage *msg,
+              gpointer data)
+    {
+      switch (GST_MESSAGE_TYPE (msg)) {
+
+        case GST_MESSAGE_EOS:
+            log_trace ("End of stream\n");
+            g_main_loop_quit (((class GnashWebcamPrivate *)data)->_loop);
+            break;
+        
+        case GST_MESSAGE_ERROR: {
+            gchar  *debug;
+            GError *error;
+
+            gst_message_parse_error (msg, &error, &debug);
+            g_free (debug);
+
+            g_printerr ("Error: %s\n", error->message);
+            g_error_free (error);
+            
+            g_main_loop_quit (((class GnashWebcamPrivate *)data)->_loop);
+            break;
+        }
+        default:
+            break;
+      }
+
+      return TRUE;
+    }
+    
+    //start the pipeline and run the g_main_loop
+    void
+    VideoInputGst::webcamPlay(GnashWebcamPrivate *webcam) {
+        GstStateChangeReturn state;
+        GstBus *bus;
+        GMainLoop *loop;
+        gint ret;
+        
+        //setup bus to watch pipeline for messages
+        bus = gst_pipeline_get_bus (GST_PIPELINE (webcam->_pipeline));
+        ret = gst_bus_add_watch (bus, bus_call, webcam);
+        gst_object_unref (bus);
+
+        //declare clock variables to record time (mainly useful in debug)
+        GstClockTime tfthen, tfnow;
+        GstClockTimeDiff diff;
+        
+        tfthen = gst_util_get_timestamp ();
+        state = gst_element_set_state (webcam->_pipeline, GST_STATE_PLAYING);
+        
+        if (state == GST_STATE_CHANGE_SUCCESS) {
+            webcam->_pipelineIsPlaying = true;
+        }
+        
+        loop = webcam->_loop;
+        log_trace("running (ctrl-c in terminal to quit).....\n");
+        g_main_loop_run(loop);
+        log_trace("main loop done...\n");
+        tfnow = gst_util_get_timestamp ();
+        diff = GST_CLOCK_DIFF (tfthen, tfnow);
+        log_trace(("Execution ended after %" G_GUINT64_FORMAT " ns.\n"), diff);
+    }
 } //gst namespace
 } //media namespace
 } //gnash namespace

=== modified file 'libmedia/gst/VideoInputGst.h'
--- a/libmedia/gst/VideoInputGst.h      2009-07-16 18:44:25 +0000
+++ b/libmedia/gst/VideoInputGst.h      2009-07-17 21:38:26 +0000
@@ -37,23 +37,23 @@
 /// the information returned from probing hardware cameras for supported
 /// framerates.
 class FramerateFraction{
-       public:
-               /// \var FramerateFraction::numerator
-               /// \brief contains a gint value for the numerator portion of a 
fraction.
-               gint numerator;
-               /// \var FramerateFraction::denominator
-               /// \brief contains a gint value for the denominator portion of 
a fraction.
-               gint denominator;
-               
-               /// \brief Constructor which sets the numerator and denominator 
fields upon construction.
-               ///
-               /// @param num The integer numerator value to initialize the 
FramerateFraction class with.
-               ///
-               /// @param denom The integer denominator value to initialzie 
the FramerateFraction class with.
-               FramerateFraction(gint num, gint denom);
-               
-               /// Create a new empty FramerateFraction class.
-               FramerateFraction();
+    public:
+        /// \var FramerateFraction::numerator
+        /// \brief contains a gint value for the numerator portion of a 
fraction.
+        gint numerator;
+        /// \var FramerateFraction::denominator
+        /// \brief contains a gint value for the denominator portion of a 
fraction.
+        gint denominator;
+        
+        /// \brief Constructor which sets the numerator and denominator fields 
upon construction.
+        ///
+        /// @param num The integer numerator value to initialize the 
FramerateFraction class with.
+        ///
+        /// @param denom The integer denominator value to initialzie the 
FramerateFraction class with.
+        FramerateFraction(gint num, gint denom);
+        
+        /// Create a new empty FramerateFraction class.
+        FramerateFraction();
 };
 
 /// \class GnashWebcam
@@ -64,102 +64,102 @@
 /// specifies a hardware input device to use in the gnashrc file.
 ///
 class GnashWebcam {
-       public:
-               /// \brief Accessor to retreive a the private _element variable
-               ///       from the GnashWebcam class which contains a pointer
-               ///       to the video source element.
-               ///
-               /// @return GstElement* to the video source element
-               GstElement* get_element_ptr() {return _element;};
-               
-               /// \brief Accessor to set the private _element variable from
-               ///       the GnashWebcam class.
-               ///
-               /// @param element The GstElement pointer to the video source 
element.
-               void set_element_ptr(GstElement* element) {_element = element;};
-               
-               /// \brief Accessor to get the private _dev_location variable 
from
-               ///       the GnashWebcam class.
-               ///
-               /// @return The _dev_location private variable from GnashWebcam 
class.
-               gchar* get_dev_location() {return _dev_location;};
-               
-               /// \brief Accessor to set the private _dev_location variable 
from
-               ///       the GnashWebcam class.
-               ///
-               /// @param l A gchar* containing the physical location of the 
video
-               ///       input hardware device (e.g. on Linux typically would 
be set
-               ///       to '/dev/video0').
-               void set_dev_location(gchar *l) {_dev_location = l;};
-               
-               /// \brief Accessor to return the private _gstreamer_src 
variable
-               ///       from the GnashWebcam class.
-               ///
-               /// @return The _gstreamer_src variable from the GnashWebcam 
class.
-               ///        which should contain the type of the Gstreamer video 
source
-               ///        element (e.g. v4lsrc, v4l2src).
-               gchar* get_gstreamer_src() {return _gstreamer_src;};
-               
-               /// \brief Accessor to set the private _gstreamer_src variable
-               ///       from the GnashWebcam class.
-               ///
-               /// @param s A gchar* containing the type of the Gstreamer 
source
-               ///         element type (e.g. v4lsrc, v4l2src, etc)
-               void set_gstreamer_src(gchar *s) {_gstreamer_src = s;};
-               
-               /// \brief Accessor to get the private _product_name variable
-               ///       from the GnashWebcam class.
-               ///
-               /// @return A gchar* containing the video input's hardware name
-               ///       (e.g. Built-In Webcam or Microsoft LifeCam VX500).
-               gchar* get_product_name() {return _product_name;};
-               
-               /// \brief Accessor to set the private _product_name variable
-               ///       from the GnashWebcam class.
-               ///
-               /// @param n A gchar* to the hardware input device's hardware 
name
-               ///         (e.g. Built-In Webcam or Microsoft LifeCam VX500).
-               void set_product_name(gchar *n) {_product_name = n;};
-               
-               /// \var GnashWebcam::num_video_formats
-               /// \brief Contains an integer value representing the number of
-               ///       video formats the camera supports (used for iteration
-               ///       purposes).
-               gint   num_video_formats;
-               
-               /// \var GnashWebcam::video_formats
-               /// \brief A GArray containing WebcamVidFormat data structures
-               ///       (see WebcamVidFormat class documentation for more 
info).
-               GArray* video_formats;
-               
-               /// \var GnashWebcam::supported_resolutions
-               /// \brief A hash table for easy lookup of resolutions the 
hardware
-               ///       camera supports.
-               GHashTable* supported_resolutions;
+    public:
+        /// \brief Accessor to retreive a the private _element variable
+        ///       from the GnashWebcam class which contains a pointer
+        ///       to the video source element.
+        ///
+        /// @return GstElement* to the video source element
+        GstElement* getElementPtr() {return _element;};
+        
+        /// \brief Accessor to set the private _element variable from
+        ///       the GnashWebcam class.
+        ///
+        /// @param element The GstElement pointer to the video source element.
+        void setElementPtr(GstElement* element) {_element = element;};
+        
+        /// \brief Accessor to get the private _devLocation variable from
+        ///       the GnashWebcam class.
+        ///
+        /// @return The _devLocation private variable from GnashWebcam class.
+        gchar* getDevLocation() {return _devLocation;};
+        
+        /// \brief Accessor to set the private _devLocation variable from
+        ///       the GnashWebcam class.
+        ///
+        /// @param l A gchar* containing the physical location of the video
+        ///       input hardware device (e.g. on Linux typically would be set
+        ///       to '/dev/video0').
+        void setDevLocation(gchar *l) {_devLocation = l;};
+        
+        /// \brief Accessor to return the private _gstreamerSrc variable
+        ///       from the GnashWebcam class.
+        ///
+        /// @return The _gstreamerSrc variable from the GnashWebcam class.
+        ///        which should contain the type of the Gstreamer video source
+        ///        element (e.g. v4lsrc, v4l2src).
+        gchar* getGstreamerSrc() {return _gstreamerSrc;};
+        
+        /// \brief Accessor to set the private _gstreamerSrc variable
+        ///       from the GnashWebcam class.
+        ///
+        /// @param s A gchar* containing the type of the Gstreamer source
+        ///         element type (e.g. v4lsrc, v4l2src, etc)
+        void setGstreamerSrc(gchar *s) {_gstreamerSrc = s;};
+        
+        /// \brief Accessor to get the private _productName variable
+        ///       from the GnashWebcam class.
+        ///
+        /// @return A gchar* containing the video input's hardware name
+        ///       (e.g. Built-In Webcam or Microsoft LifeCam VX500).
+        gchar* getProductName() {return _productName;};
+        
+        /// \brief Accessor to set the private _productName variable
+        ///       from the GnashWebcam class.
+        ///
+        /// @param n A gchar* to the hardware input device's hardware name
+        ///         (e.g. Built-In Webcam or Microsoft LifeCam VX500).
+        void setProductName(gchar *n) {_productName = n;};
+        
+        /// \var GnashWebcam::numVideoFormats
+        /// \brief Contains an integer value representing the number of
+        ///       video formats the camera supports (used for iteration
+        ///       purposes).
+        gint   numVideoFormats;
+        
+        /// \var GnashWebcam::videoFormats
+        /// \brief A GArray containing WebcamVidFormat data structures
+        ///       (see WebcamVidFormat class documentation for more info).
+        GArray* videoFormats;
+        
+        /// \var GnashWebcam::supportedResolutions
+        /// \brief A hash table for easy lookup of resolutions the hardware
+        ///       camera supports.
+        GHashTable* supportedResolutions;
 
-               /// Constructor for the GnashWebcam class.
-               GnashWebcam();
-               
-       private:
-               /// \var GnashWebcam::_element
-               /// \brief GstElement* which points to the video source
-               ///       element.
-               GstElement* _element;
-               
-               /// \var GnashWebcam::_dev_location
-               /// \brief Contains the physical location of the webcam device
-               ///      (e.g. on Linux typically would be set to /dev/video0).
-               gchar* _dev_location;
-               
-               /// \var GnashWebcam::_gstreamer_src
-               /// \brief Contains a gchar* which describes the gstreamer 
source
-               ///       type (e.g. v4lsrc or v4l2src).
-               gchar* _gstreamer_src;
-               
-               /// \var GnashWebcam::_product_name
-               /// \brief Contains a gchar* which describes the name of the 
hardware
-               ///      device (e.g. Built-In Webcam or Microsoft LifeCam 
VX500).
-               gchar* _product_name;
+        /// Constructor for the GnashWebcam class.
+        GnashWebcam();
+        
+    private:
+        /// \var GnashWebcam::_element
+        /// \brief GstElement* which points to the video source
+        ///       element.
+        GstElement* _element;
+        
+        /// \var GnashWebcam::_devLocation
+        /// \brief Contains the physical location of the webcam device
+        ///      (e.g. on Linux typically would be set to /dev/video0).
+        gchar* _devLocation;
+        
+        /// \var GnashWebcam::_gstreamerSrc
+        /// \brief Contains a gchar* which describes the gstreamer source
+        ///       type (e.g. v4lsrc or v4l2src).
+        gchar* _gstreamerSrc;
+        
+        /// \var GnashWebcam::_productName
+        /// \brief Contains a gchar* which describes the name of the hardware
+        ///      device (e.g. Built-In Webcam or Microsoft LifeCam VX500).
+        gchar* _productName;
 };
 
 /// \class WebcamVidFormat
@@ -167,42 +167,42 @@
 /// Class used to hold enumerated information about usable video formats.
 ///
 class WebcamVidFormat {
-       public:
-               /// \var WebcamVidFormat::mimetype
-               /// \brief Contains a gchar* which describes the raw video 
input stream
-               ///       from the camera formated in a Gstreamer video format
-               ///       type (e.g. video/x-raw-rgb or video/x-raw-yuv).
-               gchar *mimetype;
-               
-               /// \var WebcamVidFormat::width
-               /// \brief Contains a gint value describing the width of the 
selected
-               ///       format.
-               gint   width;
-               
-               /// \var WebcamVidFormat::height
-               /// \brief Contains a gint value describing the height of the 
selected
-               ///       format.
-               gint   height;
-               
-               /// \var WebcamVidFormat::num_framerates
-               /// \brief Contains a gint value representing the number of 
framerate
-               ///       values supported by the format described in the 
mimetype var.
-               gint   num_framerates;
-               
-               /// \var WebcamVidFormat::framerates
-               /// \brief Pointer to a FramerateFraction class which simply 
holds a
-               ///      temporary framerate variable while trying to determine 
the
-               ///      highest possible supported framerate for the format 
described
-               ///      in the mimetype var.
-               FramerateFraction *framerates;
-               
-               /// \var WebcamVidFormat::highest_framerate
-               /// \brief Holds the highest_frame supported by the format 
described
-               ///      in the mimetype var.
-               FramerateFraction highest_framerate;
-               
-               /// Constructor for the WebcamVidFormat class
-               WebcamVidFormat();
+    public:
+        /// \var WebcamVidFormat::mimetype
+        /// \brief Contains a gchar* which describes the raw video input stream
+        ///       from the camera formated in a Gstreamer video format
+        ///       type (e.g. video/x-raw-rgb or video/x-raw-yuv).
+        gchar *mimetype;
+        
+        /// \var WebcamVidFormat::width
+        /// \brief Contains a gint value describing the width of the selected
+        ///       format.
+        gint   width;
+        
+        /// \var WebcamVidFormat::height
+        /// \brief Contains a gint value describing the height of the selected
+        ///       format.
+        gint   height;
+        
+        /// \var WebcamVidFormat::numFramerates
+        /// \brief Contains a gint value representing the number of framerate
+        ///       values supported by the format described in the mimetype var.
+        gint   numFramerates;
+        
+        /// \var WebcamVidFormat::framerates
+        /// \brief Pointer to a FramerateFraction class which simply holds a
+        ///      temporary framerate variable while trying to determine the
+        ///      highest possible supported framerate for the format described
+        ///      in the mimetype var.
+        FramerateFraction *framerates;
+        
+        /// \var WebcamVidFormat::highestFramerate
+        /// \brief Holds the highest_frame supported by the format described
+        ///      in the mimetype var.
+        FramerateFraction highestFramerate;
+        
+        /// Constructor for the WebcamVidFormat class
+        WebcamVidFormat();
 };
 
 /// Constructor for the WebcamVidFormat class. This constructor prepares
@@ -210,36 +210,36 @@
 /// are initialized to -1 to show that these values have never been set.
 ///
 WebcamVidFormat::WebcamVidFormat() {
-       width = -1;
-       height = -1;
-       num_framerates = -1;
-       framerates = NULL;
+    width = -1;
+    height = -1;
+    numFramerates = -1;
+    framerates = NULL;
 }
 
 /// Default constructor for the FramerateFraction class. This constructor 
prepares
 /// the data structure for data that will come in later. All gint values
 /// are initialized to -1 to show that these values have never been set.
 FramerateFraction::FramerateFraction() {
-       numerator = -1;
-       denominator = -1;
+    numerator = -1;
+    denominator = -1;
 }
 
 /// Secondary constructor for the FramerateFraction class. This constructor
 /// initialzes the structure with the numerator and denominator values passed
 /// to the constructor.
 FramerateFraction::FramerateFraction(gint num, gint denom) {
-       numerator = num;
-       denominator = denom;
+    numerator = num;
+    denominator = denom;
 }
 
 /// Constructor for the GnashWebcam class. This constructor prepares the data
 /// structure for data that will come in later. Also creates a blank hash table
 /// and array.
 GnashWebcam::GnashWebcam() {
-       set_element_ptr(NULL);
-       supported_resolutions = g_hash_table_new_full (g_str_hash, g_str_equal, 
g_free, NULL);
-       video_formats = g_array_new (FALSE, FALSE, sizeof (WebcamVidFormat));
-       num_video_formats = 0;
+    setElementPtr(NULL);
+    supportedResolutions = g_hash_table_new_full (g_str_hash, g_str_equal, 
g_free, NULL);
+    videoFormats = g_array_new (FALSE, FALSE, sizeof (WebcamVidFormat));
+    numVideoFormats = 0;
 }
 
 /// \class GnashWebcamPrivate
@@ -250,174 +250,174 @@
 ///
 class GnashWebcamPrivate
 {
-       public:   
-               /// Constructor for the GnashWebcamPrivate class.
-               GnashWebcamPrivate();
-               
-               /// \brief Accessor to set the private _webcam_device variable 
in the
-               ///       GnashWebcamPrivate class.
-               ///
-               /// @param d A pointer to a GnashWebcam class for the selected 
input device.
-               void set_webcam_device(GnashWebcam *d) {_webcam_device = d;}
-         
-               /// \brief Accessor to set the private _device_name variable in 
the
-               ///       GnashWebcamPrivate class.
-               ///
-               /// @param n A gchar* describing the name of the hardware device
-               ///       (e.g. Built-In Webcam or Microsoft LifeCam VX500).
-               void set_device_name(gchar *n) {_device_name = n;}
-         
-       //FIXME: this should eventually be a private or protected data field  
-       //protected:
-               
-               /// \var GnashWebcamPrivate::_pipeline
-               ///
-               /// \brief A pointer to the main Gstreamer pipeline that all
-               ///      created elements and bins will be dropped into.
-               GstElement *_pipeline;  
-
-               /// \var GnashWebcamPrivate::_webcam_source_bin
-               ///
-               /// A pointer to the Gstreamer source bin. This variable is set
-               /// inside of the make_webcam_source_bin() function. The 
pipeline
-               /// API of this source bin is written as follows:
-               /// videosourcedevice ! capsfilter (ghostpad)
-               GstElement *_webcam_source_bin;
-               
-               /// \var GnashWebcamPrivate::_webcam_main_bin
-               ///
-               /// A pointer to the Gstreamer main bin. This variable is set
-               /// inside of the make_webcam_main_bin() function. The pipeline
-               /// API of the main bin is written as follows:
-               /// tee ! save_queue (ghostpad)
-               ///
-               /// tee ! display_queue (ghostpad)
-               ///
-               /// This basically creates two queues where video stream data 
sits
-               /// and can be attached (optionally) to a display_bin to show 
the
-               /// video onscreen or to a save_bin to mux-out the stream and
-               /// save to a file on disk.
-               GstElement *_webcam_main_bin;
-               
-               /// \var GnashWebcamPrivate::_video_display_bin
-               ///
-               /// A pointer to the Gstreamer display bin. This variable is set
-               /// inside of the make_webcam_display_bin() function. The 
pipeline
-               /// API of the video_display_bin is written as follows:
-               ///
-               /// videoscale ! videosink
-               ///
-               /// This bin is dropped into the webcam_main_bin, but by default
-               /// the connection to display_queue is not made. This means that
-               /// even though the video_display_bin is created, it is not 
linked
-               /// and thus will not show video to the screen unless you call 
the
-               /// webcam_make_video_display_link() function.
-               GstElement *_video_display_bin;
-               
-               /// \var GnashWebcamPrivate::_video_save_bin
-               ///
-               /// A pointer to the Gstreamer video_save_bin. This variable is 
set
-               /// inside of the make_webcam_save_bin() function. The pipeline
-               /// API of the video_save_bin is written as follows:
-               ///
-               /// ffmpegcolorspace ! videorate ! videoscale ! theoraenc ! 
oggmux ! filesink
-               ///
-               /// This bin is dropped into the webcam_main_bin and is linked 
automatically
-               /// to the video_save_queue element in the webcam_main_bin
-               /// Note: if you want to save the file in a different format, 
simply
-               ///   link up video scale to a different encoder and muxer.
-               GstElement *_video_save_bin;
-               
-               /// \var GnashWebcamPrivate::_video_source
-               /// \brief Contains a direct link to the src pad in the video 
source
-               ///       element. This is different from _webcam_source_bin in 
that
-               ///       it points to the video source element INSIDE the bin, 
not
-               ///       the source bin itself.
-               GstElement *_video_source;
-               
-               /// \var GnashWebcamPrivate::_caps_filter
-               /// \brief Contains a direct link to the src pad in the 
capsfilter
-               ///      element.
-               GstElement *_capsfilter;
-               
-               /// \var GnashWebcamPrivate:_video_file_sink
-               /// \brief Contains a direct link to the video_file_sink element
-               GstElement *_video_file_sink;
-               
-               /// \var GnashWebcamPrivate::_video_enc
-               /// \brief Contains a direct link to the video encoder element
-               GstElement *_video_enc;
-               
-               /// \var GnashWebcamPrivate::_pipeline_is_playing
-               /// \brief Boolean value which is changed based on whether or 
not
-               ///       the Gstreamer pipeline status is GST_STATE_PLAYING 
(true)
-               ///       or GST_STATE_NULL (false), GST_STATE_READY (false),
-               ///       GST_STATE_PAUSED (false).
-               gboolean _pipeline_is_playing;
-
-               /// \var GnashWebcamPrivate::_device_name
-               /// \brief Contains a string with the hardware device name 
(transferred
-               ///       from GnashWebcam class
-               gchar *_device_name;
-               
-               /// \var GnashWebcamPrivate::_webcam_device
-               /// \brief Contains a pointer to the original GnashWebcam class
-               ///       that was created when enumerating and probing attached
-               ///       hardware.
-               GnashWebcam *_webcam_device;
-               
-               /// \var GnashWebcamPrivate::_x_resolution
-               /// \brief Contains the integer x_resolution variable (the first
-               ///       value when resolution is written as INTxINT)
-               gint _x_resolution;
-               
-               /// \var GnashWebcamPrivate::_y_resolution
-               /// \brief Contains the integer y_resolution variable (the 
second
-               ///       value when resolution is written as INTxINT)
-               gint _y_resolution;
-               
-               /// \var GnashWebcamPrivate::_current_format
-               /// \brief Contains a pointer to the WebcamVidFormat data 
structure
-               ///       selected to be used with this pipeline.
-               WebcamVidFormat *_current_format;
-         
-               /// \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::_eos_timeout_id
-               /// \brief This variable is not currently used, but will 
eventually
-               ///       be used as a timeout when networking encapsulation is 
being
-               ///       used.
-               guint _eos_timeout_id;
+    public:   
+        /// Constructor for the GnashWebcamPrivate class.
+        GnashWebcamPrivate();
+        
+        /// \brief Accessor to set the private _webcamDevice variable in the
+        ///       GnashWebcamPrivate class.
+        ///
+        /// @param d A pointer to a GnashWebcam class for the selected input 
device.
+        void setWebcamDevice(GnashWebcam *d) {_webcamDevice = d;}
+      
+        /// \brief Accessor to set the private _deviceName variable in the
+        ///       GnashWebcamPrivate class.
+        ///
+        /// @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;}
+      
+    //FIXME: this should eventually be a private or protected data field  
+    //protected:
+        
+        /// \var GnashWebcamPrivate::_pipeline
+        ///
+        /// \brief A pointer to the main Gstreamer pipeline that all
+        ///      created elements and bins will be dropped into.
+        GstElement *_pipeline;  
+
+        /// \var GnashWebcamPrivate::_webcamSourceBin
+        ///
+        /// A pointer to the Gstreamer source bin. This variable is set
+        /// inside of the make_webcamSourceBin() function. The pipeline
+        /// API of this source bin is written as follows:
+        /// videosourcedevice ! capsfilter (ghostpad)
+        GstElement *_webcamSourceBin;
+        
+        /// \var GnashWebcamPrivate::_webcamMainBin
+        ///
+        /// A pointer to the Gstreamer main bin. This variable is set
+        /// inside of the make_webcamMainBin() function. The pipeline
+        /// API of the main bin is written as follows:
+        /// tee ! save_queue (ghostpad)
+        ///
+        /// tee ! display_queue (ghostpad)
+        ///
+        /// This basically creates two queues where video stream data sits
+        /// and can be attached (optionally) to a display_bin to show the
+        /// video onscreen or to a save_bin to mux-out the stream and
+        /// save to a file on disk.
+        GstElement *_webcamMainBin;
+        
+        /// \var GnashWebcamPrivate::_videoDisplayBin
+        ///
+        /// A pointer to the Gstreamer display bin. This variable is set
+        /// inside of the make_webcam_display_bin() function. The pipeline
+        /// API of the video_display_bin is written as follows:
+        ///
+        /// videoscale ! videosink
+        ///
+        /// This bin is dropped into the webcam_main_bin, but by default
+        /// the connection to display_queue is not made. This means that
+        /// even though the video_display_bin is created, it is not linked
+        /// and thus will not show video to the screen unless you call the
+        /// webcamMakeVideoDisplayLink() function.
+        GstElement *_videoDisplayBin;
+        
+        /// \var GnashWebcamPrivate::_videoSaveBin
+        ///
+        /// A pointer to the Gstreamer video_save_bin. This variable is set
+        /// inside of the make_webcam_save_bin() function. The pipeline
+        /// API of the video_save_bin is written as follows:
+        ///
+        /// ffmpegcolorspace ! videorate ! videoscale ! theoraenc ! oggmux ! 
filesink
+        ///
+        /// This bin is dropped into the webcam_main_bin and is linked 
automatically
+        /// to the video_save_queue element in the webcam_main_bin
+        /// Note: if you want to save the file in a different format, simply
+        ///   link up video scale to a different encoder and muxer.
+        GstElement *_videoSaveBin;
+        
+        /// \var GnashWebcamPrivate::_videoSource
+        /// \brief Contains a direct link to the src pad in the video source
+        ///       element. This is different from _webcamSourceBin in that
+        ///       it points to the video source element INSIDE the bin, not
+        ///       the source bin itself.
+        GstElement *_videoSource;
+        
+        /// \var GnashWebcamPrivate::_capsFilter
+        /// \brief Contains a direct link to the src pad in the capsfilter
+        ///      element.
+        GstElement *_capsFilter;
+        
+        /// \var GnashWebcamPrivate:_videoFileSink
+        /// \brief Contains a direct link to the video_file_sink element
+        GstElement *_videoFileSink;
+        
+        /// \var GnashWebcamPrivate::_videoEnc
+        /// \brief Contains a direct link to the video encoder element
+        GstElement *_videoEnc;
+        
+        /// \var GnashWebcamPrivate::_pipelineIsPlaying
+        /// \brief Boolean value which is changed based on whether or not
+        ///       the Gstreamer pipeline status is GST_STATE_PLAYING (true)
+        ///       or GST_STATE_NULL (false), GST_STATE_READY (false),
+        ///       GST_STATE_PAUSED (false).
+        gboolean _pipelineIsPlaying;
+
+        /// \var GnashWebcamPrivate::_deviceName
+        /// \brief Contains a string with the hardware device name (transferred
+        ///       from GnashWebcam class
+        gchar *_deviceName;
+        
+        /// \var GnashWebcamPrivate::_webcamDevice
+        /// \brief Contains a pointer to the original GnashWebcam class
+        ///       that was created when enumerating and probing attached
+        ///       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::_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
+        ///       be used as a timeout when networking encapsulation is being
+        ///       used.
+        guint _eosTimeoutId;
 };
 
 /// Constructor that initializes all GnashWebcamPrivate variables to have
 /// data dropped in later.
 GnashWebcamPrivate::GnashWebcamPrivate() {
-       _pipeline = NULL;
-       _webcam_source_bin = NULL;
-       _webcam_main_bin = NULL;
-       _video_display_bin = NULL;
-       _video_save_bin = NULL;
-       _video_source = NULL;
-       _capsfilter = NULL;
-       _video_file_sink = NULL;
-       _video_enc = NULL;
-       
-       _loop = g_main_loop_new(NULL, false);
-       
-       _pipeline_is_playing = 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
-       _x_resolution = 320;
-       _y_resolution = 240;
-       _current_format = NULL;
-       _eos_timeout_id = 0;
+    _pipeline = NULL;
+    _webcamSourceBin = NULL;
+    _webcamMainBin = NULL;
+    _videoDisplayBin = NULL;
+    _videoSaveBin = NULL;
+    _videoSource = NULL;
+    _capsFilter = NULL;
+    _videoFileSink = NULL;
+    _videoEnc = NULL;
+    
+    _loop = g_main_loop_new(NULL, false);
+    
+    _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;
+    _currentFormat = NULL;
+    _eosTimeoutId = 0;
 };
 
 /// \class VideoInputGst
@@ -428,209 +428,209 @@
 ///
 class VideoInputGst : public VideoInput, public GnashWebcamPrivate {
 public:
-       /// Constructor for the VideoInputGst class
-       VideoInputGst();
-       
-       /// Destructor for the VideoInputGst class
-       ~VideoInputGst();
-       
-       /// \brief This function interacts with the hardware on the machine
-       ///       to enumerate information about devices connected. Currently
-       ///       this function only looks for videotestsources (implemented
-       ///       in Gstreamer), video4linux and video4linux2 sources.
-       /// @return Nothing. All pertantent information is now stored in a
-       ///      GnashWebcam class.
-       void find_vid_devs();
-       
-       /// \brief This function is important in the flow of the code. It looks
-       ///       in the gnashrc file to see if you have a default camera 
defined
-       ///       and selects that one (if it's defined), otherwise a 
videotestsrc
-       ///       will be used for the remainder of the execution of the code.
-       ///       Currently this code also calls other functions to make bins 
and
-       ///       pipelines. It might be abstracted into separate functions 
later.
-       /// @return Nothing.
-       void make_webcamDevice_selection();
-       
-       /// \brief This function makes a temporary pipeline with the selected 
device
-       ///       to determine its capabilities (Gstreamer calls these caps). 
This
-       ///       information is saved in a GnashWebcamPrivate class and will be
-       ///       used when enumerating additional information about the camera 
and
-       ///       in creating the real pipeline to capture video.
-       ///
-       /// @param dev_select The integer value of the camera the user wants to 
select.
-       ///                 This might be changed to the name of the camera, 
but it's
-       ///                 currently an integer (if it changes, we need to 
change the
-       ///                                     gnashrc element). If this value 
is 0, you've selected a
-       ///                 videotestsrc.
-       ///
-       /// @return Nothing. All pertantent information is stored in a 
GnashWebcam class.
-       void get_selected_caps(gint dev_select);
-       
-       /// \brief This function is called by get_selected caps to determine 
what
-       ///       formats the input device can handle. It saves all the 
information
-       ///       it finds into an array of WebcamVidFormat pointers. This 
information
-       ///       will then be analyzed and actually added as a supported 
format in 
-       ///       a call to add_supported_format.
-       ///
-       /// @param cam A pointer to the GnashWebcam structure you want to use 
as input.
-       /// @param caps A pointer to the capabilities discovered in the 
get_selected_caps() function.
-       ///
-       /// @return Nothing. All pertantent information is stored in a 
GnashWebcam class.
-       void get_supported_formats(GnashWebcam *cam, GstCaps *caps);
-       
-       /// \brief This function is called by get_supported_formats when it has
-       ///       determined that the format being analyzed can be used to 
capture
-       ///       information from the hardware device.
-       ///
-       /// @param cam A pointer to the GnashWebcam structure you want to use 
as input.
-       /// @param video_format A pointer to a WebcamVidFormat class that has 
had all
-       ///                    variables initialize to their respective values.
-       ///
-       /// @return Nothing. All pertantent information is stored in a 
GnashWebcam class.
-       void add_supported_format(GnashWebcam *cam, WebcamVidFormat 
*video_format,
-               GstStructure *format_structure);
-       
-       /// \brief This function is called by add_supported_format. Since we 
have found
-       ///       a format that will work with the input device, we now need to 
figure
-       ///       out what framerate the camera can capture at that corresponds 
with the
-       ///       format being analyzed.
-       ///
-       /// @param video_format A pointer to a WebcamVidFormat class taht has 
had all
-       ///                    variables initialized to their respective values.
-       /// @param structure A pointer to a structure initialized with the 
capabilities
-       ///                    of the selected input device.
-       ///
-       /// @return Nothing. All pertantent information is stored in a 
WebcamVidFormat class.
-       void get_supported_framerates(WebcamVidFormat *video_format, 
GstStructure *structure);
-
-       /// \brief This function runs through the list of framerates determined 
by
-       ///       get_supported_framerates() and finds the highest supported 
framerate
-       ///       less than 30fps.
-       ///
-       /// @param format A pointer to the chosen format structure.
-       ///
-       /// @return Nothing. All pertantent information is stored in the 
structure
-       ///        passed in (a WebcamVidFormat class).
-       void find_highest_framerate(WebcamVidFormat *format);
-       
-       /// \brief Function is called when all the information has been 
enumerated
-       ///       that can be stored in the GnashWebcam structure. Now transfer 
the
-       ///       important information from the GnashWebcam structure to the
-       ///       GnashWebcamPrivate structure which is larger because it has
-       ///       space to store Gstreamer pipeline, element and bin elements.
-       ///       See definition of GnashWebcamPrivate for more info.
-       ///
-       /// @param dev_select The integer value of the camera the user wants to 
select.
-       ///                 This might be changed to the name of the camera, 
but it's
-       ///                 currently an integer (if it changes, we need to 
change the
-       ///                                     gnashrc element). If this value 
is 0, you've selected a
-       ///                 videotestsrc.
-       ///
-       /// @return A pointer to the newly created GnashWebcamPrivate structure.
-       GnashWebcamPrivate* transfer_to_private(gint dev_select);
-       
-       /// \brief Function creates the source bin. For more information on 
pipeline
-       ///      implementation and this function in general see the definition 
of
-       ///      the _webcam_source_bin variable in the GnashWebcamPrivate 
structure
-       ///      documentation.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       /// @return True if everything went correctly (making elements, dropping
-       ///        into bins and linking elements), false otherwise.
-       gboolean webcam_create_source_bin(GnashWebcamPrivate *webcam);
-       
-       /// \brief Function creates the main bin. For more information on 
pipeline
-       ///       implementation and this function in general see the 
definition of
-       ///       the _webcam_main_bin variable in the GnashWebcamPrivate 
structure
-       ///       documentation.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       /// @return True if everything went correctly (making elements, dropping
-       ///        into bins and linking elements), false otherwise.
-       gboolean webcam_create_main_bin(GnashWebcamPrivate *webcam);
-       
-       /// \brief Function creates the display bin. For more information on 
pipeline
-       ///       implementation and this function in general see the 
definition of
-       ///       the _video_display_bin variable in the GnashWebcamPrivate 
structure
-       ///       documentation.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       /// @return True if everything went correctly (making elements, dropping
-       ///        into bins and linking elements), false otherwise.
-       gboolean webcam_create_display_bin(GnashWebcamPrivate *webcam);
-       
-       /// \brief Function links the video_display_bin to the 
video_display_queue
-       ///       in the main bin.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       /// @return True if the link to the video_display_queue was successful,
-       ///        False otherwise.
-       gboolean webcam_make_video_display_link(GnashWebcamPrivate *webcam);
-
-       /// \brief Function creates the save bin. For more information on 
pipeline
-       ///       implementation and this function in general see the 
definition of
-       ///       the _webcam_save_bin variable in the GnashWebcamPrivate 
structure
-       ///       documentation.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       /// @return True if everything went correctly (making elements, dropping
-       ///        into bins and linking elements), false otherwis
-       gboolean webcam_create_save_bin(GnashWebcamPrivate *webcam);
-       
-       /// \brief Function starts up the pipeline designed earlier in code
-       ///      execution. This puts everything into motion.
-       ///
-       /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
-       ///             created previously in a call to transfer_to_private()
-       ///
-       void webcam_play(GnashWebcamPrivate *webcam);
-       
-       /// \brief Accessor which returns the vid_vect private variable in the
-       ///       VideoInputGst class.
-       ///
-       /// @return A pointer to a vector of GnashWebcam pointers.
-       std::vector<GnashWebcam*>* get_vid_vect() {return &_vid_vect;}
-       
-       /// \brief Accessor which sets the number of devices in the vid_vect
-       ///
-       /// @param i The integer value representing the number of devices 
attached
-       ///         to the machine.
-       void set_numdevs(int i) {_numdevs = i;}
-       
-       /// \brief Accessor which returns the number of video devices attached
-       ///      to the machine (useful in accessing the vid_vect vector).
-       ///
-       /// @return The _numdev variable in the VideoInputGst class.
-       int get_numdevs() {return _numdevs;}
-       
-       /// \brief Accessor which increments the number of video devices
-       ///       attached to the machine.
-       void increment_numdevs() {_numdevs += 1;}
-       
+    /// Constructor for the VideoInputGst class
+    VideoInputGst();
+    
+    /// Destructor for the VideoInputGst class
+    ~VideoInputGst();
+    
+    /// \brief This function interacts with the hardware on the machine
+    ///       to enumerate information about devices connected. Currently
+    ///       this function only looks for videotestsources (implemented
+    ///       in Gstreamer), video4linux and video4linux2 sources.
+    /// @return Nothing. All pertantent information is now stored in a
+    ///      GnashWebcam class.
+    void findVidDevs();
+    
+    /// \brief This function is important in the flow of the code. It looks
+    ///       in the gnashrc file to see if you have a default camera defined
+    ///       and selects that one (if it's defined), otherwise a videotestsrc
+    ///       will be used for the remainder of the execution of the code.
+    ///       Currently this code also calls other functions to make bins and
+    ///       pipelines. It might be abstracted into separate functions later.
+    /// @return Nothing.
+    void makeWebcamDeviceSelection();
+    
+    /// \brief This function makes a temporary pipeline with the selected 
device
+    ///       to determine its capabilities (Gstreamer calls these caps). This
+    ///       information is saved in a GnashWebcamPrivate class and will be
+    ///       used when enumerating additional information about the camera and
+    ///       in creating the real pipeline to capture video.
+    ///
+    /// @param dev_select The integer value of the camera the user wants to 
select.
+    ///                 This might be changed to the name of the camera, but 
it's
+    ///                 currently an integer (if it changes, we need to change 
the
+    ///                 gnashrc element). If this value is 0, you've selected a
+    ///                 videotestsrc.
+    ///
+    /// @return Nothing. All pertantent information is stored in a GnashWebcam 
class.
+    void getSelectedCaps(gint dev_select);
+    
+    /// \brief This function is called by get_selected caps to determine what
+    ///       formats the input device can handle. It saves all the information
+    ///       it finds into an array of WebcamVidFormat pointers. This 
information
+    ///       will then be analyzed and actually added as a supported format 
in 
+    ///       a call to addSupportedFormat.
+    ///
+    /// @param cam A pointer to the GnashWebcam structure you want to use as 
input.
+    /// @param caps A pointer to the capabilities discovered in the 
getSelectedCaps() function.
+    ///
+    /// @return Nothing. All pertantent information is stored in a GnashWebcam 
class.
+    void getSupportedFormats(GnashWebcam *cam, GstCaps *caps);
+    
+    /// \brief This function is called by getSupportedFormats when it has
+    ///       determined that the format being analyzed can be used to capture
+    ///       information from the hardware device.
+    ///
+    /// @param cam A pointer to the GnashWebcam structure you want to use as 
input.
+    /// @param video_format A pointer to a WebcamVidFormat class that has had 
all
+    ///                    variables initialize to their respective values.
+    ///
+    /// @return Nothing. All pertantent information is stored in a GnashWebcam 
class.
+    void addSupportedFormat(GnashWebcam *cam, WebcamVidFormat *video_format,
+        GstStructure *format_structure);
+    
+    /// \brief This function is called by addSupportedFormat. Since we have 
found
+    ///       a format that will work with the input device, we now need to 
figure
+    ///       out what framerate the camera can capture at that corresponds 
with the
+    ///       format being analyzed.
+    ///
+    /// @param video_format A pointer to a WebcamVidFormat class taht has had 
all
+    ///                    variables initialized to their respective values.
+    /// @param structure A pointer to a structure initialized with the 
capabilities
+    ///                    of the selected input device.
+    ///
+    /// @return Nothing. All pertantent information is stored in a 
WebcamVidFormat class.
+    void getSupportedFramerates(WebcamVidFormat *video_format, GstStructure 
*structure);
+
+    /// \brief This function runs through the list of framerates determined by
+    ///       getSupportedFramerates() and finds the highest supported 
framerate
+    ///       less than 30fps.
+    ///
+    /// @param format A pointer to the chosen format structure.
+    ///
+    /// @return Nothing. All pertantent information is stored in the structure
+    ///        passed in (a WebcamVidFormat class).
+    void findHighestFramerate(WebcamVidFormat *format);
+    
+    /// \brief Function is called when all the information has been enumerated
+    ///       that can be stored in the GnashWebcam structure. Now transfer the
+    ///       important information from the GnashWebcam structure to the
+    ///       GnashWebcamPrivate structure which is larger because it has
+    ///       space to store Gstreamer pipeline, element and bin elements.
+    ///       See definition of GnashWebcamPrivate for more info.
+    ///
+    /// @param dev_select The integer value of the camera the user wants to 
select.
+    ///                 This might be changed to the name of the camera, but 
it's
+    ///                 currently an integer (if it changes, we need to change 
the
+    ///                 gnashrc element). If this value is 0, you've selected a
+    ///                 videotestsrc.
+    ///
+    /// @return A pointer to the newly created GnashWebcamPrivate structure.
+    GnashWebcamPrivate* transferToPrivate(gint dev_select);
+    
+    /// \brief Function creates the source bin. For more information on 
pipeline
+    ///      implementation and this function in general see the definition of
+    ///      the _webcamSourceBin variable in the GnashWebcamPrivate structure
+    ///      documentation.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    /// @return True if everything went correctly (making elements, dropping
+    ///        into bins and linking elements), false otherwise.
+    gboolean webcamCreateSourceBin(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
+    ///       documentation.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    /// @return True if everything went correctly (making elements, dropping
+    ///        into bins and linking elements), false otherwise.
+    gboolean webcamCreateMainBin(GnashWebcamPrivate *webcam);
+    
+    /// \brief Function creates the display bin. For more information on 
pipeline
+    ///       implementation and this function in general see the definition of
+    ///       the _videoDisplayBin variable in the GnashWebcamPrivate structure
+    ///       documentation.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    /// @return True if everything went correctly (making elements, dropping
+    ///        into bins and linking elements), false otherwise.
+    gboolean webcamCreateDisplayBin(GnashWebcamPrivate *webcam);
+    
+    /// \brief Function links the video_display_bin to the video_display_queue
+    ///       in the main bin.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    /// @return True if the link to the video_display_queue was successful,
+    ///        False otherwise.
+    gboolean webcamMakeVideoDisplayLink(GnashWebcamPrivate *webcam);
+
+    /// \brief Function creates the save bin. For more information on pipeline
+    ///       implementation and this function in general see the definition of
+    ///       the _webcam_save_bin variable in the GnashWebcamPrivate structure
+    ///       documentation.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    /// @return True if everything went correctly (making elements, dropping
+    ///        into bins and linking elements), false otherwis
+    gboolean webcamCreateSaveBin(GnashWebcamPrivate *webcam);
+    
+    /// \brief Function starts up the pipeline designed earlier in code
+    ///      execution. This puts everything into motion.
+    ///
+    /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+    ///             created previously in a call to transferToPrivate()
+    ///
+    void webcamPlay(GnashWebcamPrivate *webcam);
+    
+    /// \brief Accessor which returns the vid_vect private variable in the
+    ///       VideoInputGst class.
+    ///
+    /// @return A pointer to a vector of GnashWebcam pointers.
+    std::vector<GnashWebcam*>* getVidVect() {return &_vidVect;}
+    
+    /// \brief Accessor which sets the number of devices in the vid_vect
+    ///
+    /// @param i The integer value representing the number of devices attached
+    ///         to the machine.
+    void setNumdevs(int i) {_numdevs = i;}
+    
+    /// \brief Accessor which returns the number of video devices attached
+    ///      to the machine (useful in accessing the vid_vect vector).
+    ///
+    /// @return The _numdev variable in the VideoInputGst class.
+    int getNumdevs() {return _numdevs;}
+    
+    /// \brief Accessor which increments the number of video devices
+    ///       attached to the machine.
+    void incrementNumdevs() {_numdevs += 1;}
+    
 private:
-       /// \var VideoInputGst::_vid_vect
-       /// \brief A vector containing pointers to GnashWebcam classes.
-       std::vector<GnashWebcam*> _vid_vect;
-       
-       /// \var VideoInputGst::_numdevs
-       /// \brief An integer value containing the number of devices attached
-       ///       to the machine.
-       gint _numdevs;
-       
-       /// \var VideoInputGst::_global_webcam
-       /// \brief Convienient pointer to the selected device's 
GnashWebcamPrivate
-       ///       class structure.
-       GnashWebcamPrivate *_global_webcam;
+    /// \var VideoInputGst::_vidVect
+    /// \brief A vector containing pointers to GnashWebcam classes.
+    std::vector<GnashWebcam*> _vidVect;
+    
+    /// \var VideoInputGst::_numdevs
+    /// \brief An integer value containing the number of devices attached
+    ///       to the machine.
+    gint _numdevs;
+    
+    /// \var VideoInputGst::_globalWebcam
+    /// \brief Convienient pointer to the selected device's GnashWebcamPrivate
+    ///       class structure.
+    GnashWebcamPrivate *_globalWebcam;
 };
 
 } //gst namespace

=== modified file 'utilities/findwebcams.cpp'
--- a/utilities/findwebcams.cpp 2009-07-17 20:00:12 +0000
+++ b/utilities/findwebcams.cpp 2009-07-17 21:38:26 +0000
@@ -26,151 +26,151 @@
 #include <vector>
 
 namespace {
-       //get rc file for webcam selection
-       gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
+    //get rc file for webcam selection
+    gnash::RcInitFile& rcfile = gnash::RcInitFile::getDefaultInstance();
 }
 
 class data {
-       public:
-               data();
-               gchar* deviceName;
-               gchar* deviceType;
+    public:
+        data();
+        gchar* deviceName;
+        gchar* deviceType;
 };
 
 data::data() {
-       deviceName = NULL;
-       deviceType = NULL;
+    deviceName = NULL;
+    deviceType = NULL;
 };
 
 gint findVidDevs(std::vector<data*>& vidVect) {
-       gint numdevs = 0;
-       
-       //vid test source
-       GstElement *element;
-       element = gst_element_factory_make ("videotestsrc", "vidtestsrc");
-       
-       if (element == NULL) {
-               vidVect.push_back(NULL);
-               numdevs += 1;
-       } else {
-               vidVect.push_back(new data);
-               vidVect[numdevs]->deviceName = g_strdup_printf("videotestsrc");
-               vidVect[numdevs]->deviceType = g_strdup_printf("videotestsrc");
-               numdevs += 1;
-       }
-       
-       //video4linux source
-       GstPropertyProbe *probe;
-       GValueArray *devarr;
-       element = NULL;
-       gint i;
-       
-       element = gst_element_factory_make ("v4lsrc", "v4lvidsrc");
-       probe = GST_PROPERTY_PROBE (element);
-       devarr = gst_property_probe_probe_and_get_values_name (probe, "device");
-       for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
-               GValue *val;
-               gchar *dev_name = NULL;
-               
-               val = g_value_array_get_nth (devarr, i);
-               g_object_set (element, "device", g_value_get_string (val), 
NULL);
-               gst_element_set_state (element, GST_STATE_PLAYING);
-               g_object_get (element, "device-name", &dev_name, NULL);
-               gst_element_set_state (element, GST_STATE_NULL);
-               if (dev_name == "null") {
-                       g_print("no v4l video sources found\n");
-               }
-               else { 
-                       vidVect.push_back(new data);
-                       vidVect[numdevs]->deviceType = 
g_strdup_printf("v4lsrc");
-                       vidVect[numdevs]->deviceName = dev_name;
-                       numdevs += 1;
-               }
-       }
-       if (devarr) {
-               g_value_array_free (devarr);
-       }
-       
-       
-       //video4linux2 source
-       probe = NULL;
-       element = NULL;
-       devarr = NULL;
-       
-       element = gst_element_factory_make ("v4l2src", "v4l2vidsrc");
-       probe = GST_PROPERTY_PROBE (element);
-       devarr = gst_property_probe_probe_and_get_values_name (probe, "device");
-       for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
-               GValue *val;
-               gchar *dev_name = NULL;
-               
-               val = g_value_array_get_nth (devarr, i);
-               g_object_set (element, "device", g_value_get_string (val), 
NULL);
-               gst_element_set_state (element, GST_STATE_PLAYING);
-               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");
-               }
-               else { 
-                       vidVect.push_back(new data);
-                       vidVect[numdevs]->deviceType = 
g_strdup_printf("v4l2src");
-                       vidVect[numdevs]->deviceName = dev_name;
-                       
-                       numdevs += 1;
-               }
-       }
-       if (devarr) {
-               g_value_array_free (devarr);
-       }
-       
-       return numdevs;
+    gint numdevs = 0;
+    
+    //vid test source
+    GstElement *element;
+    element = gst_element_factory_make ("videotestsrc", "vidtestsrc");
+    
+    if (element == NULL) {
+        vidVect.push_back(NULL);
+        numdevs += 1;
+    } else {
+        vidVect.push_back(new data);
+        vidVect[numdevs]->deviceName = g_strdup_printf("videotestsrc");
+        vidVect[numdevs]->deviceType = g_strdup_printf("videotestsrc");
+        numdevs += 1;
+    }
+    
+    //video4linux source
+    GstPropertyProbe *probe;
+    GValueArray *devarr;
+    element = NULL;
+    gint i;
+    
+    element = gst_element_factory_make ("v4lsrc", "v4lvidsrc");
+    probe = GST_PROPERTY_PROBE (element);
+    devarr = gst_property_probe_probe_and_get_values_name (probe, "device");
+    for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
+        GValue *val;
+        gchar *dev_name = NULL;
+        
+        val = g_value_array_get_nth (devarr, i);
+        g_object_set (element, "device", g_value_get_string (val), NULL);
+        gst_element_set_state (element, GST_STATE_PLAYING);
+        g_object_get (element, "device-name", &dev_name, NULL);
+        gst_element_set_state (element, GST_STATE_NULL);
+        if (dev_name == "null") {
+            g_print("no v4l video sources found\n");
+        }
+        else { 
+            vidVect.push_back(new data);
+            vidVect[numdevs]->deviceType = g_strdup_printf("v4lsrc");
+            vidVect[numdevs]->deviceName = dev_name;
+            numdevs += 1;
+        }
+    }
+    if (devarr) {
+        g_value_array_free (devarr);
+    }
+    
+    
+    //video4linux2 source
+    probe = NULL;
+    element = NULL;
+    devarr = NULL;
+    
+    element = gst_element_factory_make ("v4l2src", "v4l2vidsrc");
+    probe = GST_PROPERTY_PROBE (element);
+    devarr = gst_property_probe_probe_and_get_values_name (probe, "device");
+    for (i = 0; devarr != NULL && i < devarr->n_values; ++i) {
+        GValue *val;
+        gchar *dev_name = NULL;
+        
+        val = g_value_array_get_nth (devarr, i);
+        g_object_set (element, "device", g_value_get_string (val), NULL);
+        gst_element_set_state (element, GST_STATE_PLAYING);
+        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");
+        }
+        else { 
+            vidVect.push_back(new data);
+            vidVect[numdevs]->deviceType = g_strdup_printf("v4l2src");
+            vidVect[numdevs]->deviceName = dev_name;
+            
+            numdevs += 1;
+        }
+    }
+    if (devarr) {
+        g_value_array_free (devarr);
+    }
+    
+    return numdevs;
 }
 
 int main () {
-       //initialize gstreamer to probe for devs
-       gst_init(NULL, NULL);
-       gint numdevs = 0;
-       std::vector<data*> vidVector;
-       gint i;
-       
-       int fromrc = rcfile.getWebcamDevice();
-       
-       if (fromrc == -1) {
-               g_print("Use this utility to set your desired default webcam 
device.\n");
-               numdevs = findVidDevs(vidVector);
-               g_print("\nFound %d video devices: \n\n", numdevs);
-               for (i = 0; i < numdevs; ++i)
-               {
-                       if (i == 0 && (vidVector[i] != 0)) {
-                               g_print("%d. device[%d] = Video Test Source 
(videotestsrc)\n", i, i);
-                       } else if (i == 0 && (vidVector[i] == 0)) {
-                               g_print("no test video device available");
-                       } else {
-                               g_print("%d. device[%d] = %s (%s)\n", i, i, 
vidVector[i]->deviceName,
-                                               vidVector[i]->deviceType);
-                       }
-               }
-               //prompt user for device selection
-               int dev_select = -1;
-               do {
-                       dev_select = -1;
-                       g_print("\nChoose the device you would like to use 
(0-%d): ",
-                               (numdevs - 1));
-                       std::cin >> dev_select;
-                       if ((dev_select < 0) || (dev_select > (numdevs - 1))) {
-                               g_print("You must make a valid device 
selection\n");
-                       }
-               } while ((dev_select < 0) || (dev_select > (numdevs - 1)));
-               g_print("\nTo select this camera, add this line to your gnashrc 
file:\n");
-               g_print("set webcamDevice %d\n", dev_select);
-       } else {
-               numdevs = findVidDevs(vidVector);
-               g_print("\nThe gnashrc file reports default webcam is set 
to:\n");
-               g_print("%s (%s)\n", vidVector[fromrc]->deviceName,
-                       vidVector[fromrc]->deviceType);
-               g_print("To change this setting, delete the 'set webcamDevice' 
line\n");
-               g_print("from your gnashrc file and re-run this program.\n\n");
-       }
-       return 1;
+    //initialize gstreamer to probe for devs
+    gst_init(NULL, NULL);
+    gint numdevs = 0;
+    std::vector<data*> vidVector;
+    gint i;
+    
+    int fromrc = rcfile.getWebcamDevice();
+    
+    if (fromrc == -1) {
+        g_print("Use this utility to set your desired default webcam 
device.\n");
+        numdevs = findVidDevs(vidVector);
+        g_print("\nFound %d video devices: \n\n", numdevs);
+        for (i = 0; i < numdevs; ++i)
+        {
+            if (i == 0 && (vidVector[i] != 0)) {
+                g_print("%d. device[%d] = Video Test Source (videotestsrc)\n", 
i, i);
+            } else if (i == 0 && (vidVector[i] == 0)) {
+                g_print("no test video device available");
+            } else {
+                g_print("%d. device[%d] = %s (%s)\n", i, i, 
vidVector[i]->deviceName,
+                        vidVector[i]->deviceType);
+            }
+        }
+        //prompt user for device selection
+        int dev_select = -1;
+        do {
+            dev_select = -1;
+            g_print("\nChoose the device you would like to use (0-%d): ",
+                (numdevs - 1));
+            std::cin >> dev_select;
+            if ((dev_select < 0) || (dev_select > (numdevs - 1))) {
+                g_print("You must make a valid device selection\n");
+            }
+        } while ((dev_select < 0) || (dev_select > (numdevs - 1)));
+        g_print("\nTo select this camera, add this line to your gnashrc 
file:\n");
+        g_print("set webcamDevice %d\n", dev_select);
+    } else {
+        numdevs = findVidDevs(vidVector);
+        g_print("\nThe gnashrc file reports default webcam is set to:\n");
+        g_print("%s (%s)\n", vidVector[fromrc]->deviceName,
+            vidVector[fromrc]->deviceType);
+        g_print("To change this setting, delete the 'set webcamDevice' 
line\n");
+        g_print("from your gnashrc file and re-run this program.\n\n");
+    }
+    return 1;
 }


reply via email to

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