summaryrefslogtreecommitdiff
authorzecke <zecke>2004-09-23 21:38:02 (UTC)
committer zecke <zecke>2004-09-23 21:38:02 (UTC)
commit97ab73d99688443d02086b4f00d1de7c81faa3c7 (patch) (side-by-side diff)
tree63864e847abc41442d2ed88ca27a27ad1942c15a
parent3080b2095fd9dddc4937cbf74037ce1dbc7fa6b2 (diff)
downloadopie-97ab73d99688443d02086b4f00d1de7c81faa3c7.zip
opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.gz
opie-97ab73d99688443d02086b4f00d1de7c81faa3c7.tar.bz2
-Remove bogus whitespaces
-Remove stl dependency -Make switching from fullscreen video to audio work -Remove debug output
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp39
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp50
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp29
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp43
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp15
8 files changed, 55 insertions, 130 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
@@ -131,19 +131,11 @@ void Lib::initialize()
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);
@@ -160,10 +152,8 @@ Lib::~Lib() {
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 );
@@ -200,16 +190,10 @@ int Lib::subVersion() {
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;
+ if ( !xine_open( m_stream, str.utf8().data() ) ) {
+ return 0;
}
return xine_play( m_stream, startPos, start_time);
@@ -218,6 +202,4 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) {
void Lib::stop() {
assert( m_initialized );
-
- odebug << "<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>" << oendl;
xine_stop( m_stream );
}
@@ -259,10 +241,10 @@ int Lib::currentTime() const {
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;
- }
}
@@ -301,6 +283,4 @@ 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 );
}
@@ -426,5 +406,4 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
if ( !m_video ) {
- owarn << "not showing video now" << oendl;
return;
}
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
@@ -6,4 +6,5 @@
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/odevice.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
@@ -35,8 +36,4 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla
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() ) );
@@ -155,5 +152,5 @@ void MediaPlayer::next() {
}
} else { //if playing from file list, let's just stop
- odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
+ odebug << "<<<<<<<<<<<<<<<<<stop for filelists" << oendl;
mediaPlayerState.setPlaying(false);
mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
@@ -282,40 +279,5 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 );
}
@@ -332,9 +294,9 @@ void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
break;
case Key_F12: //home
- odebug << "Blank here" << oendl;
+ odebug << "Blank here" << oendl;
// mediaPlayerState->toggleBlank();
break;
case Key_F13: //mail
- odebug << "Blank here" << oendl;
+ odebug << "Blank here" << oendl;
// mediaPlayerState->toggleBlank();
break;
@@ -347,6 +309,4 @@ void MediaPlayer::cleanUp() {// this happens on closing
playList.writeDefaultPlaylist( );
-// QPEApplication::grabKeyboard();
-// QPEApplication::ungrabKeyboard();
}
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
@@ -49,9 +49,8 @@ void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint 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 );
}
}
@@ -88,14 +87,8 @@ void MediaWidget::closeEvent( QCloseEvent * )
}
-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 );
@@ -110,5 +103,5 @@ void MediaWidget::resizeEvent( QResizeEvent *e )
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;
@@ -130,6 +123,6 @@ MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position )
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 );
@@ -194,7 +187,7 @@ 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() &&
+ return ( position.x() > 0 && position.y() > 0 &&
+ position.x() < buttonMask.width() &&
+ position.y() < buttonMask.height() &&
buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 );
}
@@ -202,5 +195,5 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const
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 );
@@ -223,6 +216,6 @@ void MediaWidget::paintButton( QPainter &p, const Button &button )
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;
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
@@ -30,7 +30,4 @@
#include "playlistwidget.h"
-#include <vector>
-#include <memory>
-
class Skin;
@@ -55,5 +52,5 @@ public:
QPixmap pixDown;
};
- typedef std::vector<Button> ButtonVector;
+ typedef QValueList<Button> ButtonVector;
struct SkinButtonInfo
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
@@ -185,10 +185,8 @@ void PlayListWidget::writeDefaultPlaylist() {
QString currentString = config.readEntry( "CurrentPlaylist", filename);
if( currentString == filename) {
- Om3u *m3uList;
- // odebug << "<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>" << oendl;
+ Om3u *m3uList;
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() );
}
@@ -209,5 +207,4 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
d->selectedFiles->addToSelection( lnk );
}
-// writeCurrentM3u();
}
@@ -329,12 +326,12 @@ void PlayListWidget::addAllVideoToList() {
void PlayListWidget::setDocument( const QString& _fileref ) {
- // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
+ // odebug << "<<<<<<<<set document>>>>>>>>>> "+fileref << oendl;
QString fileref = _fileref;
fromSetDocument = TRUE;
-
+
DocLnk lnk(_fileref);
if(lnk.isValid())
fileref = lnk.file();
-
+
QFileInfo fileInfo(fileref);
@@ -411,5 +408,5 @@ bool PlayListWidget::prev() {
bool PlayListWidget::next() {
-//odebug << "<<<<<<<<<<<<next()" << oendl;
+//odebug << "<<<<<<<<<<<<next()" << oendl;
if ( mediaPlayerState->isShuffled() ) {
return prev();
@@ -622,5 +619,5 @@ void PlayListWidget::openURL() {
if( fileDlg->result() == 1 ) {
filename = fileDlg->text();
- odebug << "Selected filename is " + filename << oendl;
+ odebug << "Selected filename is " + filename << oendl;
// Om3u *m3uList;
DocLnk lnk;
@@ -698,5 +695,5 @@ void PlayListWidget::openFile() {
if( !str.isEmpty() ) {
- odebug << "Selected filename is " + str << oendl;
+ odebug << "Selected filename is " + str << oendl;
filename = str;
DocLnk lnk;
@@ -716,5 +713,5 @@ void PlayListWidget::openFile() {
void PlayListWidget::readListFromFile( const QString &filename ) {
- odebug << "read list filename " + filename << oendl;
+ odebug << "read list filename " + filename << oendl;
QFileInfo fi(filename);
Om3u *m3uList;
@@ -729,5 +726,5 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) {
s = *it;
- // odebug << s << oendl;
+ // odebug << s << oendl;
if(s.left(4)=="http") {
lnk.setName( s ); //sets file name
@@ -763,5 +760,5 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
// writes current playlist to current m3u file */
void PlayListWidget::writeCurrentM3u() {
- odebug << "writing to current m3u" << oendl;
+ odebug << "writing to current m3u" << oendl;
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
@@ -773,9 +770,9 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
do {
- // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
+ // odebug << "add writeCurrentM3u " +d->selectedFiles->current()->file() << oendl;
m3uList->add( d->selectedFiles->current()->file() );
}
while ( d->selectedFiles->next() );
- // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
+ // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl;
m3uList->write();
m3uList->close();
@@ -822,5 +819,5 @@ void PlayListWidget::writem3u() {
name = str;
// name = fileDlg->text();
-// odebug << filename << oendl;
+// odebug << filename << oendl;
if( name.find("/",0,true) != -1) {// assume they specify a file path
filename = name;
@@ -840,5 +837,5 @@ void PlayListWidget::writem3u() {
}
while ( d->selectedFiles->next() );
- // odebug << list << oendl;
+ // odebug << list << oendl;
m3uList->write();
m3uList->close();
@@ -852,5 +849,5 @@ void PlayListWidget::writem3u() {
lnk.setName( name); //sets file name
- // odebug << filename << oendl;
+ // odebug << filename << oendl;
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
@@ -860,5 +857,5 @@ void PlayListWidget::writem3u() {
if(!lnk.writeLink()) {
- odebug << "Writing doclink did not work" << oendl;
+ odebug << "Writing doclink did not work" << oendl;
}
@@ -894,5 +891,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
break;
// case Key_P: //play
- // odebug << "Play" << oendl;
+ // odebug << "Play" << oendl;
// playSelected();
// break;
@@ -924,5 +921,5 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) {
void PlayListWidget::pmViewActivated(int index) {
-// odebug << "" << index << "" << oendl;
+// odebug << "" << index << "" << oendl;
switch(index) {
case -16:
@@ -954,5 +951,5 @@ void PlayListWidget::populateSkinsMenu() {
while ( ( fi = it.current() ) ) {
skinName = fi->fileName();
-// odebug << fi->fileName() << oendl;
+// odebug << fi->fileName() << oendl;
if( skinName != "." && skinName != ".." && skinName !="CVS" ) {
item = skinsMenu->insertItem( fi->fileName() ) ;
@@ -1010,5 +1007,5 @@ QString PlayListWidget::currentFileListPathName() const {
void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) {
- odebug << "qcop message "+msg << oendl;
+ odebug << "qcop message "+msg << oendl;
QDataStream stream ( data, IO_ReadOnly );
if ( msg == "play()" ) { //plays current selection
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
@@ -184,5 +184,4 @@ void PlayListWidgetGui::setView( char view ) {
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();
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
@@ -146,4 +146,5 @@ void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
scaledWidth = 0;
scaledHeight = 0;
+ videoFrame->hide();
hide();
}
@@ -195,4 +196,5 @@ void VideoWidget::backToNormal() {
void VideoWidget::makeVisible() {
+ videoFrame->show();
if ( mediaPlayerState.isFullscreen() ) {
showFullScreen();
@@ -205,5 +207,4 @@ void VideoWidget::makeVisible() {
disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
-
} else {
showNormal();
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
@@ -82,5 +82,5 @@ void XineControl::init()
XineControl::~XineControl() {
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+#if !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
@@ -98,5 +98,5 @@ void XineControl::play( const QString& fileName ) {
m_fileName = fileName;
- odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
+ odebug << "<<FILENAME: " + fileName + ">>>>" << oendl;
if ( !libXine->play( fileName, 0, 0 ) ) {
@@ -111,10 +111,8 @@ void XineControl::play( const QString& fileName ) {
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;
@@ -151,5 +149,5 @@ void XineControl::stop( bool isSet ) {
libXine->stop();
-#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
+#if !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
@@ -177,5 +175,4 @@ long XineControl::currentTime() {
m_currentTime = libXine->currentTime();
return m_currentTime;
- QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
}
@@ -248,14 +245,16 @@ QString XineControl::getErrorCode() {
int errorCode = libXine->error();
- odebug << QString("ERRORCODE: %1 ").arg(errorCode) << oendl;
+ 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" );
+ 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" );