From 6456f5a1625a6ab9d009fb61f04a0fa76809d2aa Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 6 Nov 2006 07:56:33 +0000 Subject: [PATCH] Major performance improvement for SMIL files: Now the GstreamerPlayer is also able to open SMIL files in about 0.5 seconds. Now I have removed usage of the old (slow) autoplugger altogether. Due to bugs in the minimalaudiosmil element, we cannot currently use it with decodebin. Hence we detect the SMIL filetype by file extension, and instantiate the element manually (very fast). With this commit, #1904 is entirely fixed. --- .../playlistExecutor/src/GstreamerPlayer.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx index 006a37418..268bd18d3 100644 --- a/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx +++ b/campcaster/src/modules/playlistExecutor/src/GstreamerPlayer.cxx @@ -37,7 +37,6 @@ #include "LiveSupport/Core/Debug.h" #include "LiveSupport/Core/TimeConversion.h" -#include "LiveSupport/GstreamerElements/autoplug.h" #include "GstreamerPlayer.h" @@ -306,15 +305,16 @@ GstreamerPlayer :: open(const std::string fileUrl) // scale the sampling rate, if necessary audioscale = gst_element_factory_make("audioscale", NULL); - // Using our custom autoplugger for SMIL + // Due to bugs in the minimalaudiosmil element, it does not currently work with decodebin. + // Therefore we instantiate it manually if the file has the .smil extension. if (isSmil) { - debug() << "SMIL file detected. Using custom autoplugger." << endl; - decoder = ls_gst_autoplug_plug_source(filesrc, "decoder", sinkCaps); - gst_element_link(decoder,audioconvert); + debug() << "SMIL file detected." << endl; + decoder = gst_element_factory_make("minimalaudiosmil", NULL); + gst_element_link_many(filesrc, decoder, audioconvert, NULL); if (gst_element_get_parent(audiosink) == NULL) gst_bin_add(GST_BIN(pipeline), audiosink); } - // Using GStreamer's decodebin autoplugger for everything else (it's much faster) + // Using GStreamer's decodebin autoplugger for everything else else { decoder = gst_element_factory_make("decodebin", NULL); gst_element_link(filesrc,decoder); @@ -386,13 +386,14 @@ Ptr::Ref GstreamerPlayer :: getPosition(void) throw (std::logic_error) { Ptr::Ref length; - gint64 ns; + gint64 ns = 0; if (!isOpen()) { throw std::logic_error("player not open"); } - - ns = ls_gst_autoplug_get_position(decoder); + + GstFormat fmt = GST_FORMAT_TIME; + gst_element_query( decoder, GST_QUERY_POSITION, &fmt, &ns ); // this is necessary for boost version < 1.33.0 gint64 us = ns / 1000LL;