summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 00:29:22 (UTC)
committer simon <simon>2002-12-11 00:29:22 (UTC)
commit7d5782ef4fd19498a141ed68c23145dcc6128146 (patch) (unidiff)
tree8cdbd360962b3fa161823fa88b43e9584b23a464
parent6c71f5ccd9506234a317d9ff3d119613c457e769 (diff)
downloadopie-7d5782ef4fd19498a141ed68c23145dcc6128146.zip
opie-7d5782ef4fd19498a141ed68c23145dcc6128146.tar.gz
opie-7d5782ef4fd19498a141ed68c23145dcc6128146.tar.bz2
- initialized xine in a background thread. much time is still spend in
skin loading though.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/lib.h18
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h2
5 files changed, 42 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 99d5de6..20fd1e2 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,372 +1,389 @@
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( XineVideoWidget* widget ) { 73Lib::Lib( XineVideoWidget* widget )
74{
75 ThreadUtil::AutoLock lock( m_initGuard );
74 m_initialized = false; 76 m_initialized = false;
75 m_video = false; 77 m_video = false;
76 m_wid = widget; 78 m_wid = widget;
77 printf("Lib"); 79 printf("Lib");
78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
79 // get the configuration 81 // get the configuration
80 82
81 // not really OO, should be an extra class, later 83 // not really OO, should be an extra class, later
82 if ( !QFile::exists(configPath) ) { 84 if ( !QFile::exists(configPath) ) {
83 QFile f(configPath); 85 QFile f(configPath);
84 f.open(IO_WriteOnly); 86 f.open(IO_WriteOnly);
85 QTextStream ts( &f ); 87 QTextStream ts( &f );
86 ts << "misc.memcpy_method:glibc\n"; 88 ts << "misc.memcpy_method:glibc\n";
87 f.close(); 89 f.close();
88 } 90 }
89 91
92 start();
93}
94
95void Lib::run()
96{
90 initialize(); 97 initialize();
91} 98}
92 99
93void Lib::initialize() 100void Lib::initialize()
94{ 101{
95 m_xine = xine_new( ); 102 m_xine = xine_new( );
96 103
97 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 104 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
98 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 105 xine_config_load( m_xine, QFile::encodeName( configPath ) );
99 106
100 xine_init( m_xine ); 107 xine_init( m_xine );
101 108
102 // allocate oss for sound 109 // allocate oss for sound
103 // and fb for framebuffer 110 // and fb for framebuffer
104 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 111 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
105 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 112 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
106 113
107 114
108//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 115//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
109 116
110 117
111// null_display_handler( m_videoOutput, xine_display_frame, this ); 118// null_display_handler( m_videoOutput, xine_display_frame, this );
112 119
113 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 120 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
114 121
115 if (m_wid != 0 ) { 122 if (m_wid != 0 ) {
116 printf( "!0\n" ); 123 printf( "!0\n" );
117 resize ( m_wid-> size ( ) ); 124 resize ( m_wid-> size ( ) );
118 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 125 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
119 126
120// m_wid->repaint(); 127// m_wid->repaint();
121 } 128 }
122 129
123 m_queue = xine_event_new_queue (m_stream); 130 m_queue = xine_event_new_queue (m_stream);
124 131
125 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 132 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
126 133
134 ThreadUtil::AutoLock lock( m_initGuard );
127 m_initialized = true; 135 m_initialized = true;
136
137 send( new ThreadUtil::ChannelMessage( InitializationMessageType ), OneWay );
128} 138}
129 139
130Lib::~Lib() { 140Lib::~Lib() {
131 ThreadUtil::AutoLock lock( m_initGuard ); 141 ThreadUtil::AutoLock lock( m_initGuard );
132 142
133 assert( m_initialized ); 143 assert( m_initialized );
134 144
135// free( m_config ); 145// free( m_config );
136 146
137 xine_close( m_stream ); 147 xine_close( m_stream );
138 148
139 xine_event_dispose_queue( m_queue ); 149 xine_event_dispose_queue( m_queue );
140 150
141 xine_dispose( m_stream ); 151 xine_dispose( m_stream );
142 152
143 xine_exit( m_xine ); 153 xine_exit( m_xine );
144 /* FIXME either free or delete but valgrind bitches against both */ 154 /* FIXME either free or delete but valgrind bitches against both */
145 //free( m_videoOutput ); 155 //free( m_videoOutput );
146 //delete m_audioOutput; 156 //delete m_audioOutput;
147} 157}
148 158
149void Lib::assertInitialized() const 159void Lib::assertInitialized() const
150{ 160{
151 ThreadUtil::AutoLock lock( m_initGuard ); 161 ThreadUtil::AutoLock lock( m_initGuard );
152 162
153 if ( m_initialized ) 163 if ( m_initialized )
154 return; 164 return;
155 165
156 qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" ); 166 qDebug( "LibXine: xine function called while not being initialized, yet! Fix the caller!" );
157 assert( m_initialized ); 167 assert( m_initialized );
158} 168}
159 169
160void Lib::resize ( const QSize &s ) { 170void Lib::resize ( const QSize &s ) {
161 if ( s. width ( ) && s. height ( ) ) { 171 if ( s. width ( ) && s. height ( ) ) {
162 ::null_set_gui_width( m_videoOutput, s. width() ); 172 ::null_set_gui_width( m_videoOutput, s. width() );
163 ::null_set_gui_height( m_videoOutput, s. height() ); 173 ::null_set_gui_height( m_videoOutput, s. height() );
164 } 174 }
165} 175}
166 176
167int Lib::majorVersion() { 177int Lib::majorVersion() {
168 int major, minor, sub; 178 int major, minor, sub;
169 xine_get_version ( &major, &minor, &sub ); 179 xine_get_version ( &major, &minor, &sub );
170 return major; 180 return major;
171} 181}
172 182
173int Lib::minorVersion() { 183int Lib::minorVersion() {
174 int major, minor, sub; 184 int major, minor, sub;
175 xine_get_version ( &major, &minor, &sub ); 185 xine_get_version ( &major, &minor, &sub );
176 return minor; 186 return minor;
177} 187}
178 188
179int Lib::subVersion() { 189int Lib::subVersion() {
180 int major, minor, sub; 190 int major, minor, sub;
181 xine_get_version ( &major, &minor, &sub ); 191 xine_get_version ( &major, &minor, &sub );
182 return sub; 192 return sub;
183} 193}
184 194
185int Lib::play( const QString& fileName, int startPos, int start_time ) { 195int Lib::play( const QString& fileName, int startPos, int start_time ) {
186 assertInitialized(); 196 assertInitialized();
187 197
188 QString str = fileName.stripWhiteSpace(); 198 QString str = fileName.stripWhiteSpace();
189 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) { 199 if ( !xine_open( m_stream, QFile::encodeName(str.utf8() ).data() ) ) {
190 return 0; 200 return 0;
191 } 201 }
192 return xine_play( m_stream, startPos, start_time); 202 return xine_play( m_stream, startPos, start_time);
193} 203}
194 204
195void Lib::stop() { 205void Lib::stop() {
196 assertInitialized(); 206 assertInitialized();
197 207
198 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 208 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
199 xine_stop( m_stream ); 209 xine_stop( m_stream );
200} 210}
201 211
202void Lib::pause( bool toggle ) { 212void Lib::pause( bool toggle ) {
203 assertInitialized(); 213 assertInitialized();
204 214
205 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); 215 xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL );
206} 216}
207 217
208int Lib::speed() const { 218int Lib::speed() const {
209 assertInitialized(); 219 assertInitialized();
210 220
211 return xine_get_param ( m_stream, XINE_PARAM_SPEED ); 221 return xine_get_param ( m_stream, XINE_PARAM_SPEED );
212} 222}
213 223
214void Lib::setSpeed( int speed ) { 224void Lib::setSpeed( int speed ) {
215 assertInitialized(); 225 assertInitialized();
216 226
217 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); 227 xine_set_param ( m_stream, XINE_PARAM_SPEED, speed );
218} 228}
219 229
220int Lib::status() const { 230int Lib::status() const {
221 assertInitialized(); 231 assertInitialized();
222 232
223 return xine_get_status( m_stream ); 233 return xine_get_status( m_stream );
224} 234}
225 235
226int Lib::currentPosition() const { 236int Lib::currentPosition() const {
227 assertInitialized(); 237 assertInitialized();
228 238
229 int pos, time, length; 239 int pos, time, length;
230 xine_get_pos_length( m_stream, &pos, &time, &length ); 240 xine_get_pos_length( m_stream, &pos, &time, &length );
231 return pos; 241 return pos;
232} 242}
233 243
234int Lib::currentTime() const { 244int Lib::currentTime() const {
235 assertInitialized(); 245 assertInitialized();
236 246
237 int pos, time, length; 247 int pos, time, length;
238 xine_get_pos_length( m_stream, &pos, &time, &length ); 248 xine_get_pos_length( m_stream, &pos, &time, &length );
239 return time/1000; 249 return time/1000;
240} 250}
241 251
242int Lib::length() const { 252int Lib::length() const {
243 assertInitialized(); 253 assertInitialized();
244 254
245 int pos, time, length; 255 int pos, time, length;
246 xine_get_pos_length( m_stream, &pos, &time, &length ); 256 xine_get_pos_length( m_stream, &pos, &time, &length );
247 return length/1000; 257 return length/1000;
248} 258}
249 259
250bool Lib::isSeekable() const { 260bool Lib::isSeekable() const {
251 assertInitialized(); 261 assertInitialized();
252 262
253 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 263 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
254} 264}
255 265
256void Lib::seekTo( int time ) { 266void Lib::seekTo( int time ) {
257 assertInitialized(); 267 assertInitialized();
258 268
259 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 269 //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 270 // since its now milliseconds we need *1000
261 xine_play( m_stream, 0, time*1000 ); 271 xine_play( m_stream, 0, time*1000 );
262} 272}
263 273
264 274
265Frame Lib::currentFrame() const { 275Frame Lib::currentFrame() const {
266 assertInitialized(); 276 assertInitialized();
267 277
268 Frame frame; 278 Frame frame;
269 return frame; 279 return frame;
270}; 280};
271 281
272QString Lib::metaInfo( int number) const { 282QString Lib::metaInfo( int number) const {
273 assertInitialized(); 283 assertInitialized();
274 284
275 return xine_get_meta_info( m_stream, number ); 285 return xine_get_meta_info( m_stream, number );
276} 286}
277 287
278int Lib::error() const { 288int Lib::error() const {
279 assertInitialized(); 289 assertInitialized();
280 290
281 return xine_get_error( m_stream ); 291 return xine_get_error( m_stream );
282}; 292};
283 293
284void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 294void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
285{ 295{
286 assert( sendType == ThreadUtil::Channel::OneWay ); 296 assert( sendType == ThreadUtil::Channel::OneWay );
287 handleXineEvent( msg->type() ); 297 switch ( msg->type() ) {
298 case XineMessageType:
299 handleXineEvent( static_cast<XineMessage *>( msg )->xineEvent );
300 break;
301 case InitializationMessageType:
302 emit initialized();
303 break;
304 }
288 delete msg; 305 delete msg;
289} 306}
290 307
291void Lib::handleXineEvent( const xine_event_t* t ) { 308void Lib::handleXineEvent( const xine_event_t* t ) {
292 send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); 309 send( new XineMessage( t->type ), OneWay );
293} 310}
294 311
295void Lib::handleXineEvent( int type ) { 312void Lib::handleXineEvent( int type ) {
296 assertInitialized(); 313 assertInitialized();
297 314
298 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 315 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
299 emit stopped(); 316 emit stopped();
300 } 317 }
301} 318}
302 319
303 320
304void Lib::setShowVideo( bool video ) { 321void Lib::setShowVideo( bool video ) {
305 assertInitialized(); 322 assertInitialized();
306 323
307 m_video = video; 324 m_video = video;
308 ::null_set_show_video( m_videoOutput, video ); 325 ::null_set_show_video( m_videoOutput, video );
309} 326}
310 327
311bool Lib::isShowingVideo() const { 328bool Lib::isShowingVideo() const {
312 assertInitialized(); 329 assertInitialized();
313 330
314 return ::null_is_showing_video( m_videoOutput ); 331 return ::null_is_showing_video( m_videoOutput );
315} 332}
316 333
317bool Lib::hasVideo() const { 334bool Lib::hasVideo() const {
318 assertInitialized(); 335 assertInitialized();
319 336
320 return xine_get_stream_info( m_stream, 18 ); 337 return xine_get_stream_info( m_stream, 18 );
321} 338}
322 339
323void Lib::showVideoFullScreen( bool fullScreen ) { 340void Lib::showVideoFullScreen( bool fullScreen ) {
324 assertInitialized(); 341 assertInitialized();
325 342
326 ::null_set_fullscreen( m_videoOutput, fullScreen ); 343 ::null_set_fullscreen( m_videoOutput, fullScreen );
327} 344}
328 345
329bool Lib::isVideoFullScreen() const { 346bool Lib::isVideoFullScreen() const {
330 assertInitialized(); 347 assertInitialized();
331 348
332 return ::null_is_fullscreen( m_videoOutput ); 349 return ::null_is_fullscreen( m_videoOutput );
333} 350}
334 351
335void Lib::setScaling( bool scale ) { 352void Lib::setScaling( bool scale ) {
336 assertInitialized(); 353 assertInitialized();
337 354
338 ::null_set_scaling( m_videoOutput, scale ); 355 ::null_set_scaling( m_videoOutput, scale );
339} 356}
340 357
341void Lib::setGamma( int value ) { 358void Lib::setGamma( int value ) {
342 assertInitialized(); 359 assertInitialized();
343 360
344 //qDebug( QString( "%1").arg(value) ); 361 //qDebug( QString( "%1").arg(value) );
345 /* int gammaValue = ( 100 + value ); */ 362 /* int gammaValue = ( 100 + value ); */
346 ::null_set_videoGamma( m_videoOutput, value ); 363 ::null_set_videoGamma( m_videoOutput, value );
347} 364}
348 365
349bool Lib::isScaling() const { 366bool Lib::isScaling() const {
350 assertInitialized(); 367 assertInitialized();
351 368
352 return ::null_is_scaling( m_videoOutput ); 369 return ::null_is_scaling( m_videoOutput );
353} 370}
354 371
355void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 372void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
356 ( (Lib*)user_data)->handleXineEvent( t ); 373 ( (Lib*)user_data)->handleXineEvent( t );
357} 374}
358 375
359void Lib::xine_display_frame( void* user_data, uint8_t *frame, 376void Lib::xine_display_frame( void* user_data, uint8_t *frame,
360 int width, int height, int bytes ) { 377 int width, int height, int bytes ) {
361 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 378 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
362} 379}
363 380
364void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 381void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
365 assertInitialized(); 382 assertInitialized();
366 383
367 if ( !m_video ) { 384 if ( !m_video ) {
368 qWarning("not showing video now"); 385 qWarning("not showing video now");
369 return; 386 return;
370 } 387 }
371 m_wid-> setVideoFrame ( frame, width, height, bytes ); 388 m_wid-> setVideoFrame ( frame, width, height, bytes );
372} 389}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 4b8dc81..34b85b9 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -1,212 +1,228 @@
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 ZECKEXINELIB_H 34#ifndef ZECKEXINELIB_H
35#define ZECKEXINELIB_H 35#define ZECKEXINELIB_H
36 36
37#include <qcstring.h> 37#include <qcstring.h>
38#include <qstring.h> 38#include <qstring.h>
39#include <qobject.h> 39#include <qobject.h>
40 40
41#include <xine.h> 41#include <xine.h>
42//#include "xine.h" 42//#include "xine.h"
43 43
44#include "threadutil.h" 44#include "threadutil.h"
45 45
46class XineVideoWidget; 46class XineVideoWidget;
47 47
48namespace XINE { 48namespace XINE {
49 49
50 /** 50 /**
51 * Lib wrapps the simple interface 51 * Lib wrapps the simple interface
52 * of libxine for easy every day use 52 * of libxine for easy every day use
53 * This will become a full C++ Wrapper 53 * This will become a full C++ Wrapper
54 * It supports playing, pausing, info, 54 * It supports playing, pausing, info,
55 * stooping, seeking. 55 * stooping, seeking.
56 */ 56 */
57 class Frame; 57 class Frame;
58 class Lib : public ThreadUtil::Channel { 58 class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread
59 {
59 Q_OBJECT 60 Q_OBJECT
60 public: 61 public:
61 Lib(XineVideoWidget* = 0); 62 Lib(XineVideoWidget* = 0);
62 ~Lib(); 63 ~Lib();
63 static int majorVersion(); 64 static int majorVersion();
64 static int minorVersion(); 65 static int minorVersion();
65 static int subVersion(); 66 static int subVersion();
66 67
67 68
68 void resize ( const QSize &s ); 69 void resize ( const QSize &s );
69 70
70 int play( const QString& fileName, 71 int play( const QString& fileName,
71 int startPos = 0, 72 int startPos = 0,
72 int start_time = 0 ); 73 int start_time = 0 );
73 void stop(); 74 void stop();
74 void pause( bool toggle ); 75 void pause( bool toggle );
75 76
76 int speed() const; 77 int speed() const;
77 78
78 /** 79 /**
79 * Set the speed of the stream, if codec supports it 80 * Set the speed of the stream, if codec supports it
80 * XINE_SPEED_PAUSE 0 81 * XINE_SPEED_PAUSE 0
81 * XINE_SPEED_SLOW_4 1 82 * XINE_SPEED_SLOW_4 1
82 * XINE_SPEED_SLOW_2 2 83 * XINE_SPEED_SLOW_2 2
83 * XINE_SPEED_NORMAL 4 84 * XINE_SPEED_NORMAL 4
84 * XINE_SPEED_FAST_2 8 85 * XINE_SPEED_FAST_2 8
85 *XINE_SPEED_FAST_4 16 86 *XINE_SPEED_FAST_4 16
86 */ 87 */
87 void setSpeed( int speed = XINE_SPEED_PAUSE ); 88 void setSpeed( int speed = XINE_SPEED_PAUSE );
88 89
89 int status() const; 90 int status() const;
90 91
91 int currentPosition()const; 92 int currentPosition()const;
92 //in seconds 93 //in seconds
93 int currentTime()const; 94 int currentTime()const;
94 95
95 int length() const; 96 int length() const;
96 97
97 bool isSeekable()const; 98 bool isSeekable()const;
98 99
99 /** 100 /**
100 * Whether or not to show video output 101 * Whether or not to show video output
101 */ 102 */
102 void setShowVideo(bool video); 103 void setShowVideo(bool video);
103 104
104 /** 105 /**
105 * is we show video 106 * is we show video
106 */ 107 */
107 bool isShowingVideo() const; 108 bool isShowingVideo() const;
108 109
109 /** 110 /**
110 * 111 *
111 */ 112 */
112 void showVideoFullScreen( bool fullScreen ); 113 void showVideoFullScreen( bool fullScreen );
113 114
114 /** 115 /**
115 * 116 *
116 */ 117 */
117 bool isVideoFullScreen() const; 118 bool isVideoFullScreen() const;
118 119
119 120
120 /** 121 /**
121 * Get the meta info (like author etc) from the stream 122 * Get the meta info (like author etc) from the stream
122 * XINE_META_INFO_TITLE 0 123 * XINE_META_INFO_TITLE 0
123 * XINE_META_INFO_COMMENT 1 124 * XINE_META_INFO_COMMENT 1
124 * XINE_META_INFO_ARTIST 2 125 * XINE_META_INFO_ARTIST 2
125 * XINE_META_INFO_GENRE 3 126 * XINE_META_INFO_GENRE 3
126 * XINE_META_INFO_ALBUM 4 127 * XINE_META_INFO_ALBUM 4
127 * XINE_META_INFO_YEAR 5 128 * XINE_META_INFO_YEAR 5
128 * XINE_META_INFO_VIDEOCODEC 6 129 * XINE_META_INFO_VIDEOCODEC 6
129 * XINE_META_INFO_AUDIOCODEC 7 130 * XINE_META_INFO_AUDIOCODEC 7
130 * XINE_META_INFO_SYSTEMLAYER 8 131 * XINE_META_INFO_SYSTEMLAYER 8
131 * XINE_META_INFO_INPUT_PLUGIN 9 132 * XINE_META_INFO_INPUT_PLUGIN 9
132 */ 133 */
133 QString metaInfo( int number ) const; 134 QString metaInfo( int number ) const;
134 135
135 /** 136 /**
136 * 137 *
137 */ 138 */
138 bool isScaling() const; 139 bool isScaling() const;
139 140
140 /** 141 /**
141 * seek to a position 142 * seek to a position
142 */ 143 */
143 void seekTo( int time ); 144 void seekTo( int time );
144 145
145 /** 146 /**
146 * 147 *
147 * @return is media stream has video 148 * @return is media stream has video
148 */ 149 */
149 bool hasVideo() const; 150 bool hasVideo() const;
150 151
151 /** 152 /**
152 * 153 *
153 */ 154 */
154 void setScaling( bool ); 155 void setScaling( bool );
155 156
156 /** 157 /**
157 * Set the Gamma value for video output 158 * Set the Gamma value for video output
158 * @param int the value between -100 and 100, 0 is original 159 * @param int the value between -100 and 100, 0 is original
159 */ 160 */
160 void setGamma( int ); 161 void setGamma( int );
161 162
162 /** 163 /**
163 * test 164 * test
164 */ 165 */
165 Frame currentFrame() const; 166 Frame currentFrame() const;
166 167
167 /** 168 /**
168 * Returns the error code 169 * Returns the error code
169 * XINE_ERROR_NONE 0 170 * XINE_ERROR_NONE 0
170 * XINE_ERROR_NO_INPUT_PLUGIN 1 171 * XINE_ERROR_NO_INPUT_PLUGIN 1
171 * XINE_ERROR_NO_DEMUXER_PLUGIN 2 172 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
172 * XINE_ERROR_DEMUXER_FAILED 3 173 * XINE_ERROR_DEMUXER_FAILED 3
173 */ 174 */
174 int error() const; 175 int error() const;
175 176
176 signals: 177 signals:
177 178
178 void stopped(); 179 void stopped();
179 180
181 void initialized();
182
180 protected: 183 protected:
181 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); 184 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
182 185
186 virtual void run();
187
183 private: 188 private:
184 void initialize(); 189 void initialize();
185 190
186 void assertInitialized() const; 191 void assertInitialized() const;
187 192
193 enum { XineMessageType = 1, InitializationMessageType };
194
195 struct XineMessage : public ThreadUtil::ChannelMessage
196 {
197 XineMessage( int _xineEvent ) : ThreadUtil::ChannelMessage( XineMessageType ),
198 xineEvent( _xineEvent )
199 {}
200
201 int xineEvent;
202 };
203
188 mutable ThreadUtil::Mutex m_initGuard; 204 mutable ThreadUtil::Mutex m_initGuard;
189 bool m_initialized : 1; 205 bool m_initialized : 1;
190 206
191 int m_bytes_per_pixel; 207 int m_bytes_per_pixel;
192 bool m_video:1; 208 bool m_video:1;
193 XineVideoWidget *m_wid; 209 XineVideoWidget *m_wid;
194 xine_t *m_xine; 210 xine_t *m_xine;
195 xine_stream_t *m_stream; 211 xine_stream_t *m_stream;
196 xine_cfg_entry_t *m_config; 212 xine_cfg_entry_t *m_config;
197 xine_vo_driver_t *m_videoOutput; 213 xine_vo_driver_t *m_videoOutput;
198 xine_ao_driver_t* m_audioOutput; 214 xine_ao_driver_t* m_audioOutput;
199 xine_event_queue_t *m_queue; 215 xine_event_queue_t *m_queue;
200 216
201 void handleXineEvent( const xine_event_t* t ); 217 void handleXineEvent( const xine_event_t* t );
202 void handleXineEvent( int type ); 218 void handleXineEvent( int type );
203 void drawFrame( uint8_t* frame, int width, int height, int bytes ); 219 void drawFrame( uint8_t* frame, int width, int height, int bytes );
204 // C -> C++ bridge for the event system 220 // C -> C++ bridge for the event system
205 static void xine_event_handler( void* user_data, const xine_event_t* t); 221 static void xine_event_handler( void* user_data, const xine_event_t* t);
206 static void xine_display_frame( void* user_data, uint8_t* frame , 222 static void xine_display_frame( void* user_data, uint8_t* frame ,
207 int width, int height, int bytes ); 223 int width, int height, int bytes );
208 }; 224 };
209}; 225};
210 226
211 227
212#endif 228#endif
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 5e91561..0d9a5b8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -176,201 +176,202 @@ void MediaPlayer::startIncreasingVolume() {
176 startTimer( 100 ); 176 startTimer( 100 );
177 volControl->incVol(2); 177 volControl->incVol(2);
178} 178}
179 179
180 180
181bool drawnOnScreenDisplay = FALSE; 181bool drawnOnScreenDisplay = FALSE;
182unsigned int onScreenDisplayVolume = 0; 182unsigned int onScreenDisplayVolume = 0;
183const int yoff = 110; 183const int yoff = 110;
184 184
185void MediaPlayer::stopChangingVolume() { 185void MediaPlayer::stopChangingVolume() {
186 killTimers(); 186 killTimers();
187 // Get rid of the on-screen display stuff 187 // Get rid of the on-screen display stuff
188 drawnOnScreenDisplay = FALSE; 188 drawnOnScreenDisplay = FALSE;
189 onScreenDisplayVolume = 0; 189 onScreenDisplayVolume = 0;
190 int w=0; 190 int w=0;
191 int h=0; 191 int h=0;
192 if( !xineControl->hasVideo() ) { 192 if( !xineControl->hasVideo() ) {
193 w = audioUI->width(); 193 w = audioUI->width();
194 h = audioUI->height(); 194 h = audioUI->height();
195 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 195 audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
196 } else { 196 } else {
197 w = videoUI->width(); 197 w = videoUI->width();
198 h = videoUI->height(); 198 h = videoUI->height();
199 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); 199 videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE );
200 } 200 }
201} 201}
202 202
203 203
204void MediaPlayer::timerEvent( QTimerEvent * ) { 204void MediaPlayer::timerEvent( QTimerEvent * ) {
205 if ( volumeDirection == +1 ) { 205 if ( volumeDirection == +1 ) {
206 volControl->incVol( 2 ); 206 volControl->incVol( 2 );
207 } else if ( volumeDirection == -1 ) { 207 } else if ( volumeDirection == -1 ) {
208 volControl->decVol( 2 ); 208 volControl->decVol( 2 );
209 } 209 }
210 210
211 211
212 // TODO FIXME 212 // TODO FIXME
213 // huh?? 213 // huh??
214 unsigned int v= 0; 214 unsigned int v= 0;
215 v = volControl->volume(); 215 v = volControl->volume();
216 v = v / 10; 216 v = v / 10;
217 217
218 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 218 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
219 return; 219 return;
220 } 220 }
221 221
222 int w=0; int h=0; 222 int w=0; int h=0;
223 if( !xineControl->hasVideo() ) { 223 if( !xineControl->hasVideo() ) {
224 w = audioUI->width(); 224 w = audioUI->width();
225 h = audioUI->height(); 225 h = audioUI->height();
226 226
227 if ( drawnOnScreenDisplay ) { 227 if ( drawnOnScreenDisplay ) {
228 if ( onScreenDisplayVolume > v ) { 228 if ( onScreenDisplayVolume > v ) {
229 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 229 audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
230 } 230 }
231 } 231 }
232 drawnOnScreenDisplay = TRUE; 232 drawnOnScreenDisplay = TRUE;
233 onScreenDisplayVolume = v; 233 onScreenDisplayVolume = v;
234 QPainter p( audioUI ); 234 QPainter p( audioUI );
235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 235 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
236 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 236 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
237 237
238 QFont f; 238 QFont f;
239 f.setPixelSize( 20 ); 239 f.setPixelSize( 20 );
240 f.setBold( TRUE ); 240 f.setBold( TRUE );
241 p.setFont( f ); 241 p.setFont( f );
242 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 242 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
243 243
244 for ( unsigned int i = 0; i < 10; i++ ) { 244 for ( unsigned int i = 0; i < 10; i++ ) {
245 if ( v > i ) { 245 if ( v > i ) {
246 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 246 p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
247 } else { 247 } else {
248 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 248 p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
249 } 249 }
250 } 250 }
251 } else { 251 } else {
252 w = videoUI->width(); 252 w = videoUI->width();
253 h = videoUI->height(); 253 h = videoUI->height();
254 254
255 if ( drawnOnScreenDisplay ) { 255 if ( drawnOnScreenDisplay ) {
256 if ( onScreenDisplayVolume > v ) { 256 if ( onScreenDisplayVolume > v ) {
257 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); 257 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE );
258 } 258 }
259 } 259 }
260 drawnOnScreenDisplay = TRUE; 260 drawnOnScreenDisplay = TRUE;
261 onScreenDisplayVolume = v; 261 onScreenDisplayVolume = v;
262 QPainter p( videoUI ); 262 QPainter p( videoUI );
263 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 263 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
264 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 264 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
265 265
266 QFont f; 266 QFont f;
267 f.setPixelSize( 20 ); 267 f.setPixelSize( 20 );
268 f.setBold( TRUE ); 268 f.setBold( TRUE );
269 p.setFont( f ); 269 p.setFont( f );
270 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); 270 p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) );
271 271
272 for ( unsigned int i = 0; i < 10; i++ ) { 272 for ( unsigned int i = 0; i < 10; i++ ) {
273 if ( v > i ) { 273 if ( v > i ) {
274 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 274 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
275 } else { 275 } else {
276 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 276 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
277 } 277 }
278 } 278 }
279 } 279 }
280} 280}
281 281
282 282
283void MediaPlayer::blank( bool b ) { 283void MediaPlayer::blank( bool b ) {
284 fd=open("/dev/fb0",O_RDWR); 284 fd=open("/dev/fb0",O_RDWR);
285#ifdef QT_QWS_EBX 285#ifdef QT_QWS_EBX
286 fl= open( "/dev/fl", O_RDWR ); 286 fl= open( "/dev/fl", O_RDWR );
287#endif 287#endif
288 if (fd != -1) { 288 if (fd != -1) {
289 if ( b ) { 289 if ( b ) {
290 qDebug("do blanking"); 290 qDebug("do blanking");
291#ifdef QT_QWS_EBX 291#ifdef QT_QWS_EBX
292 ioctl( fd, FBIOBLANK, 1 ); 292 ioctl( fd, FBIOBLANK, 1 );
293 if(fl !=-1) { 293 if(fl !=-1) {
294 ioctl( fl, 2 ); 294 ioctl( fl, 2 );
295 ::close(fl); 295 ::close(fl);
296 } 296 }
297#else 297#else
298 ioctl( fd, FBIOBLANK, 3 ); 298 ioctl( fd, FBIOBLANK, 3 );
299#endif 299#endif
300 isBlanked = TRUE; 300 isBlanked = TRUE;
301 } else { 301 } else {
302 qDebug("do unblanking"); 302 qDebug("do unblanking");
303 ioctl( fd, FBIOBLANK, 0); 303 ioctl( fd, FBIOBLANK, 0);
304#ifdef QT_QWS_EBX 304#ifdef QT_QWS_EBX
305 if(fl != -1) { 305 if(fl != -1) {
306 ioctl( fl, 1); 306 ioctl( fl, 1);
307 ::close(fl); 307 ::close(fl);
308 } 308 }
309#endif 309#endif
310 isBlanked = FALSE; 310 isBlanked = FALSE;
311 } 311 }
312 close( fd ); 312 close( fd );
313 } else { 313 } else {
314 qDebug("<< /dev/fb0 could not be opened >>"); 314 qDebug("<< /dev/fb0 could not be opened >>");
315 } 315 }
316} 316}
317 317
318void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 318void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
319 switch ( e->key() ) { 319 switch ( e->key() ) {
320////////////////////////////// Zaurus keys 320////////////////////////////// Zaurus keys
321 case Key_Home: 321 case Key_Home:
322 break; 322 break;
323 case Key_F9: //activity 323 case Key_F9: //activity
324 break; 324 break;
325 case Key_F10: //contacts 325 case Key_F10: //contacts
326 break; 326 break;
327 case Key_F11: //menu 327 case Key_F11: //menu
328 break; 328 break;
329 case Key_F12: //home 329 case Key_F12: //home
330 qDebug("Blank here"); 330 qDebug("Blank here");
331// mediaPlayerState->toggleBlank(); 331// mediaPlayerState->toggleBlank();
332 break; 332 break;
333 case Key_F13: //mail 333 case Key_F13: //mail
334 qDebug("Blank here"); 334 qDebug("Blank here");
335 // mediaPlayerState->toggleBlank(); 335 // mediaPlayerState->toggleBlank();
336 break; 336 break;
337 } 337 }
338} 338}
339 339
340void MediaPlayer::cleanUp() {// this happens on closing 340void MediaPlayer::cleanUp() {// this happens on closing
341 Config cfg( "OpiePlayer" ); 341 Config cfg( "OpiePlayer" );
342 mediaPlayerState.writeConfig( cfg ); 342 mediaPlayerState.writeConfig( cfg );
343 playList.writeDefaultPlaylist( ); 343 playList.writeDefaultPlaylist( );
344 344
345// QPEApplication::grabKeyboard(); 345// QPEApplication::grabKeyboard();
346// QPEApplication::ungrabKeyboard(); 346// QPEApplication::ungrabKeyboard();
347} 347}
348 348
349void MediaPlayer::recreateAudioAndVideoWidgets() 349void MediaPlayer::recreateAudioAndVideoWidgets()
350{ 350{
351 delete xineControl; 351 delete xineControl;
352 delete audioUI; 352 delete audioUI;
353 delete videoUI; 353 delete videoUI;
354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 354 audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 355 videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
356 356
357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 357 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 358 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 359 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 360 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
361 361
362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 362 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 363 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 364 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 365 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
366 366
367 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState ); 367 xineControl = new XineControl( videoUI, videoUI->vidWidget(), mediaPlayerState );
368 mediaPlayerState.setBackendInitialized(); 368 connect( xineControl, SIGNAL( initialized() ),
369 &mediaPlayerState, SLOT( setBackendInitialized() ) );
369} 370}
370 371
371void MediaPlayer::reloadSkins() 372void MediaPlayer::reloadSkins()
372{ 373{
373 audioUI->loadSkin(); 374 audioUI->loadSkin();
374 videoUI->loadSkin(); 375 videoUI->loadSkin();
375} 376}
376 377
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 0e81fa2..14e71d9 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,249 +1,250 @@
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 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = 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 <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include "xinecontrol.h" 39#include "xinecontrol.h"
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41 41
42XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, 42XineControl::XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget,
43 MediaPlayerState &_mediaPlayerState, 43 MediaPlayerState &_mediaPlayerState,
44 QObject *parent, const char *name ) 44 QObject *parent, const char *name )
45 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ) 45 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState )
46{ 46{
47 47
48 libXine = new XINE::Lib( xineWidget ); 48 libXine = new XINE::Lib( xineWidget );
49 49
50 connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); 50 connect ( videoContainerWidget, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) );
51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 51 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 52 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 53 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 54 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 55 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 connect( libXine, SIGNAL( initialized() ), this, SIGNAL( initialized() ) );
58 59
59 disabledSuspendScreenSaver = FALSE; 60 disabledSuspendScreenSaver = FALSE;
60} 61}
61 62
62XineControl::~XineControl() { 63XineControl::~XineControl() {
63#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 64#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
64 if ( disabledSuspendScreenSaver ) { 65 if ( disabledSuspendScreenSaver ) {
65 disabledSuspendScreenSaver = FALSE; 66 disabledSuspendScreenSaver = FALSE;
66 // Re-enable the suspend mode 67 // Re-enable the suspend mode
67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 68 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
68 } 69 }
69#endif 70#endif
70 delete libXine; 71 delete libXine;
71} 72}
72 73
73void XineControl::play( const QString& fileName ) { 74void XineControl::play( const QString& fileName ) {
74 hasVideoChannel = FALSE; 75 hasVideoChannel = FALSE;
75 hasAudioChannel = FALSE; 76 hasAudioChannel = FALSE;
76 m_fileName = fileName; 77 m_fileName = fileName;
77 78
78 qDebug("<<FILENAME: " + fileName + ">>>>"); 79 qDebug("<<FILENAME: " + fileName + ">>>>");
79 80
80 if ( !libXine->play( fileName, 0, 0 ) ) { 81 if ( !libXine->play( fileName, 0, 0 ) ) {
81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 82 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
82 // toggle stop so the the play button is reset 83 // toggle stop so the the play button is reset
83 mediaPlayerState.setPlaying( false ); 84 mediaPlayerState.setPlaying( false );
84 return; 85 return;
85 } 86 }
86 mediaPlayerState.setPlaying( true ); 87 mediaPlayerState.setPlaying( true );
87 88
88 MediaPlayerState::DisplayType displayType; 89 MediaPlayerState::DisplayType displayType;
89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 90 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
90 if ( !libXine->hasVideo() ) { 91 if ( !libXine->hasVideo() ) {
91 displayType = MediaPlayerState::Audio; 92 displayType = MediaPlayerState::Audio;
92 qDebug("HAS AUDIO"); 93 qDebug("HAS AUDIO");
93 libXine->setShowVideo( false ); 94 libXine->setShowVideo( false );
94 hasAudioChannel = TRUE; 95 hasAudioChannel = TRUE;
95 } else { 96 } else {
96 displayType = MediaPlayerState::Video; 97 displayType = MediaPlayerState::Video;
97 qDebug("HAS VIDEO"); 98 qDebug("HAS VIDEO");
98 libXine->setShowVideo( true ); 99 libXine->setShowVideo( true );
99 hasVideoChannel = TRUE; 100 hasVideoChannel = TRUE;
100 } 101 }
101 // determine if slider is shown 102 // determine if slider is shown
102 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 103 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
103 104
104 // which gui (video / audio) 105 // which gui (video / audio)
105 mediaPlayerState.setDisplayType( displayType ); 106 mediaPlayerState.setDisplayType( displayType );
106 107
107#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 108#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
108 if ( !disabledSuspendScreenSaver ) { 109 if ( !disabledSuspendScreenSaver ) {
109 disabledSuspendScreenSaver = TRUE; 110 disabledSuspendScreenSaver = TRUE;
110 // Stop the screen from blanking and power saving state 111 // Stop the screen from blanking and power saving state
111 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 112 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
112 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 113 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
113 } 114 }
114#endif 115#endif
115 116
116 length(); 117 length();
117 position(); 118 position();
118} 119}
119 120
120void XineControl::nextMedia() { 121void XineControl::nextMedia() {
121 mediaPlayerState.setNext(); 122 mediaPlayerState.setNext();
122} 123}
123 124
124void XineControl::setGamma( int value ) { 125void XineControl::setGamma( int value ) {
125 libXine->setGamma( value ); 126 libXine->setGamma( value );
126} 127}
127 128
128void XineControl::stop( bool isSet ) { 129void XineControl::stop( bool isSet ) {
129 if ( !isSet ) { 130 if ( !isSet ) {
130 libXine->stop(); 131 libXine->stop();
131 132
132#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 133#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
133 if ( disabledSuspendScreenSaver ) { 134 if ( disabledSuspendScreenSaver ) {
134 disabledSuspendScreenSaver = FALSE; 135 disabledSuspendScreenSaver = FALSE;
135 // Re-enable the suspend mode 136 // Re-enable the suspend mode
136 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 137 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
137 } 138 }
138#endif 139#endif
139 } 140 }
140} 141}
141 142
142/** 143/**
143 * Pause playback 144 * Pause playback
144 * @isSet 145 * @isSet
145 */ 146 */
146void XineControl::pause( bool isSet) { 147void XineControl::pause( bool isSet) {
147 libXine->pause( isSet ); 148 libXine->pause( isSet );
148} 149}
149 150
150 151
151/** 152/**
152 * get current time in playback 153 * get current time in playback
153 */ 154 */
154long XineControl::currentTime() { 155long XineControl::currentTime() {
155 // todo: jede sekunde überprüfen 156 // todo: jede sekunde überprüfen
156 m_currentTime = libXine->currentTime(); 157 m_currentTime = libXine->currentTime();
157 return m_currentTime; 158 return m_currentTime;
158 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 159 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
159} 160}
160 161
161/** 162/**
162 * Set the length of the media file 163 * Set the length of the media file
163 */ 164 */
164void XineControl::length() { 165void XineControl::length() {
165 m_length = libXine->length(); 166 m_length = libXine->length();
166 mediaPlayerState.setLength( m_length ); 167 mediaPlayerState.setLength( m_length );
167} 168}
168 169
169 170
170/** 171/**
171 * Reports the position the xine backend is at right now 172 * Reports the position the xine backend is at right now
172 * @return long the postion in seconds 173 * @return long the postion in seconds
173 */ 174 */
174long XineControl::position() { 175long XineControl::position() {
175 m_position = ( currentTime() ); 176 m_position = ( currentTime() );
176 mediaPlayerState.updatePosition( m_position ); 177 mediaPlayerState.updatePosition( m_position );
177 long emitPos = (long)m_position; 178 long emitPos = (long)m_position;
178 emit positionChanged( emitPos ); 179 emit positionChanged( emitPos );
179 if( mediaPlayerState.isPlaying() ) { 180 if( mediaPlayerState.isPlaying() ) {
180 // needs to be stopped the media is stopped 181 // needs to be stopped the media is stopped
181 QTimer::singleShot( 1000, this, SLOT( position() ) ); 182 QTimer::singleShot( 1000, this, SLOT( position() ) );
182 } 183 }
183 // qDebug("POSITION : %d", m_position); 184 // qDebug("POSITION : %d", m_position);
184 return m_position; 185 return m_position;
185} 186}
186 187
187/** 188/**
188 * Set videoplayback to fullscreen 189 * Set videoplayback to fullscreen
189 * @param isSet 190 * @param isSet
190 */ 191 */
191void XineControl::setFullscreen( bool isSet ) { 192void XineControl::setFullscreen( bool isSet ) {
192 libXine->showVideoFullScreen( isSet ); 193 libXine->showVideoFullScreen( isSet );
193} 194}
194 195
195 196
196QString XineControl::getMetaInfo() { 197QString XineControl::getMetaInfo() {
197 198
198 QString returnString; 199 QString returnString;
199 200
200 if ( !libXine->metaInfo( 0 ).isEmpty() ) { 201 if ( !libXine->metaInfo( 0 ).isEmpty() ) {
201 returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); 202 returnString += tr( " Title: " + libXine->metaInfo( 0 ) );
202 } 203 }
203 204
204 if ( !libXine->metaInfo( 1 ).isEmpty() ) { 205 if ( !libXine->metaInfo( 1 ).isEmpty() ) {
205 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); 206 returnString += tr( " Comment: " + libXine->metaInfo( 1 ) );
206 } 207 }
207 208
208 if ( !libXine->metaInfo( 2 ).isEmpty() ) { 209 if ( !libXine->metaInfo( 2 ).isEmpty() ) {
209 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); 210 returnString += tr( " Artist: " + libXine->metaInfo( 2 ) );
210 } 211 }
211 212
212 if ( !libXine->metaInfo( 3 ).isEmpty() ) { 213 if ( !libXine->metaInfo( 3 ).isEmpty() ) {
213 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); 214 returnString += tr( " Genre: " + libXine->metaInfo( 3 ) );
214 } 215 }
215 216
216 if ( !libXine->metaInfo( 4 ).isEmpty() ) { 217 if ( !libXine->metaInfo( 4 ).isEmpty() ) {
217 returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); 218 returnString += tr( " Album: " + libXine->metaInfo( 4 ) );
218 } 219 }
219 220
220 if ( !libXine->metaInfo( 5 ).isEmpty() ) { 221 if ( !libXine->metaInfo( 5 ).isEmpty() ) {
221 returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); 222 returnString += tr( " Year: " + libXine->metaInfo( 5 ) );
222 } 223 }
223 return returnString; 224 return returnString;
224} 225}
225 226
226QString XineControl::getErrorCode() { 227QString XineControl::getErrorCode() {
227 228
228 int errorCode = libXine->error(); 229 int errorCode = libXine->error();
229 230
230 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); 231 qDebug( QString("ERRORCODE: %1 ").arg(errorCode) );
231 232
232 if ( errorCode == 1 ) { 233 if ( errorCode == 1 ) {
233 return tr( "No input plugin found for this media type" ); 234 return tr( "No input plugin found for this media type" );
234 } else if ( errorCode == 2 ) { 235 } else if ( errorCode == 2 ) {
235 return tr( "No demux plugin found for this media type" ); 236 return tr( "No demux plugin found for this media type" );
236 } else if ( errorCode == 3 ) { 237 } else if ( errorCode == 3 ) {
237 return tr( "Demuxing failed for this media type" ); 238 return tr( "Demuxing failed for this media type" );
238 } else if ( errorCode == 4 ) { 239 } else if ( errorCode == 4 ) {
239 return tr( "Malformed MRL" ); 240 return tr( "Malformed MRL" );
240 } else { 241 } else {
241 return tr( "Some other error" ); 242 return tr( "Some other error" );
242 } 243 }
243} 244}
244 245
245/** 246/**
246 * Seek to a position in the track 247 * Seek to a position in the track
247 * @param second the second to jump to 248 * @param second the second to jump to
248 */ 249 */
249void XineControl::seekTo( long second ) { 250void XineControl::seekTo( long second ) {
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
index 69a594f..000529c 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.h
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -1,120 +1,122 @@
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 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
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..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; 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  -_. . .   )=.  = 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 <qobject.h> 38#include <qobject.h>
39 39
40#include "mediaplayerstate.h" 40#include "mediaplayerstate.h"
41 41
42class XineControl : public QObject { 42class XineControl : public QObject {
43 Q_OBJECT 43 Q_OBJECT
44public: 44public:
45 XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget, 45 XineControl( QWidget *videoContainerWidget, XineVideoWidget *xineWidget,
46 MediaPlayerState &_mediaPlayerState, 46 MediaPlayerState &_mediaPlayerState,
47 QObject *parent = 0, const char *name =0 ); 47 QObject *parent = 0, const char *name =0 );
48 ~XineControl(); 48 ~XineControl();
49 49
50 bool hasVideo() const { return hasVideoChannel; } 50 bool hasVideo() const { return hasVideoChannel; }
51 bool hasAudio() const { return hasAudioChannel; } 51 bool hasAudio() const { return hasAudioChannel; }
52 52
53public slots: 53public slots:
54 void play( const QString& fileName ); 54 void play( const QString& fileName );
55 void stop( bool ); 55 void stop( bool );
56 56
57 /** 57 /**
58 * Pause the media stream 58 * Pause the media stream
59 * @param if pause or not 59 * @param if pause or not
60 */ 60 */
61 void pause( bool ); 61 void pause( bool );
62 62
63 /** 63 /**
64 * Set videos fullscreen 64 * Set videos fullscreen
65 * @param yes or no 65 * @param yes or no
66 */ 66 */
67 void setFullscreen( bool ); 67 void setFullscreen( bool );
68 68
69 /** 69 /**
70 * 70 *
71 */ 71 */
72 long currentTime(); 72 long currentTime();
73 void seekTo( long ); 73 void seekTo( long );
74 // get length of media file and set it 74 // get length of media file and set it
75 void length(); 75 void length();
76 long position(); 76 long position();
77 77
78 /** 78 /**
79 * Proceed to the next media file in playlist 79 * Proceed to the next media file in playlist
80 */ 80 */
81 void nextMedia(); 81 void nextMedia();
82 82
83 /** 83 /**
84 * Get as much info about the stream from xine as possible 84 * Get as much info about the stream from xine as possible
85 */ 85 */
86 QString getMetaInfo(); 86 QString getMetaInfo();
87 87
88 /** 88 /**
89 * get the error code and "translate" it for the user 89 * get the error code and "translate" it for the user
90 * 90 *
91 */ 91 */
92 QString getErrorCode(); 92 QString getErrorCode();
93 93
94 94
95 void videoResized ( const QSize &s ); 95 void videoResized ( const QSize &s );
96 96
97 /** 97 /**
98 * Set the gamma value of the video output 98 * Set the gamma value of the video output
99 * @param int value between -100 and 100, 0 is original 99 * @param int value between -100 and 100, 0 is original
100 */ 100 */
101 void setGamma( int ); 101 void setGamma( int );
102 102
103 103
104private: 104private:
105 XINE::Lib *libXine; 105 XINE::Lib *libXine;
106 long m_currentTime; 106 long m_currentTime;
107 long m_position; 107 long m_position;
108 int m_length; 108 int m_length;
109 QString m_fileName; 109 QString m_fileName;
110 bool disabledSuspendScreenSaver : 1; 110 bool disabledSuspendScreenSaver : 1;
111 bool hasVideoChannel : 1; 111 bool hasVideoChannel : 1;
112 bool hasAudioChannel : 1; 112 bool hasAudioChannel : 1;
113 MediaPlayerState &mediaPlayerState; 113 MediaPlayerState &mediaPlayerState;
114 114
115signals: 115signals:
116 void positionChanged( long ); 116 void positionChanged( long );
117
118 void initialized();
117}; 119};
118 120
119 121
120#endif 122#endif