summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h6
3 files changed, 20 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 299239b..8896cfe 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,295 +1,297 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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#include <stdio.h> 34#include <stdio.h>
35#include <stdlib.h> 35#include <stdlib.h>
36#include <qimage.h> 36#include <qimage.h>
37#include <qtextstream.h> 37#include <qtextstream.h>
38#include <qpe/resource.h> 38#include <qpe/resource.h>
39 39
40#include <qfile.h> 40#include <qfile.h>
41#include <qdir.h> 41#include <qdir.h>
42 42
43#include <qgfx_qws.h> 43#include <qgfx_qws.h>
44#include <qdirectpainter_qws.h> 44#include <qdirectpainter_qws.h>
45 45
46#include <assert.h> 46#include <assert.h>
47 47
48#include "xinevideowidget.h" 48#include "xinevideowidget.h"
49#include "frame.h" 49#include "frame.h"
50#include "lib.h" 50#include "lib.h"
51 51
52 52
53typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 53typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
54 int width, int height,int bytes ); 54 int width, int height,int bytes );
55 55
56extern "C" { 56extern "C" {
57 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); 57 xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * );
58 int null_is_showing_video( const xine_vo_driver_t* self ); 58 int null_is_showing_video( const xine_vo_driver_t* self );
59 void null_set_show_video( const xine_vo_driver_t* self, int show ); 59 void null_set_show_video( const xine_vo_driver_t* self, int show );
60 int null_is_fullscreen( const xine_vo_driver_t* self ); 60 int null_is_fullscreen( const xine_vo_driver_t* self );
61 void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); 61 void null_set_fullscreen( const xine_vo_driver_t* self, int screen );
62 int null_is_scaling( const xine_vo_driver_t* self ); 62 int null_is_scaling( const xine_vo_driver_t* self );
63 void null_set_scaling( const xine_vo_driver_t* self, int scale ); 63 void null_set_scaling( const xine_vo_driver_t* self, int scale );
64 void null_set_gui_width( const xine_vo_driver_t* self, int width ); 64 void null_set_gui_width( const xine_vo_driver_t* self, int width );
65 void null_set_gui_height( const xine_vo_driver_t* self, int height ); 65 void null_set_gui_height( const xine_vo_driver_t* self, int height );
66 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); 66 void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb );
67 void null_set_videoGamma( const xine_vo_driver_t* self , int value ); 67 void null_set_videoGamma( const xine_vo_driver_t* self , int value );
68 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); 68 void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data );
69} 69}
70 70
71using namespace XINE; 71using namespace XINE;
72 72
73Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) 73Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
74{ 74{
75 m_initialized = false; 75 m_initialized = false;
76 m_duringInitialization = false; 76 m_duringInitialization = false;
77 m_video = false; 77 m_video = false;
78 m_wid = widget; 78 m_wid = widget;
79 printf("Lib"); 79 printf("Lib");
80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
81 // get the configuration 81 // get the configuration
82 82
83 // not really OO, should be an extra class, later 83 // not really OO, should be an extra class, later
84 if ( !QFile::exists(configPath) ) { 84 if ( !QFile::exists(configPath) ) {
85 QFile f(configPath); 85 QFile f(configPath);
86 f.open(IO_WriteOnly); 86 f.open(IO_WriteOnly);
87 QTextStream ts( &f ); 87 QTextStream ts( &f );
88 ts << "misc.memcpy_method:glibc\n"; 88 ts << "misc.memcpy_method:glibc\n";
89 f.close(); 89 f.close();
90 } 90 }
91 91
92 if ( initMode == InitializeImmediately ) { 92 if ( initMode == InitializeImmediately ) {
93 initialize(); 93 initialize();
94 m_initialized = true; 94 m_initialized = true;
95 } 95 }
96 else 96 else
97 assert( false ); 97 start();
98} 98}
99 99
100void Lib::run() 100void Lib::run()
101{ 101{
102 qDebug( "Lib::run() started" );
102 initialize(); 103 initialize();
103 m_initialized = true; 104 m_initialized = true;
105 qDebug( "Lib::run() finished" );
104} 106}
105 107
106void Lib::initialize() 108void Lib::initialize()
107{ 109{
108 m_duringInitialization = true; 110 m_duringInitialization = true;
109 m_xine = xine_new( ); 111 m_xine = xine_new( );
110 112
111 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 113 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
112 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 114 xine_config_load( m_xine, QFile::encodeName( configPath ) );
113 115
114 xine_init( m_xine ); 116 xine_init( m_xine );
115 117
116 // allocate oss for sound 118 // allocate oss for sound
117 // and fb for framebuffer 119 // and fb for framebuffer
118 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 120 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
119 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 121 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
120 122
121 123
122//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 124//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
123 125
124 126
125// null_display_handler( m_videoOutput, xine_display_frame, this ); 127// null_display_handler( m_videoOutput, xine_display_frame, this );
126 128
127 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 129 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
128 130
129 if (m_wid != 0 ) { 131 if (m_wid != 0 ) {
130 printf( "!0\n" ); 132 printf( "!0\n" );
131 setWidget( m_wid ); 133 setWidget( m_wid );
132 } 134 }
133 135
134 m_queue = xine_event_new_queue (m_stream); 136 m_queue = xine_event_new_queue (m_stream);
135 137
136 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 138 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
137 m_duringInitialization = false; 139 m_duringInitialization = false;
138} 140}
139 141
140Lib::~Lib() { 142Lib::~Lib() {
141 assert( isRunning() == false ); 143 assert( isRunning() == false );
142 assert( m_initialized ); 144 assert( m_initialized );
143 145
144// free( m_config ); 146// free( m_config );
145 147
146 xine_close( m_stream ); 148 xine_close( m_stream );
147 149
148 xine_event_dispose_queue( m_queue ); 150 xine_event_dispose_queue( m_queue );
149 151
150 xine_dispose( m_stream ); 152 xine_dispose( m_stream );
151 153
152 xine_exit( m_xine ); 154 xine_exit( m_xine );
153 /* FIXME either free or delete but valgrind bitches against both */ 155 /* FIXME either free or delete but valgrind bitches against both */
154 //free( m_videoOutput ); 156 //free( m_videoOutput );
155 //delete m_audioOutput; 157 //delete m_audioOutput;
156} 158}
157 159
158void Lib::resize ( const QSize &s ) { 160void Lib::resize ( const QSize &s ) {
159 assert( m_initialized || m_duringInitialization ); 161 assert( m_initialized || m_duringInitialization );
160 162
161 if ( s. width ( ) && s. height ( ) ) { 163 if ( s. width ( ) && s. height ( ) ) {
162 ::null_set_gui_width( m_videoOutput, s. width() ); 164 ::null_set_gui_width( m_videoOutput, s. width() );
163 ::null_set_gui_height( m_videoOutput, s. height() ); 165 ::null_set_gui_height( m_videoOutput, s. height() );
164 } 166 }
165} 167}
166 168
167int Lib::majorVersion() { 169int Lib::majorVersion() {
168 int major, minor, sub; 170 int major, minor, sub;
169 xine_get_version ( &major, &minor, &sub ); 171 xine_get_version ( &major, &minor, &sub );
170 return major; 172 return major;
171} 173}
172 174
173int Lib::minorVersion() { 175int Lib::minorVersion() {
174 int major, minor, sub; 176 int major, minor, sub;
175 xine_get_version ( &major, &minor, &sub ); 177 xine_get_version ( &major, &minor, &sub );
176 return minor; 178 return minor;
177} 179}
178 180
179int Lib::subVersion() { 181int Lib::subVersion() {
180 int major, minor, sub; 182 int major, minor, sub;
181 xine_get_version ( &major, &minor, &sub ); 183 xine_get_version ( &major, &minor, &sub );
182 return sub; 184 return sub;
183} 185}
184 186
185int Lib::play( const QString& fileName, int startPos, int start_time ) { 187int Lib::play( const QString& fileName, int startPos, int start_time ) {
186 assert( m_initialized ); 188 assert( m_initialized );
187 189
188 QString str = fileName.stripWhiteSpace(); 190 QString str = fileName.stripWhiteSpace();
189 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 191 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
190 return 0; 192 return 0;
191 } 193 }
192 return xine_play( m_stream, startPos, start_time); 194 return xine_play( m_stream, startPos, start_time);
193} 195}
194 196
195void Lib::stop() { 197void Lib::stop() {
196 assert( m_initialized ); 198 assert( m_initialized );
197 199
198 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 200 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
199 xine_stop( m_stream ); 201 xine_stop( m_stream );
200} 202}
201 203
202void Lib::pause( bool toggle ) { 204void Lib::pause( bool toggle ) {
203 assert( m_initialized ); 205 assert( m_initialized );
204 206
205 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 207 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
206} 208}
207 209
208int Lib::speed() const { 210int Lib::speed() const {
209 assert( m_initialized ); 211 assert( m_initialized );
210 212
211 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 213 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
212} 214}
213 215
214void Lib::setSpeed( int speed ) { 216void Lib::setSpeed( int speed ) {
215 assert( m_initialized ); 217 assert( m_initialized );
216 218
217 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 219 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
218} 220}
219 221
220int Lib::status() const { 222int Lib::status() const {
221 assert( m_initialized ); 223 assert( m_initialized );
222 224
223 return xine_get_status( m_stream ); 225 return xine_get_status( m_stream );
224} 226}
225 227
226int Lib::currentPosition() const { 228int Lib::currentPosition() const {
227 assert( m_initialized ); 229 assert( m_initialized );
228 230
229 int pos, time, length; 231 int pos, time, length;
230 xine_get_pos_length( m_stream, &pos, &time, &length ); 232 xine_get_pos_length( m_stream, &pos, &time, &length );
231 return pos; 233 return pos;
232} 234}
233 235
234int Lib::currentTime() const { 236int Lib::currentTime() const {
235 assert( m_initialized ); 237 assert( m_initialized );
236 238
237 int pos, time, length; 239 int pos, time, length;
238 xine_get_pos_length( m_stream, &pos, &time, &length ); 240 xine_get_pos_length( m_stream, &pos, &time, &length );
239 return time/1000; 241 return time/1000;
240} 242}
241 243
242int Lib::length() const { 244int Lib::length() const {
243 assert( m_initialized ); 245 assert( m_initialized );
244 246
245 int pos, time, length; 247 int pos, time, length;
246 xine_get_pos_length( m_stream, &pos, &time, &length ); 248 xine_get_pos_length( m_stream, &pos, &time, &length );
247 return length/1000; 249 return length/1000;
248} 250}
249 251
250bool Lib::isSeekable() const { 252bool Lib::isSeekable() const {
251 assert( m_initialized ); 253 assert( m_initialized );
252 254
253 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 255 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
254} 256}
255 257
256void Lib::seekTo( int time ) { 258void Lib::seekTo( int time ) {
257 assert( m_initialized ); 259 assert( m_initialized );
258 260
259 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 261 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
260 // since its now milliseconds we need *1000 262 // since its now milliseconds we need *1000
261 xine_play( m_stream, 0, time*1000 ); 263 xine_play( m_stream, 0, time*1000 );
262} 264}
263 265
264 266
265Frame Lib::currentFrame() const { 267Frame Lib::currentFrame() const {
266 assert( m_initialized ); 268 assert( m_initialized );
267 269
268 Frame frame; 270 Frame frame;
269 return frame; 271 return frame;
270}; 272};
271 273
272QString Lib::metaInfo( int number) const { 274QString Lib::metaInfo( int number) const {
273 assert( m_initialized ); 275 assert( m_initialized );
274 276
275 return xine_get_meta_info( m_stream, number ); 277 return xine_get_meta_info( m_stream, number );
276} 278}
277 279
278int Lib::error() const { 280int Lib::error() const {
279 assert( m_initialized ); 281 assert( m_initialized );
280 282
281 return xine_get_error( m_stream ); 283 return xine_get_error( m_stream );
282}; 284};
283 285
284void Lib::ensureInitialized() 286void Lib::ensureInitialized()
285{ 287{
286 if ( m_initialized ) 288 if ( m_initialized )
287 return; 289 return;
288 290
289 qDebug( "waiting for initialization thread to finish" ); 291 qDebug( "waiting for initialization thread to finish" );
290 wait(); 292 wait();
291 qDebug( "initialization thread finished!" ); 293 qDebug( "initialization thread finished!" );
292} 294}
293 295
294void Lib::setWidget( XineVideoWidget *widget ) 296void Lib::setWidget( XineVideoWidget *widget )
295{ 297{
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index d6fbb53..0ec6fad 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,404 +1,414 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h> 6#include <qfileinfo.h>
7 7
8#include <qmainwindow.h> 8#include <qmainwindow.h>
9#include <qmessagebox.h> 9#include <qmessagebox.h>
10#include <qwidgetstack.h> 10#include <qwidgetstack.h>
11#include <qfile.h> 11#include <qfile.h>
12 12
13#include "mediaplayer.h" 13#include "mediaplayer.h"
14#include "playlistwidget.h" 14#include "playlistwidget.h"
15#include "audiowidget.h" 15#include "audiowidget.h"
16#include "videowidget.h" 16#include "videowidget.h"
17#include "volumecontrol.h" 17#include "volumecontrol.h"
18#include "lib.h" 18#include "lib.h"
19 19
20#include "mediaplayerstate.h" 20#include "mediaplayerstate.h"
21 21
22// for setBacklight() 22// for setBacklight()
23#include <linux/fb.h> 23#include <linux/fb.h>
24#include <sys/file.h> 24#include <sys/file.h>
25#include <sys/ioctl.h> 25#include <sys/ioctl.h>
26 26
27 27
28 28
29 29
30#define FBIOBLANK 0x4611 30#define FBIOBLANK 0x4611
31 31
32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
34 34
35 m_audioUI = 0; 35 m_audioUI = 0;
36 m_videoUI = 0; 36 m_videoUI = 0;
37 m_xineControl = 0; 37 m_xineControl = 0;
38 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
38 39
39 fd=-1;fl=-1; 40 fd=-1;fl=-1;
40 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 41 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
41 42
42 qApp->processEvents(); 43 qApp->processEvents();
43 // QPEApplication::grabKeyboard(); // EVIL 44 // QPEApplication::grabKeyboard(); // EVIL
44 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 45 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
45 46
46 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 47 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
47 48
48// What is pauseCheck good for? (Simon) 49// What is pauseCheck good for? (Simon)
49// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 50// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
50 51
51 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 52 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
52 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 53 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
53 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 54 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
54 55
55 volControl = new VolumeControl; 56 volControl = new VolumeControl;
56 Config cfg( "OpiePlayer" ); 57 Config cfg( "OpiePlayer" );
57 cfg.setGroup("PlayList"); 58 cfg.setGroup("PlayList");
58 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 59 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
59 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 60 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
60 61
61 m_skinLoader = new SkinLoader; 62 m_skinLoader = new SkinLoader;
62 m_skinLoader->schedule( AudioWidget::guiInfo() ); 63 m_skinLoader->schedule( AudioWidget::guiInfo() );
63 m_skinLoader->schedule( VideoWidget::guiInfo() ); 64 m_skinLoader->schedule( VideoWidget::guiInfo() );
64 m_skinLoader->start(); 65 m_skinLoader->start();
65} 66}
66 67
67MediaPlayer::~MediaPlayer() { 68MediaPlayer::~MediaPlayer() {
69 // this shold never happen, but one never knows...
70 if ( xine ) {
71 xine->ensureInitialized();
72 delete xine;
73 }
68 delete m_xineControl; 74 delete m_xineControl;
69 delete m_audioUI; 75 delete m_audioUI;
70 delete m_videoUI; 76 delete m_videoUI;
71 delete volControl; 77 delete volControl;
72} 78}
73 79
74void MediaPlayer::pauseCheck( bool b ) { 80void MediaPlayer::pauseCheck( bool b ) {
75 if ( b && !mediaPlayerState.isPlaying() ) { 81 if ( b && !mediaPlayerState.isPlaying() ) {
76 mediaPlayerState.setPaused( FALSE ); 82 mediaPlayerState.setPaused( FALSE );
77 } 83 }
78} 84}
79 85
80void MediaPlayer::play() { 86void MediaPlayer::play() {
81 mediaPlayerState.setPlaying( FALSE ); 87 mediaPlayerState.setPlaying( FALSE );
82 mediaPlayerState.setPlaying( TRUE ); 88 mediaPlayerState.setPlaying( TRUE );
83} 89}
84 90
85void MediaPlayer::setPlaying( bool play ) { 91void MediaPlayer::setPlaying( bool play ) {
86 if ( !play ) { 92 if ( !play ) {
87 return; 93 return;
88 } 94 }
89 95
90 if ( mediaPlayerState.isPaused() ) { 96 if ( mediaPlayerState.isPaused() ) {
91 mediaPlayerState.setPaused( FALSE ); 97 mediaPlayerState.setPaused( FALSE );
92 return; 98 return;
93 } 99 }
94 100
95 QString tickerText, time, fileName; 101 QString tickerText, time, fileName;
96 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { 102 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
97 //if playing in file list.. play in a different way 103 //if playing in file list.. play in a different way
98 // random and looping settings enabled causes problems here, 104 // random and looping settings enabled causes problems here,
99 // since there is no selected file in the playlist, but a selected file in the file list, 105 // since there is no selected file in the playlist, but a selected file in the file list,
100 // so we remember and shutoff 106 // so we remember and shutoff
101 l = mediaPlayerState.isLooping(); 107 l = mediaPlayerState.isLooping();
102 if(l) { 108 if(l) {
103 mediaPlayerState.setLooping( false ); 109 mediaPlayerState.setLooping( false );
104 } 110 }
105 r = mediaPlayerState.isShuffled(); 111 r = mediaPlayerState.isShuffled();
106 mediaPlayerState.setShuffled( false ); 112 mediaPlayerState.setShuffled( false );
107 } 113 }
108 114
109 PlayListWidget::Entry playListEntry = playList.currentEntry(); 115 PlayListWidget::Entry playListEntry = playList.currentEntry();
110 fileName = playListEntry.name; 116 fileName = playListEntry.name;
111 xineControl()->play( playListEntry.file ); 117 xineControl()->play( playListEntry.file );
112 118
113 long seconds = mediaPlayerState.length(); 119 long seconds = mediaPlayerState.length();
114 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 120 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
115 121
116 if( fileName.left(4) == "http" ) { 122 if( fileName.left(4) == "http" ) {
117 fileName = QFileInfo( fileName ).baseName(); 123 fileName = QFileInfo( fileName ).baseName();
118 if ( xineControl()->getMetaInfo().isEmpty() ) { 124 if ( xineControl()->getMetaInfo().isEmpty() ) {
119 tickerText = tr( " File: " ) + fileName; 125 tickerText = tr( " File: " ) + fileName;
120 } else { 126 } else {
121 tickerText = xineControl()->getMetaInfo(); 127 tickerText = xineControl()->getMetaInfo();
122 } 128 }
123 } else { 129 } else {
124 if ( xineControl()->getMetaInfo().isEmpty() ) { 130 if ( xineControl()->getMetaInfo().isEmpty() ) {
125 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 131 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
126 } else { 132 } else {
127 tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; 133 tickerText = xineControl()->getMetaInfo() + " Length: " + time + " ";
128 } 134 }
129 } 135 }
130 audioUI()->setTickerText( tickerText ); 136 audioUI()->setTickerText( tickerText );
131} 137}
132 138
133 139
134void MediaPlayer::prev() { 140void MediaPlayer::prev() {
135 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 141 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
136 if ( playList.prev() ) { 142 if ( playList.prev() ) {
137 play(); 143 play();
138 } else if ( mediaPlayerState.isLooping() ) { 144 } else if ( mediaPlayerState.isLooping() ) {
139 if ( playList.last() ) { 145 if ( playList.last() ) {
140 play(); 146 play();
141 } 147 }
142 } else { 148 } else {
143 mediaPlayerState.setList(); 149 mediaPlayerState.setList();
144 } 150 }
145 } 151 }
146} 152}
147 153
148 154
149void MediaPlayer::next() { 155void MediaPlayer::next() {
150 156
151 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 157 if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
152 if ( playList.next() ) { 158 if ( playList.next() ) {
153 play(); 159 play();
154 } else if ( mediaPlayerState.isLooping() ) { 160 } else if ( mediaPlayerState.isLooping() ) {
155 if ( playList.first() ) { 161 if ( playList.first() ) {
156 play(); 162 play();
157 } 163 }
158 } else { 164 } else {
159 mediaPlayerState.setList(); 165 mediaPlayerState.setList();
160 } 166 }
161 } else { //if playing from file list, let's just stop 167 } else { //if playing from file list, let's just stop
162 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 168 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
163 mediaPlayerState.setPlaying(false); 169 mediaPlayerState.setPlaying(false);
164 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); 170 mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection );
165 if(l) mediaPlayerState.setLooping(l); 171 if(l) mediaPlayerState.setLooping(l);
166 if(r) mediaPlayerState.setShuffled(r); 172 if(r) mediaPlayerState.setShuffled(r);
167 } 173 }
168 qApp->processEvents(); 174 qApp->processEvents();
169} 175}
170 176
171 177
172void MediaPlayer::startDecreasingVolume() { 178void MediaPlayer::startDecreasingVolume() {
173 volumeDirection = -1; 179 volumeDirection = -1;
174 startTimer( 100 ); 180 startTimer( 100 );
175 volControl->decVol(2); 181 volControl->decVol(2);
176} 182}
177 183
178 184
179void MediaPlayer::startIncreasingVolume() { 185void MediaPlayer::startIncreasingVolume() {
180 volumeDirection = +1; 186 volumeDirection = +1;
181 startTimer( 100 ); 187 startTimer( 100 );
182 volControl->incVol(2); 188 volControl->incVol(2);
183} 189}
184 190
185 191
186bool drawnOnScreenDisplay = FALSE; 192bool drawnOnScreenDisplay = FALSE;
187unsigned int onScreenDisplayVolume = 0; 193unsigned int onScreenDisplayVolume = 0;
188const int yoff = 110; 194const int yoff = 110;
189 195
190void MediaPlayer::stopChangingVolume() { 196void MediaPlayer::stopChangingVolume() {
191 killTimers(); 197 killTimers();
192 // Get rid of the on-screen display stuff 198 // Get rid of the on-screen display stuff
193 drawnOnScreenDisplay = FALSE; 199 drawnOnScreenDisplay = FALSE;
194 onScreenDisplayVolume = 0; 200 onScreenDisplayVolume = 0;
195 int w=0; 201 int w=0;
196 int h=0; 202 int h=0;
197 if( !xineControl()->hasVideo() ) { 203 if( !xineControl()->hasVideo() ) {
198 w = audioUI()->width(); 204 w = audioUI()->width();
199 h = audioUI()->height(); 205 h = audioUI()->height();
200 audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 206 audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
201 } else { 207 } else {
202 w = videoUI()->width(); 208 w = videoUI()->width();
203 h = videoUI()->height(); 209 h = videoUI()->height();
204 videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 210 videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
205 } 211 }
206} 212}
207 213
208 214
209void MediaPlayer::timerEvent( QTimerEvent * ) { 215void MediaPlayer::timerEvent( QTimerEvent * ) {
210 if ( volumeDirection == +1 ) { 216 if ( volumeDirection == +1 ) {
211 volControl->incVol( 2 ); 217 volControl->incVol( 2 );
212 } else if ( volumeDirection == -1 ) { 218 } else if ( volumeDirection == -1 ) {
213 volControl->decVol( 2 ); 219 volControl->decVol( 2 );
214 } 220 }
215 221
216 222
217 // TODO FIXME 223 // TODO FIXME
218 // huh?? 224 // huh??
219 unsigned int v= 0; 225 unsigned int v= 0;
220 v = volControl->volume(); 226 v = volControl->volume();
221 v = v / 10; 227 v = v / 10;
222 228
223 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 229 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
224 return; 230 return;
225 } 231 }
226 232
227 int w=0; int h=0; 233 int w=0; int h=0;
228 if( !xineControl()->hasVideo() ) { 234 if( !xineControl()->hasVideo() ) {
229 w = audioUI()->width(); 235 w = audioUI()->width();
230 h = audioUI()->height(); 236 h = audioUI()->height();
231 237
232 if ( drawnOnScreenDisplay ) { 238 if ( drawnOnScreenDisplay ) {
233 if ( onScreenDisplayVolume > v ) { 239 if ( onScreenDisplayVolume > v ) {
234 audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 240 audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
235 } 241 }
236 } 242 }
237 drawnOnScreenDisplay = TRUE; 243 drawnOnScreenDisplay = TRUE;
238 onScreenDisplayVolume = v; 244 onScreenDisplayVolume = v;
239 QPainter p( audioUI() ); 245 QPainter p( audioUI() );
240 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 246 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
241 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 247 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
242 248
243 QFont f; 249 QFont f;
244 f.setPixelSize( 20 ); 250 f.setPixelSize( 20 );
245 f.setBold( TRUE ); 251 f.setBold( TRUE );
246 p.setFont( f ); 252 p.setFont( f );
247 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 253 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
248 254
249 for ( unsigned int i = 0; i < 10; i++ ) { 255 for ( unsigned int i = 0; i < 10; i++ ) {
250 if ( v > i ) { 256 if ( v > i ) {
251 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 257 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
252 } else { 258 } else {
253 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 259 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
254 } 260 }
255 } 261 }
256 } else { 262 } else {
257 w = videoUI()->width(); 263 w = videoUI()->width();
258 h = videoUI()->height(); 264 h = videoUI()->height();
259 265
260 if ( drawnOnScreenDisplay ) { 266 if ( drawnOnScreenDisplay ) {
261 if ( onScreenDisplayVolume > v ) { 267 if ( onScreenDisplayVolume > v ) {
262 videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 268 videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
263 } 269 }
264 } 270 }
265 drawnOnScreenDisplay = TRUE; 271 drawnOnScreenDisplay = TRUE;
266 onScreenDisplayVolume = v; 272 onScreenDisplayVolume = v;
267 QPainter p( videoUI() ); 273 QPainter p( videoUI() );
268 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 274 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
269 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 275 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
270 276
271 QFont f; 277 QFont f;
272 f.setPixelSize( 20 ); 278 f.setPixelSize( 20 );
273 f.setBold( TRUE ); 279 f.setBold( TRUE );
274 p.setFont( f ); 280 p.setFont( f );
275 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 281 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
276 282
277 for ( unsigned int i = 0; i < 10; i++ ) { 283 for ( unsigned int i = 0; i < 10; i++ ) {
278 if ( v > i ) { 284 if ( v > i ) {
279 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 285 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
280 } else { 286 } else {
281 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 287 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
282 } 288 }
283 } 289 }
284 } 290 }
285} 291}
286 292
287 293
288void MediaPlayer::blank( bool b ) { 294void MediaPlayer::blank( bool b ) {
289 fd=open("/dev/fb0",O_RDWR); 295 fd=open("/dev/fb0",O_RDWR);
290#ifdef QT_QWS_EBX 296#ifdef QT_QWS_EBX
291 fl= open( "/dev/fl", O_RDWR ); 297 fl= open( "/dev/fl", O_RDWR );
292#endif 298#endif
293 if (fd != -1) { 299 if (fd != -1) {
294 if ( b ) { 300 if ( b ) {
295 qDebug("do blanking"); 301 qDebug("do blanking");
296#ifdef QT_QWS_EBX 302#ifdef QT_QWS_EBX
297 ioctl( fd, FBIOBLANK, 1 ); 303 ioctl( fd, FBIOBLANK, 1 );
298 if(fl !=-1) { 304 if(fl !=-1) {
299 ioctl( fl, 2 ); 305 ioctl( fl, 2 );
300 ::close(fl); 306 ::close(fl);
301 } 307 }
302#else 308#else
303 ioctl( fd, FBIOBLANK, 3 ); 309 ioctl( fd, FBIOBLANK, 3 );
304#endif 310#endif
305 isBlanked = TRUE; 311 isBlanked = TRUE;
306 } else { 312 } else {
307 qDebug("do unblanking"); 313 qDebug("do unblanking");
308 ioctl( fd, FBIOBLANK, 0); 314 ioctl( fd, FBIOBLANK, 0);
309#ifdef QT_QWS_EBX 315#ifdef QT_QWS_EBX
310 if(fl != -1) { 316 if(fl != -1) {
311 ioctl( fl, 1); 317 ioctl( fl, 1);
312 ::close(fl); 318 ::close(fl);
313 } 319 }
314#endif 320#endif
315 isBlanked = FALSE; 321 isBlanked = FALSE;
316 } 322 }
317 close( fd ); 323 close( fd );
318 } else { 324 } else {
319 qDebug("<< /dev/fb0 could not be opened >>"); 325 qDebug("<< /dev/fb0 could not be opened >>");
320 } 326 }
321} 327}
322 328
323void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 329void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
324 switch ( e->key() ) { 330 switch ( e->key() ) {
325////////////////////////////// Zaurus keys 331////////////////////////////// Zaurus keys
326 case Key_Home: 332 case Key_Home:
327 break; 333 break;
328 case Key_F9: //activity 334 case Key_F9: //activity
329 break; 335 break;
330 case Key_F10: //contacts 336 case Key_F10: //contacts
331 break; 337 break;
332 case Key_F11: //menu 338 case Key_F11: //menu
333 break; 339 break;
334 case Key_F12: //home 340 case Key_F12: //home
335 qDebug("Blank here"); 341 qDebug("Blank here");
336// mediaPlayerState->toggleBlank(); 342// mediaPlayerState->toggleBlank();
337 break; 343 break;
338 case Key_F13: //mail 344 case Key_F13: //mail
339 qDebug("Blank here"); 345 qDebug("Blank here");
340 // mediaPlayerState->toggleBlank(); 346 // mediaPlayerState->toggleBlank();
341 break; 347 break;
342 } 348 }
343} 349}
344 350
345void MediaPlayer::cleanUp() {// this happens on closing 351void MediaPlayer::cleanUp() {// this happens on closing
346 Config cfg( "OpiePlayer" ); 352 Config cfg( "OpiePlayer" );
347 mediaPlayerState.writeConfig( cfg ); 353 mediaPlayerState.writeConfig( cfg );
348 playList.writeDefaultPlaylist( ); 354 playList.writeDefaultPlaylist( );
349 355
350// QPEApplication::grabKeyboard(); 356// QPEApplication::grabKeyboard();
351// QPEApplication::ungrabKeyboard(); 357// QPEApplication::ungrabKeyboard();
352} 358}
353 359
354void MediaPlayer::recreateAudioAndVideoWidgets() const 360void MediaPlayer::recreateAudioAndVideoWidgets() const
355{ 361{
356 delete m_skinLoader; 362 delete m_skinLoader;
357 363
358 delete m_xineControl; 364 delete m_xineControl;
359 delete m_audioUI; 365 delete m_audioUI;
360 delete m_videoUI; 366 delete m_videoUI;
361 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 367 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
362 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 368 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
363 369
364 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 370 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
365 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 371 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
366 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 372 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
367 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 373 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
368 374
369 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 375 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
370 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 376 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
371 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 377 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
372 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 378 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
373 379
374 XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); 380 if ( !xine )
381 xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
382
375 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); 383 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState );
384
385 xine = 0;
376} 386}
377 387
378AudioWidget *MediaPlayer::audioUI() const 388AudioWidget *MediaPlayer::audioUI() const
379{ 389{
380 if ( !m_audioUI ) 390 if ( !m_audioUI )
381 recreateAudioAndVideoWidgets(); 391 recreateAudioAndVideoWidgets();
382 return m_audioUI; 392 return m_audioUI;
383} 393}
384 394
385VideoWidget *MediaPlayer::videoUI() const 395VideoWidget *MediaPlayer::videoUI() const
386{ 396{
387 if ( !m_videoUI ) 397 if ( !m_videoUI )
388 recreateAudioAndVideoWidgets(); 398 recreateAudioAndVideoWidgets();
389 return m_videoUI; 399 return m_videoUI;
390} 400}
391 401
392XineControl *MediaPlayer::xineControl() const 402XineControl *MediaPlayer::xineControl() const
393{ 403{
394 if ( !m_xineControl ) 404 if ( !m_xineControl )
395 recreateAudioAndVideoWidgets(); 405 recreateAudioAndVideoWidgets();
396 return m_xineControl; 406 return m_xineControl;
397} 407}
398 408
399void MediaPlayer::reloadSkins() 409void MediaPlayer::reloadSkins()
400{ 410{
401 audioUI()->loadSkin(); 411 audioUI()->loadSkin();
402 videoUI()->loadSkin(); 412 videoUI()->loadSkin();
403} 413}
404 414
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 351c884..cbe4d86 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,99 +1,105 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library 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 MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qframe.h> 38#include <qframe.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41 41
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43#include "skin.h" 43#include "skin.h"
44 44
45class DocLnk; 45class DocLnk;
46class VolumeControl; 46class VolumeControl;
47class MediaPlayerState; 47class MediaPlayerState;
48class AudioWidget; 48class AudioWidget;
49class VideoWidget; 49class VideoWidget;
50 50
51namespace XINE
52{
53 class Lib;
54};
55
51class MediaPlayer : public QObject { 56class MediaPlayer : public QObject {
52 Q_OBJECT 57 Q_OBJECT
53public: 58public:
54 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ); 59 MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name );
55 ~MediaPlayer(); 60 ~MediaPlayer();
56 61
57public slots: 62public slots:
58 void reloadSkins(); 63 void reloadSkins();
59 64
60private slots: 65private slots:
61 void setPlaying( bool ); 66 void setPlaying( bool );
62 void pauseCheck( bool ); 67 void pauseCheck( bool );
63 void play(); 68 void play();
64 void next(); 69 void next();
65 void prev(); 70 void prev();
66 void startIncreasingVolume(); 71 void startIncreasingVolume();
67 void startDecreasingVolume(); 72 void startDecreasingVolume();
68 void stopChangingVolume(); 73 void stopChangingVolume();
69 void cleanUp(); 74 void cleanUp();
70 void blank( bool ); 75 void blank( bool );
71 76
72protected: 77protected:
73 void timerEvent( QTimerEvent *e ); 78 void timerEvent( QTimerEvent *e );
74 void keyReleaseEvent( QKeyEvent *e); 79 void keyReleaseEvent( QKeyEvent *e);
75 80
76private: 81private:
77 AudioWidget *audioUI() const; 82 AudioWidget *audioUI() const;
78 VideoWidget *videoUI() const; 83 VideoWidget *videoUI() const;
79 XineControl *xineControl() const; 84 XineControl *xineControl() const;
80 85
81 bool isBlanked, l, r; 86 bool isBlanked, l, r;
82 int fd, fl; 87 int fd, fl;
83 int volumeDirection; 88 int volumeDirection;
84 VolumeControl *volControl; 89 VolumeControl *volControl;
85 MediaPlayerState &mediaPlayerState; 90 MediaPlayerState &mediaPlayerState;
86 PlayListWidget &playList; 91 PlayListWidget &playList;
87 92
88 void recreateAudioAndVideoWidgets() const; 93 void recreateAudioAndVideoWidgets() const;
89 94
90 mutable XineControl *m_xineControl; 95 mutable XineControl *m_xineControl;
91 mutable AudioWidget *m_audioUI; 96 mutable AudioWidget *m_audioUI;
92 mutable VideoWidget *m_videoUI; 97 mutable VideoWidget *m_videoUI;
98 mutable XINE::Lib *xine;
93 99
94 QGuardedPtr<SkinLoader> m_skinLoader; 100 QGuardedPtr<SkinLoader> m_skinLoader;
95}; 101};
96 102
97 103
98#endif // MEDIA_PLAYER_H 104#endif // MEDIA_PLAYER_H
99 105