added short file tests to the autoplug test cases
This commit is contained in:
parent
6788fc9aa1
commit
1ffef04932
5 changed files with 85 additions and 8 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/AutoplugTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/AutoplugTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,6 +71,16 @@ static const char * smilTestFile = "var/simple.smil";
|
||||||
*/
|
*/
|
||||||
static const char * badFile = "src/AutoplugTest.cxx";
|
static const char * badFile = "src/AutoplugTest.cxx";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A very short file.
|
||||||
|
*/
|
||||||
|
static const char * shortFile = "var/test-short.mp3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A SMIL file referring to a very short file.
|
||||||
|
*/
|
||||||
|
static const char * shortSmilFile = "var/short.smil";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
@ -219,3 +229,37 @@ AutoplugTest :: negativeTest(void)
|
||||||
CPPUNIT_ASSERT_MESSAGE(str, timePlayed == 0LL);
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed == 0LL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test on a very short file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
AutoplugTest :: shortTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFile(shortFile);
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 1.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 2.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Test on a SMIL file referring to a very short file.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
AutoplugTest :: shortSmilTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFile(shortSmilFile);
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 1.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 2.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.2 $
|
Version : $Revision: 1.3 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/AutoplugTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/AutoplugTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -58,7 +58,7 @@ namespace GstreamerElements {
|
||||||
* Unit test for the partialplay gstreamer element.
|
* Unit test for the partialplay gstreamer element.
|
||||||
*
|
*
|
||||||
* @author $Author: maroy $
|
* @author $Author: maroy $
|
||||||
* @version $Revision: 1.2 $
|
* @version $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
class AutoplugTest : public CPPUNIT_NS::TestFixture
|
class AutoplugTest : public CPPUNIT_NS::TestFixture
|
||||||
{
|
{
|
||||||
|
@ -67,6 +67,8 @@ class AutoplugTest : public CPPUNIT_NS::TestFixture
|
||||||
CPPUNIT_TEST(oggVorbisTest);
|
CPPUNIT_TEST(oggVorbisTest);
|
||||||
CPPUNIT_TEST(smilTest);
|
CPPUNIT_TEST(smilTest);
|
||||||
CPPUNIT_TEST(negativeTest);
|
CPPUNIT_TEST(negativeTest);
|
||||||
|
CPPUNIT_TEST(shortTest);
|
||||||
|
CPPUNIT_TEST(shortSmilTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -117,6 +119,22 @@ class AutoplugTest : public CPPUNIT_NS::TestFixture
|
||||||
void
|
void
|
||||||
negativeTest(void) throw (CPPUNIT_NS::Exception);
|
negativeTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test on a very short file.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
shortTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test on a SMIL file referring to a very short file.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
shortSmilTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/seek-pack.c,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/seek-pack.c,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -199,10 +199,17 @@ livesupport_seek_pack_init(LivesupportSeekPack * seekPack,
|
||||||
seekPack->switcher,
|
seekPack->switcher,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* seek on the decoder, and link it up with the switcher */
|
if (seekPack->decoder) {
|
||||||
gst_element_link(seekPack->source, seekPack->decoder);
|
/* seek on the decoder, and link it up with the switcher */
|
||||||
livesupport_seek_pack_seek(seekPack);
|
gst_element_link(seekPack->source, seekPack->decoder);
|
||||||
gst_element_link(seekPack->decoder, seekPack->switcher);
|
livesupport_seek_pack_seek(seekPack);
|
||||||
|
gst_element_link(seekPack->decoder, seekPack->switcher);
|
||||||
|
} else {
|
||||||
|
/* just fake the content with silence,
|
||||||
|
* if it could not be auto-plugged */
|
||||||
|
seekPack->decoder = gst_element_factory_make("silence", "decoder");
|
||||||
|
gst_element_link(seekPack->decoder, seekPack->switcher);
|
||||||
|
}
|
||||||
|
|
||||||
/* put all inside the bin, and link up a ghost pad to switch's src pad */
|
/* put all inside the bin, and link up a ghost pad to switch's src pad */
|
||||||
gst_bin_add_many(GST_BIN(seekPack->bin),
|
gst_bin_add_many(GST_BIN(seekPack->bin),
|
||||||
|
|
8
livesupport/modules/gstreamerElements/var/short.smil
Normal file
8
livesupport/modules/gstreamerElements/var/short.smil
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<smil xmlns="http://www.w3.org/2001/SMIL20/Language" >
|
||||||
|
<body>
|
||||||
|
<par>
|
||||||
|
<audio src = "file:var/test-short.mp3" />
|
||||||
|
</par>
|
||||||
|
</body>
|
||||||
|
</smil>
|
BIN
livesupport/modules/gstreamerElements/var/test-short.mp3
Normal file
BIN
livesupport/modules/gstreamerElements/var/test-short.mp3
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue