summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp35
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp44
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp9
8 files changed, 24 insertions, 99 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 248221b..8afb318 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -121,59 +121,49 @@ void Lib::initialize()
m_xine = xine_new( );
QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
xine_config_load( m_xine, QFile::encodeName( configPath ) );
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 );
-
-//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
-
-
-// null_display_handler( m_videoOutput, xine_display_frame, this );
-
m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
- if (m_wid != 0 ) {
- printf( "!0\n" );
+ if (m_wid != 0 )
setWidget( m_wid );
- }
- m_queue = xine_event_new_queue (m_stream);
+ m_queue = xine_event_new_queue (m_stream);
xine_event_create_listener_thread (m_queue, xine_event_handler, this);
::null_preload_decoders( m_stream );
m_duringInitialization = false;
}
Lib::~Lib() {
assert( isRunning() == false );
assert( m_initialized );
// free( m_config );
xine_close( m_stream );
-
xine_event_dispose_queue( m_queue );
-
xine_dispose( m_stream );
-
xine_exit( m_xine );
+
/* FIXME either free or delete but valgrind bitches against both */
//free( m_videoOutput );
//delete m_audioOutput;
}
void Lib::resize ( const QSize &s ) {
assert( m_initialized || m_duringInitialization );
if ( s. width ( ) && s. height ( ) ) {
::null_set_gui_width( m_videoOutput, s. width() );
::null_set_gui_height( m_videoOutput, s. height() );
}
@@ -190,44 +180,36 @@ int Lib::minorVersion() {
xine_get_version ( &major, &minor, &sub );
return minor;
}
int Lib::subVersion() {
int major, minor, sub;
xine_get_version ( &major, &minor, &sub );
return sub;
}
int Lib::play( const QString& fileName, int startPos, int start_time ) {
assert( m_initialized );
- // FIXME actually a hack imho. Should not be needed to dispose the whole stream
- // but without we get wrong media length reads from libxine for the second media
- //xine_dispose ( m_stream );
QString str = fileName.stripWhiteSpace();
- //m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
- //m_queue = xine_event_new_queue (m_stream);
- //xine_event_create_listener_thread (m_queue, xine_event_handler, this);
if ( !xine_open( m_stream, str.utf8().data() ) ) {
return 0;
}
return xine_play( m_stream, startPos, start_time);
}
void Lib::stop() {
assert( m_initialized );
-
- odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl;
xine_stop( m_stream );
}
void Lib::pause( bool toggle ) {
assert( m_initialized );
xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
}
int Lib::speed() const {
assert( m_initialized );
@@ -249,31 +231,31 @@ int Lib::status() const {
int Lib::currentPosition() const {
assert( m_initialized );
int pos, time, length;
xine_get_pos_length( m_stream, &pos, &time, &length );
return pos;
}
int Lib::currentTime() const {
assert( m_initialized );
int pos, time, length;
- xine_get_pos_length( m_stream, &pos, &time, &length );
- if ( time > 0 ) {
+ pos = time = length = 0;
+
+ if ( xine_get_pos_length( m_stream, &pos, &time, &length ) )
return time/1000;
- } else {
+ else
return 0;
}
-}
int Lib::length() const {
assert( m_initialized );
int pos, time, length;
/* dilb: patch to solve the wrong stream length reported to the GUI*/
int iRetVal=0, iTestLoop=0;
do
{
iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length );
if (iRetVal)
@@ -291,26 +273,24 @@ unseekable, but it should never occur!! Mr. Murphy ? :) ) */
return -1;
}
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_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
- // since its now milliseconds we need *1000
xine_play( m_stream, 0, time*1000 );
}
Frame Lib::currentFrame() const {
assert( m_initialized );
Frame frame;
return frame;
};
QString Lib::metaInfo( int number) const {
@@ -416,20 +396,19 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
( (Lib*)user_data)->handleXineEvent( t );
}
void Lib::xine_display_frame( void* user_data, uint8_t *frame,
int width, int height, int bytes ) {
( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
}
void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
assert( m_initialized );
if ( !m_video ) {
- owarn << "not showing video now" << oendl;
return;
}
assert( m_wid );
m_wid-> setVideoFrame ( frame, width, height, bytes );
}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index e6afbd8..b8023ca 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,19 +1,20 @@
#include "mediaplayer.h"
#include "audiowidget.h"
#include "videowidget.h"
#include "volumecontrol.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/odevice.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
/* QT */
#include <qfileinfo.h>
/* STD */
#include <linux/fb.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#define FBIOBLANK 0x4611
@@ -25,28 +26,24 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
m_videoUI = 0;
m_xineControl = 0;
xine = new XINE::Lib( XINE::Lib::InitializeInThread );
fd=-1;fl=-1;
playList.setCaption( tr( "OpiePlayer: Initializating" ) );
qApp->processEvents();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
-
-// What is pauseCheck good for? (Simon)
-// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
-
connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) );
volControl = new VolumeControl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
m_skinLoader = new SkinLoader;
m_skinLoader->schedule( AudioWidget::guiInfo() );
@@ -272,60 +269,25 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
for ( unsigned int i = 0; i < 10; i++ ) {
if ( v > i ) {
p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
} else {
p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
}
}
}
}
void MediaPlayer::blank( bool b ) {
-#ifdef QT_QWS_DEVFS
- fd=open("/dev/fb/0",O_RDWR);
-#else
- fd=open("/dev/fb0",O_RDWR);
-#endif
-#ifdef QT_QWS_SL5XXX
- fl= open( "/dev/fl", O_RDWR );
-#endif
- if (fd != -1) {
- if ( b ) {
- odebug << "do blanking" << oendl;
-#ifdef QT_QWS_SL5XXX
- ioctl( fd, FBIOBLANK, 1 );
- if(fl !=-1) {
- ioctl( fl, 2 );
- ::close(fl);
- }
-#else
- ioctl( fd, FBIOBLANK, 3 );
-#endif
- isBlanked = TRUE;
- } else {
- odebug << "do unblanking" << oendl;
- ioctl( fd, FBIOBLANK, 0);
-#ifdef QT_QWS_SL5XXX
- if(fl != -1) {
- ioctl( fl, 1);
- ::close(fl);
- }
-#endif
- isBlanked = FALSE;
- }
- close( fd );
- } else {
- odebug << "<< /dev/fb0 could not be opened >>" << oendl;
- }
+ Opie::Core::ODevice::inst()->setDisplayStatus( b );
}
void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
case Key_F9: //activity
break;
case Key_F10: //contacts
break;
case Key_F11: //menu
@@ -337,26 +299,24 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
case Key_F13: //mail
odebug << "Blank here" << oendl;
// mediaPlayerState->toggleBlank();
break;
}
}
void MediaPlayer::cleanUp() {// this happens on closing
Config cfg( "OpiePlayer" );
mediaPlayerState.writeConfig( cfg );
playList.writeDefaultPlaylist( );
-// QPEApplication::grabKeyboard();
-// QPEApplication::ungrabKeyboard();
}
void MediaPlayer::recreateAudioAndVideoWidgets() const
{
delete m_skinLoader;
delete m_xineControl;
delete m_audioUI;
delete m_videoUI;
m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 563ccf5..880b295 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -39,29 +39,28 @@ MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPla
}
MediaWidget::~MediaWidget()
{
}
void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
const Skin &skin )
{
buttonMask = skin.buttonMask( skinInfo, buttonCount );
buttons.clear();
- buttons.reserve( buttonCount );
for ( uint i = 0; i < buttonCount; ++i ) {
Button button = setupButton( skinInfo[ i ], skin );
- buttons.push_back( button );
+ buttons.append( button );
}
}
MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
{
Button button;
button.command = buttonInfo.command;
button.type = buttonInfo.type;
button.mask = skin.buttonMaskImage( buttonInfo.fileName );
return button;
}
@@ -78,68 +77,62 @@ void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, co
backgroundPixmap = skin.backgroundPixmap();
buttonUpImage = skin.buttonUpImage();
buttonDownImage = skin.buttonDownImage();
setupButtons( skinInfo, buttonCount, skin );
}
void MediaWidget::closeEvent( QCloseEvent * )
{
mediaPlayerState.setList();
}
-void MediaWidget::paintEvent( QPaintEvent *pe )
+void MediaWidget::paintEvent( QPaintEvent * )
{
QPainter p( this );
- if ( mediaPlayerState.isFullscreen() ) {
- // Clear the background
- p.setBrush( QBrush( Qt::black ) );
- return;
- }
-
QPixmap buffer( size() );
QPainter bufferedPainter( &buffer );
bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) );
paintAllButtons( bufferedPainter );
p.drawPixmap( 0, 0, buffer );
}
void MediaWidget::resizeEvent( QResizeEvent *e )
{
QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask );
QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask );
- for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
+ for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it ) {
Button &button = *it;
if ( button.mask.isNull() )
continue;
button.pixUp = addMaskToPixmap( pixUp, button.mask );
button.pixDown = addMaskToPixmap( pixDn, button.mask );
}
QWidget::resizeEvent( e );
}
MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position )
{
if ( position.x() <= 0 || position.y() <= 0 ||
position.x() >= buttonMask.width() ||
position.y() >= buttonMask.height() )
return 0;
int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() );
- for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
- if ( it->command + 1 == pixelIdx )
+ for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it )
+ if ( (*it).command + 1 == pixelIdx )
return &( *it );
return 0;
}
void MediaWidget::mousePressEvent( QMouseEvent *event )
{
Button *button = buttonAt( event->pos() - upperLeftOfButtonMask );
if ( !button ) {
QWidget::mousePressEvent( event );
return;
@@ -192,47 +185,47 @@ void MediaWidget::handleCommand( Command command, bool buttonDown )
}
bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
{
return ( position.x() > 0 && position.y() > 0 &&
position.x() < buttonMask.width() &&
position.y() < buttonMask.height() &&
buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
}
void MediaWidget::paintAllButtons( QPainter &p )
{
- for ( ButtonVector::const_iterator it = buttons.begin();
+ for ( ButtonVector::ConstIterator it = buttons.begin();
it != buttons.end(); ++it )
paintButton( p, *it );
}
void MediaWidget::paintButton( const Button &button )
{
QPainter p( this );
paintButton( p, button );
}
void MediaWidget::paintButton( QPainter &p, const Button &button )
{
if ( button.isDown )
p.drawPixmap( upperLeftOfButtonMask, button.pixDown );
else
p.drawPixmap( upperLeftOfButtonMask, button.pixUp );
}
void MediaWidget::setToggleButton( Command command, bool down )
{
- for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
- if ( it->command == command ) {
+ for ( ButtonVector::Iterator it = buttons.begin(); it != buttons.end(); ++it )
+ if ( (*it).command == command ) {
setToggleButton( *it, down );
return;
}
}
void MediaWidget::setToggleButton( Button &button, bool down )
{
if ( down != button.isDown )
toggleButton( button );
}
void MediaWidget::toggleButton( Button &button )
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 8c3a467..d885150 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -20,50 +20,47 @@
Boston, MA 02111-1307, USA.
*/
#ifndef MEDIAWIDGET_H
#define MEDIAWIDGET_H
#include <qwidget.h>
#include <qmap.h>
#include "mediaplayerstate.h"
#include "playlistwidget.h"
-#include <vector>
-#include <memory>
-
class Skin;
class MediaWidget : public QWidget
{
Q_OBJECT
public:
enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, FullScreen, Undefined };
enum ButtonType { NormalButton, ToggleButton };
struct Button
{
Button() : command( Undefined ), type( NormalButton ), isDown( false ) {}
Command command;
ButtonType type; // this should be part of the bitfield but gcc2 is too buggy to support this :-(
bool isDown : 1;
QBitmap mask;
QPixmap pixUp;
QPixmap pixDown;
};
- typedef std::vector<Button> ButtonVector;
+ typedef QValueList<Button> ButtonVector;
struct SkinButtonInfo
{
Command command;
const char *fileName;
ButtonType type;
};
struct GUIInfo
{
GUIInfo() : buttonInfo( 0 ), buttonCount( 0 ) {}
GUIInfo( const QString &_fileNameInfix, const SkinButtonInfo *_buttonInfo, const uint _buttonCount )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 36f77be..d73f0cd 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -176,48 +176,45 @@ void PlayListWidget::initializeStates() {
d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
d->playListFrame->show();
}
void PlayListWidget::writeDefaultPlaylist() {
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
QString filename=QPEApplication::documentDir() + "/default.m3u";
QString currentString = config.readEntry( "CurrentPlaylist", filename);
if( currentString == filename) {
Om3u *m3uList;
- // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
if( d->selectedFiles->first() ) {
m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
do {
- // odebug << d->selectedFiles->current()->file() << oendl;
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
m3uList->write();
m3uList->close();
delete m3uList;
}
}
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->setDocumentUsed = FALSE;
if( QFileInfo( lnk.file() ).exists() ||
lnk.file().left(4) == "http" ) {
d->selectedFiles->addToSelection( lnk );
}
-// writeCurrentM3u();
}
void PlayListWidget::clearList() {
while ( first() ) {
d->selectedFiles->removeSelected();
}
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
cfg.writeEntry("CurrentPlaylist","default");
setCaption("OpiePlayer");
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index 922f9d7..c3c1282 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -174,20 +174,19 @@ PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
PlayListWidgetGui::~PlayListWidgetGui() {
}
void PlayListWidgetGui::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidgetGui::setActiveWindow() {
- // odebug << "SETTING active window" << oendl;
// When we get raised we need to ensure that it switches views
MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
}
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 0625376..2b44701 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -136,24 +136,25 @@ void VideoWidget::setLength( long max ) {
}
void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
{
if ( displayType == MediaPlayerState::Video ) {
makeVisible();
return;
}
// Effectively blank the view next time we show it so it looks nicer
scaledWidth = 0;
scaledHeight = 0;
+ videoFrame->hide();
hide();
}
void VideoWidget::loadSkin()
{
loadDefaultSkin( guiInfo() );
delete slider;
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( backgroundPixmap );
@@ -185,35 +186,35 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
makeVisible();
}
MediaWidget::mouseReleaseEvent( event );
}
void VideoWidget::backToNormal() {
mediaPlayerState.setFullscreen( FALSE );
makeVisible();
setToggleButton( FullScreen, false );
}
void VideoWidget::makeVisible() {
+ videoFrame->show();
if ( mediaPlayerState.isFullscreen() ) {
showFullScreen();
resize( qApp->desktop()->size() );
videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
slider->hide();
disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
-
} else {
showNormal();
showMaximized();
QWidget *d = QApplication::desktop();
int w = d->width();
int h = d->height();
if(w>h) {
int newW=(w/2)-(246/2); //this will only work with 320x240
videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) );
} else {
videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) );
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 9f944d7..e1816c8 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -72,25 +72,25 @@ void XineControl::init()
connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+#if !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
hasVideoChannel = FALSE;
@@ -101,30 +101,28 @@ void XineControl::play( const QString& fileName ) {
if ( !libXine->play( fileName, 0, 0 ) ) {
QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
// toggle stop so the the play button is reset
mediaPlayerState.setPlaying( false );
return;
}
mediaPlayerState.setPlaying( true );
MediaPlayerState::DisplayType displayType;
if ( !libXine->hasVideo() ) {
displayType = MediaPlayerState::Audio;
- odebug << "HAS AUDIO" << oendl;
libXine->setShowVideo( false );
hasAudioChannel = TRUE;
} else {
displayType = MediaPlayerState::Video;
- odebug << "HAS VIDEO" << oendl;
libXine->setShowVideo( true );
hasVideoChannel = TRUE;
}
// determine if slider is shown
mediaPlayerState.setIsSeekable( libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState.setDisplayType( displayType );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
@@ -141,25 +139,25 @@ void XineControl::play( const QString& fileName ) {
void XineControl::nextMedia() {
mediaPlayerState.setNext();
}
void XineControl::setGamma( int value ) {
libXine->setGamma( value );
}
void XineControl::stop( bool isSet ) {
if ( !isSet ) {
libXine->stop();
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+#if !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
}
}
/**
* Pause playback
* @isSet
@@ -167,25 +165,24 @@ void XineControl::stop( bool isSet ) {
void XineControl::pause( bool isSet) {
libXine->pause( isSet );
}
/**
* get current time in playback
*/
long XineControl::currentTime() {
// todo: jede sekunde überprüfen
m_currentTime = libXine->currentTime();
return m_currentTime;
- QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
}
/**
* Set the length of the media file
*/
void XineControl::length() {
m_length = libXine->length();
mediaPlayerState.setLength( m_length );
}
/**
@@ -248,24 +245,26 @@ QString XineControl::getErrorCode() {
int errorCode = libXine->error();
odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
if ( errorCode == 1 ) {
return tr( "No input plugin found for this media type" );
} else if ( errorCode == 2 ) {
return tr( "No demux plugin found for this media type" );
} else if ( errorCode == 3 ) {
return tr( "Demuxing failed for this media type" );
} else if ( errorCode == 4 ) {
return tr( "Malformed MRL" );
+ } else if ( errorCode == 5 ) {
+ return tr( "Input failed" );
} else {
return tr( "Some other error" );
}
}
/**
* Seek to a position in the track
* @param second the second to jump to
*/
void XineControl::seekTo( long second ) {
libXine->seekTo( (int)second );
}