summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp92
1 files changed, 2 insertions, 90 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 20fd1e2..1e0dc21 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -73,6 +73,4 @@ using namespace XINE;
Lib::Lib( XineVideoWidget* widget )
{
- ThreadUtil::AutoLock lock( m_initGuard );
- m_initialized = false;
m_video = false;
m_wid = widget;
@@ -90,17 +88,6 @@ Lib::Lib( XineVideoWidget* widget )
}
- start();
-}
-
-void Lib::run()
-{
- initialize();
-}
-
-void Lib::initialize()
-{
m_xine = xine_new( );
- QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
xine_config_load( m_xine, QFile::encodeName( configPath ) );
@@ -131,16 +118,7 @@ void Lib::initialize()
xine_event_create_listener_thread (m_queue, xine_event_handler, this);
-
- ThreadUtil::AutoLock lock( m_initGuard );
- m_initialized = true;
-
- send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay );
}
Lib::~Lib() {
- ThreadUtil::AutoLock lock( m_initGuard );
-
- assert( m_initialized );
-
// free( m_config );
@@ -157,15 +135,4 @@ Lib::~Lib() {
}
-void Lib::assertInitialized() const
-{
- ThreadUtil::AutoLock lock( m_initGuard );
-
- if ( m_initialized )
- return;
-
- qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" );
- assert( m_initialized );
-}
-
void Lib::resize ( const QSize &s ) {
if ( s. width ( ) && s. height ( ) ) {
@@ -194,6 +161,4 @@ int Lib::subVersion() {
int Lib::play( const QString& fileName, int startPos, int start_time ) {
- assertInitialized();
-
QString str = fileName.stripWhiteSpace();
if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
@@ -204,6 +169,4 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) {
void Lib::stop() {
- assertInitialized();
-
qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
xine_stop( m_stream );
@@ -211,30 +174,20 @@ void Lib::stop() {
void Lib::pause( bool toggle ) {
- assertInitialized();
-
xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
}
int Lib::speed() const {
- assertInitialized();
-
return xine_get_param ( m_stream, XINE_PARAM_SPEED );
}
void Lib::setSpeed( int speed ) {
- assertInitialized();
-
xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
}
int Lib::status() const {
- assertInitialized();
-
return xine_get_status( m_stream );
}
int Lib::currentPosition() const {
- assertInitialized();
-
int pos, time, length;
xine_get_pos_length( m_stream, &pos, &time, &length );
@@ -243,6 +196,4 @@ int Lib::currentPosition() const {
int Lib::currentTime() const {
- assertInitialized();
-
int pos, time, length;
xine_get_pos_length( m_stream, &pos, &time, &length );
@@ -251,6 +202,4 @@ int Lib::currentTime() const {
int Lib::length() const {
- assertInitialized();
-
int pos, time, length;
xine_get_pos_length( m_stream, &pos, &time, &length );
@@ -259,12 +208,8 @@ int Lib::length() const {
bool Lib::isSeekable() const {
- assertInitialized();
-
return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
}
void Lib::seekTo( int time ) {
- assertInitialized();
-
//xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
// since its now milliseconds we need *1000
@@ -274,6 +219,4 @@ void Lib::seekTo( int time ) {
Frame Lib::currentFrame() const {
- assertInitialized();
-
Frame frame;
return frame;
@@ -281,12 +224,8 @@ Frame Lib::currentFrame() const {
QString Lib::metaInfo( int number) const {
- assertInitialized();
-
return xine_get_meta_info( m_stream, number );
}
int Lib::error() const {
- assertInitialized();
-
return xine_get_error( m_stream );
};
@@ -295,22 +234,13 @@ void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
{
assert( sendType == ThreadUtil::Channel::OneWay );
- switch ( msg->type() ) {
- case XineMessageType:
- handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent );
- break;
- case InitializationMessageType:
- emit initialized();
- break;
- }
+ handleXineEvent( msg->type() );
delete msg;
}
void Lib::handleXineEvent( const xine_event_t* t ) {
- send( new XineMessage( t->type ), OneWay );
+ send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
}
void Lib::handleXineEvent( int type ) {
- assertInitialized();
-
if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
emit stopped();
@@ -320,6 +250,4 @@ void Lib::handleXineEvent( int type ) {
void Lib::setShowVideo( bool video ) {
- assertInitialized();
-
m_video = video;
::null_set_show_video( m_videoOutput, video );
@@ -327,36 +255,24 @@ void Lib::setShowVideo( bool video ) {
bool Lib::isShowingVideo() const {
- assertInitialized();
-
return ::null_is_showing_video( m_videoOutput );
}
bool Lib::hasVideo() const {
- assertInitialized();
-
return xine_get_stream_info( m_stream, 18 );
}
void Lib::showVideoFullScreen( bool fullScreen ) {
- assertInitialized();
-
::null_set_fullscreen( m_videoOutput, fullScreen );
}
bool Lib::isVideoFullScreen() const {
- assertInitialized();
-
return ::null_is_fullscreen( m_videoOutput );
}
void Lib::setScaling( bool scale ) {
- assertInitialized();
-
::null_set_scaling( m_videoOutput, scale );
}
void Lib::setGamma( int value ) {
- assertInitialized();
-
//qDebug( QString( "%1").arg(value) );
/* int gammaValue = ( 100 + value ); */
@@ -365,6 +281,4 @@ void Lib::setGamma( int value ) {
bool Lib::isScaling() const {
- assertInitialized();
-
return ::null_is_scaling( m_videoOutput );
}
@@ -380,6 +294,4 @@ void Lib::xine_display_frame( void* user_data, uint8_t *frame,
void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
- assertInitialized();
-
if ( !m_video ) {
qWarning("not showing video now");