/* * player_xine.h * * This file is part of dc-qt, distributed under GPL-2, blablabla. * * Class av_player_xine: an implementation of the pure interface * av_player, defined in player.h. It implements an audio/video * player that uses xine-lib for playback. * * The code is X11-specific, i.e. not portable. * * Parts of this code are included only if preview is enabled by the * configure script, i.e. DISABLE_PREVIEW is not #defined. */ #ifndef _XINE_PLAYER_H_ #define _XINE_PLAYER_H_ // pure interface that we implement here #include "player.h" //DISABLE_PREVIEW #ifndef DISABLE_PREVIEW // Qt stuff #include // forward decls for our own OSD class QLabel; class QTimer; // xine stuff #include #endif // our nice xine-lib-based player class class av_player_xine : public av_player { Q_OBJECT public: // re-implmented interface functions from av_player virtual bool init(); // av_player init, callback setup virtual void shutdown(); // av_player close virtual bool play(QString &title, QString &filename); // inits xine drivers and plays file virtual bool stop(); // stops playback and close xine drivers virtual bool ffwd(); // fast forward virtual bool rwnd(); // rewind virtual bool pause(); // pause (doesn't shut down xine) virtual bool seek(int percent); // seek in file virtual int get_progress(); // get pos in file virtual bool set_fullscreen(bool on); // sets playback in full-screen window on/off // query funcs virtual bool playing_audio(); virtual bool playing_video(); virtual bool playing_fullscreen(); virtual av_player_status get_status(); // misc virtual void set_volume(int percent); virtual int get_volume(); // constructor/destructor av_player_xine(QWidget *parent=0, char *name=0); virtual ~av_player_xine(); /* Signals inherited from av_player: * * sig_progress(int percent) * sig_playing() * sig_stopped() * sig_set_title(const QString&) */ #ifndef DISABLE_PREVIEW // // All code below is not compiled if media preview is disabled // ----------------------------------------------------------- // re-implemented public from QWidget virtual QSize sizeHint() const; double aspect() const { return pixel_aspect; } protected: // internal class methods // re-implemented protected methods from QWidget virtual bool x11Event( XEvent * ); virtual void keyPressEvent( QKeyEvent * ); // static functions to use as callbacks // X-display locking functions - I don't even know if I need them =) static void x11Lock(); static void x11Unlock(); // called by xine if it wants to know the target size of a frame static void dest_size_cb(void *data, int video_width, int video_height, double video_pixel_aspect, int *dest_width, int *dest_height, double *dest_pixel_aspect); // called by xine when it's about to draw the frame static void frame_output_cb(void *data, int video_width, int video_height, double video_pixel_aspect, int *dest_x, int *dest_y, int *dest_width, int *dest_height, double *dest_pixel_aspect, int *win_x, int *win_y); // xine "event listener" callback static void event_listener(void *data, const xine_event_t *event); // called from frame output callback if video size has changed void frame_size_changed(int w, int h); // called from xine event callback void title_changed(const QString &title); void tell_status(const QString &msg, int msec); void playback_finished(); // called from callbacks to access status bool is_idle(); // called to display a message visible in full-screen void show_osd(const QString &msg, int msec); // internal class members bool is_fullscreen; bool audio_port_initialized; bool video_port_initialized; av_player_status status; // if set to true, the corresponding signal will emit within 1 second bool has_finished_playback; bool has_status_message; bool has_title; QString status_msg; int status_msg_time; QString title_str; QSize video_frame_size; double pixel_aspect; int volume; // original parent QWidget *org_parent; // "on-screen display" for status messages in full-screen mode QLabel *osd_label; QTimer *osd_timer; // xine data xine_t *xine; xine_stream_t *stream; xine_video_port_t *vo_port; xine_audio_port_t *ao_port; xine_event_queue_t *event_queue; // endif DISABLE_PREVIEW #endif private slots: void slot_emit_signals(); }; // endif _XINE_PLAYER_H_ #endif