updates for position reporting
This commit is contained in:
parent
7faa025d4a
commit
0c4639c314
5 changed files with 31 additions and 18 deletions
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: maroy $
|
||||
# Version : $Revision: 1.10 $
|
||||
# Version : $Revision: 1.11 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/etc/Makefile.in,v $
|
||||
#
|
||||
# @configure_input@
|
||||
|
@ -145,7 +145,8 @@ PARTIAL_PLAY_LIB_OBJS = ${TMP_DIR}/partial-play.o
|
|||
SWITCHER_LIB_OBJS = ${TMP_DIR}/switcher.o
|
||||
|
||||
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.o \
|
||||
${TMP_DIR}/AutoplugTest.o \
|
||||
${TMP_DIR}/AutoplugTest.o
|
||||
DONT_TEST= ${TMP_DIR}/AutoplugTest.o \
|
||||
${TMP_DIR}/SeekTest.o \
|
||||
${TMP_DIR}/SwitcherTest.o \
|
||||
${TMP_DIR}/SeekPackTest.o \
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.11 $
|
||||
Version : $Revision: 1.12 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/AutoplugTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -55,10 +55,15 @@ using namespace LiveSupport::GstreamerElements;
|
|||
CPPUNIT_TEST_SUITE_REGISTRATION(AutoplugTest);
|
||||
|
||||
/**
|
||||
* Define this is time statistics should be printed while running tests.
|
||||
* Define this if time statistics should be printed while running tests.
|
||||
*/
|
||||
#undef PRINT_TIMES
|
||||
|
||||
/**
|
||||
* Define this if time statistics should be printed for each iteration.
|
||||
*/
|
||||
#undef PRINT_ITERATION_TIMES
|
||||
|
||||
|
||||
/**
|
||||
* An mp3 test file.
|
||||
|
@ -156,7 +161,6 @@ AutoplugTest :: playFile(const char * audioFile)
|
|||
GstElement * decoder;
|
||||
GstElement * sink;
|
||||
GstCaps * caps;
|
||||
GstFormat format;
|
||||
gint64 timePlayed;
|
||||
|
||||
/* initialize GStreamer */
|
||||
|
@ -196,12 +200,14 @@ AutoplugTest :: playFile(const char * audioFile)
|
|||
gst_element_set_state(sink, GST_STATE_PAUSED);
|
||||
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
||||
|
||||
while (gst_bin_iterate(GST_BIN(pipeline)));
|
||||
while (gst_bin_iterate(GST_BIN(pipeline))) {
|
||||
#ifdef PRINT_ITERATION_TIMES
|
||||
timePlayed = ls_gst_autoplug_get_position(decoder);
|
||||
std::cerr << "iteration time: " << timePlayed << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FIXME: query the decoder, as for some reason, the sink will return
|
||||
* unreal numbers, when playing back mp3s only! */
|
||||
format = GST_FORMAT_TIME;
|
||||
gst_element_query(decoder, GST_QUERY_POSITION, &format, &timePlayed);
|
||||
timePlayed = ls_gst_autoplug_get_position(decoder);
|
||||
|
||||
/* clean up nicely */
|
||||
gst_element_set_state(pipeline, GST_STATE_NULL);
|
||||
|
@ -494,5 +500,11 @@ AutoplugTest :: playDurationTest(void)
|
|||
std::cerr << "duration for " << sequentialSmilFile << ": "
|
||||
<< duration << std::endl;
|
||||
#endif
|
||||
|
||||
duration = playFile(embeddedSmilFile);
|
||||
#ifdef PRINT_TIMES
|
||||
std::cerr << "duration for " << embeddedSmilFile << ": "
|
||||
<< duration << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -308,8 +308,8 @@ MinimalAudioSmilTest :: embeddedTest(void)
|
|||
|
||||
timePlayed = playSmilFile(embeddedSmilFile);
|
||||
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);
|
||||
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 9.9 * GST_SECOND);
|
||||
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 10.1 * GST_SECOND);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.10 $
|
||||
Version : $Revision: 1.11 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/autoplug.c,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -815,12 +815,9 @@ ls_gst_autoplug_get_position(GstElement * element)
|
|||
if (!element || !GST_IS_BIN(element)) {
|
||||
return 0LL;
|
||||
}
|
||||
if (!(sink = gst_bin_get_by_name(GST_BIN(element), "audiosink"))) {
|
||||
return 0LL;
|
||||
}
|
||||
|
||||
format = GST_FORMAT_TIME;
|
||||
if (!gst_element_query(sink, GST_QUERY_POSITION, &format, &position)
|
||||
if (!gst_element_query(element, GST_QUERY_POSITION, &format, &position)
|
||||
|| format != GST_FORMAT_TIME) {
|
||||
return 0LL;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<par>
|
||||
<audio src = "file:var/simple.smil"
|
||||
/>
|
||||
<audio src = "file:var/5seccounter.mp3"
|
||||
begin = "5s"
|
||||
/>
|
||||
</par>
|
||||
</body>
|
||||
</smil>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue