summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/lib.cpp
authorsimon <simon>2002-12-02 10:25:36 (UTC)
committer simon <simon>2002-12-02 10:25:36 (UTC)
commit4447c70039ba1a3104bf229628699f33b8608973 (patch) (unidiff)
tree9810b07492a20f1ec9332da8c353469c8c120e2e /noncore/multimedia/opieplayer2/lib.cpp
parent2f11390d99fba4eefa330322e11280802fb6dc26 (diff)
downloadopie-4447c70039ba1a3104bf229628699f33b8608973.zip
opie-4447c70039ba1a3104bf229628699f33b8608973.tar.gz
opie-4447c70039ba1a3104bf229628699f33b8608973.tar.bz2
- put a thread pipe between the xine callback handler and the receiver
on qt side, to avoid problems like repaints from within a non-gui thread
Diffstat (limited to 'noncore/multimedia/opieplayer2/lib.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 19b64e8..1ac9809 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -21,48 +21,50 @@
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 <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 41
42#include <qgfx_qws.h> 42#include <qgfx_qws.h>
43#include <qdirectpainter_qws.h> 43#include <qdirectpainter_qws.h>
44 44
45#include <assert.h>
46
45#include "xinevideowidget.h" 47#include "xinevideowidget.h"
46#include "frame.h" 48#include "frame.h"
47#include "lib.h" 49#include "lib.h"
48 50
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 51typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame,
50 int width, int height,int bytes ); 52 int width, int height,int bytes );
51 53
52extern "C" { 54extern "C" {
53 xine_vo_driver_t* init_video_out_plugin( xine_cfg_entry_t* conf, void* video); 55 xine_vo_driver_t* init_video_out_plugin( xine_cfg_entry_t* conf, void* video);
54 int null_is_showing_video( const xine_vo_driver_t* self ); 56 int null_is_showing_video( const xine_vo_driver_t* self );
55 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 );
56 int null_is_fullscreen( const xine_vo_driver_t* self ); 58 int null_is_fullscreen( const xine_vo_driver_t* self );
57 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 );
58 int null_is_scaling( const xine_vo_driver_t* self ); 60 int null_is_scaling( const xine_vo_driver_t* self );
59 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 );
60 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 );
61 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 );
62 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 );
63 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 );
64 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 );
65} 67}
66 68
67using namespace XINE; 69using namespace XINE;
68 70
@@ -198,50 +200,61 @@ int Lib::length() {
198bool Lib::isSeekable() { 200bool Lib::isSeekable() {
199 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE ); 201 return xine_get_stream_info( m_stream, XINE_STREAM_INFO_SEEKABLE );
200} 202}
201 203
202void Lib::seekTo( int time ) { 204void Lib::seekTo( int time ) {
203 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( 205 //xine_trick_mode ( m_stream, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_(
204 // since its now milliseconds we need *1000 206 // since its now milliseconds we need *1000
205 xine_play( m_stream, 0, time*1000 ); 207 xine_play( m_stream, 0, time*1000 );
206} 208}
207 209
208 210
209Frame Lib::currentFrame() { 211Frame Lib::currentFrame() {
210 Frame frame; 212 Frame frame;
211 return frame; 213 return frame;
212}; 214};
213 215
214QString Lib::metaInfo( int number) { 216QString Lib::metaInfo( int number) {
215 return xine_get_meta_info( m_stream, number ); 217 return xine_get_meta_info( m_stream, number );
216} 218}
217 219
218int Lib::error() { 220int Lib::error() {
219 return xine_get_error( m_stream ); 221 return xine_get_error( m_stream );
220}; 222};
221 223
224void Lib::receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType )
225{
226 assert( sendType == ThreadUtil::Channel::OneWay );
227 handleXineEvent( msg->type() );
228 delete msg;
229}
230
222void Lib::handleXineEvent( const xine_event_t* t ) { 231void Lib::handleXineEvent( const xine_event_t* t ) {
223 if ( t->type == XINE_EVENT_UI_PLAYBACK_FINISHED ) { 232 send( new ThreadUtil::ChannelMessage( t->type ), OneWay );
233}
234
235void Lib::handleXineEvent( int type ) {
236 if ( type == XINE_EVENT_UI_PLAYBACK_FINISHED ) {
224 emit stopped(); 237 emit stopped();
225 } 238 }
226} 239}
227 240
228 241
229void Lib::setShowVideo( bool video ) { 242void Lib::setShowVideo( bool video ) {
230 m_video = video; 243 m_video = video;
231 ::null_set_show_video( m_videoOutput, video ); 244 ::null_set_show_video( m_videoOutput, video );
232} 245}
233 246
234bool Lib::isShowingVideo() { 247bool Lib::isShowingVideo() {
235 return ::null_is_showing_video( m_videoOutput ); 248 return ::null_is_showing_video( m_videoOutput );
236} 249}
237 250
238bool Lib::hasVideo() { 251bool Lib::hasVideo() {
239 return xine_get_stream_info( m_stream, 18 ); 252 return xine_get_stream_info( m_stream, 18 );
240} 253}
241 254
242void Lib::showVideoFullScreen( bool fullScreen ) { 255void Lib::showVideoFullScreen( bool fullScreen ) {
243 ::null_set_fullscreen( m_videoOutput, fullScreen ); 256 ::null_set_fullscreen( m_videoOutput, fullScreen );
244} 257}
245 258
246bool Lib::isVideoFullScreen() { 259bool Lib::isVideoFullScreen() {
247 return ::null_is_fullscreen( m_videoOutput ); 260 return ::null_is_fullscreen( m_videoOutput );