added missing test setup sources
This commit is contained in:
parent
7555faa074
commit
70a2c6bb64
4 changed files with 690 additions and 0 deletions
224
livesupport/modules/gstreamerElements/src/SeekPackTest.cxx
Normal file
224
livesupport/modules/gstreamerElements/src/SeekPackTest.cxx
Normal file
|
@ -0,0 +1,224 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LiveSupport is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SeekPackTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "seek-pack.h"
|
||||
#include "SeekPackTest.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::GstreamerElements;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(SeekPackTest);
|
||||
|
||||
/**
|
||||
* A test file.
|
||||
*/
|
||||
static const char * testFile = "var/5seccounter.mp3";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
/**
|
||||
* Signal handler for the eos event of the switcher element.
|
||||
*
|
||||
* @param element the element emitting the eos signal
|
||||
* @param userData pointer to the container bin of the switcher.
|
||||
*/
|
||||
static void
|
||||
eos_signal_handler(GstElement * element,
|
||||
gpointer userData);
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekPackTest :: setUp(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Clean up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekPackTest :: tearDown(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* A simple smoke test.
|
||||
*----------------------------------------------------------------------------*/
|
||||
gint64
|
||||
SeekPackTest :: playFile(const char * audioFile,
|
||||
gint64 silenceDuration,
|
||||
gint64 playFrom,
|
||||
gint64 playTo)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
GstElement * pipeline;
|
||||
GstElement * source;
|
||||
LivesupportSeekPack * seekPack;
|
||||
GstElement * sink;
|
||||
GstFormat format;
|
||||
gint64 timePlayed;
|
||||
|
||||
/* initialize GStreamer */
|
||||
gst_init(0, 0);
|
||||
|
||||
/* create elements */
|
||||
pipeline = gst_pipeline_new("audio-player");
|
||||
source = gst_element_factory_make("filesrc", "filesource");
|
||||
seekPack = livesupport_seek_pack_new("seekPack");
|
||||
sink = gst_element_factory_make("alsasink", "alsaoutput");
|
||||
|
||||
/* set filename property on the file source */
|
||||
g_object_set(G_OBJECT (source), "location", audioFile, NULL);
|
||||
|
||||
livesupport_seek_pack_init(seekPack,
|
||||
source,
|
||||
silenceDuration,
|
||||
playFrom,
|
||||
playTo);
|
||||
g_signal_connect(seekPack->bin,
|
||||
"eos",
|
||||
G_CALLBACK(eos_signal_handler),
|
||||
pipeline);
|
||||
|
||||
livesupport_seek_pack_link(seekPack, sink);
|
||||
|
||||
livesupport_seek_pack_add_to_bin(seekPack, GST_BIN(pipeline));
|
||||
gst_bin_add(GST_BIN(pipeline), sink);
|
||||
|
||||
gst_element_set_state(sink, GST_STATE_READY);
|
||||
livesupport_seek_pack_set_state(seekPack, GST_STATE_PLAYING);
|
||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||
|
||||
while (gst_bin_iterate(GST_BIN(pipeline)));
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_element_query(sink, GST_QUERY_POSITION, &format, &timePlayed);
|
||||
|
||||
/* clean up nicely */
|
||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||
livesupport_seek_pack_destroy(seekPack);
|
||||
gst_object_unref(GST_OBJECT(pipeline));
|
||||
|
||||
return timePlayed;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* eos signal handler for the switcher element
|
||||
*----------------------------------------------------------------------------*/
|
||||
static void
|
||||
eos_signal_handler(GstElement * element,
|
||||
gpointer userData)
|
||||
{
|
||||
GstElement * container = GST_ELEMENT(userData);
|
||||
|
||||
g_return_if_fail(container != NULL);
|
||||
g_return_if_fail(GST_IS_ELEMENT(container));
|
||||
|
||||
// set the container into eos state
|
||||
gst_element_set_eos(container);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* A simple smoke test.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekPackTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
gint64 timePlayed;
|
||||
|
||||
timePlayed = playFile(testFile,
|
||||
2LL * GST_SECOND,
|
||||
1LL * GST_SECOND,
|
||||
3LL * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed > 3.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed < 4.1 * GST_SECOND);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* A test with no silence.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekPackTest :: noSilenceTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
gint64 timePlayed;
|
||||
|
||||
timePlayed = playFile(testFile,
|
||||
0LL * GST_SECOND,
|
||||
1LL * GST_SECOND,
|
||||
3LL * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed > 1.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed < 2.1 * GST_SECOND);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Open ended test
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekPackTest :: openEndedTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
gint64 timePlayed;
|
||||
|
||||
timePlayed = playFile(testFile,
|
||||
2LL * GST_SECOND,
|
||||
1LL * GST_SECOND,
|
||||
-1LL);
|
||||
CPPUNIT_ASSERT(timePlayed > 5.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed < 6.1 * GST_SECOND);
|
||||
}
|
||||
|
145
livesupport/modules/gstreamerElements/src/SeekPackTest.h
Normal file
145
livesupport/modules/gstreamerElements/src/SeekPackTest.h
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LiveSupport is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SeekPackTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SeekPackTest_h
|
||||
#define SeekPackTest_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GstreamerElements {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* Unit test for the SeekPack structure.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class SeekPackTest : public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(SeekPackTest);
|
||||
CPPUNIT_TEST(firstTest);
|
||||
CPPUNIT_TEST(noSilenceTest);
|
||||
CPPUNIT_TEST(openEndedTest);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Play a file, with a specific partial play config.
|
||||
*
|
||||
* @param audioFile the file to play
|
||||
* @param silenceDuration the amount of silence before playing
|
||||
* @param playFrom play the audio file from this offset
|
||||
* @param playTo play the audio file until this offset,
|
||||
* or -1LL if until the end.
|
||||
* @return the number of milliseconds played.
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
gint64
|
||||
playFile(const char * audioFile,
|
||||
gint64 silenceDuration,
|
||||
gint64 playFrom,
|
||||
gint64 playTo)
|
||||
throw (CPPUNIT_NS::Exception);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* A simple smoke test.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* A test with no silence.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
noSilenceTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* An open ended play test.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
openEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Set up the environment for the test case.
|
||||
*/
|
||||
void
|
||||
setUp(void) throw ();
|
||||
|
||||
/**
|
||||
* Clean up the environment after the test case.
|
||||
*/
|
||||
void
|
||||
tearDown(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace GstreamerElements
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SeekPackTest_h
|
||||
|
187
livesupport/modules/gstreamerElements/src/SeekTest.cxx
Normal file
187
livesupport/modules/gstreamerElements/src/SeekTest.cxx
Normal file
|
@ -0,0 +1,187 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LiveSupport is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SeekTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include "seek.h"
|
||||
#include "SeekTest.h"
|
||||
|
||||
|
||||
using namespace LiveSupport::GstreamerElements;
|
||||
|
||||
/* =================================================== local data structures */
|
||||
|
||||
|
||||
/* ================================================ local constants & macros */
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(SeekTest);
|
||||
|
||||
static const char * testFile = "var/5seccounter.mp3";
|
||||
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
/* ============================================================= module code */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Set up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekTest :: setUp(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Clean up the test environment
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekTest :: tearDown(void) throw ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Play an audio file
|
||||
*----------------------------------------------------------------------------*/
|
||||
gint64
|
||||
SeekTest :: playFile(const char * audioFile,
|
||||
gint64 seekTo,
|
||||
gint64 playTo)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
GstElement * pipeline;
|
||||
GstElement * source;
|
||||
GstElement * decoder;
|
||||
GstElement * sink;
|
||||
GstSeekType seekType;
|
||||
GstFormat format;
|
||||
gint64 timePlayed;
|
||||
gint64 timeAfterSeek;
|
||||
gboolean ret;
|
||||
|
||||
/* initialize GStreamer */
|
||||
gst_init(0, 0);
|
||||
|
||||
/* create elements */
|
||||
seekType = (GstSeekType) (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH);
|
||||
|
||||
pipeline = gst_pipeline_new("audio-player");
|
||||
source = gst_element_factory_make("filesrc", "source");
|
||||
decoder = gst_element_factory_make("mad", "decoder");
|
||||
sink = gst_element_factory_make("alsasink", "alsa-output");
|
||||
|
||||
g_object_set(G_OBJECT(source), "location", audioFile, NULL);
|
||||
|
||||
gst_element_link_many(source, decoder, sink, NULL);
|
||||
gst_bin_add_many(GST_BIN(pipeline), source, decoder, sink, NULL);
|
||||
|
||||
gst_element_set_state(sink, GST_STATE_READY);
|
||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||
|
||||
// iterate on the piplinee until the played time becomes more than 0
|
||||
// as the seek even will only be taken into consideration after that
|
||||
// by gstreamer
|
||||
for (timePlayed = 0;
|
||||
timePlayed == 0 && gst_bin_iterate(GST_BIN(pipeline)); ) {
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_element_query(sink, GST_QUERY_POSITION, &format, &timePlayed);
|
||||
}
|
||||
|
||||
// so, seek now
|
||||
timeAfterSeek = -1LL;
|
||||
ret = livesupport_seek(decoder, seekType, seekTo);
|
||||
CPPUNIT_ASSERT(ret);
|
||||
|
||||
// iterate until playTo is reached
|
||||
while (gst_bin_iterate(GST_BIN(pipeline))) {
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_element_query(sink, GST_QUERY_POSITION, &format, &timePlayed);
|
||||
|
||||
if (timeAfterSeek == -1LL && timePlayed > seekTo) {
|
||||
timeAfterSeek = timePlayed;
|
||||
}
|
||||
|
||||
if (playTo > 0 && timePlayed > playTo) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* clean up nicely */
|
||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||
gst_object_unref(GST_OBJECT (pipeline));
|
||||
|
||||
return timePlayed - timeAfterSeek;
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* A simple smoke test.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekTest :: firstTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
gint64 timePlayed;
|
||||
|
||||
timePlayed = playFile(testFile, 1LL * GST_SECOND, 4LL * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed > 2.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed < 3.1 * GST_SECOND);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Seek and play until the end of the auido file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
SeekTest :: openEndedTest(void)
|
||||
throw (CPPUNIT_NS::Exception)
|
||||
{
|
||||
gint64 timePlayed;
|
||||
|
||||
// see http://bugzilla.gnome.org/show_bug.cgi?id=308312
|
||||
// as why this seek is not precise
|
||||
timePlayed = playFile(testFile, 2LL * GST_SECOND, -1LL);
|
||||
CPPUNIT_ASSERT(timePlayed > 2.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT(timePlayed < 3.1 * GST_SECOND);
|
||||
}
|
||||
|
134
livesupport/modules/gstreamerElements/src/SeekTest.h
Normal file
134
livesupport/modules/gstreamerElements/src/SeekTest.h
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*------------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2004 Media Development Loan Fund
|
||||
|
||||
This file is part of the LiveSupport project.
|
||||
http://livesupport.campware.org/
|
||||
To report bugs, send an e-mail to bugs@campware.org
|
||||
|
||||
LiveSupport is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
LiveSupport is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with LiveSupport; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.1 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SeekTest.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
#ifndef SeekTest_h
|
||||
#define SeekTest_h
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This is a C++ include file
|
||||
#endif
|
||||
|
||||
|
||||
/* ============================================================ include files */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
|
||||
namespace LiveSupport {
|
||||
namespace GstreamerElements {
|
||||
|
||||
/* ================================================================ constants */
|
||||
|
||||
|
||||
/* =================================================================== macros */
|
||||
|
||||
|
||||
/* =============================================================== data types */
|
||||
|
||||
/**
|
||||
* Unit test for the partialplay gstreamer element.
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.1 $
|
||||
*/
|
||||
class SeekTest : public CPPUNIT_NS::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(SeekTest);
|
||||
CPPUNIT_TEST(firstTest);
|
||||
CPPUNIT_TEST(openEndedTest);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Play a specific file, from and until a specific timepoint.
|
||||
*
|
||||
* @param audioFile the audio file to play.
|
||||
* @param seekTo before playing, seek to this position.
|
||||
* @param playTo play until this position, or -1LL if play until
|
||||
* the end.
|
||||
* @return the number of milliseconds played.
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
gint64
|
||||
playFile(const char * audioFile,
|
||||
gint64 seekTo,
|
||||
gint64 playTo)
|
||||
throw (CPPUNIT_NS::Exception);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* A simple smoke test.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
/**
|
||||
* A test where the result is played until its end.
|
||||
*
|
||||
* @exception CPPUNIT_NS::Exception on test failures.
|
||||
*/
|
||||
void
|
||||
openEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Set up the environment for the test case.
|
||||
*/
|
||||
void
|
||||
setUp(void) throw ();
|
||||
|
||||
/**
|
||||
* Clean up the environment after the test case.
|
||||
*/
|
||||
void
|
||||
tearDown(void) throw ();
|
||||
};
|
||||
|
||||
|
||||
/* ================================================= external data structures */
|
||||
|
||||
|
||||
/* ====================================================== function prototypes */
|
||||
|
||||
|
||||
} // namespace GstreamerElements
|
||||
} // namespace LiveSupport
|
||||
|
||||
#endif // SeekTest_h
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue