Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 90 |
1 files changed, 51 insertions, 39 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,5 +1,5 @@ /* - This file is part of the Opie Project + This file is part of the Opie Project - Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> + Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> Copyright (c) 2002 LJP <> @@ -8,21 +8,21 @@ .=l. - .>+-= - _;:, .> :=|. This program is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This program is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU -..}^=.= = ; Library General Public License for more -++= -. .` .: details. - : = ...= . :.=- - -. .:....=;==+<; You should have received a copy of the GNU - -_. . . )=. = Library General Public License along with - -- :-=` this library; see the file COPYING.LIB. + .>+-= +_;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. +: = ...= . :.=- +-. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, @@ -50,3 +50,3 @@ typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, - int width, int height,int bytes ); + int width, int height,int bytes ); @@ -191,2 +191,13 @@ int Lib::subVersion() { +int Lib::setfile(const QString& fileName) +{ + QString str = fileName.stripWhiteSpace(); + + + if ( !xine_open( m_stream, str.utf8().data() ) ) { + return 0; + } + return 1; +} + int Lib::play( const QString& fileName, int startPos, int start_time ) { @@ -216,3 +227,3 @@ void Lib::pause( bool toggle ) { } - + else { @@ -268,12 +279,12 @@ int Lib::length() const { do - { - iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); - if (iRetVal) - {/* if the function didn't return 0, then pos, time and length are valid.*/ - return length/1000; - } - /*don't poll too much*/ - usleep(100000); - iTestLoop++; - } + { + iRetVal = xine_get_pos_length( m_stream, &pos, &time, &length ); + if (iRetVal) + {/* if the function didn't return 0, then pos, time and length are valid.*/ + return length/1000; + } + /*don't poll too much*/ + usleep(100000); + iTestLoop++; + } while ( iTestLoop < 10 ); /* if after 1s, we still don't have any @@ -304,3 +315,3 @@ void Lib::seekTo( int time ) { } - + } @@ -333,5 +344,6 @@ void Lib::setWidget( XineVideoWidget *widget ) m_wid = widget; - resize ( m_wid-> size ( ) ); - ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); - m_wid->repaint(); + if (m_wid) { + resize ( m_wid-> size ( ) ); + ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); + } } @@ -433,5 +445,5 @@ void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { - assert( m_wid ); +// assert( m_wid ); - m_wid-> setVideoFrame ( frame, width, height, bytes ); + if (m_wid) m_wid-> setVideoFrame ( frame, width, height, bytes ); } |