summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/lib.h13
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
3 files changed, 26 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 1e0dc21..6431de7 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -25,115 +25,129 @@
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( InitializationMode initMode, XineVideoWidget* widget )
74{ 74{
75 m_video = false; 75 m_video = false;
76 m_wid = widget; 76 m_wid = widget;
77 printf("Lib"); 77 printf("Lib");
78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; 78 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
79 // get the configuration 79 // get the configuration
80 80
81 // not really OO, should be an extra class, later 81 // not really OO, should be an extra class, later
82 if ( !QFile::exists(configPath) ) { 82 if ( !QFile::exists(configPath) ) {
83 QFile f(configPath); 83 QFile f(configPath);
84 f.open(IO_WriteOnly); 84 f.open(IO_WriteOnly);
85 QTextStream ts( &f ); 85 QTextStream ts( &f );
86 ts << "misc.memcpy_method:glibc\n"; 86 ts << "misc.memcpy_method:glibc\n";
87 f.close(); 87 f.close();
88 } 88 }
89 89
90 if ( initMode == InitializeImmediately )
91 initialize();
92 else
93 assert( false );
94}
95
96void Lib::run()
97{
98 assert( false );
99}
100
101void Lib::initialize()
102{
90 m_xine = xine_new( ); 103 m_xine = xine_new( );
91 104
105 QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf";
92 xine_config_load( m_xine, QFile::encodeName( configPath ) ); 106 xine_config_load( m_xine, QFile::encodeName( configPath ) );
93 107
94 xine_init( m_xine ); 108 xine_init( m_xine );
95 109
96 // allocate oss for sound 110 // allocate oss for sound
97 // and fb for framebuffer 111 // and fb for framebuffer
98 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); 112 m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL );
99 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); 113 m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this );
100 114
101 115
102//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); 116//xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL);
103 117
104 118
105// null_display_handler( m_videoOutput, xine_display_frame, this ); 119// null_display_handler( m_videoOutput, xine_display_frame, this );
106 120
107 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); 121 m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput );
108 122
109 if (m_wid != 0 ) { 123 if (m_wid != 0 ) {
110 printf( "!0\n" ); 124 printf( "!0\n" );
111 resize ( m_wid-> size ( ) ); 125 resize ( m_wid-> size ( ) );
112 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 126 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
113 127
114// m_wid->repaint(); 128// m_wid->repaint();
115 } 129 }
116 130
117 m_queue = xine_event_new_queue (m_stream); 131 m_queue = xine_event_new_queue (m_stream);
118 132
119 xine_event_create_listener_thread (m_queue, xine_event_handler, this); 133 xine_event_create_listener_thread (m_queue, xine_event_handler, this);
120} 134}
121 135
122Lib::~Lib() { 136Lib::~Lib() {
123// free( m_config ); 137// free( m_config );
124 138
125 xine_close( m_stream ); 139 xine_close( m_stream );
126 140
127 xine_event_dispose_queue( m_queue ); 141 xine_event_dispose_queue( m_queue );
128 142
129 xine_dispose( m_stream ); 143 xine_dispose( m_stream );
130 144
131 xine_exit( m_xine ); 145 xine_exit( m_xine );
132 /* FIXME either free or delete but valgrind bitches against both */ 146 /* FIXME either free or delete but valgrind bitches against both */
133 //free( m_videoOutput ); 147 //free( m_videoOutput );
134 //delete m_audioOutput; 148 //delete m_audioOutput;
135} 149}
136 150
137void Lib::resize ( const QSize &s ) { 151void Lib::resize ( const QSize &s ) {
138 if ( s. width ( ) && s. height ( ) ) { 152 if ( s. width ( ) && s. height ( ) ) {
139 ::null_set_gui_width( m_videoOutput, s. width() ); 153 ::null_set_gui_width( m_videoOutput, s. width() );
diff --git a/noncore/multimedia/opieplayer2/lib.h b/noncore/multimedia/opieplayer2/lib.h
index aba2ec9..6363918 100644
--- a/noncore/multimedia/opieplayer2/lib.h
+++ b/noncore/multimedia/opieplayer2/lib.h
@@ -10,108 +10,111 @@
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 {
60 Q_OBJECT 60 Q_OBJECT
61 public: 61 public:
62 Lib(XineVideoWidget* = 0); 62 enum InitializationMode { InitializeImmediately, InitializeInThread };
63
64 Lib( InitializationMode initMode, XineVideoWidget* = 0);
65
63 ~Lib(); 66 ~Lib();
64 static int majorVersion(); 67 static int majorVersion();
65 static int minorVersion(); 68 static int minorVersion();
66 static int subVersion(); 69 static int subVersion();
67 70
68 71
69 void resize ( const QSize &s ); 72 void resize ( const QSize &s );
70 73
71 int play( const QString& fileName, 74 int play( const QString& fileName,
72 int startPos = 0, 75 int startPos = 0,
73 int start_time = 0 ); 76 int start_time = 0 );
74 void stop(); 77 void stop();
75 void pause( bool toggle ); 78 void pause( bool toggle );
76 79
77 int speed() const; 80 int speed() const;
78 81
79 /** 82 /**
80 * Set the speed of the stream, if codec supports it 83 * Set the speed of the stream, if codec supports it
81 * XINE_SPEED_PAUSE 0 84 * XINE_SPEED_PAUSE 0
82 * XINE_SPEED_SLOW_4 1 85 * XINE_SPEED_SLOW_4 1
83 * XINE_SPEED_SLOW_2 2 86 * XINE_SPEED_SLOW_2 2
84 * XINE_SPEED_NORMAL 4 87 * XINE_SPEED_NORMAL 4
85 * XINE_SPEED_FAST_2 8 88 * XINE_SPEED_FAST_2 8
86 *XINE_SPEED_FAST_4 16 89 *XINE_SPEED_FAST_4 16
87 */ 90 */
88 void setSpeed( int speed = XINE_SPEED_PAUSE ); 91 void setSpeed( int speed = XINE_SPEED_PAUSE );
89 92
90 int status() const; 93 int status() const;
91 94
92 int currentPosition()const; 95 int currentPosition()const;
93 //in seconds 96 //in seconds
94 int currentTime()const; 97 int currentTime()const;
95 98
96 int length() const; 99 int length() const;
97 100
98 bool isSeekable()const; 101 bool isSeekable()const;
99 102
100 /** 103 /**
101 * Whether or not to show video output 104 * Whether or not to show video output
102 */ 105 */
103 void setShowVideo(bool video); 106 void setShowVideo(bool video);
104 107
105 /** 108 /**
106 * is we show video 109 * is we show video
107 */ 110 */
108 bool isShowingVideo() const; 111 bool isShowingVideo() const;
109 112
110 /** 113 /**
111 * 114 *
112 */ 115 */
113 void showVideoFullScreen( bool fullScreen ); 116 void showVideoFullScreen( bool fullScreen );
114 117
115 /** 118 /**
116 * 119 *
117 */ 120 */
@@ -138,71 +141,75 @@ namespace XINE {
138 */ 141 */
139 bool isScaling() const; 142 bool isScaling() const;
140 143
141 /** 144 /**
142 * seek to a position 145 * seek to a position
143 */ 146 */
144 void seekTo( int time ); 147 void seekTo( int time );
145 148
146 /** 149 /**
147 * 150 *
148 * @return is media stream has video 151 * @return is media stream has video
149 */ 152 */
150 bool hasVideo() const; 153 bool hasVideo() const;
151 154
152 /** 155 /**
153 * 156 *
154 */ 157 */
155 void setScaling( bool ); 158 void setScaling( bool );
156 159
157 /** 160 /**
158 * Set the Gamma value for video output 161 * Set the Gamma value for video output
159 * @param int the value between -100 and 100, 0 is original 162 * @param int the value between -100 and 100, 0 is original
160 */ 163 */
161 void setGamma( int ); 164 void setGamma( int );
162 165
163 /** 166 /**
164 * test 167 * test
165 */ 168 */
166 Frame currentFrame() const; 169 Frame currentFrame() const;
167 170
168 /** 171 /**
169 * Returns the error code 172 * Returns the error code
170 * XINE_ERROR_NONE 0 173 * XINE_ERROR_NONE 0
171 * XINE_ERROR_NO_INPUT_PLUGIN 1 174 * XINE_ERROR_NO_INPUT_PLUGIN 1
172 * XINE_ERROR_NO_DEMUXER_PLUGIN 2 175 * XINE_ERROR_NO_DEMUXER_PLUGIN 2
173 * XINE_ERROR_DEMUXER_FAILED 3 176 * XINE_ERROR_DEMUXER_FAILED 3
174 */ 177 */
175 int error() const; 178 int error() const;
176 179
177 signals: 180 signals:
178 181
179 void stopped(); 182 void stopped();
180 183
181 void initialized(); 184 void initialized();
182 185
183 protected: 186 protected:
184 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ); 187 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
185 188
189 virtual void run();
190
186 private: 191 private:
192 void initialize();
193
187 int m_bytes_per_pixel; 194 int m_bytes_per_pixel;
188 bool m_video:1; 195 bool m_video:1;
189 XineVideoWidget *m_wid; 196 XineVideoWidget *m_wid;
190 xine_t *m_xine; 197 xine_t *m_xine;
191 xine_stream_t *m_stream; 198 xine_stream_t *m_stream;
192 xine_cfg_entry_t *m_config; 199 xine_cfg_entry_t *m_config;
193 xine_vo_driver_t *m_videoOutput; 200 xine_vo_driver_t *m_videoOutput;
194 xine_ao_driver_t* m_audioOutput; 201 xine_ao_driver_t* m_audioOutput;
195 xine_event_queue_t *m_queue; 202 xine_event_queue_t *m_queue;
196 203
197 void handleXineEvent( const xine_event_t* t ); 204 void handleXineEvent( const xine_event_t* t );
198 void handleXineEvent( int type ); 205 void handleXineEvent( int type );
199 void drawFrame( uint8_t* frame, int width, int height, int bytes ); 206 void drawFrame( uint8_t* frame, int width, int height, int bytes );
200 // C -> C++ bridge for the event system 207 // C -> C++ bridge for the event system
201 static void xine_event_handler( void* user_data, const xine_event_t* t); 208 static void xine_event_handler( void* user_data, const xine_event_t* t);
202 static void xine_display_frame( void* user_data, uint8_t* frame , 209 static void xine_display_frame( void* user_data, uint8_t* frame ,
203 int width, int height, int bytes ); 210 int width, int height, int bytes );
204 }; 211 };
205}; 212};
206 213
207 214
208#endif 215#endif
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index efa9934..1aa3daa 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,97 +1,97 @@
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#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 48
49 libXine = new XINE::Lib( xineWidget ); 49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
50 50
51 init(); 51 init();
52} 52}
53 53
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState, 55 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name ) 56 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{ 58{
59 init(); 59 init();
60} 60}
61 61
62void XineControl::init() 62void XineControl::init()
63{ 63{
64 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 64 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) );
65 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 65 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) );
66 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 66 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
67 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 67 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
68 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 68 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
69 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 69 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
70 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 70 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
71 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 71 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) );
72 72
73 disabledSuspendScreenSaver = FALSE; 73 disabledSuspendScreenSaver = FALSE;
74} 74}
75 75
76XineControl::~XineControl() { 76XineControl::~XineControl() {
77#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 77#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
78 if ( disabledSuspendScreenSaver ) { 78 if ( disabledSuspendScreenSaver ) {
79 disabledSuspendScreenSaver = FALSE; 79 disabledSuspendScreenSaver = FALSE;
80 // Re-enable the suspend mode 80 // Re-enable the suspend mode
81 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 81 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
82 } 82 }
83#endif 83#endif
84 delete libXine; 84 delete libXine;
85} 85}
86 86
87void XineControl::play( const QString& fileName ) { 87void XineControl::play( const QString& fileName ) {
88 hasVideoChannel = FALSE; 88 hasVideoChannel = FALSE;
89 hasAudioChannel = FALSE; 89 hasAudioChannel = FALSE;
90 m_fileName = fileName; 90 m_fileName = fileName;
91 91
92 qDebug("<<FILENAME: " + fileName + ">>>>"); 92 qDebug("<<FILENAME: " + fileName + ">>>>");
93 93
94 if ( !libXine->play( fileName, 0, 0 ) ) { 94 if ( !libXine->play( fileName, 0, 0 ) ) {
95 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 95 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
96 // toggle stop so the the play button is reset 96 // toggle stop so the the play button is reset
97 mediaPlayerState.setPlaying( false ); 97 mediaPlayerState.setPlaying( false );