summaryrefslogtreecommitdiff
Unidiff
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
@@ -57,49 +57,56 @@ extern "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 );
@@ -111,33 +118,36 @@ void Lib::initialize()
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 );
@@ -271,38 +281,45 @@ Frame Lib::currentFrame() const {
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 );
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
@@ -42,33 +42,34 @@
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 );
@@ -164,40 +165,55 @@ namespace XINE {
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 );
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
@@ -352,25 +352,26 @@ void MediaPlayer::recreateAudioAndVideoWidgets()
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
@@ -42,32 +42,33 @@
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 ) {
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
@@ -101,20 +101,22 @@ public slots:
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