added ogg vorbis and SMIL test cases to the switcher test
This commit is contained in:
parent
aa54dd2da9
commit
c6e63b5e3b
3 changed files with 301 additions and 77 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SwitcherTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SwitcherTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include "LiveSupport/GstreamerElements/autoplug.h"
|
||||||
#include "SwitcherTest.h"
|
#include "SwitcherTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +51,20 @@ using namespace LiveSupport::GstreamerElements;
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(SwitcherTest);
|
CPPUNIT_TEST_SUITE_REGISTRATION(SwitcherTest);
|
||||||
|
|
||||||
static const char * testFile = "var/5seccounter.mp3";
|
/**
|
||||||
|
* An mp3 test file.
|
||||||
|
*/
|
||||||
|
static const char * mp3File = "var/5seccounter.mp3";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An ogg vorbis test file.
|
||||||
|
*/
|
||||||
|
static const char * oggVorbisFile = "var/5seccounter.ogg";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A SMIL test file.
|
||||||
|
*/
|
||||||
|
static const char * smilFile = "var/simple.smil";
|
||||||
|
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== local function prototypes */
|
||||||
|
@ -110,9 +124,6 @@ SwitcherTest :: playFiles(const char ** audioFiles,
|
||||||
switcher = gst_element_factory_make("switcher", "switcher");
|
switcher = gst_element_factory_make("switcher", "switcher");
|
||||||
sink = gst_element_factory_make("alsasink", "alsa-output");
|
sink = gst_element_factory_make("alsasink", "alsa-output");
|
||||||
|
|
||||||
gst_element_link_many(switcher, sink, NULL);
|
|
||||||
gst_bin_add_many(GST_BIN(pipeline), switcher, sink, NULL);
|
|
||||||
|
|
||||||
for (i = 0; i < noFiles; ++i) {
|
for (i = 0; i < noFiles; ++i) {
|
||||||
GstElement * source;
|
GstElement * source;
|
||||||
GstElement * decoder;
|
GstElement * decoder;
|
||||||
|
@ -122,23 +133,34 @@ SwitcherTest :: playFiles(const char ** audioFiles,
|
||||||
g_snprintf(str, 256, "source_%d", i);
|
g_snprintf(str, 256, "source_%d", i);
|
||||||
source = gst_element_factory_make("filesrc", str);
|
source = gst_element_factory_make("filesrc", str);
|
||||||
CPPUNIT_ASSERT(source);
|
CPPUNIT_ASSERT(source);
|
||||||
|
|
||||||
g_snprintf(str, 256, "decoder_%d", i);
|
|
||||||
decoder = gst_element_factory_make("mad", str);
|
|
||||||
CPPUNIT_ASSERT(decoder);
|
|
||||||
|
|
||||||
g_object_set(G_OBJECT(source), "location", audioFiles[i], NULL);
|
g_object_set(G_OBJECT(source), "location", audioFiles[i], NULL);
|
||||||
|
|
||||||
ret = gst_element_link_many(source, decoder, switcher, NULL);
|
g_snprintf(str, 256, "decoder_%d", i);
|
||||||
|
decoder = ls_gst_autoplug_plug_source(source, str);
|
||||||
|
CPPUNIT_ASSERT(decoder);
|
||||||
|
|
||||||
|
ret = gst_element_link(decoder, switcher);
|
||||||
CPPUNIT_ASSERT(ret);
|
CPPUNIT_ASSERT(ret);
|
||||||
gst_bin_add_many(GST_BIN(pipeline), source, decoder, NULL);
|
gst_bin_add_many(GST_BIN(pipeline), source, decoder, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* link and add the switcher & sink _after_ the decoders above
|
||||||
|
* otherwise we'll get a:
|
||||||
|
* "assertion failed: (group->group_links == NULL)"
|
||||||
|
* error later on when trying to free up the pipeline
|
||||||
|
* see http://bugzilla.gnome.org/show_bug.cgi?id=309122
|
||||||
|
*/
|
||||||
|
gst_element_link_many(switcher, sink, NULL);
|
||||||
|
gst_bin_add_many(GST_BIN(pipeline), switcher, sink, NULL);
|
||||||
|
|
||||||
g_object_set(G_OBJECT(switcher), "source-config", sourceConfig, NULL);
|
g_object_set(G_OBJECT(switcher), "source-config", sourceConfig, NULL);
|
||||||
/* listen for the eos event on switcher, so the pipeline can be stopped */
|
/* listen for the eos event on switcher, so the pipeline can be stopped */
|
||||||
g_signal_connect(switcher, "eos", G_CALLBACK(eos_signal_handler), pipeline);
|
g_signal_connect(switcher, "eos", G_CALLBACK(eos_signal_handler), pipeline);
|
||||||
|
|
||||||
gst_element_set_state(sink, GST_STATE_READY);
|
gst_element_set_state(sink, GST_STATE_PAUSED);
|
||||||
|
/* set the switcher to PAUSED, as it will give
|
||||||
|
* "trying to push on unnegotiaded pad" warnings otherwise */
|
||||||
|
gst_element_set_state(switcher, GST_STATE_PAUSED);
|
||||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
while (gst_bin_iterate(GST_BIN(pipeline)));
|
while (gst_bin_iterate(GST_BIN(pipeline)));
|
||||||
|
@ -175,14 +197,16 @@ eos_signal_handler(GstElement * element,
|
||||||
* A simple smoke test.
|
* A simple smoke test.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SwitcherTest :: firstTest(void)
|
SwitcherTest :: mp3Test(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
gint64 timePlayed;
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
timePlayed = playFiles(&testFile, 1, "0[3s]");
|
timePlayed = playFiles(&mp3File, 1, "0[3s]");
|
||||||
CPPUNIT_ASSERT(timePlayed > 2.9 * GST_SECOND);
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
CPPUNIT_ASSERT(timePlayed < 3.1 * GST_SECOND);
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 2.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 3.1 * GST_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,14 +214,16 @@ SwitcherTest :: firstTest(void)
|
||||||
* Play a file until its end.
|
* Play a file until its end.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SwitcherTest :: openEndedTest(void)
|
SwitcherTest :: mp3OpenEndedTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
gint64 timePlayed;
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
timePlayed = playFiles(&testFile, 1, "0[]");
|
timePlayed = playFiles(&mp3File, 1, "0[]");
|
||||||
CPPUNIT_ASSERT(timePlayed > 4.9 * GST_SECOND);
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
CPPUNIT_ASSERT(timePlayed < 5.1 * GST_SECOND);
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,15 +231,17 @@ SwitcherTest :: openEndedTest(void)
|
||||||
* Play a file until its end.
|
* Play a file until its end.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SwitcherTest :: multipleTest(void)
|
SwitcherTest :: mp3MultipleTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
const char * testFiles[2] = { testFile, testFile };
|
const char * testFiles[] = { mp3File, mp3File };
|
||||||
gint64 timePlayed;
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
timePlayed = playFiles(testFiles, 2, "0[2s];1[2s]");
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[2s]");
|
||||||
CPPUNIT_ASSERT(timePlayed > 3.9 * GST_SECOND);
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
CPPUNIT_ASSERT(timePlayed < 4.1 * GST_SECOND);
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 3.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 4.1 * GST_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,15 +249,157 @@ SwitcherTest :: multipleTest(void)
|
||||||
* Play a file until its end.
|
* Play a file until its end.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SwitcherTest :: multipleOpenEndedTest(void)
|
SwitcherTest :: mp3MultipleOpenEndedTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
const char * testFiles[2] = { testFile, testFile };
|
const char * testFiles[] = { mp3File, mp3File };
|
||||||
gint64 timePlayed;
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
timePlayed = playFiles(testFiles, 2, "0[2s];1[]");
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[]");
|
||||||
CPPUNIT_ASSERT(timePlayed > 6.9 * GST_SECOND);
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
CPPUNIT_ASSERT(timePlayed < 7.1 * GST_SECOND);
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 6.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 7.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* A simple smoke test.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: oggVorbisTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(&oggVorbisFile, 1, "0[3s]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 2.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 3.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: oggVorbisOpenEndedTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(&oggVorbisFile, 1, "0[]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: oggVorbisMultipleTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
const char * testFiles[] = { oggVorbisFile, oggVorbisFile };
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[2s]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 3.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 4.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: oggVorbisMultipleOpenEndedTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
const char * testFiles[] = { oggVorbisFile, oggVorbisFile };
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 6.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 7.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* A simple smoke test.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: smilTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(&smilFile, 1, "0[3s]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 2.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 3.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: smilOpenEndedTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(&smilFile, 1, "0[]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: smilMultipleTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
const char * testFiles[] = { smilFile, smilFile };
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[2s]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 3.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 4.1 * GST_SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Play a file until its end.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: smilMultipleOpenEndedTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
const char * testFiles[] = { smilFile, smilFile };
|
||||||
|
gint64 timePlayed;
|
||||||
|
char str[256];
|
||||||
|
|
||||||
|
timePlayed = playFiles(testFiles, 2, "0[2s];1[]");
|
||||||
|
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 6.9 * GST_SECOND);
|
||||||
|
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 7.1 * GST_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.4 $
|
Version : $Revision: 1.5 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SwitcherTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/SwitcherTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -58,15 +58,23 @@ 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.4 $
|
* @version $Revision: 1.5 $
|
||||||
*/
|
*/
|
||||||
class SwitcherTest : public CPPUNIT_NS::TestFixture
|
class SwitcherTest : public CPPUNIT_NS::TestFixture
|
||||||
{
|
{
|
||||||
CPPUNIT_TEST_SUITE(SwitcherTest);
|
CPPUNIT_TEST_SUITE(SwitcherTest);
|
||||||
CPPUNIT_TEST(firstTest);
|
CPPUNIT_TEST(mp3Test);
|
||||||
CPPUNIT_TEST(openEndedTest);
|
CPPUNIT_TEST(mp3OpenEndedTest);
|
||||||
CPPUNIT_TEST(multipleTest);
|
CPPUNIT_TEST(mp3MultipleTest);
|
||||||
CPPUNIT_TEST(multipleOpenEndedTest);
|
CPPUNIT_TEST(mp3MultipleOpenEndedTest);
|
||||||
|
CPPUNIT_TEST(oggVorbisTest);
|
||||||
|
CPPUNIT_TEST(oggVorbisOpenEndedTest);
|
||||||
|
CPPUNIT_TEST(oggVorbisMultipleTest);
|
||||||
|
CPPUNIT_TEST(oggVorbisMultipleOpenEndedTest);
|
||||||
|
CPPUNIT_TEST(smilTest);
|
||||||
|
CPPUNIT_TEST(smilOpenEndedTest);
|
||||||
|
CPPUNIT_TEST(smilMultipleTest);
|
||||||
|
CPPUNIT_TEST(smilMultipleOpenEndedTest);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -90,36 +98,103 @@ class SwitcherTest : public CPPUNIT_NS::TestFixture
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple smoke test.
|
* A simple smoke test with an mp3 file.
|
||||||
*
|
*
|
||||||
* @exception CPPUNIT_NS::Exception on test failures.
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
firstTest(void) throw (CPPUNIT_NS::Exception);
|
mp3Test(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A test to play a file until its end.
|
* A test to play an mp3 file until its end.
|
||||||
*
|
*
|
||||||
* @exception CPPUNIT_NS::Exception on test failures.
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
openEndedTest(void) throw (CPPUNIT_NS::Exception);
|
mp3OpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the switcher with multiple inputs.
|
* Test the switcher with multiple mp3 inputs.
|
||||||
*
|
*
|
||||||
* @exception CPPUNIT_NS::Exception on test failures.
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
multipleTest(void) throw (CPPUNIT_NS::Exception);
|
mp3MultipleTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the switcher with multiple inputs, including open-ended ones.
|
* Test the switcher with multiple mp3 inputs,
|
||||||
|
* including open-ended ones.
|
||||||
*
|
*
|
||||||
* @exception CPPUNIT_NS::Exception on test failures.
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
multipleOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
mp3MultipleOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple smoke test with an ogg vorbis file.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
oggVorbisTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test to play an ogg vorbis file until its end.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
oggVorbisOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the switcher with multiple ogg vorbis inputs.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
oggVorbisMultipleTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the switcher with multiple ogg vorbis inputs,
|
||||||
|
* including open-ended ones.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
oggVorbisMultipleOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple smoke test with a SMIL file.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
smilTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A test to play a SMIL file until its end.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
smilOpenEndedTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the switcher with multiple SMIL inputs.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
smilMultipleTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the switcher with multiple SMIL inputs,
|
||||||
|
* including open-ended ones.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
smilMultipleOpenEndedTest(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/switcher.c,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/switcher.c,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -64,7 +64,7 @@ GST_PLUGIN_DEFINE (
|
||||||
"switcher",
|
"switcher",
|
||||||
"A filter that connects to a swtich, and changes its source",
|
"A filter that connects to a swtich, and changes its source",
|
||||||
plugin_init,
|
plugin_init,
|
||||||
"$Revision: 1.6 $",
|
"$Revision: 1.7 $",
|
||||||
"GPL",
|
"GPL",
|
||||||
"LiveSupport",
|
"LiveSupport",
|
||||||
"http://livesupport.campware.org/"
|
"http://livesupport.campware.org/"
|
||||||
|
@ -168,19 +168,6 @@ livesupport_switcher_get_property(GObject * object,
|
||||||
static void
|
static void
|
||||||
livesupport_switcher_loop(GstElement * element);
|
livesupport_switcher_loop(GstElement * element);
|
||||||
|
|
||||||
/**
|
|
||||||
* This function handles the link with other plug-ins.
|
|
||||||
*
|
|
||||||
* @param pad the pad that is about to be linked.
|
|
||||||
* @param caps the set of possible linking capabilities
|
|
||||||
* @return GST_PAD_LINK_OK or GST_PAD_LINK_DONE if linking can be or has
|
|
||||||
* been done, GST_PAD_LINK_DELAYED if linking can not yet be done,
|
|
||||||
* GST_PAD_LINK_REFUSED in linking can not be done.
|
|
||||||
*/
|
|
||||||
static GstPadLinkReturn
|
|
||||||
livesupport_switcher_link(GstPad * pad,
|
|
||||||
const GstCaps * caps);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switch to the source next in line.
|
* Switch to the source next in line.
|
||||||
* Call this function if it's time to switch to the next source.
|
* Call this function if it's time to switch to the next source.
|
||||||
|
@ -245,22 +232,6 @@ livesupport_switcher_get_type(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------ * This function handles the link with other plug-ins.
|
|
||||||
*----------------------------------------------------------------------------*/static GstPadLinkReturn
|
|
||||||
livesupport_switcher_link(GstPad * pad,
|
|
||||||
const GstCaps * caps)
|
|
||||||
{
|
|
||||||
LivesupportSwitcher * switcher;
|
|
||||||
|
|
||||||
switcher = LIVESUPPORT_SWITCHER(gst_pad_get_parent(pad));
|
|
||||||
g_return_val_if_fail(switcher != NULL, GST_PAD_LINK_REFUSED);
|
|
||||||
g_return_val_if_fail(LIVESUPPORT_IS_SWITCHER(switcher),
|
|
||||||
GST_PAD_LINK_REFUSED);
|
|
||||||
|
|
||||||
return gst_pad_try_set_caps(switcher->srcpad, caps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Do base initialization for the Switcher class.
|
* Do base initialization for the Switcher class.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -335,7 +306,7 @@ request_new_pad(GstElement * element,
|
||||||
}
|
}
|
||||||
|
|
||||||
pad = gst_pad_new_from_template(template, name);
|
pad = gst_pad_new_from_template(template, name);
|
||||||
gst_pad_set_link_function(pad, livesupport_switcher_link);
|
gst_pad_set_link_function(pad, gst_pad_proxy_pad_link);
|
||||||
gst_pad_set_getcaps_function(pad, gst_pad_proxy_getcaps);
|
gst_pad_set_getcaps_function(pad, gst_pad_proxy_getcaps);
|
||||||
|
|
||||||
gst_element_add_pad(element, pad);
|
gst_element_add_pad(element, pad);
|
||||||
|
@ -434,7 +405,11 @@ switch_to_next_source(LivesupportSwitcher * switcher)
|
||||||
if (!newConfig->sinkPad) {
|
if (!newConfig->sinkPad) {
|
||||||
if (!(newConfig->sinkPad = g_list_nth_data(switcher->sinkpadList,
|
if (!(newConfig->sinkPad = g_list_nth_data(switcher->sinkpadList,
|
||||||
newConfig->sourceId))) {
|
newConfig->sourceId))) {
|
||||||
/* TODO: mark error */
|
GST_ELEMENT_ERROR(GST_ELEMENT(switcher),
|
||||||
|
RESOURCE,
|
||||||
|
NOT_FOUND,
|
||||||
|
("can't find sinkpad for next sink"),
|
||||||
|
(NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +460,11 @@ livesupport_switcher_loop(GstElement * element)
|
||||||
if (!config->sinkPad) {
|
if (!config->sinkPad) {
|
||||||
if (!(config->sinkPad = g_list_nth_data(switcher->sinkpadList,
|
if (!(config->sinkPad = g_list_nth_data(switcher->sinkpadList,
|
||||||
config->sourceId))) {
|
config->sourceId))) {
|
||||||
/* TODO: mark error */
|
GST_ELEMENT_ERROR(GST_ELEMENT(switcher),
|
||||||
|
RESOURCE,
|
||||||
|
NOT_FOUND,
|
||||||
|
("can't find sinkpad for first sink"),
|
||||||
|
(NULL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -512,11 +491,11 @@ livesupport_switcher_loop(GstElement * element)
|
||||||
|
|
||||||
if (GST_BUFFER_DURATION(buf) != GST_CLOCK_TIME_NONE) {
|
if (GST_BUFFER_DURATION(buf) != GST_CLOCK_TIME_NONE) {
|
||||||
switcher->elapsedTime += GST_BUFFER_DURATION(buf);
|
switcher->elapsedTime += GST_BUFFER_DURATION(buf);
|
||||||
|
GST_BUFFER_TIMESTAMP(buf) = switcher->elapsedTime;
|
||||||
}
|
}
|
||||||
switcher->offset += GST_BUFFER_SIZE(buf);
|
switcher->offset += GST_BUFFER_SIZE(buf);
|
||||||
GST_INFO("elapsed time: %" G_GINT64_FORMAT, switcher->elapsedTime);
|
GST_INFO("elapsed time: %" G_GINT64_FORMAT, switcher->elapsedTime);
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP(buf) = switcher->elapsedTime;
|
|
||||||
GST_BUFFER_OFFSET(buf) = switcher->offset;
|
GST_BUFFER_OFFSET(buf) = switcher->offset;
|
||||||
|
|
||||||
/* just push out the incoming buffer without touching it */
|
/* just push out the incoming buffer without touching it */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue