-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 31 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.h | 28 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 31 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 32 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/opieplayer2.pro | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 67 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.h | 14 |
8 files changed, 177 insertions, 49 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 620c71f..a6fd334 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -60,3 +60,3 @@ Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { setFrameStyle( WinPanel | Sunken ); - setText( "No Song" ); + //setText( "No Song" ); } @@ -462,3 +462,2 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { if( mediaPlayerState->isPaused ) { -// setToggleButton( i, FALSE ); mediaPlayerState->setPaused( FALSE ); @@ -466,8 +465,4 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { } else if( !mediaPlayerState->isPaused ) { -// setToggleButton( i, TRUE ); mediaPlayerState->setPaused( TRUE ); return; - } else { - // setToggleButton( i, TRUE ); - // mediaPlayerState->setPlaying( videoButtons[i].isDown ); } @@ -582,14 +577,2 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) { case Key_Escape: { -/* - * author pleas tell me where the i come from .-) - #if defined(QT_QWS_IPAQ) - if( mediaPlayerState->isPaused ) { - setToggleButton( i, FALSE ); - mediaPlayerState->setPaused( FALSE ); - } else if( !mediaPlayerState->isPaused ) { - setToggleButton( i, TRUE ); - mediaPlayerState->setPaused( TRUE ); - } -#endif -*/ } diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 4021d4a..85030de 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp @@ -152,3 +152,5 @@ int Lib::play( const QString& fileName, int startPos, int start_time ) { QString str = fileName.stripWhiteSpace(); - xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ); + if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) { + return 0; + } return xine_play( m_xine, startPos, start_time); @@ -196,2 +198,8 @@ bool Lib::isSeekable() { +void Lib::seekTo( int time ) { +// xine_trick_mode ( m_xine, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( + xine_play( m_xine, 0, time ); +} + + Frame Lib::currentFrame() { @@ -201,4 +209,4 @@ Frame Lib::currentFrame() { -QString Lib::metaInfo() { - xine_get_meta_info( m_xine, 0 ); +QString Lib::metaInfo( int number) { + return xine_get_meta_info( m_xine, number ); } @@ -225,2 +233,16 @@ bool Lib::isShowingVideo() { +bool Lib::hasVideo() { + //looks like it is not implemented yet + //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS ); + // ugly hack until xine is ready, look for the width of the video + int test = xine_get_stream_info( m_xine, 2 ); + if( test > 0 ) { + // qDebug( QString(" has video: %1").arg( test ) ); + return true; + } else { + //qDebug ( "does not have video "); + return false; + } +} + void Lib::showVideoFullScreen( bool fullScreen ) { @@ -260,5 +282,2 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { } - -// qWarning( "called draw frame %d %d", width, height ); - m_wid-> setVideoFrame ( frame, width, height, bytes ); diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h index 29adc4d..6cdd9c6 100644 --- a/noncore/multimedia/opieplayer2/lib.h +++ b/noncore/multimedia/opieplayer2/lib.h @@ -119,5 +119,14 @@ namespace XINE { * Get the meta info (like author etc) from the stream - * + * XINE_META_INFO_TITLE 0 + * XINE_META_INFO_COMMENT 1 + * XINE_META_INFO_ARTIST 2 + * XINE_META_INFO_GENRE 3 + * XINE_META_INFO_ALBUM 4 + * XINE_META_INFO_YEAR 5 + * XINE_META_INFO_VIDEOCODEC 6 + * XINE_META_INFO_AUDIOCODEC 7 + * XINE_META_INFO_SYSTEMLAYER 8 + * XINE_META_INFO_INPUT_PLUGIN 9 */ - QString metaInfo() ; + QString metaInfo( int number ); @@ -129,2 +138,13 @@ namespace XINE { /** + * seek to a position + */ + void seekTo( int time ); + + /** + * + * @return is media stream has video + */ + bool hasVideo(); + + /** * @@ -146,2 +166,6 @@ namespace XINE { * Returns the error code + * XINE_ERROR_NONE 0 + * XINE_ERROR_NO_INPUT_PLUGIN 1 + * XINE_ERROR_NO_DEMUXER_PLUGIN 2 + * XINE_ERROR_DEMUXER_FAILED 3 */ diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 553e3c1..8da7f73 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp @@ -102,5 +102,6 @@ void MediaPlayer::setPlaying( bool play ) { time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); - qDebug(time); + //qDebug(time); - } else { //if playing in file list.. play in a different way + } else { + //if playing in file list.. play in a different way // random and looping settings enabled causes problems here, @@ -109,4 +110,5 @@ void MediaPlayer::setPlaying( bool play ) { l = mediaPlayerState->looping(); - if(l) + if(l) { mediaPlayerState->setLooping( false ); + } r = mediaPlayerState->shuffled(); @@ -116,13 +118,24 @@ void MediaPlayer::setPlaying( bool play ) { xineControl->play( fileName); - long seconds = mediaPlayerState->length();// + long seconds = mediaPlayerState->length(); time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); - qDebug(time); - if( fileName.left(4) != "http" ) + //qDebug(time); + if( fileName.left(4) != "http" ) { fileName = QFileInfo( fileName).baseName(); + } } - if( fileName.left(4) == "http" ) + + if( fileName.left(4) == "http" ) { + if ( xineControl->getMetaInfo().isEmpty() ) { tickerText= tr( " File: " ) + fileName; - else - tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; + } else { + tickerText = xineControl->getMetaInfo(); + } + } else { + if ( xineControl->getMetaInfo().isEmpty() ) { + tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; + } else { + tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; + } + } audioUI->setTickerText( tickerText ); diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 05be128..131db33 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h @@ -1 +1,33 @@ + /* + This file is part of the Opie Project + + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 LJP <> + Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro index 1b687a3..619d36d 100644 --- a/noncore/multimedia/opieplayer2/opieplayer2.pro +++ b/noncore/multimedia/opieplayer2/opieplayer2.pro @@ -4,3 +4,3 @@ CONFIG = qt warn_on debug DESTDIR = $(OPIEDIR)/bin -HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ +HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \ videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ @@ -9,3 +9,3 @@ HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ SOURCES = main.cpp \ - playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ + playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \ videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index fabc9a5..c22822c 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp @@ -35,2 +35,3 @@ #include <qtimer.h> +#include <qmessagebox.h> #include <qpe/qcopenvelope_qws.h> @@ -45,2 +46,3 @@ XineControl::XineControl( QObject *parent, const char *name ) : QObject( parent, name ) { + libXine = new XINE::Lib(videoUI->vidWidget() ); @@ -77,10 +79,13 @@ void XineControl::play( const QString& fileName ) { - libXine->play( fileName ); - mediaPlayerState->setPlaying( true ); - char whichGui = mdetect.videoOrAudio( fileName ); - if (whichGui == 'f') { - qDebug("Nicht erkannter Dateityp"); + if ( !libXine->play( fileName ) ) { + QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); return; } - if (whichGui == 'a') { + mediaPlayerState->setPlaying( true ); + + char whichGui; + // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); + if ( !libXine->hasVideo() ) { + whichGui = 'a'; + qDebug("HAS AUDIO"); libXine->setShowVideo( false ); @@ -88,2 +93,4 @@ void XineControl::play( const QString& fileName ) { } else { + whichGui = 'v'; + qDebug("HAS VIDEO"); libXine->setShowVideo( true ); @@ -96,3 +103,2 @@ void XineControl::play( const QString& fileName ) { - #if defined(Q_WS_QWS) && !defined(QT_NO_COP) @@ -129,3 +135,2 @@ void XineControl::stop( bool isSet ) { #endif - } @@ -174,5 +179,6 @@ long XineControl::position() { emit positionChanged( emitPos ); - if(mediaPlayerState->isPlaying) + if( mediaPlayerState->isPlaying ) { // needs to be stopped the media is stopped QTimer::singleShot( 1000, this, SLOT( position() ) ); + } // qDebug("POSITION : %d", m_position); @@ -189,2 +195,43 @@ void XineControl::setFullscreen( bool isSet ) { + +QString XineControl::getMetaInfo() { + + QString returnString; + + if ( !libXine->metaInfo( 0 ).isEmpty() ) { + returnString += tr( " Titel: " + libXine->metaInfo( 0 ) ); + } + + if ( !libXine->metaInfo( 1 ).isEmpty() ) { + returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); + } + + if ( !libXine->metaInfo( 2 ).isEmpty() ) { + returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); + } + + if ( !libXine->metaInfo( 3 ).isEmpty() ) { + returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); + } + + if ( !libXine->metaInfo( 4 ).isEmpty() ) { + returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); + } + + if ( !libXine->metaInfo( 5 ).isEmpty() ) { + returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); + } + return returnString; +} + +QString XineControl::getErrorCode() { + int errorCode = libXine->error(); + + if ( errorCode == 1 ) { + return tr( "No input plugin found for this media type" ); + } else { + return tr( "Some other error" ); + } +} + /** @@ -194,3 +241,3 @@ void XineControl::setFullscreen( bool isSet ) { void XineControl::seekTo( long second ) { - libXine->play( m_fileName , 0, (int)second ); + libXine->seekTo( (int)second ); } diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h index 1de610b..b1300a8 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.h +++ b/noncore/multimedia/opieplayer2/xinecontrol.h @@ -37,3 +37,2 @@ #include "lib.h" -#include "mediadetect.h" #include <qobject.h> @@ -79,2 +78,14 @@ public slots: + /** + * Get as much info about the stream from xine as possible + */ + QString getMetaInfo(); + + /** + * get the error code and "translate" it for the user + * + */ + QString getErrorCode(); + + void videoResized ( const QSize &s ); @@ -90,3 +101,2 @@ private: XINE::Lib *libXine; - MediaDetect mdetect; long m_currentTime; |