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
@@ -49,25 +49,25 @@
49#include "mediaplayerstate.h" 49#include "mediaplayerstate.h"
50#include "playlistwidget.h" 50#include "playlistwidget.h"
51 51
52extern MediaPlayerState *mediaPlayerState; 52extern MediaPlayerState *mediaPlayerState;
53extern PlayListWidget *playList; 53extern PlayListWidget *playList;
54 54
55static const int xo = -2; // movable x offset 55static const int xo = -2; // movable x offset
56static const int yo = 22; // movable y offset 56static const int yo = 22; // movable y offset
57 57
58 58
59Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) { 59Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
60 setFrameStyle( WinPanel | Sunken ); 60 setFrameStyle( WinPanel | Sunken );
61 setText( "No Song" ); 61 //setText( "No Song" );
62} 62}
63 63
64Ticker::~Ticker() { 64Ticker::~Ticker() {
65} 65}
66 66
67void Ticker::setText( const QString& text ) { 67void Ticker::setText( const QString& text ) {
68 pos = 0; // reset it everytime the text is changed 68 pos = 0; // reset it everytime the text is changed
69 scrollText = text; 69 scrollText = text;
70 pixelLen = fontMetrics().width( scrollText ); 70 pixelLen = fontMetrics().width( scrollText );
71 killTimers(); 71 killTimers();
72 if ( pixelLen > width() ) { 72 if ( pixelLen > width() ) {
73 startTimer( 50 ); 73 startTimer( 50 );
@@ -451,34 +451,29 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
451 toggleButton(i); 451 toggleButton(i);
452 } 452 }
453 } else { 453 } else {
454 if ( audioButtons[i].isHeld ) { 454 if ( audioButtons[i].isHeld ) {
455 audioButtons[i].isHeld = FALSE; 455 audioButtons[i].isHeld = FALSE;
456 if ( !audioButtons[i].isToggle ) { 456 if ( !audioButtons[i].isToggle ) {
457 setToggleButton( i, FALSE ); 457 setToggleButton( i, FALSE );
458 } 458 }
459 qDebug("mouseEvent %d", i); 459 qDebug("mouseEvent %d", i);
460 switch (i) { 460 switch (i) {
461 case AudioPlay: 461 case AudioPlay:
462 if( mediaPlayerState->isPaused ) { 462 if( mediaPlayerState->isPaused ) {
463// setToggleButton( i, FALSE );
464 mediaPlayerState->setPaused( FALSE ); 463 mediaPlayerState->setPaused( FALSE );
465 return; 464 return;
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 }
474 case AudioStop: mediaPlayerState->setPlaying(FALSE); return; 469 case AudioStop: mediaPlayerState->setPlaying(FALSE); return;
475 case AudioNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; 470 case AudioNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return;
476 case AudioPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; 471 case AudioPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return;
477 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; 472 case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return;
478 case AudioVolumeUp: emit moreReleased(); return; 473 case AudioVolumeUp: emit moreReleased(); return;
479 case AudioVolumeDown: emit lessReleased(); return; 474 case AudioVolumeDown: emit lessReleased(); return;
480 case AudioPlayList: mediaPlayerState->setList(); return; 475 case AudioPlayList: mediaPlayerState->setList(); return;
481 case AudioForward: emit forwardReleased(); return; 476 case AudioForward: emit forwardReleased(); return;
482 case AudioBack: emit backReleased(); return; 477 case AudioBack: emit backReleased(); return;
483 } 478 }
484 } 479 }
@@ -571,29 +566,17 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
571 break; 566 break;
572 case Key_Right: 567 case Key_Right:
573 // toggleButton(3); 568 // toggleButton(3);
574 mediaPlayerState->setNext(); 569 mediaPlayerState->setNext();
575 // toggleButton(3); 570 // toggleButton(3);
576 break; 571 break;
577 case Key_Left: 572 case Key_Left:
578 // toggleButton(4); 573 // toggleButton(4);
579 mediaPlayerState->setPrev(); 574 mediaPlayerState->setPrev();
580 // toggleButton(4); 575 // toggleButton(4);
581 break; 576 break;
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 }
596 break; 579 break;
597 580
598 }; 581 };
599} 582}
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
@@ -141,25 +141,27 @@ int Lib::majorVersion() {
141int Lib::minorVersion() { 141int Lib::minorVersion() {
142 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 142 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
143 return m_minor_version; 143 return m_minor_version;
144} 144}
145 145
146int Lib::subVersion() { 146int Lib::subVersion() {
147 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); 147 xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version );
148 return m_sub_version; 148 return m_sub_version;
149} 149}
150 150
151int Lib::play( const QString& fileName, int startPos, int start_time ) { 151int 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);
155} 157}
156 158
157void Lib::stop() { 159void Lib::stop() {
158 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 160 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
159 xine_stop( m_xine ); 161 xine_stop( m_xine );
160} 162}
161 163
162void Lib::pause() { 164void Lib::pause() {
163 xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); 165 xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE );
164} 166}
165 167
@@ -185,53 +187,73 @@ int Lib::currentTime() {
185 return m_time/1000; 187 return m_time/1000;
186} 188}
187 189
188int Lib::length() { 190int Lib::length() {
189 xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); 191 xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length );
190 return m_length/1000; 192 return m_length/1000;
191} 193}
192 194
193bool Lib::isSeekable() { 195bool Lib::isSeekable() {
194 return xine_get_stream_info ( m_xine, XINE_STREAM_INFO_SEEKABLE ); 196 return xine_get_stream_info ( m_xine, XINE_STREAM_INFO_SEEKABLE );
195} 197}
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() {
198 Frame frame; 206 Frame frame;
199 return frame; 207 return frame;
200}; 208};
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}
205 213
206int Lib::error() { 214int Lib::error() {
207 return xine_get_error( m_xine ); 215 return xine_get_error( m_xine );
208}; 216};
209 217
210void Lib::handleXineEvent( xine_event_t* t ) { 218void Lib::handleXineEvent( xine_event_t* t ) {
211 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { 219 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) {
212 emit stopped(); 220 emit stopped();
213 } 221 }
214} 222}
215 223
216 224
217void Lib::setShowVideo( bool video ) { 225void Lib::setShowVideo( bool video ) {
218 m_video = video; 226 m_video = video;
219 ::null_set_show_video( m_videoOutput, video ); 227 ::null_set_show_video( m_videoOutput, video );
220} 228}
221 229
222bool Lib::isShowingVideo() { 230bool Lib::isShowingVideo() {
223 return ::null_is_showing_video( m_videoOutput ); 231 return ::null_is_showing_video( m_videoOutput );
224} 232}
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 ) {
227 ::null_set_fullscreen( m_videoOutput, fullScreen ); 249 ::null_set_fullscreen( m_videoOutput, fullScreen );
228} 250}
229 251
230bool Lib::isVideoFullScreen() { 252bool Lib::isVideoFullScreen() {
231 return ::null_is_fullscreen( m_videoOutput ); 253 return ::null_is_fullscreen( m_videoOutput );
232} 254}
233 255
234void Lib::setScaling( bool scale ) { 256void Lib::setScaling( bool scale ) {
235 ::null_set_scaling( m_videoOutput, scale ); 257 ::null_set_scaling( m_videoOutput, scale );
236} 258}
237 259
@@ -249,17 +271,14 @@ void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
249} 271}
250 272
251void Lib::xine_display_frame( void* user_data, uint8_t *frame, 273void Lib::xine_display_frame( void* user_data, uint8_t *frame,
252 int width, int height, int bytes ) { 274 int width, int height, int bytes ) {
253 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 275 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
254} 276}
255 277
256void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 278void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
257 if ( !m_video ) { 279 if ( !m_video ) {
258 qWarning("not showing video now"); 280 qWarning("not showing video now");
259 return; 281 return;
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 );
265} 284}
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
@@ -108,51 +108,75 @@ namespace XINE {
108 * 108 *
109 */ 109 */
110 void showVideoFullScreen( bool fullScreen ); 110 void showVideoFullScreen( bool fullScreen );
111 111
112 /** 112 /**
113 * 113 *
114 */ 114 */
115 bool isVideoFullScreen()/*const*/ ; 115 bool isVideoFullScreen()/*const*/ ;
116 116
117 117
118 /** 118 /**
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
124 /** 133 /**
125 * 134 *
126 */ 135 */
127 bool isScaling(); 136 bool isScaling();
128 137
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 *
131 */ 151 */
132 void setScaling( bool ); 152 void setScaling( bool );
133 153
134 /** 154 /**
135 * Set the Gamma value for video output 155 * Set the Gamma value for video output
136 * @param int the value between -100 and 100, 0 is original 156 * @param int the value between -100 and 100, 0 is original
137 */ 157 */
138 void setGamma( int ); 158 void setGamma( int );
139 159
140 /** 160 /**
141 * test 161 * test
142 */ 162 */
143 Frame currentFrame()/*const*/; 163 Frame currentFrame()/*const*/;
144 164
145 /** 165 /**
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 */
148 int error() /*const*/; 172 int error() /*const*/;
149 173
150 signals: 174 signals:
151 void stopped(); 175 void stopped();
152 private: 176 private:
153 int m_bytes_per_pixel; 177 int m_bytes_per_pixel;
154 int m_length, m_pos, m_time; 178 int m_length, m_pos, m_time;
155 int m_major_version, m_minor_version, m_sub_version; 179 int m_major_version, m_minor_version, m_sub_version;
156 bool m_video:1; 180 bool m_video:1;
157 XineVideoWidget *m_wid; 181 XineVideoWidget *m_wid;
158 xine_t *m_xine; 182 xine_t *m_xine;
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
@@ -91,49 +91,62 @@ void MediaPlayer::setPlaying( bool play ) {
91 } 91 }
92 92
93 QString tickerText, time, fileName; 93 QString tickerText, time, fileName;
94 if( playList->whichList() == 0 ) { //check for filelist 94 if( playList->whichList() == 0 ) { //check for filelist
95 const DocLnk *playListCurrent = playList->current(); 95 const DocLnk *playListCurrent = playList->current();
96 if ( playListCurrent != NULL ) { 96 if ( playListCurrent != NULL ) {
97 currentFile = playListCurrent; 97 currentFile = playListCurrent;
98 } 98 }
99 xineControl->play( currentFile->file() ); 99 xineControl->play( currentFile->file() );
100 fileName = currentFile->name(); 100 fileName = currentFile->name();
101 long seconds = mediaPlayerState->length();// 101 long seconds = mediaPlayerState->length();//
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,
107 // since there is no selected file in the playlist, but a selected file in the file list, 108 // since there is no selected file in the playlist, but a selected file in the file list,
108 // so we remember and shutoff 109 // so we remember and shutoff
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();
113 mediaPlayerState->setShuffled(false); 115 mediaPlayerState->setShuffled(false);
114 116
115 fileName = playList->currentFileListPathName(); 117 fileName = playList->currentFileListPathName();
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 );
129} 142}
130 143
131 144
132void MediaPlayer::prev() { 145void MediaPlayer::prev() {
133 if(playList->whichList() == 0) { //if using the playlist 146 if(playList->whichList() == 0) { //if using the playlist
134 if ( playList->prev() ) { 147 if ( playList->prev() ) {
135 play(); 148 play();
136 } else if ( mediaPlayerState->looping() ) { 149 } else if ( mediaPlayerState->looping() ) {
137 if ( playList->last() ) { 150 if ( playList->last() ) {
138 play(); 151 play();
139 } 152 }
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,12 +1,44 @@
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
2#ifndef MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
3#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
4 36
5#include <qmainwindow.h> 37#include <qmainwindow.h>
6#include <qframe.h> 38#include <qframe.h>
7#include <qpe/qlibrary.h> 39#include <qpe/qlibrary.h>
8#include <qpe/mediaplayerplugininterface.h> 40#include <qpe/mediaplayerplugininterface.h>
9 41
10#include "xinecontrol.h" 42#include "xinecontrol.h"
11 43
12class DocLnk; 44class DocLnk;
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
@@ -1,22 +1,22 @@
1TEMPLATE = app 1TEMPLATE = app
2#CONFIG = qt warn_on release 2#CONFIG = qt warn_on release
3CONFIG = qt warn_on debug 3CONFIG = 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 \
7 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\ 7 frame.h lib.h xinevideowidget.h volumecontrol.h playlistwidgetgui.h\
8 alphablend.h yuv2rgb.h 8 alphablend.h yuv2rgb.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 \
12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \ 12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp \
13 playlistwidgetgui.cpp\ 13 playlistwidgetgui.cpp\
14 alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S 14 alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S
15TARGET = opieplayer2 15TARGET = opieplayer2
16INCLUDEPATH += $(OPIEDIR)/include 16INCLUDEPATH += $(OPIEDIR)/include
17DEPENDPATH += $(OPIEDIR)/include 17DEPENDPATH += $(OPIEDIR)/include
18LIBS += -lqpe -lpthread -lopie -lxine 18LIBS += -lqpe -lpthread -lopie -lxine
19MOC_DIR = qpeobj 19MOC_DIR = qpeobj
20OBJECTS_DIR = qpeobj 20OBJECTS_DIR = qpeobj
21 21
22#INCLUDEPATH += $(OPIEDIR)/include 22#INCLUDEPATH += $(OPIEDIR)/include
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
@@ -24,34 +24,36 @@
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h>
36#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
37#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
38#include "xinecontrol.h" 39#include "xinecontrol.h"
39#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
40#include "videowidget.h" 41#include "videowidget.h"
41 42
42extern MediaPlayerState *mediaPlayerState; 43extern MediaPlayerState *mediaPlayerState;
43extern VideoWidget *videoUI; 44extern VideoWidget *videoUI;
44XineControl::XineControl( QObject *parent, const char *name ) 45XineControl::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() );
47 49
48 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); 50 connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
49 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); 51 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
50 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
51 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
52 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
53 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
54 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
55 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
56 58
57 disabledSuspendScreenSaver = FALSE; 59 disabledSuspendScreenSaver = FALSE;
@@ -66,44 +68,48 @@ XineControl::~XineControl() {
66 } 68 }
67#endif 69#endif
68 delete libXine; 70 delete libXine;
69} 71}
70 72
71void XineControl::play( const QString& fileName ) { 73void XineControl::play( const QString& fileName ) {
72 hasVideoChannel=FALSE; 74 hasVideoChannel=FALSE;
73 hasAudioChannel=FALSE; 75 hasAudioChannel=FALSE;
74 m_fileName = fileName; 76 m_fileName = fileName;
75 77
76 //qDebug("<<FILENAME: " + fileName + ">>>>"); 78 //qDebug("<<FILENAME: " + 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 );
87 hasAudioChannel=TRUE; 92 hasAudioChannel=TRUE;
88 } else { 93 } else {
94 whichGui = 'v';
95 qDebug("HAS VIDEO");
89 libXine->setShowVideo( true ); 96 libXine->setShowVideo( true );
90 hasVideoChannel=TRUE; 97 hasVideoChannel=TRUE;
91 } 98 }
92 // determine if slider is shown 99 // determine if slider is shown
93 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 100 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
94 // which gui (video / audio) 101 // which gui (video / audio)
95 mediaPlayerState->setView( whichGui ); 102 mediaPlayerState->setView( whichGui );
96 103
97
98#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 104#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
99 if ( !disabledSuspendScreenSaver ) { 105 if ( !disabledSuspendScreenSaver ) {
100 disabledSuspendScreenSaver = TRUE; 106 disabledSuspendScreenSaver = TRUE;
101 // Stop the screen from blanking and power saving state 107 // Stop the screen from blanking and power saving state
102 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 108 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
103 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 109 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
104 } 110 }
105#endif 111#endif
106 112
107 length(); 113 length();
108 position(); 114 position();
109} 115}
@@ -118,25 +124,24 @@ void XineControl::setGamma( int value ) {
118 124
119void XineControl::stop( bool isSet ) { 125void XineControl::stop( bool isSet ) {
120 if ( !isSet) { 126 if ( !isSet) {
121 libXine->stop( ); 127 libXine->stop( );
122 128
123#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 129#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
124 if ( disabledSuspendScreenSaver ) { 130 if ( disabledSuspendScreenSaver ) {
125 disabledSuspendScreenSaver = FALSE; 131 disabledSuspendScreenSaver = FALSE;
126 // Re-enable the suspend mode 132 // Re-enable the suspend mode
127 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 133 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
128 } 134 }
129#endif 135#endif
130
131 } 136 }
132} 137}
133 138
134/** 139/**
135 * Pause playback 140 * Pause playback
136 * @isSet 141 * @isSet
137 */ 142 */
138void XineControl::pause( bool isSet) { 143void XineControl::pause( bool isSet) {
139 if (isSet) { 144 if (isSet) {
140 libXine->pause(); 145 libXine->pause();
141 } else { 146 } else {
142 libXine->play( m_fileName, 0, m_currentTime); 147 libXine->play( m_fileName, 0, m_currentTime);
@@ -163,38 +168,80 @@ void XineControl::length() {
163} 168}
164 169
165 170
166/** 171/**
167 * Reports the position the xine backend is at right now 172 * Reports the position the xine backend is at right now
168 * @return long the postion in seconds 173 * @return long the postion in seconds
169 */ 174 */
170long XineControl::position() { 175long XineControl::position() {
171 m_position = ( currentTime() ); 176 m_position = ( currentTime() );
172 mediaPlayerState->updatePosition( m_position ); 177 mediaPlayerState->updatePosition( m_position );
173 long emitPos = (long)m_position; 178 long emitPos = (long)m_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);
179 return m_position; 185 return m_position;
180} 186}
181 187
182/** 188/**
183 * Set videoplayback to fullscreen 189 * Set videoplayback to fullscreen
184 * @param isSet 190 * @param isSet
185 */ 191 */
186void XineControl::setFullscreen( bool isSet ) { 192void XineControl::setFullscreen( bool isSet ) {
187 libXine->showVideoFullScreen( isSet); 193 libXine->showVideoFullScreen( isSet);
188} 194}
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/**
191 * Seek to a position in the track 238 * Seek to a position in the track
192 * @param second the second to jump to 239 * @param second the second to jump to
193 */ 240 */
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}
197 244
198void XineControl::videoResized ( const QSize &s ) { 245void XineControl::videoResized ( const QSize &s ) {
199 libXine-> resize ( s ); 246 libXine-> resize ( s );
200} 247}
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
@@ -26,25 +26,24 @@
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef XINECONTROL_H 34#ifndef XINECONTROL_H
35#define XINECONTROL_H 35#define XINECONTROL_H
36 36
37#include "lib.h" 37#include "lib.h"
38#include "mediadetect.h"
39#include <qobject.h> 38#include <qobject.h>
40 39
41class XineControl : public QObject { 40class XineControl : public QObject {
42 Q_OBJECT 41 Q_OBJECT
43public: 42public:
44 XineControl( QObject *parent = 0, const char *name =0 ); 43 XineControl( QObject *parent = 0, const char *name =0 );
45 ~XineControl(); 44 ~XineControl();
46 45
47 bool hasVideo() const { return hasVideoChannel; } 46 bool hasVideo() const { return hasVideoChannel; }
48 bool hasAudio() const { return hasAudioChannel; } 47 bool hasAudio() const { return hasAudioChannel; }
49 48
50public slots: 49public slots:
@@ -68,36 +67,47 @@ public slots:
68 */ 67 */
69 long currentTime(); 68 long currentTime();
70 void seekTo( long ); 69 void seekTo( long );
71 // get length of media file and set it 70 // get length of media file and set it
72 void length(); 71 void length();
73 long position(); 72 long position();
74 73
75 /** 74 /**
76 * Proceed to the next media file in playlist 75 * Proceed to the next media file in playlist
77 */ 76 */
78 void nextMedia(); 77 void nextMedia();
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 );
81 92
82 /** 93 /**
83 * Set the gamma value of the video output 94 * Set the gamma value of the video output
84 * @param int value between -100 and 100, 0 is original 95 * @param int value between -100 and 100, 0 is original
85 */ 96 */
86 void setGamma( int ); 97 void setGamma( int );
87 98
88 99
89private: 100private:
90 XINE::Lib *libXine; 101 XINE::Lib *libXine;
91 MediaDetect mdetect;
92 long m_currentTime; 102 long m_currentTime;
93 long m_position; 103 long m_position;
94 int m_length; 104 int m_length;
95 QString m_fileName; 105 QString m_fileName;
96 bool disabledSuspendScreenSaver : 1; 106 bool disabledSuspendScreenSaver : 1;
97 bool hasVideoChannel : 1; 107 bool hasVideoChannel : 1;
98 bool hasAudioChannel : 1; 108 bool hasAudioChannel : 1;
99 109
100signals: 110signals:
101 void positionChanged( long ); 111 void positionChanged( long );
102 112
103}; 113};