summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/lib.h2
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp3
3 files changed, 16 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index cef46a1..84194b7 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -78,49 +78,50 @@ Lib::Lib( InitializationMode initMode, XineVideoWidget* widget )
78 m_wid = widget; 78 m_wid = widget;
79 printf("Lib"); 79 printf("Lib");
80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 80 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
81 // get the configuration 81 // get the configuration
82 82
83 // not really OO, should be an extra class, later 83 // not really OO, should be an extra class, later
84 if ( !QFile::exists(configPath) ) { 84 if ( !QFile::exists(configPath) ) {
85 QFile f(configPath); 85 QFile f(configPath);
86 f.open(IO_WriteOnly); 86 f.open(IO_WriteOnly);
87 QTextStream ts( &f ); 87 QTextStream ts( &f );
88 ts << "misc.memcpy_method:glibc\n"; 88 ts << "misc.memcpy_method:glibc\n";
89 f.close(); 89 f.close();
90 } 90 }
91 91
92 if ( initMode == InitializeImmediately ) { 92 if ( initMode == InitializeImmediately ) {
93 initialize(); 93 initialize();
94 m_initialized = true; 94 m_initialized = true;
95 } 95 }
96 else 96 else
97 assert( false ); 97 assert( false );
98} 98}
99 99
100void Lib::run() 100void Lib::run()
101{ 101{
102 assert( false ); 102 initialize();
103 m_initialized = true;
103} 104}
104 105
105void Lib::initialize() 106void Lib::initialize()
106{ 107{
107 m_duringInitialization = true; 108 m_duringInitialization = true;
108 m_xine = xine_new( ); 109 m_xine = xine_new( );
109 110
110 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 111 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
111 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 112 xine_config_load( m_xine, QFile::encodeName( configPath ) );
112 113
113 xine_init( m_xine ); 114 xine_init( m_xine );
114 115
115 // allocate oss for sound 116 // allocate oss for sound
116 // and fb for framebuffer 117 // and fb for framebuffer
117 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 118 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
118 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 );
119 120
120 121
121//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);
122 123
123 124
124// null_display_handler( m_videoOutput, xine_display_frame, this ); 125// null_display_handler( m_videoOutput, xine_display_frame, this );
125 126
126 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 127 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
@@ -262,48 +263,58 @@ void Lib::seekTo( int time ) {
262 // since its now milliseconds we need *1000 263 // since its now milliseconds we need *1000
263 xine_play( m_stream, 0, time*1000 ); 264 xine_play( m_stream, 0, time*1000 );
264} 265}
265 266
266 267
267Frame Lib::currentFrame() const { 268Frame Lib::currentFrame() const {
268 assert( m_initialized ); 269 assert( m_initialized );
269 270
270 Frame frame; 271 Frame frame;
271 return frame; 272 return frame;
272}; 273};
273 274
274QString Lib::metaInfo( int number) const { 275QString Lib::metaInfo( int number) const {
275 assert( m_initialized ); 276 assert( m_initialized );
276 277
277 return xine_get_meta_info( m_stream, number ); 278 return xine_get_meta_info( m_stream, number );
278} 279}
279 280
280int Lib::error() const { 281int Lib::error() const {
281 assert( m_initialized ); 282 assert( m_initialized );
282 283
283 return xine_get_error( m_stream ); 284 return xine_get_error( m_stream );
284}; 285};
285 286
287void Lib::ensureInitialized()
288{
289 if ( m_initialized )
290 return;
291
292 qDebug( "waiting for initialization thread to finish" );
293 wait();
294 qDebug( "initialization thread finished!" );
295}
296
286void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) 297void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
287{ 298{
288 assert( sendType == ThreadUtil::Channel::OneWay ); 299 assert( sendType == ThreadUtil::Channel::OneWay );
289 handleXineEvent( msg->type() ); 300 handleXineEvent( msg->type() );
290 delete msg; 301 delete msg;
291} 302}
292 303
293void Lib::handleXineEvent( const xine_event_t* t ) { 304void Lib::handleXineEvent( const xine_event_t* t ) {
294 send( new ThreadUtil::ChannelMessage( t->type ), OneWay ); 305 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
295} 306}
296 307
297void Lib::handleXineEvent( int type ) { 308void Lib::handleXineEvent( int type ) {
298 assert( m_initialized ); 309 assert( m_initialized );
299 310
300 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 311 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
301 emit stopped(); 312 emit stopped();
302 } 313 }
303} 314}
304 315
305 316
306void Lib::setShowVideo( bool video ) { 317void Lib::setShowVideo( bool video ) {
307 assert( m_initialized ); 318 assert( m_initialized );
308 319
309 m_video = video; 320 m_video = video;
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index 9dd7385..6b67f67 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -156,48 +156,50 @@ namespace XINE {
156 * 156 *
157 */ 157 */
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();
181
180 signals: 182 signals:
181 183
182 void stopped(); 184 void stopped();
183 185
184 void initialized(); 186 void initialized();
185 187
186 protected: 188 protected:
187 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); 189 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
188 190
189 virtual void run(); 191 virtual void run();
190 192
191 private: 193 private:
192 void initialize(); 194 void initialize();
193 195
194 int m_bytes_per_pixel; 196 int m_bytes_per_pixel;
195 bool m_initialized:1; 197 bool m_initialized:1;
196 bool m_duringInitialization:1; 198 bool m_duringInitialization:1;
197 bool m_video:1; 199 bool m_video:1;
198 XineVideoWidget *m_wid; 200 XineVideoWidget *m_wid;
199 xine_t *m_xine; 201 xine_t *m_xine;
200 xine_stream_t *m_stream; 202 xine_stream_t *m_stream;
201 xine_cfg_entry_t *m_config; 203 xine_cfg_entry_t *m_config;
202 xine_vo_driver_t *m_videoOutput; 204 xine_vo_driver_t *m_videoOutput;
203 xine_ao_driver_t* m_audioOutput; 205 xine_ao_driver_t* m_audioOutput;
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 1aa3daa..7c54499 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -24,59 +24,60 @@
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#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
49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 48 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
50 49
51 init(); 50 init();
52} 51}
53 52
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 53XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState, 54 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name ) 55 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 56 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{ 57{
58 xine->ensureInitialized();
59
59 init(); 60 init();
60} 61}
61 62
62void XineControl::init() 63void XineControl::init()
63{ 64{
64 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 65 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
65 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 66 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
66 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 67 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
67 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 68 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
68 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 69 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
69 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 70 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
70 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 71 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
71 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 72 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
72 73
73 disabledSuspendScreenSaver = FALSE; 74 disabledSuspendScreenSaver = FALSE;
74} 75}
75 76
76XineControl::~XineControl() { 77XineControl::~XineControl() {
77#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 78#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
78 if ( disabledSuspendScreenSaver ) { 79 if ( disabledSuspendScreenSaver ) {
79 disabledSuspendScreenSaver = FALSE; 80 disabledSuspendScreenSaver = FALSE;
80 // Re-enable the suspend mode 81 // Re-enable the suspend mode
81 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 82 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
82 } 83 }