-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index f1b9773..6ed4cea 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -126,16 +126,17 @@ void Lib::initialize() xine_init( m_xine ); // allocate oss for sound // and fb for framebuffer m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); + xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); if (m_wid != 0 ) setWidget( m_wid ); m_queue = xine_event_new_queue (m_stream); xine_event_create_listener_thread (m_queue, xine_event_handler, this); @@ -197,22 +198,30 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { return 0; } return xine_play( m_stream, startPos, start_time); } void Lib::stop() { assert( m_initialized ); xine_stop( m_stream ); + xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); } void Lib::pause( bool toggle ) { assert( m_initialized ); - xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); + if ( toggle ) { + xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); + xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); + } + + else { + xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); + } } int Lib::speed() const { assert( m_initialized ); return xine_get_param ( m_stream, XINE_PARAM_SPEED ); } @@ -277,17 +286,27 @@ bool Lib::isSeekable() const { assert( m_initialized ); return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); } void Lib::seekTo( int time ) { assert( m_initialized ); - xine_play( m_stream, 0, time*1000 ); + odebug << "Seeking to second " << time << oendl; + //Keep it paused if it was in that state + if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { + xine_play( m_stream, 0, time*1000 ); + } + + else { + xine_play( m_stream, 0, time*1000 ); + xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); + } + } Frame Lib::currentFrame() const { assert( m_initialized ); Frame frame; return frame; |