Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 60 |
1 files changed, 36 insertions, 24 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index e3289bc..9f7a9c5 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,39 +1,39 @@ | |||
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 LJP <> | 5 | Copyright (c) 2002 LJP <> |
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 | ..}^=.= = ; 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 | #include "xinevideowidget.h" | 34 | #include "xinevideowidget.h" |
35 | #include "lib.h" | 35 | #include "lib.h" |
36 | 36 | ||
37 | /* OPIE */ | 37 | /* OPIE */ |
38 | #include <opie2/odebug.h> | 38 | #include <opie2/odebug.h> |
39 | #include <qpe/global.h> | 39 | #include <qpe/global.h> |
@@ -180,24 +180,35 @@ int Lib::majorVersion() { | |||
180 | int Lib::minorVersion() { | 180 | int Lib::minorVersion() { |
181 | int major, minor, sub; | 181 | int major, minor, sub; |
182 | xine_get_version ( &major, &minor, &sub ); | 182 | xine_get_version ( &major, &minor, &sub ); |
183 | return minor; | 183 | return minor; |
184 | } | 184 | } |
185 | 185 | ||
186 | int Lib::subVersion() { | 186 | int Lib::subVersion() { |
187 | int major, minor, sub; | 187 | int major, minor, sub; |
188 | xine_get_version ( &major, &minor, &sub ); | 188 | xine_get_version ( &major, &minor, &sub ); |
189 | return sub; | 189 | return sub; |
190 | } | 190 | } |
191 | 191 | ||
192 | int Lib::setfile(const QString& fileName) | ||
193 | { | ||
194 | QString str = fileName.stripWhiteSpace(); | ||
195 | |||
196 | |||
197 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | ||
198 | return 0; | ||
199 | } | ||
200 | return 1; | ||
201 | } | ||
202 | |||
192 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 203 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
193 | assert( m_initialized ); | 204 | assert( m_initialized ); |
194 | 205 | ||
195 | QString str = fileName.stripWhiteSpace(); | 206 | QString str = fileName.stripWhiteSpace(); |
196 | 207 | ||
197 | 208 | ||
198 | if ( !xine_open( m_stream, str.utf8().data() ) ) { | 209 | if ( !xine_open( m_stream, str.utf8().data() ) ) { |
199 | return 0; | 210 | return 0; |
200 | } | 211 | } |
201 | return xine_play( m_stream, startPos, start_time); | 212 | return xine_play( m_stream, startPos, start_time); |
202 | } | 213 | } |
203 | 214 | ||
@@ -322,27 +333,28 @@ void Lib::ensureInitialized() | |||
322 | { | 333 | { |
323 | if ( m_initialized ) | 334 | if ( m_initialized ) |
324 | return; | 335 | return; |
325 | 336 | ||
326 | odebug << "waiting for initialization thread to finish" << oendl; | 337 | odebug << "waiting for initialization thread to finish" << oendl; |
327 | wait(); | 338 | wait(); |
328 | odebug << "initialization thread finished!" << oendl; | 339 | odebug << "initialization thread finished!" << oendl; |
329 | } | 340 | } |
330 | 341 | ||
331 | void Lib::setWidget( XineVideoWidget *widget ) | 342 | void Lib::setWidget( XineVideoWidget *widget ) |
332 | { | 343 | { |
333 | m_wid = widget; | 344 | m_wid = widget; |
345 | if (m_wid) { | ||
334 | resize ( m_wid-> size ( ) ); | 346 | resize ( m_wid-> size ( ) ); |
335 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 347 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
336 | m_wid->repaint(); | 348 | } |
337 | } | 349 | } |
338 | 350 | ||
339 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) | 351 | void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType ) |
340 | { | 352 | { |
341 | assert( sendType == ThreadUtil::Channel::OneWay ); | 353 | assert( sendType == ThreadUtil::Channel::OneWay ); |
342 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); | 354 | handleXineEvent( msg->type(), msg->data(), msg->msg() ); |
343 | delete msg; | 355 | delete msg; |
344 | } | 356 | } |
345 | 357 | ||
346 | void Lib::handleXineEvent( const xine_event_t* t ) { | 358 | void Lib::handleXineEvent( const xine_event_t* t ) { |
347 | int prog = -1; const char* name = 0; | 359 | int prog = -1; const char* name = 0; |
348 | if ( t->type == XINE_EVENT_PROGRESS ) { | 360 | if ( t->type == XINE_EVENT_PROGRESS ) { |
@@ -422,16 +434,16 @@ void Lib::xine_event_handler( void* user_data, const xine_event_t* t ) { | |||
422 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 434 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
423 | int width, int height, int bytes ) { | 435 | int width, int height, int bytes ) { |
424 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 436 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
425 | } | 437 | } |
426 | 438 | ||
427 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 439 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
428 | assert( m_initialized ); | 440 | assert( m_initialized ); |
429 | 441 | ||
430 | if ( !m_video ) { | 442 | if ( !m_video ) { |
431 | return; | 443 | return; |
432 | } | 444 | } |
433 | 445 | ||
434 | assert( m_wid ); | 446 | // assert( m_wid ); |
435 | 447 | ||
436 | m_wid-> setVideoFrame ( frame, width, height, bytes ); | 448 | if (m_wid) m_wid-> setVideoFrame ( frame, width, height, bytes ); |
437 | } | 449 | } |