author | skyhusker <skyhusker> | 2005-03-24 16:52:08 (UTC) |
---|---|---|
committer | skyhusker <skyhusker> | 2005-03-24 16:52:08 (UTC) |
commit | 38ace7e9b3c9665336c0e6d2350895b147858f1f (patch) (unidiff) | |
tree | b82538e70104d8ea179b3364b1d592e7cfb4c650 | |
parent | 76db09fe0448c68496055f5e2b5c672fea1df5df (diff) | |
download | opie-38ace7e9b3c9665336c0e6d2350895b147858f1f.zip opie-38ace7e9b3c9665336c0e6d2350895b147858f1f.tar.gz opie-38ace7e9b3c9665336c0e6d2350895b147858f1f.tar.bz2 |
Keep paused when sliding the progress bar in paused state. Block de audio device only while playing.
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index f1b9773..6ed4cea 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -38,344 +38,363 @@ | |||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <opie2/odebug.h> | 39 | #include <opie2/odebug.h> |
40 | #include <qpe/global.h> | 40 | #include <qpe/global.h> |
41 | 41 | ||
42 | /* QT */ | 42 | /* QT */ |
43 | #include <qtextstream.h> | 43 | #include <qtextstream.h> |
44 | #include <qdir.h> | 44 | #include <qdir.h> |
45 | #include <qgfx_qws.h> | 45 | #include <qgfx_qws.h> |
46 | 46 | ||
47 | /* STD */ | 47 | /* STD */ |
48 | #include <assert.h> | 48 | #include <assert.h> |
49 | #include <unistd.h> | 49 | #include <unistd.h> |
50 | 50 | ||
51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 51 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
52 | int width, int height,int bytes ); | 52 | int width, int height,int bytes ); |
53 | 53 | ||
54 | extern "C" { | 54 | extern "C" { |
55 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); | 55 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); |
56 | int null_is_showing_video( const xine_vo_driver_t* self ); | 56 | int null_is_showing_video( const xine_vo_driver_t* self ); |
57 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 57 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
58 | int null_is_fullscreen( const xine_vo_driver_t* self ); | 58 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
59 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 59 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
60 | int null_is_scaling( const xine_vo_driver_t* self ); | 60 | int null_is_scaling( const xine_vo_driver_t* self ); |
61 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 61 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
62 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 62 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
63 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 63 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
64 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 64 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
65 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 65 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
66 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 66 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
67 | 67 | ||
68 | void null_preload_decoders( xine_stream_t *stream ); | 68 | void null_preload_decoders( xine_stream_t *stream ); |
69 | } | 69 | } |
70 | 70 | ||
71 | using namespace XINE; | 71 | using namespace XINE; |
72 | 72 | ||
73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 73 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
74 | { | 74 | { |
75 | m_initialized = false; | 75 | m_initialized = false; |
76 | m_duringInitialization = false; | 76 | m_duringInitialization = false; |
77 | m_video = false; | 77 | m_video = false; |
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 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | 89 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; |
90 | ts << "codec.ffmpeg_pp_quality:3\n"; | 90 | ts << "codec.ffmpeg_pp_quality:3\n"; |
91 | ts << "audio.num_buffers:50\n"; | 91 | ts << "audio.num_buffers:50\n"; |
92 | ts << "audio.size_buffers:4096\n"; | 92 | ts << "audio.size_buffers:4096\n"; |
93 | ts << "video.num_buffers:20\n"; | 93 | ts << "video.num_buffers:20\n"; |
94 | ts << "video.size_buffers:4096\n"; | 94 | ts << "video.size_buffers:4096\n"; |
95 | ts << "audio.out_num_audio_buf:16\n"; | 95 | ts << "audio.out_num_audio_buf:16\n"; |
96 | ts << "audio.out_size_audio_buf:8096\n"; | 96 | ts << "audio.out_size_audio_buf:8096\n"; |
97 | ts << "audio.out_size_zero_buf:1024\n"; | 97 | ts << "audio.out_size_zero_buf:1024\n"; |
98 | ts << "audio.passthrough_offset:0\n"; | 98 | ts << "audio.passthrough_offset:0\n"; |
99 | f.close(); | 99 | f.close(); |
100 | } | 100 | } |
101 | 101 | ||
102 | if ( initMode == InitializeImmediately ) { | 102 | if ( initMode == InitializeImmediately ) { |
103 | initialize(); | 103 | initialize(); |
104 | m_initialized = true; | 104 | m_initialized = true; |
105 | } | 105 | } |
106 | else | 106 | else |
107 | start(); | 107 | start(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void Lib::run() | 110 | void Lib::run() |
111 | { | 111 | { |
112 | odebug << "Lib::run() started" << oendl; | 112 | odebug << "Lib::run() started" << oendl; |
113 | initialize(); | 113 | initialize(); |
114 | m_initialized = true; | 114 | m_initialized = true; |
115 | odebug << "Lib::run() finished" << oendl; | 115 | odebug << "Lib::run() finished" << oendl; |
116 | } | 116 | } |
117 | 117 | ||
118 | void Lib::initialize() | 118 | void Lib::initialize() |
119 | { | 119 | { |
120 | m_duringInitialization = true; | 120 | m_duringInitialization = true; |
121 | m_xine = xine_new( ); | 121 | m_xine = xine_new( ); |
122 | 122 | ||
123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 123 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 124 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
125 | 125 | ||
126 | xine_init( m_xine ); | 126 | xine_init( m_xine ); |
127 | 127 | ||
128 | // allocate oss for sound | 128 | // allocate oss for sound |
129 | // and fb for framebuffer | 129 | // and fb for framebuffer |
130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 130 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 131 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
132 | 132 | ||
133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 133 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
134 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | ||
134 | 135 | ||
135 | if (m_wid != 0 ) | 136 | if (m_wid != 0 ) |
136 | setWidget( m_wid ); | 137 | setWidget( m_wid ); |
137 | 138 | ||
138 | 139 | ||
139 | m_queue = xine_event_new_queue (m_stream); | 140 | m_queue = xine_event_new_queue (m_stream); |
140 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); | 141 | xine_event_create_listener_thread (m_queue, xine_event_handler, this); |
141 | 142 | ||
142 | ::null_preload_decoders( m_stream ); | 143 | ::null_preload_decoders( m_stream ); |
143 | 144 | ||
144 | m_duringInitialization = false; | 145 | m_duringInitialization = false; |
145 | } | 146 | } |
146 | 147 | ||
147 | Lib::~Lib() { | 148 | Lib::~Lib() { |
148 | assert( isRunning() == false ); | 149 | assert( isRunning() == false ); |
149 | assert( m_initialized ); | 150 | assert( m_initialized ); |
150 | 151 | ||
151 | // free( m_config ); | 152 | // free( m_config ); |
152 | 153 | ||
153 | xine_close( m_stream ); | 154 | xine_close( m_stream ); |
154 | xine_event_dispose_queue( m_queue ); | 155 | xine_event_dispose_queue( m_queue ); |
155 | xine_dispose( m_stream ); | 156 | xine_dispose( m_stream ); |
156 | xine_exit( m_xine ); | 157 | xine_exit( m_xine ); |
157 | 158 | ||
158 | /* FIXME either free or delete but valgrind bitches against both */ | 159 | /* FIXME either free or delete but valgrind bitches against both */ |
159 | //free( m_videoOutput ); | 160 | //free( m_videoOutput ); |
160 | //delete m_audioOutput; | 161 | //delete m_audioOutput; |
161 | } | 162 | } |
162 | 163 | ||
163 | void Lib::resize ( const QSize &s ) { | 164 | void Lib::resize ( const QSize &s ) { |
164 | assert( m_initialized || m_duringInitialization ); | 165 | assert( m_initialized || m_duringInitialization ); |
165 | 166 | ||
166 | if ( s. width ( ) && s. height ( ) ) { | 167 | if ( s. width ( ) && s. height ( ) ) { |
167 | ::null_set_gui_width( m_videoOutput, s. width() ); | 168 | ::null_set_gui_width( m_videoOutput, s. width() ); |
168 | ::null_set_gui_height( m_videoOutput, s. height() ); | 169 | ::null_set_gui_height( m_videoOutput, s. height() ); |
169 | } | 170 | } |
170 | } | 171 | } |
171 | 172 | ||
172 | int Lib::majorVersion() { | 173 | int Lib::majorVersion() { |
173 | int major, minor, sub; | 174 | int major, minor, sub; |
174 | xine_get_version ( &major, &minor, &sub ); | 175 | xine_get_version ( &major, &minor, &sub ); |
175 | return major; | 176 | return major; |
176 | } | 177 | } |
177 | 178 | ||
178 | int Lib::minorVersion() { | 179 | int Lib::minorVersion() { |
179 | int major, minor, sub; | 180 | int major, minor, sub; |
180 | xine_get_version ( &major, &minor, &sub ); | 181 | xine_get_version ( &major, &minor, &sub ); |
181 | return minor; | 182 | return minor; |
182 | } | 183 | } |
183 | 184 | ||
184 | int Lib::subVersion() { | 185 | int Lib::subVersion() { |
185 | int major, minor, sub; | 186 | int major, minor, sub; |
186 | xine_get_version ( &major, &minor, &sub ); | 187 | xine_get_version ( &major, &minor, &sub ); |
187 | return sub; | 188 | return sub; |
188 | } | 189 | } |
189 | 190 | ||
190 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 191 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
191 | assert( m_initialized ); | 192 | assert( m_initialized ); |
192 | 193 | ||
193 | QString str = fileName.stripWhiteSpace(); | 194 | QString str = fileName.stripWhiteSpace(); |
194 | 195 | ||
195 | 196 | ||
196 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 197 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
197 | return 0; | 198 | return 0; |
198 | } | 199 | } |
199 | return xine_play( m_stream, startPos, start_time); | 200 | return xine_play( m_stream, startPos, start_time); |
200 | } | 201 | } |
201 | 202 | ||
202 | void Lib::stop() { | 203 | void Lib::stop() { |
203 | assert( m_initialized ); | 204 | assert( m_initialized ); |
204 | xine_stop( m_stream ); | 205 | xine_stop( m_stream ); |
206 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | ||
205 | } | 207 | } |
206 | 208 | ||
207 | void Lib::pause( bool toggle ) { | 209 | void Lib::pause( bool toggle ) { |
208 | assert( m_initialized ); | 210 | assert( m_initialized ); |
209 | 211 | ||
210 | xine_set_param( m_stream, XINE_PARAM_SPEED, toggle ? XINE_SPEED_PAUSE : XINE_SPEED_NORMAL ); | 212 | if ( toggle ) { |
213 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | ||
214 | xine_set_param( m_stream, XINE_PARAM_AUDIO_CLOSE_DEVICE, 1); | ||
215 | } | ||
216 | |||
217 | else { | ||
218 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_NORMAL ); | ||
219 | } | ||
211 | } | 220 | } |
212 | 221 | ||
213 | int Lib::speed() const { | 222 | int Lib::speed() const { |
214 | assert( m_initialized ); | 223 | assert( m_initialized ); |
215 | 224 | ||
216 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); | 225 | return xine_get_param ( m_stream, XINE_PARAM_SPEED ); |
217 | } | 226 | } |
218 | 227 | ||
219 | void Lib::setSpeed( int speed ) { | 228 | void Lib::setSpeed( int speed ) { |
220 | assert( m_initialized ); | 229 | assert( m_initialized ); |
221 | 230 | ||
222 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); | 231 | xine_set_param ( m_stream, XINE_PARAM_SPEED, speed ); |
223 | } | 232 | } |
224 | 233 | ||
225 | int Lib::status() const { | 234 | int Lib::status() const { |
226 | assert( m_initialized ); | 235 | assert( m_initialized ); |
227 | 236 | ||
228 | return xine_get_status( m_stream ); | 237 | return xine_get_status( m_stream ); |
229 | } | 238 | } |
230 | 239 | ||
231 | int Lib::currentPosition() const { | 240 | int Lib::currentPosition() const { |
232 | assert( m_initialized ); | 241 | assert( m_initialized ); |
233 | 242 | ||
234 | int pos, time, length; | 243 | int pos, time, length; |
235 | xine_get_pos_length( m_stream, &pos, &time, &length ); | 244 | xine_get_pos_length( m_stream, &pos, &time, &length ); |
236 | return pos; | 245 | return pos; |
237 | } | 246 | } |
238 | 247 | ||
239 | int Lib::currentTime() const { | 248 | int Lib::currentTime() const { |
240 | assert( m_initialized ); | 249 | assert( m_initialized ); |
241 | 250 | ||
242 | int pos, time, length; | 251 | int pos, time, length; |
243 | pos = time = length = 0; | 252 | pos = time = length = 0; |
244 | 253 | ||
245 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) | 254 | if ( xine_get_pos_length( m_stream, &pos, &time, &length ) ) |
246 | return time/1000; | 255 | return time/1000; |
247 | else | 256 | else |
248 | return 0; | 257 | return 0; |
249 | } | 258 | } |
250 | 259 | ||
251 | int Lib::length() const { | 260 | int Lib::length() const { |
252 | assert( m_initialized ); | 261 | assert( m_initialized ); |
253 | 262 | ||
254 | int pos, time, length; | 263 | int pos, time, length; |
255 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ | 264 | /* dilb: patch to solve the wrong stream length reported to the GUI*/ |
256 | int iRetVal=0, iTestLoop=0; | 265 | int iRetVal=0, iTestLoop=0; |
257 | 266 | ||
258 | do | 267 | do |
259 | { | 268 | { |
260 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); | 269 | iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); |
261 | if (iRetVal) | 270 | if (iRetVal) |
262 | {/* if the function didn't return 0, then pos, time and length are valid.*/ | 271 | {/* if the function didn't return 0, then pos, time and length are valid.*/ |
263 | return length/1000; | 272 | return length/1000; |
264 | } | 273 | } |
265 | /*don't poll too much*/ | 274 | /*don't poll too much*/ |
266 | usleep(100000); | 275 | usleep(100000); |
267 | iTestLoop++; | 276 | iTestLoop++; |
268 | } | 277 | } |
269 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any | 278 | while ( iTestLoop < 10 ); /* if after 1s, we still don't have any |
270 | valid stream, then return -1 (this value could be used to make the stream | 279 | valid stream, then return -1 (this value could be used to make the stream |
271 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ | 280 | unseekable, but it should never occur!! Mr. Murphy ? :) ) */ |
272 | 281 | ||
273 | return -1; | 282 | return -1; |
274 | } | 283 | } |
275 | 284 | ||
276 | bool Lib::isSeekable() const { | 285 | bool Lib::isSeekable() const { |
277 | assert( m_initialized ); | 286 | assert( m_initialized ); |
278 | 287 | ||
279 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); | 288 | return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); |
280 | } | 289 | } |
281 | 290 | ||
282 | void Lib::seekTo( int time ) { | 291 | void Lib::seekTo( int time ) { |
283 | assert( m_initialized ); | 292 | assert( m_initialized ); |
284 | 293 | ||
285 | xine_play( m_stream, 0, time*1000 ); | 294 | odebug << "Seeking to second " << time << oendl; |
295 | //Keep it paused if it was in that state | ||
296 | if ( xine_get_param( m_stream, XINE_PARAM_SPEED ) ) { | ||
297 | xine_play( m_stream, 0, time*1000 ); | ||
298 | } | ||
299 | |||
300 | else { | ||
301 | xine_play( m_stream, 0, time*1000 ); | ||
302 | xine_set_param( m_stream, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | ||
303 | } | ||
304 | |||
286 | } | 305 | } |
287 | 306 | ||
288 | 307 | ||
289 | Frame Lib::currentFrame() const { | 308 | Frame Lib::currentFrame() const { |
290 | assert( m_initialized ); | 309 | assert( m_initialized ); |
291 | 310 | ||
292 | Frame frame; | 311 | Frame frame; |
293 | return frame; | 312 | return frame; |
294 | }; | 313 | }; |
295 | 314 | ||
296 | QString Lib::metaInfo( int number) const { | 315 | QString Lib::metaInfo( int number) const { |
297 | assert( m_initialized ); | 316 | assert( m_initialized ); |
298 | 317 | ||
299 | return xine_get_meta_info( m_stream, number ); | 318 | return xine_get_meta_info( m_stream, number ); |
300 | } | 319 | } |
301 | 320 | ||
302 | int Lib::error() const { | 321 | int Lib::error() const { |
303 | assert( m_initialized ); | 322 | assert( m_initialized ); |
304 | 323 | ||
305 | return xine_get_error( m_stream ); | 324 | return xine_get_error( m_stream ); |
306 | }; | 325 | }; |
307 | 326 | ||
308 | void Lib::ensureInitialized() | 327 | void Lib::ensureInitialized() |
309 | { | 328 | { |
310 | if ( m_initialized ) | 329 | if ( m_initialized ) |
311 | return; | 330 | return; |
312 | 331 | ||
313 | odebug << "waiting for initialization thread to finish" << oendl; | 332 | odebug << "waiting for initialization thread to finish" << oendl; |
314 | wait(); | 333 | wait(); |
315 | odebug << "initialization thread finished!" << oendl; | 334 | odebug << "initialization thread finished!" << oendl; |
316 | } | 335 | } |
317 | 336 | ||
318 | void Lib::setWidget( XineVideoWidget *widget ) | 337 | void Lib::setWidget( XineVideoWidget *widget ) |
319 | { | 338 | { |
320 | m_wid = widget; | 339 | m_wid = widget; |
321 | resize ( m_wid-> size ( ) ); | 340 | resize ( m_wid-> size ( ) ); |
322 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 341 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
323 | m_wid->repaint(); | 342 | m_wid->repaint(); |
324 | } | 343 | } |
325 | 344 | ||
326 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 345 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
327 | { | 346 | { |
328 | assert( sendType == ThreadUtil::Channel::OneWay ); | 347 | assert( sendType == ThreadUtil::Channel::OneWay ); |
329 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); | 348 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); |
330 | delete msg; | 349 | delete msg; |
331 | } | 350 | } |
332 | 351 | ||
333 | void Lib::handleXineEvent( const xine_event_t* t ) { | 352 | void Lib::handleXineEvent( const xine_event_t* t ) { |
334 | int prog = -1; const char* name = 0; | 353 | int prog = -1; const char* name = 0; |
335 | if ( t->type == XINE_EVENT_PROGRESS ) { | 354 | if ( t->type == XINE_EVENT_PROGRESS ) { |
336 | xine_progress_data_t *pt = static_cast<xine_progress_data_t*>( t->data ); | 355 | xine_progress_data_t *pt = static_cast<xine_progress_data_t*>( t->data ); |
337 | prog = pt->percent; | 356 | prog = pt->percent; |
338 | name = pt->description; | 357 | name = pt->description; |
339 | } | 358 | } |
340 | 359 | ||
341 | send( new ThreadUtil::ChannelMessage( t->type, prog, name ), OneWay ); | 360 | send( new ThreadUtil::ChannelMessage( t->type, prog, name ), OneWay ); |
342 | } | 361 | } |
343 | 362 | ||
344 | void Lib::handleXineEvent( int type, int data, const char* name ) { | 363 | void Lib::handleXineEvent( int type, int data, const char* name ) { |
345 | assert( m_initialized ); | 364 | assert( m_initialized ); |
346 | 365 | ||
347 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { | 366 | if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { |
348 | emit stopped(); | 367 | emit stopped(); |
349 | }else if ( type == XINE_EVENT_PROGRESS ) { | 368 | }else if ( type == XINE_EVENT_PROGRESS ) { |
350 | QString str = name == 0 ? QString::null : QString::fromUtf8( name ); | 369 | QString str = name == 0 ? QString::null : QString::fromUtf8( name ); |
351 | Global::statusMessage( tr( "Progress: %1 %2" ).arg( name, data ) );; | 370 | Global::statusMessage( tr( "Progress: %1 %2" ).arg( name, data ) );; |
352 | } | 371 | } |
353 | } | 372 | } |
354 | 373 | ||
355 | 374 | ||
356 | void Lib::setShowVideo( bool video ) { | 375 | void Lib::setShowVideo( bool video ) { |
357 | assert( m_initialized ); | 376 | assert( m_initialized ); |
358 | 377 | ||
359 | m_video = video; | 378 | m_video = video; |
360 | ::null_set_show_video( m_videoOutput, video ); | 379 | ::null_set_show_video( m_videoOutput, video ); |
361 | } | 380 | } |
362 | 381 | ||
363 | bool Lib::isShowingVideo() const { | 382 | bool Lib::isShowingVideo() const { |
364 | assert( m_initialized ); | 383 | assert( m_initialized ); |
365 | 384 | ||
366 | return ::null_is_showing_video( m_videoOutput ); | 385 | return ::null_is_showing_video( m_videoOutput ); |
367 | } | 386 | } |
368 | 387 | ||
369 | bool Lib::hasVideo() const { | 388 | bool Lib::hasVideo() const { |
370 | assert( m_initialized ); | 389 | assert( m_initialized ); |
371 | 390 | ||
372 | return xine_get_stream_info( m_stream, 18 ); | 391 | return xine_get_stream_info( m_stream, 18 ); |
373 | } | 392 | } |
374 | 393 | ||
375 | void Lib::showVideoFullScreen( bool fullScreen ) { | 394 | void Lib::showVideoFullScreen( bool fullScreen ) { |
376 | assert( m_initialized ); | 395 | assert( m_initialized ); |
377 | 396 | ||
378 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 397 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
379 | } | 398 | } |
380 | 399 | ||
381 | bool Lib::isVideoFullScreen() const { | 400 | bool Lib::isVideoFullScreen() const { |