00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef XINE_VIDEO_LIB_H
00035 #define XINE_VIDEO_LIB_H
00036
00037 #include <xine.h>
00038
00039 #include "threadutil.h"
00040
00041 class XineVideoWidget;
00042
00043 namespace XINE {
00044
00052 class Lib : public ThreadUtil::Channel, private ThreadUtil::Thread
00053 {
00054 Q_OBJECT
00055 public:
00056 enum InitializationMode { InitializeImmediately, InitializeInThread };
00057
00058 Lib( InitializationMode initMode, XineVideoWidget* = 0);
00059
00060 ~Lib();
00061 static int majorVersion();
00062 static int minorVersion();
00063 static int subVersion();
00064
00065
00066 void resize ( const QSize &s );
00067
00068 int setfile(const QString& fileName);
00069 int play( const QString& fileName,
00070 int startPos = 0,
00071 int start_time = 0 );
00072 void stop();
00073 void pause( bool toggle );
00074
00075 int speed() const;
00076
00086 void setSpeed( int speed = XINE_SPEED_PAUSE );
00087
00088 int status() const;
00089
00090 int currentPosition()const;
00091
00092 int currentTime()const;
00093
00094 int length() const;
00095
00096 bool isSeekable()const;
00097
00101 void setShowVideo(bool video);
00102
00106 bool isShowingVideo() const;
00107
00111 void showVideoFullScreen( bool fullScreen );
00112
00116 bool isVideoFullScreen() const;
00117
00118
00132 QString metaInfo( int number ) const;
00133
00137 bool isScaling() const;
00138
00142 void seekTo( int time );
00143
00148 bool hasVideo() const;
00149
00153 void setScaling( bool );
00154
00159 void setGamma( int );
00160
00168 int error() const;
00169
00170 void ensureInitialized();
00171
00172 void setWidget( XineVideoWidget *widget );
00173
00174 QSize videoSize()const;
00175 int audioBitrate()const;
00176 int videoBitrate()const;
00177
00178 signals:
00179
00180 void stopped();
00181
00182 void initialized();
00183
00184 protected:
00185 virtual void receiveMessage( ThreadUtil::ChannelMessage *msg, SendType sendType );
00186
00187 virtual void run();
00188
00189 private:
00190 void initialize();
00191
00192 int m_bytes_per_pixel;
00193 bool m_initialized:1;
00194 bool m_duringInitialization:1;
00195 bool m_video:1;
00196 XineVideoWidget *m_wid;
00197 QSize m_videoSize;
00198 xine_t *m_xine;
00199 xine_stream_t *m_stream;
00200 xine_cfg_entry_t *m_config;
00201 xine_vo_driver_t *m_videoOutput;
00202 xine_ao_driver_t* m_audioOutput;
00203 xine_event_queue_t *m_queue;
00204
00205 void handleXineEvent( const xine_event_t* t );
00206 void handleXineEvent( int type, int data, const char* name );
00207 void drawFrame( uint8_t* frame, int width, int height, int bytes );
00208
00209 static void xine_event_handler( void* user_data, const xine_event_t* t);
00210 static void xine_display_frame( void* user_data, uint8_t* frame ,
00211 int width, int height, int bytes );
00212 static void xine_vo_scale_cb(void *, int, int, double,
00213 int*,int*,int*,int*,double*,int*,int*);
00214 static void xine_dest_cb(void*,int,int,double,int*,int*,double*);
00215 };
00216 };
00217
00218
00219 #endif