00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef QXINEWIDGET_H
00021 #define QXINEWIDGET_H
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include <qwidget.h>
00028 #include <qfile.h>
00029 #include <qstringlist.h>
00030 #include <qptrlist.h>
00031 #include <qtimer.h>
00032 #include <qevent.h>
00033 #include <qthread.h>
00034
00035 #include <xine.h>
00036
00037 #include <X11/Xlib.h>
00038
00039
00040 class QXineWidget : public QWidget, protected QThread
00041 {
00042
00043 Q_OBJECT
00044
00045 public:
00046 QXineWidget(QWidget *parent=0, const char *name=0, const QString& prefAudio = QString::null, const QString& prefVideo = QString::null, bool verbose = false, bool startManual = false);
00047 virtual ~QXineWidget();
00048
00049 QString i18n(const char *text);
00050 static void debugOut (QString);
00051 static void errorOut (QString);
00052 static void warningOut (QString);
00053 static void postEvent(QObject *, QEvent *);
00054 void messageBoxError(QWidget *, QString);
00055
00056 bool InitXine();
00057
00058 void GetAutoplayPlugins(QStringList&) const;
00059 bool GetAutoplayPluginMrl(const QString&, QStringList&);
00060 void GetVisualPlugins(QStringList&) const;
00061
00062 bool PlayMRL(const QString& mrl, const QString& title, bool returnInfo);
00063 virtual void setLogoFile();
00064 bool xineRunning;
00065
00066 void PlayNextChapter() const;
00067 void PlayPreviousChapter() const;
00068
00069 QString GetSupportedExtensions() const;
00070
00071 int GetScreensaverTimeout() const;
00072
00073 void GetVideoSettings(int& hue, int& sat, int& contrast, int& bright, int& audioAmp,
00074 int& avOffset, int& spuOffset) const;
00075
00076
00077
00078 void GetScreenshot(uchar*& rgb32BitData, int& videoWidth, int& videoHeight, double& scaleFactor) const;
00079
00080
00081 const xine_t* const GetXineEngine() const;
00082
00083 void StartMouseHideTimer();
00084 void StopMouseHideTimer();
00085
00086 void SetDevice(const QString& device);
00087 void SetStreamSaveDir(const QString& dir);
00088 const QString GetStreamSaveDir();
00089 void SetBroadcasterPort(const uint port);
00090 void SetVisualPlugin(const QString&);
00091
00092 QString GetLengthInfo();
00093 QString GetStreamInfo();
00094
00095 void SaveXineConfig();
00096
00097 const QString& GetXineMessage() { return xineMessage; }
00098
00099 void GlobalPosChanged();
00100
00101 signals:
00102 void signalQuit();
00103 void signalNewInfo(const QString&);
00104 void signalNewTitle(const QString&);
00105 void signalHasChapters(bool);
00106 void signalPlaybackFinished();
00107 void signalNewMrlReference(const QString&);
00108 void signalNewChannels(const QStringList&, const QStringList&, int, int);
00109 void signalNewPosition(int, const QString&);
00110 void signalLengthInfo(const QString&);
00111
00112 void signalStreamInfo(const QString&);
00113
00114 void signalShowOSD(const QString&);
00115
00116 void signalShowContextMenu(const QPoint&);
00117 void signalShowFullscreenPanel(const QPoint&);
00118 void signalMetaInfo( const QString& );
00119 void signalNewXineMessage();
00120 void signalToggleFullscreen();
00121
00122 public slots:
00123 virtual void polish();
00124 void slotSetMetaString( const QString& metaStr ) { metaString = metaStr; }
00125
00126 void slotSetVolume(int);
00127 virtual void slotStopPlayback();
00128 void slotSpeedPause();
00129 void slotSpeedNormal();
00130 void slotSetAudioChannel(int);
00131 void slotSetSubtitleChannel(int);
00132 void slotSetFileSubtitles(QString);
00133 void slotChangePosition(int);
00134 void slotTogglePlayMode();
00135 void slotEject();
00136 void slotEnableAutoresize(bool enable);
00137 void slotToggleDeinterlace();
00138 void slotAspectRatioAuto();
00139 void slotAspectRatio4_3();
00140 void slotAspectRatio16_9();
00141 void slotAspectRatioSquare();
00142 void slotZoomIn();
00143 void slotZoomOut();
00144 void slotZoomOff();
00145 void slotSetScreensaverTimeout( int ssTimeout );
00146
00147 void slotSetHue(int hue);
00148 void slotSetSaturation(int sat);
00149 void slotSetContrast(int contrast);
00150 void slotSetBrightness(int bright);
00151 void slotSetAudioAmp(int amp);
00152 void slotSetAVOffset(int av);
00153 void slotSetSpuOffset(int spu);
00154
00155 void slotSetEq30(int val);
00156 void slotSetEq60(int val);
00157 void slotSetEq125(int val);
00158 void slotSetEq250(int val);
00159 void slotSetEq500(int val);
00160 void slotSetEq1k(int val);
00161 void slotSetEq2k(int val);
00162 void slotSetEq4k(int val);
00163 void slotSetEq8k(int val);
00164 void slotSetEq16k(int val);
00165
00166 void slotMenu1();
00167 void slotMenu2();
00168 void slotMenu3();
00169 void slotMenu4();
00170 void slotMenu5();
00171 void slotMenu6();
00172 void slotMenu7();
00173
00174
00175
00176 private slots:
00177 void slotGetPosition();
00178 void slotEmitLengthInfo();
00179 void slotHideMouse();
00180 void slotFakeKeyEvent();
00181
00182 protected:
00183 virtual void mouseMoveEvent(QMouseEvent*);
00184 virtual void mousePressEvent(QMouseEvent*);
00185 virtual void keyPressEvent(QKeyEvent *);
00186 virtual void timerEvent( QTimerEvent* );
00187
00188
00189 static void VideoDriverChangedCallback(void* p, xine_cfg_entry_t* entry);
00190 static void AudioDriverChangedCallback(void* p, xine_cfg_entry_t* entry);
00191
00192 private:
00193 virtual void run();
00194
00195
00196 static void DestSizeCallback(void* p, int video_width, int video_height, double video_aspect,
00197 int* dest_width, int* dest_height, double* dest_aspect);
00198
00199 static void FrameOutputCallback(void* p, int video_width, int video_height, double video_aspect,
00200 int* dest_x, int* dest_y, int* dest_width, int* dest_height,
00201 double* dest_aspect, int* win_x, int* win_y);
00202
00203 static void XineEventListener(void* p, const xine_event_t*);
00204
00205 void SendXineError( bool returnInfo );
00206
00207 protected:
00208 xine_t* xineEngine;
00209 xine_audio_port_t* audioDriver;
00210 xine_video_port_t* videoDriver;
00211 xine_stream_t* xineStream;
00212 QTimer posTimer;
00213
00214
00215 private:
00216
00217
00218 bool startXineManual;
00219
00220 enum PLAY_MODE { NORMAL_PLAY, REPEAT_PLAY, PERCENT_PLAY};
00221 PLAY_MODE playMode;
00222
00223 QString preferedAudio;
00224 QString preferedVideo;
00225 QString devicePath;
00226 QString cachedCDPath,cachedVCDPath, cachedDVDPath;
00227 bool xineVerbose;
00228
00229 QString xineMessage;
00230
00231 pthread_t eventThread;
00232
00233 Window xineWindow;
00234 Display* xineDisplay;
00235 int xineScreen;
00236
00237 int videoFrameWidth;
00238 int videoFrameHeight;
00239 int globX;
00240 int globY;
00241
00242 x11_visual_t visual;
00243 xine_event_queue_t* eventQueue;
00244
00245 xine_post_t* xinePost;
00246 xine_post_out_t* postAudioSource;
00247 xine_post_in_t* postInput;
00248
00249 double displayRatio;
00250
00251 QSize newParentSize;
00252
00253 int screensaverTimeout;
00254 int osdTimeout;
00255 int currentZoom;
00256
00257 QTimer lengthInfoTimer;
00258 QTimer screensaverTimer;
00259 QTimer mouseHideTimer;
00260
00261 QString configFile;
00262 QString currentMRL;
00263 QString currentTitle;
00264 QString currentProgress;
00265 QString newMrlReference;
00266 QString extraInfo;
00267 QString trackInfoRow;
00268
00269 QString metaString;
00270
00271 QStringList audioCh;
00272 QStringList subCh;
00273 int currentAudio, currentSub;
00274 int savedPos;
00275
00276 QString audioDriverName;
00277 QString videoDriverName;
00278 QString visualPluginName;
00279
00280 int haveXTest, xTestKeycode;
00281
00282 bool autoresizeEnabled;
00283 bool DVDMenuEntered;
00284 bool DVDButtonEntered;
00285
00286 };
00287
00288 #endif // QXINEWIDGET_H