From 4b1ea1e069dc6820ab6a4100a668d2602e369351 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 22 Nov 2006 16:41:34 +0000 Subject: [PATCH] half of the solution for #2012, for testing --- .../gLiveSupport/src/GLiveSupport.cxx | 26 +++++++++++++++++++ .../products/gLiveSupport/src/GLiveSupport.h | 10 +++++++ .../gLiveSupport/src/LiveModeWindow.cxx | 20 ++++++++++++++ .../gLiveSupport/src/LiveModeWindow.h | 7 +++++ .../gLiveSupport/src/MasterPanelWindow.cxx | 4 +-- 5 files changed, 65 insertions(+), 2 deletions(-) diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx index de37462d8..eeb9d79c6 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -1163,6 +1163,32 @@ GLiveSupport :: removeFromSchedule(Ptr::Ref scheduleEntryId) } +/*------------------------------------------------------------------------------ + * Preload the item in the output audio player. + *----------------------------------------------------------------------------*/ +void +LiveSupport :: GLiveSupport :: +GLiveSupport :: preload(Ptr::Ref playable) + throw () +{ + Ptr::Ref uri = playable->getUri(); + if (uri) { + try { + outputPlayer->preload(*uri); + + } catch (std::invalid_argument) { + std::cerr << "gLiveSupport: invalid argument in preload(" + << *uri + << ")" << std::endl; + } catch (std::runtime_error) { + std::cerr << "gLiveSupport: runtime error in preload(" + << *uri + << ")" << std::endl; + } + } +} + + /*------------------------------------------------------------------------------ * Play a Playable object using the output audio player. *----------------------------------------------------------------------------*/ diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index cf20d0819..e60b2494a 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -870,6 +870,16 @@ class GLiveSupport : public LocalizedConfigurable, removeFromSchedule(Ptr::Ref scheduleEntryId) throw (XmlRpcException); + /** + * Preload the item in the output audio player. + * This is to shorten the time a playlist takes to start. + * + * @param playable the Playable object to be preloaded. + */ + void + preload(Ptr::Ref playable) + throw (); + /** * Play a Playable object using the output audio player. * diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx index e2df3e1a0..e4aa0b252 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.cxx @@ -197,6 +197,10 @@ void LiveModeWindow :: addItem(Ptr::Ref playable) throw () { addItem(treeModel->append(), playable); + + if (treeModel->children().size() == 1) { + preloadNextItem(); + } } @@ -268,6 +272,22 @@ LiveModeWindow :: popTop(void) throw () } +/*------------------------------------------------------------------------------ + * Preload the item at the top of the window. + *----------------------------------------------------------------------------*/ +void +LiveModeWindow :: preloadNextItem(void) throw () +{ + Ptr::Ref playable; + Gtk::TreeModel::iterator iter = treeModel->children().begin(); + + if (iter) { + playable = (*iter)[modelColumns.playableColumn]; + gLiveSupport->preload(playable); + } +} + + /*------------------------------------------------------------------------------ * Find the selected row. *----------------------------------------------------------------------------*/ diff --git a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h index 1fed4b240..f6f78908d 100644 --- a/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h +++ b/campcaster/src/products/gLiveSupport/src/LiveModeWindow.h @@ -341,6 +341,13 @@ class LiveModeWindow : public GuiWindow Ptr::Ref popTop(void) throw (); + /** + * Preload the item at the top of the window. + * This is to shorten the time a playlist takes to start. + */ + void + preloadNextItem() throw (); + /** * Update the cue player display to show a stopped state. */ diff --git a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx index 92a39c363..94a5bfb00 100644 --- a/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/MasterPanelWindow.cxx @@ -466,11 +466,11 @@ MasterPanelWindow :: updateLiveModeWindow(Ptr::Ref playable) liveModeButton)); } + liveModeWindow->present(); + if (playable) { liveModeWindow->addItem(playable); } - - liveModeWindow->present(); }