summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/lib.h2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
4 files changed, 19 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 84194b7..299239b 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -107,52 +107,49 @@ void Lib::initialize()
107{ 107{
108 m_duringInitialization = true; 108 m_duringInitialization = true;
109 m_xine = xine_new( ); 109 m_xine = xine_new( );
110 110
111 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 111 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
112 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 112 xine_config_load( m_xine, QFile::encodeName( configPath ) );
113 113
114 xine_init( m_xine ); 114 xine_init( m_xine );
115 115
116 // allocate oss for sound 116 // allocate oss for sound
117 // and fb for framebuffer 117 // and fb for framebuffer
118 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 118 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
119 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 119 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
120 120
121 121
122//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 122//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
123 123
124 124
125// null_display_handler( m_videoOutput, xine_display_frame, this ); 125// null_display_handler( m_videoOutput, xine_display_frame, this );
126 126
127 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 127 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
128 128
129 if (m_wid != 0 ) { 129 if (m_wid != 0 ) {
130 printf( "!0\n" ); 130 printf( "!0\n" );
131 resize ( m_wid-> size ( ) ); 131 setWidget( m_wid );
132 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
133
134// m_wid->repaint();
135 } 132 }
136 133
137 m_queue = xine_event_new_queue (m_stream); 134 m_queue = xine_event_new_queue (m_stream);
138 135
139 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 136 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
140 m_duringInitialization = false; 137 m_duringInitialization = false;
141} 138}
142 139
143Lib::~Lib() { 140Lib::~Lib() {
144 assert( isRunning() == false ); 141 assert( isRunning() == false );
145 assert( m_initialized ); 142 assert( m_initialized );
146 143
147// free( m_config ); 144// free( m_config );
148 145
149 xine_close( m_stream ); 146 xine_close( m_stream );
150 147
151 xine_event_dispose_queue( m_queue ); 148 xine_event_dispose_queue( m_queue );
152 149
153 xine_dispose( m_stream ); 150 xine_dispose( m_stream );
154 151
155 xine_exit( m_xine ); 152 xine_exit( m_xine );
156 /* FIXME either free or delete but valgrind bitches against both */ 153 /* FIXME either free or delete but valgrind bitches against both */
157 //free( m_videoOutput ); 154 //free( m_videoOutput );
158 //delete m_audioOutput; 155 //delete m_audioOutput;
@@ -273,48 +270,56 @@ Frame Lib::currentFrame() const {
273}; 270};
274 271
275QString Lib::metaInfo( int number) const { 272QString Lib::metaInfo( int number) const {
276 assert( m_initialized ); 273 assert( m_initialized );
277 274
278 return xine_get_meta_info( m_stream, number ); 275 return xine_get_meta_info( m_stream, number );
279} 276}
280 277
281int Lib::error() const { 278int Lib::error() const {
282 assert( m_initialized ); 279 assert( m_initialized );
283 280
284 return xine_get_error( m_stream ); 281 return xine_get_error( m_stream );
285}; 282};
286 283
287void Lib::ensureInitialized() 284void Lib::ensureInitialized()
288{ 285{
289 if ( m_initialized ) 286 if ( m_initialized )
290 return; 287 return;
291 288
292 qDebug( "waiting for initialization thread to finish" ); 289 qDebug( "waiting for initialization thread to finish" );
293 wait(); 290 wait();
294 qDebug( "initialization thread finished!" ); 291 qDebug( "initialization thread finished!" );
295} 292}
296 293
294void Lib::setWidget( XineVideoWidget *widget )
295{
296 m_wid = widget;
297 resize ( m_wid-> size ( ) );
298 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
299 m_wid->repaint();
300}
301
297void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 302void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
298{ 303{
299 assert( sendType == ThreadUtil::Channel::OneWay ); 304 assert( sendType == ThreadUtil::Channel::OneWay );
300 handleXineEvent( msg->type() ); 305 handleXineEvent( msg->type() );
301 delete msg; 306 delete msg;
302} 307}
303 308
304void Lib::handleXineEvent( const xine_event_t* t ) { 309void Lib::handleXineEvent( const xine_event_t* t ) {
305 send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); 310 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
306} 311}
307 312
308void Lib::handleXineEvent( int type ) { 313void Lib::handleXineEvent( int type ) {
309 assert( m_initialized ); 314 assert( m_initialized );
310 315
311 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 316 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
312 emit stopped(); 317 emit stopped();
313 } 318 }
314} 319}
315 320
316 321
317void Lib::setShowVideo( bool video ) { 322void Lib::setShowVideo( bool video ) {
318 assert( m_initialized ); 323 assert( m_initialized );
319 324
320 m_video = video; 325 m_video = video;
@@ -360,26 +365,29 @@ void Lib::setGamma( int value ) {
360} 365}
361 366
362bool Lib::isScaling() const { 367bool Lib::isScaling() const {
363 assert( m_initialized ); 368 assert( m_initialized );
364 369
365 return ::null_is_scaling( m_videoOutput ); 370 return ::null_is_scaling( m_videoOutput );
366} 371}
367 372
368void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { 373void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) {
369 ( (Lib*)user_data)->handleXineEvent( t ); 374 ( (Lib*)user_data)->handleXineEvent( t );
370} 375}
371 376
372void Lib::xine_display_frame( void* user_data, uint8_t *frame, 377void Lib::xine_display_frame( void* user_data, uint8_t *frame,
373 int width, int height, int bytes ) { 378 int width, int height, int bytes ) {
374 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); 379 ( (Lib*)user_data)->drawFrame( frame, width, height, bytes );
375} 380}
376 381
377void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 382void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
378 assert( m_initialized ); 383 assert( m_initialized );
379 384
380 if ( !m_video ) { 385 if ( !m_video ) {
381 qWarning("not showing video now"); 386 qWarning("not showing video now");
382 return; 387 return;
383 } 388 }
389
390 assert( m_wid );
391
384 m_wid-> setVideoFrame ( frame, width, height, bytes ); 392 m_wid-> setVideoFrame ( frame, width, height, bytes );
385} 393}
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 6b67f67..181735c 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -158,48 +158,50 @@ namespace XINE {
158 void setScaling( bool ); 158 void setScaling( bool );
159 159
160 /** 160 /**
161 * Set the Gamma value for video output 161 * Set the Gamma value for video output
162 * @param int the value between -100 and 100, 0 is original 162 * @param int the value between -100 and 100, 0 is original
163 */ 163 */
164 void setGamma( int ); 164 void setGamma( int );
165 165
166 /** 166 /**
167 * test 167 * test
168 */ 168 */
169 Frame currentFrame() const; 169 Frame currentFrame() const;
170 170
171 /** 171 /**
172 * Returns the error code 172 * Returns the error code
173 * XINE_ERROR_NONE 0 173 * XINE_ERROR_NONE 0
174 * XINE_ERROR_NO_INPUT_PLUGIN 1 174 * XINE_ERROR_NO_INPUT_PLUGIN 1
175 * XINE_ERROR_NO_DEMUXER_PLUGIN 2 175 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
176 * XINE_ERROR_DEMUXER_FAILED 3 176 * XINE_ERROR_DEMUXER_FAILED 3
177 */ 177 */
178 int error() const; 178 int error() const;
179 179
180 void ensureInitialized(); 180 void ensureInitialized();
181 181
182 void setWidget( XineVideoWidget *widget );
183
182 signals: 184 signals:
183 185
184 void stopped(); 186 void stopped();
185 187
186 void initialized(); 188 void initialized();
187 189
188 protected: 190 protected:
189 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); 191 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
190 192
191 virtual void run(); 193 virtual void run();
192 194
193 private: 195 private:
194 void initialize(); 196 void initialize();
195 197
196 int m_bytes_per_pixel; 198 int m_bytes_per_pixel;
197 bool m_initialized:1; 199 bool m_initialized:1;
198 bool m_duringInitialization:1; 200 bool m_duringInitialization:1;
199 bool m_video:1; 201 bool m_video:1;
200 XineVideoWidget *m_wid; 202 XineVideoWidget *m_wid;
201 xine_t *m_xine; 203 xine_t *m_xine;
202 xine_stream_t *m_stream; 204 xine_stream_t *m_stream;
203 xine_cfg_entry_t *m_config; 205 xine_cfg_entry_t *m_config;
204 xine_vo_driver_t *m_videoOutput; 206 xine_vo_driver_t *m_videoOutput;
205 xine_ao_driver_t* m_audioOutput; 207 xine_ao_driver_t* m_audioOutput;
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 963e783..d6fbb53 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,41 +1,42 @@
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 19
19#include "mediaplayerstate.h" 20#include "mediaplayerstate.h"
20 21
21// for setBacklight() 22// for setBacklight()
22#include <linux/fb.h> 23#include <linux/fb.h>
23#include <sys/file.h> 24#include <sys/file.h>
24#include <sys/ioctl.h> 25#include <sys/ioctl.h>
25 26
26 27
27 28
28 29
29#define FBIOBLANK 0x4611 30#define FBIOBLANK 0x4611
30 31
31MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 32MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
32 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 33 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
33 34
34 m_audioUI = 0; 35 m_audioUI = 0;
35 m_videoUI = 0; 36 m_videoUI = 0;
36 m_xineControl = 0; 37 m_xineControl = 0;
37 38
38 fd=-1;fl=-1; 39 fd=-1;fl=-1;
39 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 40 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
40 41
41 qApp->processEvents(); 42 qApp->processEvents();
@@ -349,49 +350,50 @@ void MediaPlayer::cleanUp() {// this happens on closing
349// QPEApplication::grabKeyboard(); 350// QPEApplication::grabKeyboard();
350// QPEApplication::ungrabKeyboard(); 351// QPEApplication::ungrabKeyboard();
351} 352}
352 353
353void MediaPlayer::recreateAudioAndVideoWidgets() const 354void MediaPlayer::recreateAudioAndVideoWidgets() const
354{ 355{
355 delete m_skinLoader; 356 delete m_skinLoader;
356 357
357 delete m_xineControl; 358 delete m_xineControl;
358 delete m_audioUI; 359 delete m_audioUI;
359 delete m_videoUI; 360 delete m_videoUI;
360 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); 361 m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" );
361 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); 362 m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" );
362 363
363 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 364 connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
364 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 365 connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
365 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 366 connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
366 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 367 connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
367 368
368 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 369 connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
369 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 370 connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
370 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 371 connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
371 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 372 connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
372 373
373 m_xineControl = new XineControl( m_videoUI->vidWidget(), mediaPlayerState ); 374 XINE::Lib *xine = new XINE::Lib( XINE::Lib::InitializeImmediately );
375 m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState );
374} 376}
375 377
376AudioWidget *MediaPlayer::audioUI() const 378AudioWidget *MediaPlayer::audioUI() const
377{ 379{
378 if ( !m_audioUI ) 380 if ( !m_audioUI )
379 recreateAudioAndVideoWidgets(); 381 recreateAudioAndVideoWidgets();
380 return m_audioUI; 382 return m_audioUI;
381} 383}
382 384
383VideoWidget *MediaPlayer::videoUI() const 385VideoWidget *MediaPlayer::videoUI() const
384{ 386{
385 if ( !m_videoUI ) 387 if ( !m_videoUI )
386 recreateAudioAndVideoWidgets(); 388 recreateAudioAndVideoWidgets();
387 return m_videoUI; 389 return m_videoUI;
388} 390}
389 391
390XineControl *MediaPlayer::xineControl() const 392XineControl *MediaPlayer::xineControl() const
391{ 393{
392 if ( !m_xineControl ) 394 if ( !m_xineControl )
393 recreateAudioAndVideoWidgets(); 395 recreateAudioAndVideoWidgets();
394 return m_xineControl; 396 return m_xineControl;
395} 397}
396 398
397void MediaPlayer::reloadSkins() 399void MediaPlayer::reloadSkins()
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 7c54499..1c489e3 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -36,48 +36,50 @@
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#include "xinevideowidget.h" 41#include "xinevideowidget.h"
42 42
43XineControl::XineControl( XineVideoWidget *xineWidget, 43XineControl::XineControl( XineVideoWidget *xineWidget,
44 MediaPlayerState &_mediaPlayerState, 44 MediaPlayerState &_mediaPlayerState,
45 QObject *parent, const char *name ) 45 QObject *parent, const char *name )
46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 46 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
47{ 47{
48 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 48 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
49 49
50 init(); 50 init();
51} 51}
52 52
53XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 53XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
54 MediaPlayerState &_mediaPlayerState, 54 MediaPlayerState &_mediaPlayerState,
55 QObject *parent, const char *name ) 55 QObject *parent, const char *name )
56 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 56 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
57{ 57{
58 xine->ensureInitialized(); 58 xine->ensureInitialized();
59 59
60 xine->setWidget( xineWidget );
61
60 init(); 62 init();
61} 63}
62 64
63void XineControl::init() 65void XineControl::init()
64{ 66{
65 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 67 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
66 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 68 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
67 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 69 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
68 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 70 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
69 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 71 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
70 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 72 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
71 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 73 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
72 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 74 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
73 75
74 disabledSuspendScreenSaver = FALSE; 76 disabledSuspendScreenSaver = FALSE;
75} 77}
76 78
77XineControl::~XineControl() { 79XineControl::~XineControl() {
78#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 80#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
79 if ( disabledSuspendScreenSaver ) { 81 if ( disabledSuspendScreenSaver ) {
80 disabledSuspendScreenSaver = FALSE; 82 disabledSuspendScreenSaver = FALSE;
81 // Re-enable the suspend mode 83 // Re-enable the suspend mode
82 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 84 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
83 } 85 }