fixed open/close cycle, hopefully
This commit is contained in:
parent
3e851ea7ed
commit
dc01754047
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -237,9 +237,7 @@ HelixPlayer :: open(const std::string fileUrl)
|
|||
if (HXR_OK != player->OpenURL(fileUrl.c_str())) {
|
||||
throw std::invalid_argument("can't open URL");
|
||||
}
|
||||
// if the source count was not 0 before OpenURL(), the source is simply
|
||||
// replaced
|
||||
if (!sourceCount && sourceCount == player->GetSourceCount()) {
|
||||
if (sourceCount == player->GetSourceCount()) {
|
||||
throw std::invalid_argument("can't open URL");
|
||||
}
|
||||
}
|
||||
|
@ -316,6 +314,21 @@ HelixPlayer :: stop(void) throw (std::logic_error)
|
|||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* Close the currently opened audio file.
|
||||
*----------------------------------------------------------------------------*/
|
||||
void
|
||||
HelixPlayer :: close(void) throw ()
|
||||
{
|
||||
if (isPlaying()) {
|
||||
stop();
|
||||
} else {
|
||||
// else, call IHXPlayer->Stop(), to clean up things...
|
||||
player->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
* A global function needed by the Helix library, this will return the
|
||||
* access path to shared objects.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.5 $
|
||||
Version : $Revision: 1.6 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -91,7 +91,7 @@ using namespace LiveSupport::Core;
|
|||
* </pre></code>
|
||||
*
|
||||
* @author $Author: maroy $
|
||||
* @version $Revision: 1.5 $
|
||||
* @version $Revision: 1.6 $
|
||||
*/
|
||||
class HelixPlayer : virtual public Configurable,
|
||||
virtual public AudioPlayerInterface,
|
||||
|
@ -253,15 +253,7 @@ class HelixPlayer : virtual public Configurable,
|
|||
* @see #open
|
||||
*/
|
||||
virtual void
|
||||
close(void) throw ()
|
||||
{
|
||||
if (isPlaying()) {
|
||||
stop();
|
||||
}
|
||||
|
||||
// nothing else to do here, the Helix Player object does not
|
||||
// have a close() function...
|
||||
}
|
||||
close(void) throw ();
|
||||
|
||||
/**
|
||||
* Start playing.
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: maroy $
|
||||
Version : $Revision: 1.6 $
|
||||
Version : $Revision: 1.7 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayerTest.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -207,6 +207,17 @@ HelixPlayerTest :: checkErrorConditions(void)
|
|||
}
|
||||
CPPUNIT_ASSERT(gotException);
|
||||
|
||||
// check for opening a wrong URL after opening a proper one
|
||||
helixPlayer->open("file:var/test.mp3");
|
||||
helixPlayer->close();
|
||||
gotException = false;
|
||||
try {
|
||||
helixPlayer->open("totally/bad/URL");
|
||||
} catch (std::invalid_argument &e) {
|
||||
gotException = true;
|
||||
}
|
||||
CPPUNIT_ASSERT(gotException);
|
||||
|
||||
helixPlayer->deInitialize();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue