updates for position reporting

This commit is contained in:
maroy 2005-09-07 13:56:10 +00:00
parent 7faa025d4a
commit 0c4639c314
5 changed files with 31 additions and 18 deletions

View file

@ -21,7 +21,7 @@
# #
# #
# Author : $Author: maroy $ # 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 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/etc/Makefile.in,v $
# #
# @configure_input@ # @configure_input@
@ -145,7 +145,8 @@ PARTIAL_PLAY_LIB_OBJS = ${TMP_DIR}/partial-play.o
SWITCHER_LIB_OBJS = ${TMP_DIR}/switcher.o SWITCHER_LIB_OBJS = ${TMP_DIR}/switcher.o
TEST_RUNNER_OBJS = ${TMP_DIR}/TestRunner.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}/SeekTest.o \
${TMP_DIR}/SwitcherTest.o \ ${TMP_DIR}/SwitcherTest.o \
${TMP_DIR}/SeekPackTest.o \ ${TMP_DIR}/SeekPackTest.o \

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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); 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 #undef PRINT_TIMES
/**
* Define this if time statistics should be printed for each iteration.
*/
#undef PRINT_ITERATION_TIMES
/** /**
* An mp3 test file. * An mp3 test file.
@ -156,7 +161,6 @@ AutoplugTest :: playFile(const char * audioFile)
GstElement * decoder; GstElement * decoder;
GstElement * sink; GstElement * sink;
GstCaps * caps; GstCaps * caps;
GstFormat format;
gint64 timePlayed; gint64 timePlayed;
/* initialize GStreamer */ /* initialize GStreamer */
@ -196,12 +200,14 @@ AutoplugTest :: playFile(const char * audioFile)
gst_element_set_state(sink, GST_STATE_PAUSED); gst_element_set_state(sink, 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))) {
#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 timePlayed = ls_gst_autoplug_get_position(decoder);
* unreal numbers, when playing back mp3s only! */
format = GST_FORMAT_TIME;
gst_element_query(decoder, GST_QUERY_POSITION, &format, &timePlayed);
/* clean up nicely */ /* clean up nicely */
gst_element_set_state(pipeline, GST_STATE_NULL); gst_element_set_state(pipeline, GST_STATE_NULL);
@ -494,5 +500,11 @@ AutoplugTest :: playDurationTest(void)
std::cerr << "duration for " << sequentialSmilFile << ": " std::cerr << "duration for " << sequentialSmilFile << ": "
<< duration << std::endl; << duration << std::endl;
#endif #endif
duration = playFile(embeddedSmilFile);
#ifdef PRINT_TIMES
std::cerr << "duration for " << embeddedSmilFile << ": "
<< duration << std::endl;
#endif
} }

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/gstreamerElements/src/MinimalAudioSmilTest.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -308,8 +308,8 @@ MinimalAudioSmilTest :: embeddedTest(void)
timePlayed = playSmilFile(embeddedSmilFile); timePlayed = playSmilFile(embeddedSmilFile);
g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed); g_snprintf(str, 256, "time played: %" G_GINT64_FORMAT, timePlayed);
CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 4.9 * GST_SECOND); CPPUNIT_ASSERT_MESSAGE(str, timePlayed > 9.9 * GST_SECOND);
CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 5.1 * GST_SECOND); CPPUNIT_ASSERT_MESSAGE(str, timePlayed < 10.1 * GST_SECOND);
} }

View file

@ -27,7 +27,7 @@
Author : $Author: maroy $ 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 $ 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)) { if (!element || !GST_IS_BIN(element)) {
return 0LL; return 0LL;
} }
if (!(sink = gst_bin_get_by_name(GST_BIN(element), "audiosink"))) {
return 0LL;
}
format = GST_FORMAT_TIME; 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) { || format != GST_FORMAT_TIME) {
return 0LL; return 0LL;
} }

View file

@ -4,6 +4,9 @@
<par> <par>
<audio src = "file:var/simple.smil" <audio src = "file:var/simple.smil"
/> />
<audio src = "file:var/5seccounter.mp3"
begin = "5s"
/>
</par> </par>
</body> </body>
</smil> </smil>