|
|
@ -47,10 +47,12 @@ extern "C"
|
|
|
|
#define LLONG_MAX 9223372036854775807LL
|
|
|
|
#define LLONG_MAX 9223372036854775807LL
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//define this to use xine in a more standard way
|
|
|
|
//define this to use xine in a more standard way
|
|
|
|
//#define XINE_SAFE_MODE
|
|
|
|
//#define XINE_SAFE_MODE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//define this to enable libxine debug spew
|
|
|
|
|
|
|
|
//#define XINE_DEBUG_ENGINE 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///some logging static globals
|
|
|
|
///some logging static globals
|
|
|
|
namespace Log
|
|
|
|
namespace Log
|
|
|
@ -174,8 +176,13 @@ XineEngine::makeNewStream()
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( m_eventQueue )
|
|
|
|
#ifdef XINE_DEBUG_ENGINE
|
|
|
|
|
|
|
|
xine_set_param(m_stream, XINE_PARAM_VERBOSITY, XINE_VERBOSITY_DEBUG);
|
|
|
|
|
|
|
|
#endif // XINE_DEBUG_ENGINE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( m_eventQueue ) {
|
|
|
|
xine_event_dispose_queue( m_eventQueue );
|
|
|
|
xine_event_dispose_queue( m_eventQueue );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
xine_event_create_listener_thread(
|
|
|
|
xine_event_create_listener_thread(
|
|
|
|
m_eventQueue = xine_event_new_queue( m_stream ),
|
|
|
|
m_eventQueue = xine_event_new_queue( m_stream ),
|
|
|
@ -203,8 +210,9 @@ XineEngine::makeNewStream()
|
|
|
|
bool
|
|
|
|
bool
|
|
|
|
XineEngine::ensureStream()
|
|
|
|
XineEngine::ensureStream()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !m_stream )
|
|
|
|
if( !m_stream ) {
|
|
|
|
return makeNewStream();
|
|
|
|
return makeNewStream();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -242,7 +250,7 @@ XineEngine::load( const KURL &url, bool isStream )
|
|
|
|
setEqualizerParameters( m_intPreamp, m_equalizerGains );
|
|
|
|
setEqualizerParameters( m_intPreamp, m_equalizerGains );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// for users who stubbonly refuse to use DMIX or buy a good soundcard
|
|
|
|
// for users who stubbornly refuse to use DMIX or buy a good soundcard
|
|
|
|
// why doesn't xine do this? I cannot say.
|
|
|
|
// why doesn't xine do this? I cannot say.
|
|
|
|
xine_close( m_stream );
|
|
|
|
xine_close( m_stream );
|
|
|
|
|
|
|
|
|
|
|
@ -448,8 +456,9 @@ XineEngine::state() const
|
|
|
|
uint
|
|
|
|
uint
|
|
|
|
XineEngine::position() const
|
|
|
|
XineEngine::position() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( state() == Engine::Empty )
|
|
|
|
if ( state() == Engine::Empty ) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int pos;
|
|
|
|
int pos;
|
|
|
|
int time = 0;
|
|
|
|
int time = 0;
|
|
|
@ -509,16 +518,45 @@ XineEngine::length() const
|
|
|
|
void
|
|
|
|
void
|
|
|
|
XineEngine::seek( uint ms )
|
|
|
|
XineEngine::seek( uint ms )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if( !ensureStream() )
|
|
|
|
if( !ensureStream() ) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool seekable = (xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ) != 0);
|
|
|
|
|
|
|
|
if (!seekable) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool use_xine_ui_seek_method = false;
|
|
|
|
|
|
|
|
TQString audioCodec = TQString::fromUtf8(xine_get_meta_info(m_stream, XINE_META_INFO_SYSTEMLAYER));
|
|
|
|
|
|
|
|
if (audioCodec == "FLAC") {
|
|
|
|
|
|
|
|
// Work around Xine bug with FLAC files
|
|
|
|
|
|
|
|
// See Bug 1204
|
|
|
|
|
|
|
|
use_xine_ui_seek_method = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if( xine_get_param( m_stream, XINE_PARAM_SPEED ) == XINE_SPEED_PAUSE ) {
|
|
|
|
if( xine_get_param( m_stream, XINE_PARAM_SPEED ) == XINE_SPEED_PAUSE ) {
|
|
|
|
// FIXME this is a xine API issue really, they need to add a seek function
|
|
|
|
// FIXME this is a xine API issue really, they need to add a seek function
|
|
|
|
|
|
|
|
if (use_xine_ui_seek_method) {
|
|
|
|
|
|
|
|
int pos, time, length = 0;
|
|
|
|
|
|
|
|
xine_get_pos_length( m_stream, &pos, &time, &length );
|
|
|
|
|
|
|
|
xine_play( m_stream, ((ms*65535.0)/length), 0 );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
xine_play( m_stream, 0, (int)ms );
|
|
|
|
xine_play( m_stream, 0, (int)ms );
|
|
|
|
|
|
|
|
}
|
|
|
|
xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
|
|
|
|
xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (use_xine_ui_seek_method) {
|
|
|
|
|
|
|
|
int pos, time, length = 0;
|
|
|
|
|
|
|
|
xine_get_pos_length( m_stream, &pos, &time, &length );
|
|
|
|
|
|
|
|
xine_play( m_stream, ((ms*65535.0)/length), 0 );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
xine_play( m_stream, 0, (int)ms );
|
|
|
|
xine_play( m_stream, 0, (int)ms );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
void
|
|
|
|