added audioStreamTimeout and fadeLookAheadTime parameters to the HelixPlayer
config file (for fine-tuning the fade-in/fade-out hack)
This commit is contained in:
parent
0f924d38d5
commit
df99ff2cb5
|
@ -4,7 +4,10 @@
|
|||
<!ELEMENT audioPlayer (helixPlayer) >
|
||||
|
||||
<!ELEMENT helixPlayer EMPTY >
|
||||
<!ATTLIST helixPlayer dllPath CDATA #REQUIRED >
|
||||
<!ATTLIST helixPlayer dllPath CDATA #REQUIRED >
|
||||
<!ATTLIST helixPlayer audioDevice CDATA #IMPLIED >
|
||||
<!ATTLIST helixPlayer audioStreamTimeout NMTOKEN #IMPLIED >
|
||||
<!ATTLIST helixPlayer fadeLookAheatTime NMTOKEN #IMPLIED >
|
||||
]>
|
||||
<audioPlayer>
|
||||
<helixPlayer dllPath = "../../usr/lib/helix"
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
<!ELEMENT helixPlayer EMPTY >
|
||||
<!ATTLIST helixPlayer dllPath CDATA #REQUIRED >
|
||||
<!ATTLIST helixPlayer audioDevice CDATA #IMPLIED >
|
||||
<!ATTLIST helixPlayer audioStreamTimeout NMTOKEN #IMPLIED >
|
||||
<!ATTLIST helixPlayer fadeLookAheadTime NMTOKEN #IMPLIED >
|
||||
]>
|
||||
<helixPlayer dllPath = "../../usr/lib/helix"
|
||||
audioDevice = "/dev/sound/dsp"
|
||||
audioStreamTimeout="6"
|
||||
fadeLookAheadTime="2510"
|
||||
/>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.15 $
|
||||
Version : $Revision: 1.16 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -33,6 +33,8 @@
|
|||
#include "configure.h"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "HelixDefs.h"
|
||||
|
||||
#include "LiveSupport/Core/TimeConversion.h"
|
||||
|
@ -76,22 +78,31 @@ static const std::string dllPathName = "dllPath";
|
|||
*/
|
||||
static const std::string audioDeviceName = "audioDevice";
|
||||
|
||||
/**
|
||||
* The name of the audio stream timeout attribute.
|
||||
*/
|
||||
static const std::string audioStreamTimeoutName = "audioStreamTimeout";
|
||||
|
||||
/**
|
||||
* The default value of the audio stream timeout attribute.
|
||||
*/
|
||||
static const int audioStreamTimeoutDefault = 5;
|
||||
|
||||
/**
|
||||
* The name of the fade look ahead time attribute.
|
||||
*/
|
||||
static const std::string fadeLookAheadTimeName = "fadeLookAheadTime";
|
||||
|
||||
/**
|
||||
* The default value of the fade look ahead time attribute.
|
||||
*/
|
||||
static const int fadeLookAheadTimeDefault = 2500;
|
||||
/**
|
||||
* The name of the client core shared object, as found under dllPath
|
||||
*/
|
||||
static const std::string clntcoreName = "/clntcore.so";
|
||||
|
||||
|
||||
/**
|
||||
* Magic number #1: max time to wait for an audio stream, in milliseconds
|
||||
*/
|
||||
static const int getAudioStreamTimeOut = 5;
|
||||
|
||||
/**
|
||||
* Magic number #2: schedule fading this many milliseconds in advance
|
||||
*/
|
||||
static const int lookAheadTime = 2500;
|
||||
|
||||
/* =============================================== local function prototypes */
|
||||
|
||||
|
||||
|
@ -123,6 +134,20 @@ HelixPlayer :: configure(const xmlpp::Element & element)
|
|||
if ((attribute = element.get_attribute(audioDeviceName))) {
|
||||
setAudioDevice(attribute->get_value());
|
||||
}
|
||||
|
||||
if ((attribute = element.get_attribute(audioStreamTimeoutName))) {
|
||||
std::stringstream timeoutStream(attribute->get_value());
|
||||
timeoutStream >> audioStreamTimeout;
|
||||
} else {
|
||||
audioStreamTimeout = audioStreamTimeoutDefault;
|
||||
}
|
||||
|
||||
if ((attribute = element.get_attribute(fadeLookAheadTimeName))) {
|
||||
std::stringstream lookAheadStream(attribute->get_value());
|
||||
lookAheadStream >> fadeLookAheadTime;
|
||||
} else {
|
||||
fadeLookAheadTime = fadeLookAheadTimeDefault;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -436,7 +461,7 @@ HelixPlayer :: openAndStart(Ptr<Playlist>::Ref playlist)
|
|||
audioStream[i] = audioPlayer->GetAudioStream(i);
|
||||
int counter = 0;
|
||||
while (!audioStream[i]) {
|
||||
if (counter > getAudioStreamTimeOut * 100) {
|
||||
if (counter > audioStreamTimeout * 100) {
|
||||
std::stringstream eMsg;
|
||||
eMsg << "can't get audio stream number " << i;
|
||||
throw std::runtime_error(eMsg.str());
|
||||
|
@ -544,7 +569,7 @@ HelixPlayer :: implementFading(unsigned long position)
|
|||
it = fadeDataList->erase(it);
|
||||
continue;
|
||||
|
||||
} else if (fadeAt < position + lookAheadTime) { // we are on time
|
||||
} else if (fadeAt < position + fadeLookAheadTime) { // we are on time
|
||||
|
||||
IHXAudioPlayer* audioPlayer = 0;
|
||||
if (player->QueryInterface(IID_IHXAudioPlayer,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.13 $
|
||||
Version : $Revision: 1.14 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/Attic/HelixPlayer.h,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -89,16 +89,30 @@ using namespace LiveSupport::Core;
|
|||
* library shared objects. The optional audioDevice argument sets the
|
||||
* AUDIO environment variable which is read by the Helix client.
|
||||
*
|
||||
* There are two parameters which are only there because the current version
|
||||
* of the Helix client does not handle animation tags in SMIL files properly.
|
||||
* They will be removed from later versions.
|
||||
* <ul>
|
||||
* <li>audioStreamTimeOut (milliseconds) - the time to wait for each
|
||||
* GetAudioStream() operation before a timeout occurs;
|
||||
* the default is 5;</li>
|
||||
* <li>fadeLookAheadTime (milliseconds) - each fade-in or fade-out is
|
||||
* scheduled (using IHXAudioCrossFade::CrossFade()) this
|
||||
* much time before it is to happen; the default is 2500. </li>
|
||||
* </ul>
|
||||
*
|
||||
* The DTD for the above configuration is the following:
|
||||
*
|
||||
* <pre><code>
|
||||
* <!ELEMENT helixPlayer EMPTY >
|
||||
* <!ATTLIST helixPlayer dllPath CDATA #REQUIRED >
|
||||
* <!ATTLIST helixPlayer audioDevice CDATA #IMPLIED >
|
||||
* <!ATTLIST helixPlayer audioStreamTimeout #IMPLIED >
|
||||
* <!ATTLIST helixPlayer fadeLookAheatTime #IMPLIED >
|
||||
* </pre></code>
|
||||
*
|
||||
* @author $Author: fgerlits $
|
||||
* @version $Revision: 1.13 $
|
||||
* @version $Revision: 1.14 $
|
||||
*/
|
||||
class HelixPlayer : virtual public Configurable,
|
||||
virtual public AudioPlayerInterface,
|
||||
|
@ -115,6 +129,16 @@ class HelixPlayer : virtual public Configurable,
|
|||
*/
|
||||
std::string dllPath;
|
||||
|
||||
/**
|
||||
* Max time to wait for an audio stream, in milliseconds.
|
||||
*/
|
||||
int audioStreamTimeout;
|
||||
|
||||
/**
|
||||
* Schedule fading this many milliseconds in advance.
|
||||
*/
|
||||
int fadeLookAheadTime;
|
||||
|
||||
/**
|
||||
* The shared object access point.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue