[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r11315: updated Audio and Video inpu
From: |
Ben Limmer |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r11315: updated Audio and Video input cpp files and test suites |
Date: |
Mon, 27 Jul 2009 09:45:34 -0600 |
User-agent: |
Bazaar (1.13.1) |
------------------------------------------------------------
revno: 11315
committer: Ben Limmer <address@hidden>
branch nick: trunk
timestamp: Mon 2009-07-27 09:45:34 -0600
message:
updated Audio and Video input cpp files and test suites
modified:
libmedia/gst/AudioInputGst.cpp
libmedia/gst/AudioInputGst.h
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_audioinput.cpp
testsuite/libmedia.all/test_videoinput.cpp
utilities/findwebcams.cpp
------------------------------------------------------------
revno: 11306.1.2
committer: Ben Limmer <address@hidden>
branch nick: cam_mic_impl_2
timestamp: Mon 2009-07-27 09:44:55 -0600
message:
updated Audio and Video input cpp files and test suites
modified:
libmedia/gst/AudioInputGst.cpp
libmedia/gst/AudioInputGst.h
libmedia/gst/VideoInputGst.cpp
libmedia/gst/VideoInputGst.h
testsuite/libmedia.all/test_audioinput.cpp
testsuite/libmedia.all/test_videoinput.cpp
utilities/findwebcams.cpp
=== modified file 'libmedia/gst/AudioInputGst.cpp'
--- a/libmedia/gst/AudioInputGst.cpp 2009-07-23 22:54:22 +0000
+++ b/libmedia/gst/AudioInputGst.cpp 2009-07-27 15:44:55 +0000
@@ -485,7 +485,7 @@
}
}
- void
+ bool
AudioInputGst::audioPlay(GnashAudioPrivate *audio) {
GstStateChangeReturn state;
GstBus *bus;
@@ -496,25 +496,30 @@
bus = gst_pipeline_get_bus (GST_PIPELINE (audio->_pipeline));
ret = gst_bus_add_watch (bus, audio_bus_call, audio);
gst_object_unref (bus);
-
- //declare clock variables to record time (mainly useful in debug)
- GstClockTime tfthen, tfnow;
- GstClockTimeDiff diff;
- tfthen = gst_util_get_timestamp ();
+ //tfthen = gst_util_get_timestamp ();
state = gst_element_set_state (audio->_pipeline, GST_STATE_PLAYING);
- if (state == GST_STATE_CHANGE_SUCCESS) {
+ if (state != GST_STATE_CHANGE_FAILURE) {
audio->_pipelineIsPlaying = true;
- }
-
- loop = audio->_loop;
- g_print("running (ctrl-c in terminal to quit).....\n");
- g_main_loop_run(loop);
- g_print("main loop done...\n");
- tfnow = gst_util_get_timestamp ();
- diff = GST_CLOCK_DIFF (tfthen, tfnow);
- g_print(("Execution ended after %" G_GUINT64_FORMAT " ns.\n"), diff);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ bool
+ AudioInputGst::audioStop(GnashAudioPrivate *audio) {
+ GstStateChangeReturn state;
+
+ state = gst_element_set_state (audio->_pipeline, GST_STATE_NULL);
+
+ if (state != GST_STATE_CHANGE_FAILURE) {
+ audio->_pipelineIsPlaying = false;
+ return true;
+ } else {
+ return false;
+ }
}
int
@@ -533,11 +538,7 @@
getSelectedCaps(devselect);
return devselect;
- } /*
- //debug
- //g_print("starting pipeline....\n");
- audioPlay(audio);
- } */
+ }
} //gst namespace
} //media namespace
=== modified file 'libmedia/gst/AudioInputGst.h'
--- a/libmedia/gst/AudioInputGst.h 2009-07-23 22:54:22 +0000
+++ b/libmedia/gst/AudioInputGst.h 2009-07-27 15:44:55 +0000
@@ -362,7 +362,15 @@
/// parameter.
/// @param audio A pointer to the GnashAudioPrivate class structure
containing
/// the pipeline to start up.
- void audioPlay(GnashAudioPrivate *audio);
+ /// @return True if the pipeline started to play correctly, false
otherwise.
+ bool audioPlay(GnashAudioPrivate *audio);
+
+ /// This function stops the audio pipeline created earlier in code
execution.
+ ///
+ /// @param audio A pointer tot he GnashAudioPrivate class structure
containing
+ /// the pipeline to start up.
+ /// @return True if the pipeline successfully stopped, false otherwise.
+ bool audioStop(GnashAudioPrivate *audio);
/// \brief Function returns the total number of devices detected (useful in
/// iterating through the _audioVect vector.
=== modified file 'libmedia/gst/VideoInputGst.cpp'
--- a/libmedia/gst/VideoInputGst.cpp 2009-07-23 22:54:22 +0000
+++ b/libmedia/gst/VideoInputGst.cpp 2009-07-27 15:44:55 +0000
@@ -902,7 +902,7 @@
}
//start the pipeline and run the g_main_loop
- void
+ bool
VideoInputGst::webcamPlay(GnashWebcamPrivate *webcam) {
GstStateChangeReturn state;
GstBus *bus;
@@ -912,31 +912,26 @@
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 ();
+ //tfthen = gst_util_get_timestamp ();
state = gst_element_set_state (webcam->_pipeline,
GST_STATE_PLAYING);
if (state != GST_STATE_CHANGE_FAILURE) {
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);
}
- void
+ bool
VideoInputGst::webcamStop(GnashWebcamPrivate *webcam) {
- gst_element_set_state (webcam->_pipeline, GST_STATE_NULL);
- webcam->_pipelineIsPlaying = FALSE;
+ GstStateChangeReturn state;
+
+ gst_element_set_state (webcam->_pipeline, GST_STATE_NULL);
+ if (state != GST_STATE_CHANGE_FAILURE) {
+ webcam->_pipelineIsPlaying = FALSE;
+ return true;
+ } else {
+ return false;
+ }
}
} //gst namespace
} //media namespace
=== modified file 'libmedia/gst/VideoInputGst.h'
--- a/libmedia/gst/VideoInputGst.h 2009-07-23 22:54:22 +0000
+++ b/libmedia/gst/VideoInputGst.h 2009-07-27 15:44:55 +0000
@@ -605,9 +605,15 @@
/// @param webcam A pointer to the GnashWebcamPrivate webcam structure
/// created previously in a call to transferToPrivate()
///
- void webcamPlay(GnashWebcamPrivate *webcam);
+ /// @return True if the pipeline was started correctly, false otherwise.
+ bool webcamPlay(GnashWebcamPrivate *webcam);
- void webcamStop(GnashWebcamPrivate *webcam);
+ /// \brief Function stops the pipeline designed earlier in code execution.
+ ///
+ /// @param webcam A pointer to the GnashWebcamPrivate webcam structure
+ /// created previously in a call to transferToPrivate()
+ /// @return True if the pipeline was stopped correctly, false otherwise.
+ bool webcamStop(GnashWebcamPrivate *webcam);
/// \brief Accessor which returns the vid_vect private variable in the
/// VideoInputGst class.
=== modified file 'testsuite/libmedia.all/test_audioinput.cpp'
--- a/testsuite/libmedia.all/test_audioinput.cpp 2009-07-23 22:54:22
+0000
+++ b/testsuite/libmedia.all/test_audioinput.cpp 2009-07-27 15:44:55
+0000
@@ -21,16 +21,8 @@
#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 <string>
+#include <sys/stat.h>
#include <cstdio>
#include "dejagnu.h"
@@ -45,8 +37,6 @@
using namespace gst;
using namespace std;
-static void usage (void);
-
static TestState runtest;
static string infile;
@@ -177,6 +167,37 @@
} else {
runtest.pass("makeAudioSourceSaveLink() function reported no errors");
}
+
+ ok = aud.audioPlay(audio);
+ if (ok != true) {
+ runtest.fail("audioPlay() function reported an error");
+ } else {
+ runtest.pass("audioPlay() function reported no errors");
+ }
+
+ //sleep to record a few seconds of audio (from mic or test source)
+ sleep(5);
+
+ ok = aud.audioStop(audio);
+ if (ok != true) {
+ runtest.fail("audioStop() function reported an error");
+ } else {
+ runtest.pass("audioStop() function reported no errors");
+ }
+
+ struct stat st;
+ std::string file = "./audioOut.ogg";
+ if (stat(file.c_str(), &st) == 0) {
+ runtest.pass("audioOut.ogg file is in testsuite/libmedia.all");
+ if (st.st_blocks == 0) {
+ runtest.fail("the output file is there, but there's no data in
it!");
+ } else {
+ runtest.pass("the output file has data in it");
+ }
+ } else {
+ runtest.fail("there's no output video file in testsuite/libmedia.all");
+ }
+
}
=== modified file 'testsuite/libmedia.all/test_videoinput.cpp'
--- a/testsuite/libmedia.all/test_videoinput.cpp 2009-07-23 22:54:22
+0000
+++ b/testsuite/libmedia.all/test_videoinput.cpp 2009-07-27 15:44:55
+0000
@@ -256,14 +256,26 @@
//end of setup tests, now startup the webcamPipeline, run for a few seconds
//and then make sure there is a file present after running
- vig.webcamPlay(webcam);
+ result = vig.webcamPlay(webcam);
+ if (result != true) {
+ runtest.fail("webcamPlay() function reported an error");
+ } else {
+ runtest.pass("webcamPlay() function reported no errors");
+ }
+
+
if (webcam->_pipelineIsPlaying != true) {
runtest.fail("the _pipelineIsPlaying variable isn't being set");
} else {
runtest.pass("the _pipelineIsPlaying variable is properly set");
}
sleep(5);
- vig.webcamStop(webcam);
+ result = vig.webcamStop(webcam);
+ if (result != true) {
+ runtest.fail("webcamStop() function reported an error");
+ } else {
+ runtest.pass("webcamStop() function reported no errors");
+ }
struct stat st;
std::string file = "./vidoutput.ogg";
=== modified file 'utilities/findwebcams.cpp'
--- a/utilities/findwebcams.cpp 2009-07-23 22:54:22 +0000
+++ b/utilities/findwebcams.cpp 2009-07-27 15:44:55 +0000
@@ -164,8 +164,8 @@
g_print(" %s (%s)\n", vidVector[i]->deviceName,
vidVector[i]->deviceType);
}
}
- g_print("\nGnash interacts with v4l2 sources better than v4l sources,
thus they");
- g_print("\nwill not be printed in the list below.\n");
+ g_print("\nGnash interacts with v4l2 sources better than v4l sources,
thus the");
+ g_print("\nv4l sources will not be printed in the list below.\n");
g_print("\nFound %d video devices: \n\n", (numdevs - numDuplicates));
gint counter = 0;
for (i = 0; i < numdevs; ++i)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r11315: updated Audio and Video input cpp files and test suites,
Ben Limmer <=