fixed PartialPlayTest, added SwitcherTest
This commit is contained in:
parent
73a30b108b
commit
cf47169022
10 changed files with 504 additions and 65 deletions
|
@ -21,7 +21,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Author : $Author: maroy $
|
# Author : $Author: maroy $
|
||||||
# Version : $Revision: 1.1 $
|
# Version : $Revision: 1.2 $
|
||||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/etc/Makefile.in,v $
|
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/etc/Makefile.in,v $
|
||||||
#
|
#
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
@ -125,10 +125,12 @@ LDFLAGS = @LDFLAGS@ ${GSTREAMER_LIBS} \
|
||||||
ONESHOT_READER_LIB_OBJS = ${TMP_DIR}/oneshot-reader.o
|
ONESHOT_READER_LIB_OBJS = ${TMP_DIR}/oneshot-reader.o
|
||||||
|
|
||||||
MINIMAL_AUDIO_SMIL_LIB_OBJS = ${TMP_DIR}/seek.o \
|
MINIMAL_AUDIO_SMIL_LIB_OBJS = ${TMP_DIR}/seek.o \
|
||||||
${TMP_DIR}/seek-pack.o\
|
${TMP_DIR}/util.o \
|
||||||
|
${TMP_DIR}/seek-pack.o \
|
||||||
${TMP_DIR}/minimal-audio-smil.o
|
${TMP_DIR}/minimal-audio-smil.o
|
||||||
|
|
||||||
PARTIAL_PLAY_LIB_OBJS = ${TMP_DIR}/seek.o \
|
PARTIAL_PLAY_LIB_OBJS = ${TMP_DIR}/seek.o \
|
||||||
|
${TMP_DIR}/util.o \
|
||||||
${TMP_DIR}/seek-pack.o \
|
${TMP_DIR}/seek-pack.o \
|
||||||
${TMP_DIR}/smil-util.o \
|
${TMP_DIR}/smil-util.o \
|
||||||
${TMP_DIR}/partial-play.o
|
${TMP_DIR}/partial-play.o
|
||||||
|
@ -137,6 +139,7 @@ SWITCHER_LIB_OBJS = ${TMP_DIR}/smil-util.o \
|
||||||
${TMP_DIR}/switcher.o
|
${TMP_DIR}/switcher.o
|
||||||
|
|
||||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||||
|
${TMP_DIR}/SwitcherTest.o \
|
||||||
${TMP_DIR}/PartialPlayTest.o \
|
${TMP_DIR}/PartialPlayTest.o \
|
||||||
${TMP_DIR}/OneshotReaderTest.o \
|
${TMP_DIR}/OneshotReaderTest.o \
|
||||||
${TMP_DIR}/MinimalAudioSmilTest.o
|
${TMP_DIR}/MinimalAudioSmilTest.o
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/PartialPlayTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/PartialPlayTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -55,6 +55,16 @@ static const char * testFile = "var/1minutecounter.mp3";
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== 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 */
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
@ -98,6 +108,7 @@ PartialPlayTest :: firstTest(void)
|
||||||
/* set filename property on the file source */
|
/* set filename property on the file source */
|
||||||
g_object_set(G_OBJECT(filter), "location", testFile, NULL);
|
g_object_set(G_OBJECT(filter), "location", testFile, NULL);
|
||||||
g_object_set(G_OBJECT(filter), "config", "3s;10s-17s", NULL);
|
g_object_set(G_OBJECT(filter), "config", "3s;10s-17s", NULL);
|
||||||
|
g_signal_connect(filter, "eos", G_CALLBACK(eos_signal_handler), pipeline);
|
||||||
|
|
||||||
gst_element_link(filter, sink);
|
gst_element_link(filter, sink);
|
||||||
|
|
||||||
|
@ -107,13 +118,27 @@ PartialPlayTest :: firstTest(void)
|
||||||
gst_element_set_state(sink, GST_STATE_READY);
|
gst_element_set_state(sink, GST_STATE_READY);
|
||||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
// TODO: actually run the test
|
while (gst_bin_iterate(GST_BIN(pipeline)));
|
||||||
// unfortunately currently partialplay does get into EOS state
|
|
||||||
// when needed
|
|
||||||
//while (gst_bin_iterate(GST_BIN(pipeline)));
|
|
||||||
|
|
||||||
/* clean up nicely */
|
/* clean up nicely */
|
||||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||||
gst_object_unref(GST_OBJECT (pipeline));
|
gst_object_unref(GST_OBJECT (pipeline));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
150
livesupport/modules/gstreamerElements/src/SwitcherTest.cxx
Normal file
150
livesupport/modules/gstreamerElements/src/SwitcherTest.cxx
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SwitcherTest.cxx,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "configure.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include "SwitcherTest.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace LiveSupport::GstreamerElements;
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
CPPUNIT_TEST_SUITE_REGISTRATION(SwitcherTest);
|
||||||
|
|
||||||
|
static const char * testFile = "var/1minutecounter.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
|
||||||
|
SwitcherTest :: setUp(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Clean up the test environment
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: tearDown(void) throw ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* A simple smoke test.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
SwitcherTest :: firstTest(void)
|
||||||
|
throw (CPPUNIT_NS::Exception)
|
||||||
|
{
|
||||||
|
GstElement * pipeline;
|
||||||
|
GstElement * source;
|
||||||
|
GstElement * decoder;
|
||||||
|
GstElement * sw;
|
||||||
|
GstElement * switcher;
|
||||||
|
GstElement * sink;
|
||||||
|
|
||||||
|
/* initialize GStreamer */
|
||||||
|
gst_init(0, 0);
|
||||||
|
|
||||||
|
/* create elements */
|
||||||
|
pipeline = gst_pipeline_new("audio-player");
|
||||||
|
source = gst_element_factory_make("filesrc", "source");
|
||||||
|
decoder = gst_element_factory_make("mad", "decoder");
|
||||||
|
sw = gst_element_factory_make("switch", "sw");
|
||||||
|
switcher = gst_element_factory_make("switcher", "switcher");
|
||||||
|
sink = gst_element_factory_make("alsasink", "alsa-output");
|
||||||
|
|
||||||
|
/* set filename property on the file source */
|
||||||
|
g_object_set(G_OBJECT(source), "location", testFile, NULL);
|
||||||
|
g_object_set(G_OBJECT(switcher), "source-config", "0[3s]", NULL);
|
||||||
|
/* listen for the eos event on switcher, so the pipeline can be stopped */
|
||||||
|
g_signal_connect(switcher, "eos", G_CALLBACK(eos_signal_handler), pipeline);
|
||||||
|
|
||||||
|
gst_element_link_many(source, decoder, sw, switcher, sink, NULL);
|
||||||
|
gst_bin_add_many(GST_BIN(pipeline),
|
||||||
|
source, decoder, sw, switcher, sink, NULL);
|
||||||
|
|
||||||
|
gst_element_set_state(sink, GST_STATE_READY);
|
||||||
|
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate(GST_BIN(pipeline)));
|
||||||
|
|
||||||
|
/* clean up nicely */
|
||||||
|
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||||
|
gst_object_unref(GST_OBJECT (pipeline));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
|
106
livesupport/modules/gstreamerElements/src/SwitcherTest.h
Normal file
106
livesupport/modules/gstreamerElements/src/SwitcherTest.h
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/SwitcherTest.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef SwitcherTest_h
|
||||||
|
#define SwitcherTest_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 SwitcherTest : public CPPUNIT_NS::TestFixture
|
||||||
|
{
|
||||||
|
CPPUNIT_TEST_SUITE(SwitcherTest);
|
||||||
|
CPPUNIT_TEST(firstTest);
|
||||||
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple smoke test.
|
||||||
|
*
|
||||||
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
firstTest(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 // SwitcherTest_h
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/partial-play.c,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/partial-play.c,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -86,7 +86,7 @@ GST_PLUGIN_DEFINE (
|
||||||
"partialplay",
|
"partialplay",
|
||||||
"Partial play",
|
"Partial play",
|
||||||
plugin_init,
|
plugin_init,
|
||||||
"$Revision: 1.1 $",
|
"$Revision: 1.2 $",
|
||||||
"GPL",
|
"GPL",
|
||||||
"LiveSupport",
|
"LiveSupport",
|
||||||
"http://livesupport.campware.org/"
|
"http://livesupport.campware.org/"
|
||||||
|
@ -113,6 +113,17 @@ livesupport_partial_play_class_init(LivesupportPartialPlayClass * klass);
|
||||||
static void
|
static void
|
||||||
livesupport_partial_play_base_init(LivesupportPartialPlayClass * klass);
|
livesupport_partial_play_base_init(LivesupportPartialPlayClass * klass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Signal handler for the eos event of the SeekPack->bin element.
|
||||||
|
*
|
||||||
|
* @param element the element emitting the eos signal
|
||||||
|
* @param userData pointer to the container bin of the switcher,
|
||||||
|
* which is this PartialPlay element
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
seek_pack_eos_signal_handler(GstElement * element,
|
||||||
|
gpointer userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PartialPlay instance initializer.
|
* PartialPlay instance initializer.
|
||||||
*
|
*
|
||||||
|
@ -329,6 +340,25 @@ livesupport_partial_play_class_init(LivesupportPartialPlayClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* eos signal handler for the seekPack->bin element
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
seek_pack_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_DEBUG("SeekPack.bin setting PartialPlay to eos");
|
||||||
|
gst_element_set_eos(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Initialize a new PartialPlay element.
|
* Initialize a new PartialPlay element.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -343,6 +373,11 @@ livesupport_partial_play_init(LivesupportPartialPlay * pplay)
|
||||||
gst_element_get_pad(pplay->seekPack->bin, "src"),
|
gst_element_get_pad(pplay->seekPack->bin, "src"),
|
||||||
"src");
|
"src");
|
||||||
|
|
||||||
|
g_signal_connect(pplay->seekPack->bin,
|
||||||
|
"eos",
|
||||||
|
G_CALLBACK(seek_pack_eos_signal_handler),
|
||||||
|
pplay);
|
||||||
|
|
||||||
/* TODO: free these strings when disposing of the object */
|
/* TODO: free these strings when disposing of the object */
|
||||||
pplay->location = g_strdup("");
|
pplay->location = g_strdup("");
|
||||||
pplay->config = g_strdup("");
|
pplay->config = g_strdup("");
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
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 $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
#include "seek.h"
|
#include "seek.h"
|
||||||
#include "seek-pack.h"
|
#include "seek-pack.h"
|
||||||
|
|
||||||
|
@ -61,6 +62,16 @@
|
||||||
|
|
||||||
/* =============================================== local function prototypes */
|
/* =============================================== 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
|
||||||
|
switcher_eos_signal_handler(GstElement * element,
|
||||||
|
gpointer userData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the seeks on the SeekPack, set by the initialization function.
|
* Perform the seeks on the SeekPack, set by the initialization function.
|
||||||
*
|
*
|
||||||
|
@ -73,6 +84,25 @@ livesupport_seek_pack_seek(LivesupportSeekPack * seekPack);
|
||||||
|
|
||||||
/* ============================================================= module code */
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* eos signal handler for the switcher element
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
switcher_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_DEBUG("SeekPack.switcher setting SeekPack.bin to eos");
|
||||||
|
gst_element_set_eos(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Create a new SeekPack.
|
* Create a new SeekPack.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
@ -102,6 +132,11 @@ livesupport_seek_pack_new(const gchar * uniqueName)
|
||||||
seekPack->bin = gst_bin_new(str);
|
seekPack->bin = gst_bin_new(str);
|
||||||
g_free(str);
|
g_free(str);
|
||||||
|
|
||||||
|
g_signal_connect(seekPack->switcher,
|
||||||
|
"eos",
|
||||||
|
G_CALLBACK(switcher_eos_signal_handler),
|
||||||
|
seekPack->bin);
|
||||||
|
|
||||||
seekPack->silenceDuration = 0LL;
|
seekPack->silenceDuration = 0LL;
|
||||||
seekPack->startTime = 0LL;
|
seekPack->startTime = 0LL;
|
||||||
seekPack->endTime = 0LL;
|
seekPack->endTime = 0LL;
|
||||||
|
|
|
@ -22,13 +22,14 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/seek.c,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/seek.c,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* ============================================================ include files */
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
#include "seek.h"
|
#include "seek.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,17 +70,6 @@ seek_element(GstElement * element,
|
||||||
gint64 seekTime);
|
gint64 seekTime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SEEK_ELEMENT
|
|
||||||
/**
|
|
||||||
* Return the first src pad for an element.
|
|
||||||
*
|
|
||||||
* @param element the element to return the pad from.
|
|
||||||
* @return the first src pad for element, or NULL.
|
|
||||||
*/
|
|
||||||
static GstPad *
|
|
||||||
get_src_pad(GstElement * element);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SEEK_ELEMENT
|
#ifndef SEEK_ELEMENT
|
||||||
/**
|
/**
|
||||||
* Seek on the first src pad of an element.
|
* Seek on the first src pad of an element.
|
||||||
|
@ -112,30 +102,6 @@ seek_element(GstElement * element,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef SEEK_ELEMENT
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Return the first src pad for an element.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
static GstPad *
|
|
||||||
get_src_pad(GstElement * element)
|
|
||||||
{
|
|
||||||
const GList * pads;
|
|
||||||
|
|
||||||
for (pads = gst_element_get_pad_list(element);
|
|
||||||
pads;
|
|
||||||
pads = g_list_next(pads)) {
|
|
||||||
GstPad * pad = pads->data;
|
|
||||||
|
|
||||||
if (GST_PAD_IS_SRC(pad)) {
|
|
||||||
return pad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SEEK_ELEMENT
|
#ifndef SEEK_ELEMENT
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Seek on the first src pad of an element.
|
* Seek on the first src pad of an element.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: maroy $
|
Author : $Author: maroy $
|
||||||
Version : $Revision: 1.1 $
|
Version : $Revision: 1.2 $
|
||||||
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.1 $",
|
"$Revision: 1.2 $",
|
||||||
"GPL",
|
"GPL",
|
||||||
"LiveSupport",
|
"LiveSupport",
|
||||||
"http://livesupport.campware.org/"
|
"http://livesupport.campware.org/"
|
||||||
|
@ -385,7 +385,6 @@ livesupport_switcher_chain(GstPad * pad,
|
||||||
g_return_if_fail(LIVESUPPORT_IS_SWITCHER(switcher));
|
g_return_if_fail(LIVESUPPORT_IS_SWITCHER(switcher));
|
||||||
|
|
||||||
if (switcher->eos) {
|
if (switcher->eos) {
|
||||||
GstElement * parent;
|
|
||||||
GstEvent * event;
|
GstEvent * event;
|
||||||
|
|
||||||
GST_DEBUG("switcher_chain: eos");
|
GST_DEBUG("switcher_chain: eos");
|
||||||
|
@ -394,22 +393,6 @@ livesupport_switcher_chain(GstPad * pad,
|
||||||
gst_pad_send_event(switcher->srcpad, event);
|
gst_pad_send_event(switcher->srcpad, event);
|
||||||
gst_element_set_eos(GST_ELEMENT(switcher));
|
gst_element_set_eos(GST_ELEMENT(switcher));
|
||||||
|
|
||||||
parent = GST_ELEMENT(gst_element_get_parent(GST_ELEMENT(switcher)));
|
|
||||||
if (parent) {
|
|
||||||
gst_element_set_eos(parent);
|
|
||||||
}
|
|
||||||
/* TODO: fix this mess here... */
|
|
||||||
/*
|
|
||||||
for (parent =
|
|
||||||
GST_ELEMENT(gst_element_get_parent(GST_ELEMENT(switcher)));
|
|
||||||
parent;
|
|
||||||
parent = GST_ELEMENT(gst_element_get_parent(parent))) {
|
|
||||||
|
|
||||||
GST_DEBUG("switcher_chain: eos #1.1");
|
|
||||||
gst_element_set_eos(parent);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
68
livesupport/modules/gstreamerElements/src/util.c
Normal file
68
livesupport/modules/gstreamerElements/src/util.c
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/util.c,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================== local data structures */
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================ local constants & macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================== local function prototypes */
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================= module code */
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
* Return the first src pad for an element.
|
||||||
|
*----------------------------------------------------------------------------*/
|
||||||
|
GstPad *
|
||||||
|
get_src_pad(GstElement * element)
|
||||||
|
{
|
||||||
|
const GList * pads;
|
||||||
|
|
||||||
|
g_return_val_if_fail(element != NULL, NULL);
|
||||||
|
|
||||||
|
for (pads = gst_element_get_pad_list(element);
|
||||||
|
pads;
|
||||||
|
pads = g_list_next(pads)) {
|
||||||
|
GstPad * pad = pads->data;
|
||||||
|
|
||||||
|
if (GST_PAD_IS_SRC(pad)) {
|
||||||
|
return pad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
68
livesupport/modules/gstreamerElements/src/util.h
Normal file
68
livesupport/modules/gstreamerElements/src/util.h
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/*------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
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/util.h,v $
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------*/
|
||||||
|
#ifndef Util_h
|
||||||
|
#define Util_h
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Utility functions helping to work with SMIL-related data structures.
|
||||||
|
*
|
||||||
|
* @author $Author: maroy $
|
||||||
|
* @version $Revision: 1.1 $
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ============================================================ include files */
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* ================================================================ constants */
|
||||||
|
|
||||||
|
|
||||||
|
/* =================================================================== macros */
|
||||||
|
|
||||||
|
|
||||||
|
/* =============================================================== data types */
|
||||||
|
|
||||||
|
|
||||||
|
/* ====================================================== function prototypes */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the first src pad for an element.
|
||||||
|
*
|
||||||
|
* @param element the element to return the pad from.
|
||||||
|
* @return the first src pad for element, or NULL.
|
||||||
|
*/
|
||||||
|
GstPad *
|
||||||
|
get_src_pad(GstElement * element);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* Util_h */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue