summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/lib.h28
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h32
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro4
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp67
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h14
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 ) {
60 setFrameStyle( WinPanel | Sunken ); 60 setFrameStyle( WinPanel | Sunken );
61 setText( "No Song" ); 61 //setText( "No Song" );
62} 62}
@@ -462,3 +462,2 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
462 if( mediaPlayerState->isPaused ) { 462 if( mediaPlayerState->isPaused ) {
463// setToggleButton( i, FALSE );
464 mediaPlayerState->setPaused( FALSE ); 463 mediaPlayerState->setPaused( FALSE );
@@ -466,8 +465,4 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
466 } else if( !mediaPlayerState->isPaused ) { 465 } else if( !mediaPlayerState->isPaused ) {
467// setToggleButton( i, TRUE );
468 mediaPlayerState->setPaused( TRUE ); 466 mediaPlayerState->setPaused( TRUE );
469 return; 467 return;
470 } else {
471 // setToggleButton( i, TRUE );
472 // mediaPlayerState->setPlaying( videoButtons[i].isDown );
473 } 468 }
@@ -582,14 +577,2 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
582 case Key_Escape: { 577 case Key_Escape: {
583/*
584 * author pleas tell me where the i come from .-)
585 #if defined(QT_QWS_IPAQ)
586 if( mediaPlayerState->isPaused ) {
587 setToggleButton( i, FALSE );
588 mediaPlayerState->setPaused( FALSE );
589 } else if( !mediaPlayerState->isPaused ) {
590 setToggleButton( i, TRUE );
591 mediaPlayerState->setPaused( TRUE );
592 }
593#endif
594*/
595 } 578 }
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 ) {
152 QString str = fileName.stripWhiteSpace(); 152 QString str = fileName.stripWhiteSpace();
153 xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ); 153 if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) {
154 return 0;
155 }
154 return xine_play( m_xine, startPos, start_time); 156 return xine_play( m_xine, startPos, start_time);
@@ -196,2 +198,8 @@ bool Lib::isSeekable() {
196 198
199void Lib::seekTo( int time ) {
200// xine_trick_mode ( m_xine, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
201 xine_play( m_xine, 0, time );
202}
203
204
197Frame Lib::currentFrame() { 205Frame Lib::currentFrame() {
@@ -201,4 +209,4 @@ Frame Lib::currentFrame() {
201 209
202QString Lib::metaInfo() { 210QString Lib::metaInfo( int number) {
203 xine_get_meta_info( m_xine, 0 ); 211 return xine_get_meta_info( m_xine, number );
204} 212}
@@ -225,2 +233,16 @@ bool Lib::isShowingVideo() {
225 233
234bool Lib::hasVideo() {
235 //looks like it is not implemented yet
236 //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS );
237 // ugly hack until xine is ready, look for the width of the video
238 int test = xine_get_stream_info( m_xine, 2 );
239 if( test > 0 ) {
240 // qDebug( QString(" has video: %1").arg( test ) );
241 return true;
242 } else {
243 //qDebug ( "does not have video ");
244 return false;
245 }
246}
247
226void Lib::showVideoFullScreen( bool fullScreen ) { 248void Lib::showVideoFullScreen( bool fullScreen ) {
@@ -260,5 +282,2 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
260 } 282 }
261
262// qWarning( "called draw frame %d %d", width, height );
263
264 m_wid-> setVideoFrame ( frame, width, height, bytes ); 283 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 {
119 * Get the meta info (like author etc) from the stream 119 * Get the meta info (like author etc) from the stream
120 * 120 * XINE_META_INFO_TITLE 0
121 * XINE_META_INFO_COMMENT 1
122 * XINE_META_INFO_ARTIST 2
123 * XINE_META_INFO_GENRE 3
124 * XINE_META_INFO_ALBUM 4
125 * XINE_META_INFO_YEAR 5
126 * XINE_META_INFO_VIDEOCODEC 6
127 * XINE_META_INFO_AUDIOCODEC 7
128 * XINE_META_INFO_SYSTEMLAYER 8
129 * XINE_META_INFO_INPUT_PLUGIN 9
121 */ 130 */
122 QString metaInfo() ; 131 QString metaInfo( int number );
123 132
@@ -129,2 +138,13 @@ namespace XINE {
129 /** 138 /**
139 * seek to a position
140 */
141 void seekTo( int time );
142
143 /**
144 *
145 * @return is media stream has video
146 */
147 bool hasVideo();
148
149 /**
130 * 150 *
@@ -146,2 +166,6 @@ namespace XINE {
146 * Returns the error code 166 * Returns the error code
167 * XINE_ERROR_NONE 0
168 * XINE_ERROR_NO_INPUT_PLUGIN 1
169 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
170 * XINE_ERROR_DEMUXER_FAILED 3
147 */ 171 */
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 ) {
102 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 102 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
103 qDebug(time); 103 //qDebug(time);
104 104
105 } else { //if playing in file list.. play in a different way 105 } else {
106 //if playing in file list.. play in a different way
106 // random and looping settings enabled causes problems here, 107 // random and looping settings enabled causes problems here,
@@ -109,4 +110,5 @@ void MediaPlayer::setPlaying( bool play ) {
109 l = mediaPlayerState->looping(); 110 l = mediaPlayerState->looping();
110 if(l) 111 if(l) {
111 mediaPlayerState->setLooping( false ); 112 mediaPlayerState->setLooping( false );
113 }
112 r = mediaPlayerState->shuffled(); 114 r = mediaPlayerState->shuffled();
@@ -116,13 +118,24 @@ void MediaPlayer::setPlaying( bool play ) {
116 xineControl->play( fileName); 118 xineControl->play( fileName);
117 long seconds = mediaPlayerState->length();// 119 long seconds = mediaPlayerState->length();
118 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 120 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
119 qDebug(time); 121 //qDebug(time);
120 if( fileName.left(4) != "http" ) 122 if( fileName.left(4) != "http" ) {
121 fileName = QFileInfo( fileName).baseName(); 123 fileName = QFileInfo( fileName).baseName();
124 }
122 125
123 } 126 }
124 if( fileName.left(4) == "http" ) 127
128 if( fileName.left(4) == "http" ) {
129 if ( xineControl->getMetaInfo().isEmpty() ) {
125 tickerText= tr( " File: " ) + fileName; 130 tickerText= tr( " File: " ) + fileName;
126 else 131 } else {
127 tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; 132 tickerText = xineControl->getMetaInfo();
133 }
134 } else {
135 if ( xineControl->getMetaInfo().isEmpty() ) {
136 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
137 } else {
138 tickerText = xineControl->getMetaInfo() + " Length: " + time + " ";
139 }
140 }
128 audioUI->setTickerText( tickerText ); 141 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 @@
1 /*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
1 33
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
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ 5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h \
6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ 6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \
@@ -9,3 +9,3 @@ HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\
9SOURCES = main.cpp \ 9SOURCES = main.cpp \
10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ 10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp \
11 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ 11 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 @@
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h>
36#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
@@ -45,2 +46,3 @@ XineControl::XineControl( QObject *parent, const char *name )
45 : QObject( parent, name ) { 46 : QObject( parent, name ) {
47
46 libXine = new XINE::Lib(videoUI->vidWidget() ); 48 libXine = new XINE::Lib(videoUI->vidWidget() );
@@ -77,10 +79,13 @@ void XineControl::play( const QString& fileName ) {
77 79
78 libXine->play( fileName ); 80 if ( !libXine->play( fileName ) ) {
79 mediaPlayerState->setPlaying( true ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
80 char whichGui = mdetect.videoOrAudio( fileName );
81 if (whichGui == 'f') {
82 qDebug("Nicht erkannter Dateityp");
83 return; 82 return;
84 } 83 }
85 if (whichGui == 'a') { 84 mediaPlayerState->setPlaying( true );
85
86 char whichGui;
87 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
88 if ( !libXine->hasVideo() ) {
89 whichGui = 'a';
90 qDebug("HAS AUDIO");
86 libXine->setShowVideo( false ); 91 libXine->setShowVideo( false );
@@ -88,2 +93,4 @@ void XineControl::play( const QString& fileName ) {
88 } else { 93 } else {
94 whichGui = 'v';
95 qDebug("HAS VIDEO");
89 libXine->setShowVideo( true ); 96 libXine->setShowVideo( true );
@@ -96,3 +103,2 @@ void XineControl::play( const QString& fileName ) {
96 103
97
98#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 104#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
@@ -129,3 +135,2 @@ void XineControl::stop( bool isSet ) {
129#endif 135#endif
130
131 } 136 }
@@ -174,5 +179,6 @@ long XineControl::position() {
174 emit positionChanged( emitPos ); 179 emit positionChanged( emitPos );
175 if(mediaPlayerState->isPlaying) 180 if( mediaPlayerState->isPlaying ) {
176 // needs to be stopped the media is stopped 181 // needs to be stopped the media is stopped
177 QTimer::singleShot( 1000, this, SLOT( position() ) ); 182 QTimer::singleShot( 1000, this, SLOT( position() ) );
183 }
178// qDebug("POSITION : %d", m_position); 184// qDebug("POSITION : %d", m_position);
@@ -189,2 +195,43 @@ void XineControl::setFullscreen( bool isSet ) {
189 195
196
197QString XineControl::getMetaInfo() {
198
199 QString returnString;
200
201 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
202 returnString += tr( " Titel: " + libXine->metaInfo( 0 ) );
203 }
204
205 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
207 }
208
209 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
211 }
212
213 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
215 }
216
217 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
219 }
220
221 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
223 }
224 return returnString;
225}
226
227QString XineControl::getErrorCode() {
228 int errorCode = libXine->error();
229
230 if ( errorCode == 1 ) {
231 return tr( "No input plugin found for this media type" );
232 } else {
233 return tr( "Some other error" );
234 }
235}
236
190/** 237/**
@@ -194,3 +241,3 @@ void XineControl::setFullscreen( bool isSet ) {
194void XineControl::seekTo( long second ) { 241void XineControl::seekTo( long second ) {
195 libXine->play( m_fileName , 0, (int)second ); 242 libXine->seekTo( (int)second );
196} 243}
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 @@
37#include "lib.h" 37#include "lib.h"
38#include "mediadetect.h"
39#include <qobject.h> 38#include <qobject.h>
@@ -79,2 +78,14 @@ public slots:
79 78
79 /**
80 * Get as much info about the stream from xine as possible
81 */
82 QString getMetaInfo();
83
84 /**
85 * get the error code and "translate" it for the user
86 *
87 */
88 QString getErrorCode();
89
90
80 void videoResized ( const QSize &s ); 91 void videoResized ( const QSize &s );
@@ -90,3 +101,2 @@ private:
90 XINE::Lib *libXine; 101 XINE::Lib *libXine;
91 MediaDetect mdetect;
92 long m_currentTime; 102 long m_currentTime;