[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11305: updated VideoInput testcase
From: |
Ben Limmer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11305: updated VideoInput testcase |
Date: |
Wed, 22 Jul 2009 15:40:18 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11305
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Wed 2009-07-22 15:40:18 -0600
message:
updated VideoInput testcase
modified:
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_videoinput.cpp
utilities/findmicrophones.cpp
------------------------------------------------------------
revno: 11300.1.1
committer: Ben Limmer <address@hidden>
branch nick: cam_mic_impl_2
timestamp: Wed 2009-07-22 15:34:00 -0600
message:
updated Video and audioinput testcases
modified:
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_audioinput.cpp
testsuite/libmedia.all/test_videoinput.cpp
utilities/findmicrophones.cpp
=== modified file 'libmedia/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp 2009-07-17 21:38:26 +0000
+++ b/libmedia/gst/VideoInputGst.cpp 2009-07-22 21:40:18 +0000
@@ -287,7 +287,7 @@
//pulls webcam device selection from gnashrc (will eventually tie into
//gui)
- void
+ int
VideoInputGst::makeWebcamDeviceSelection() {
int dev_select;
dev_select = rcfile.getWebcamDevice();
@@ -302,55 +302,7 @@
}
//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);
+ return rcfile.getWebcamDevice();
}
//called after a device selection, this starts enumerating the device's
@@ -370,8 +322,13 @@
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());
+ if (dev_select == 0) {
+ command = g_strdup_printf ("%s name=src ! fakesink",
+ data_struct->getGstreamerSrc());
+ } else {
+ 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
@@ -410,8 +367,9 @@
log_error("%s: Template pad isn't an object for some
reason",
__FUNCTION__);
}
-
- getSupportedFormats(data_struct, caps);
+ if (dev_select != 0) {
+ getSupportedFormats(data_struct, caps);
+ }
gst_caps_unref (caps);
}
@@ -806,6 +764,29 @@
}
}
+ //make link to saveQueue in main bin
+ gboolean
+ VideoInputGst::webcamMakeVideoSaveLink(GnashWebcamPrivate *webcam) {
+ 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;
+ }
+ }
+
//create a bin to take the video stream and dump it out to
//an ogg file
gboolean
@@ -869,27 +850,6 @@
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;
}
@@ -933,30 +893,29 @@
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);
+ //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);
+ //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
=== modified file 'libmedia/gst/VideoInputGst.h'
--- a/libmedia/gst/VideoInputGst.h 2009-07-17 21:38:26 +0000
+++ b/libmedia/gst/VideoInputGst.h 2009-07-22 21:40:18 +0000
@@ -407,6 +407,8 @@
_videoFileSink = NULL;
_videoEnc = NULL;
+ _deviceName = NULL;
+
_loop = g_main_loop_new(NULL, false);
_pipelineIsPlaying = false;
@@ -448,8 +450,9 @@
/// 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();
+ /// @return The integer value respresenting the selected webcam from the
+ /// gnashrc file.
+ int makeWebcamDeviceSelection();
/// \brief This function makes a temporary pipeline with the selected
device
/// to determine its capabilities (Gstreamer calls these caps). This
@@ -574,6 +577,15 @@
/// @return True if the link to the video_display_queue was successful,
/// False otherwise.
gboolean webcamMakeVideoDisplayLink(GnashWebcamPrivate *webcam);
+
+ /// \brief Function links the videoSaveBin to the videoSaveQueue 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 videoSaveQueue was successfully, false
+ /// otherwise.
+ gboolean webcamMakeVideoSaveLink(GnashWebcamPrivate *webcam);
/// \brief Function creates the save bin. For more information on pipeline
/// implementation and this function in general see the definition of
=== modified file 'testsuite/libmedia.all/test_videoinput.cpp'
--- a/testsuite/libmedia.all/test_videoinput.cpp 2009-07-20 16:32:04
+0000
+++ b/testsuite/libmedia.all/test_videoinput.cpp 2009-07-22 21:34:00
+0000
@@ -21,15 +21,6 @@
#ifdef HAVE_DEJAGNU_H
-#include <boost/shared_ptr.hpp>
-#include <string>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <iostream>
#include <string>
#include <cstdio>
@@ -45,8 +36,6 @@
using namespace gst;
using namespace std;
-static void usage (void);
-
static TestState runtest;
static string infile;
@@ -56,7 +45,7 @@
LogFile& dbglogfile = LogFile::getDefaultInstance();
int
-main(int argc, char *argv[])
+main()
{
test_client();
return 0;
@@ -100,10 +89,171 @@
runtest.pass("the zeroth vid_vect element contains the right
product name info");
}
- //vig.make_webcamDevice_selection();
-
- //cerr << "placeholder" << endl;
-
+ int devselect;
+ devselect = vig.makeWebcamDeviceSelection();
+
+ GnashWebcamPrivate *webcam = NULL;
+ webcam = vig.transferToPrivate(devselect);
+ if (webcam == NULL) {
+ runtest.fail("the transferToPrivate function didn't return anything");
+ } else {
+ runtest.pass("the transferToPrivate function returned a
GnashWebcamPrivate ptr");
+ }
+ if (devselect == 0) {
+ //videotestsrc tests
+ if (g_strcmp0(webcam->_deviceName, "videotest") == 1) {
+ runtest.fail("webcam doesn't have the right _deviceName value");
+ } else {
+ runtest.pass("webcam has the right _deviceName value");
+ }
+ if (webcam->_webcamDevice != vid_vect->at(0)){
+ runtest.fail("_webcamDevice values isn't correct");
+ } else {
+ runtest.pass("_webcamDevice has the right address");
+ }
+ } else {
+ //real camera source tests
+ if (webcam->_deviceName == NULL) {
+ runtest.fail("_deviceName isn't set in GnashWebcamPrivate class");
+ } else {
+ runtest.pass("_deviceName is set in GnashWebcamPrivate class");
+ }
+ if (webcam->_webcamDevice != vid_vect->at(devselect)) {
+ runtest.fail("_webcamDevice isn't set in GnashWebcamPrivate
class");
+ } else {
+ runtest.pass("_webcamDevice has the right address");
+ }
+ }
+
+ gboolean result = false;
+ result = vig.webcamCreateMainBin(webcam);
+ if (result != true) {
+ runtest.fail("the webcamCreateMainBin() function reported an error");
+ } else {
+ runtest.pass("the webcamCreateMainBin() function isn't reporting
errors");
+ }
+ if (webcam->_pipeline == NULL) {
+ runtest.fail("the main pipeline (webcam->_pipeline) wasn't
initialized");
+ } else {
+ runtest.pass("the main pipeline (webcam->_pipeline) was initializied");
+ }
+ if (webcam->_webcamMainBin == NULL) {
+ runtest.fail("the _webcamMainBin wasn't created");
+ } else {
+ runtest.pass("the _webcamMainBin was created");
+ if ((gst_element_get_pad(webcam->_webcamMainBin, "save_queue_src")) ==
NULL) {
+ runtest.fail("save_queue_src ghostpad wasn't created");
+ } else {
+ runtest.pass("save_queue_src ghostpad was created");
+ }
+ if ((gst_element_get_pad(webcam->_webcamMainBin,
"video_display_queue_src")) == NULL) {
+ runtest.fail("video_display_queue_src ghostpad wasn't created");
+ } else {
+ runtest.pass("video_display_queue_src ghostpad was created");
+ }
+ if ((gst_bin_get_by_name(GST_BIN(webcam->_pipeline),
+ "webcam_main_bin")) == NULL) {
+ runtest.fail("webcamMainBin has an unexpected address");
+ } else {
+ runtest.pass("webcamMainBin's address is set as expected");
+ }
+ }
+ if (webcam->_webcamSourceBin == NULL) {
+ runtest.fail("the _webcamSourceBin wasn't created");
+ } else {
+ runtest.pass("the _webcamSourceBin was created");
+ if ((gst_bin_get_by_name(GST_BIN(webcam->_pipeline),
+ "video_source")) == NULL) {
+ runtest.fail("videoSourceBin has an unexpected address");
+ } else {
+ runtest.pass("videoSourceBin's address is set as expected");
+ }
+ }
+ if (webcam->_videoSource == NULL) {
+ runtest.fail("the _videoSource reference wasn't created");
+ } else {
+ runtest.pass("the _videoSource reference was created");
+ }
+ if (webcam->_capsFilter == NULL) {
+ runtest.fail("the _capsFilter reference wasn't created");
+ } else {
+ runtest.pass("the _capsFilter reference was created");
+ }
+ if (webcam->_currentFormat == NULL) {
+ runtest.fail("no format was set (_currentFormat == NULL!)");
+ } else {
+ runtest.pass("format is set");
+ }
+
+ result = false;
+ result = vig.webcamCreateDisplayBin(webcam);
+ if (result != true) {
+ runtest.fail("webcamCreateDisplayBin() returned an error");
+ } else {
+ runtest.pass("webcamCreateDisplayBin() isn't reporting errors");
+ }
+ if (webcam->_videoDisplayBin == NULL) {
+ runtest.fail("the _webcamDisplayBin wasn't created");
+ } else {
+ runtest.pass("the _webcamDisplayBin was created");
+ if ((gst_element_get_pad(webcam->_videoDisplayBin, "sink")) == NULL) {
+ runtest.fail("the sink ghostpad in _videoDisplayBin wasn't
created");
+ } else {
+ runtest.pass("the _videoDisplayBin sink ghostpad was created");
+ }
+ if ((gst_bin_get_by_name(GST_BIN(webcam->_pipeline),
+ "video_display_bin")) == NULL) {
+ runtest.fail("videoDisplayBin has an unexpected address");
+ } else {
+ runtest.pass("videoDisplayBin's address is set as expected");
+ }
+ }
+
+ result = false;
+ result = vig.webcamMakeVideoDisplayLink(webcam);
+ if (result != true) {
+ runtest.fail("making videosrc -> display link failed");
+ } else {
+ runtest.pass("making videosrc -> display link succeeded");
+ }
+
+ result = false;
+ result = vig.webcamCreateSaveBin(webcam);
+ if (result != true) {
+ runtest.fail("webcamCreateSaveBin() reported an error");
+ } else {
+ runtest.pass("webcamCreateSaveBin() didn't report any errors");
+ }
+ result = false;
+ result = vig.webcamMakeVideoSaveLink(webcam);
+ if (result != true) {
+ runtest.fail("webcamMakeVideoSaveLink() reported an error");
+ } else {
+ runtest.pass("webcamMakeVideoSaveLink() didn't report errors");
+ }
+ if (webcam->_videoSaveBin == NULL) {
+ runtest.fail("webcam->_videoSaveBin reference isn't set");
+ } else {
+ runtest.pass("webcam->_videoSaveBin reference is set");
+ if ((gst_bin_get_by_name(GST_BIN(webcam->_pipeline),
+ "video_save_bin")) == NULL) {
+ runtest.fail("videoSaveBin has an unexpected address");
+ } else {
+ runtest.pass("videoSaveBin's address is set as expected");
+ }
+ if ((gst_element_get_pad(webcam->_videoSaveBin, "sink")) == NULL) {
+ runtest.fail("videoSaveBin's sink ghostpad wasn't created");
+ } else {
+ runtest.pass("videoSaveBin properly has a sink ghostpad");
+ }
+ }
+ if (webcam->_videoFileSink == NULL) {
+ runtest.fail("webcam->_videoFileSink reference isn't set");
+ } else {
+ runtest.pass("webcam->_videoFileSink reference is set");
+ }
+
+ //end of setup tests
}
=== modified file 'utilities/findmicrophones.cpp'
--- a/utilities/findmicrophones.cpp 2009-07-20 22:05:15 +0000
+++ b/utilities/findmicrophones.cpp 2009-07-22 21:34:00 +0000
@@ -78,9 +78,12 @@
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" || (strstr(dev_name, "Monitor") != NULL)) {
+ if (dev_name == "null") {
g_print("no pulse audio sources found\n");
}
+ else if ((strstr(dev_name, "Monitor") != NULL)) {
+ g_print("ignoring monitor (audio output)");
+ }
else {
audioVect.push_back(new data);
audioVect[numdevs]->deviceType = g_strdup_printf("pulsesrc");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11305: updated VideoInput testcase,
Ben Limmer <=