From: Mikko Rasa Date: Thu, 15 Oct 2015 23:19:57 +0000 (+0300) Subject: Pass expose events to Xine X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2204af390e6fe6db98c5d2f6e5317f841dc31198;p=xinema.git Pass expose events to Xine --- diff --git a/source/xineengine.cpp b/source/xineengine.cpp index 4175381..656990e 100644 --- a/source/xineengine.cpp +++ b/source/xineengine.cpp @@ -7,11 +7,12 @@ using namespace std; using namespace Msp; -XineEngine::XineEngine(const Graphics::Window &w, Mutex *m): +XineEngine::XineEngine(Graphics::Window &w, Mutex *m): window(w), display_mutex(m), locked_thread(0), - lock_count(0) + lock_count(0), + pending_expose(0) { engine = xine_new(); @@ -44,6 +45,8 @@ XineEngine::XineEngine(const Graphics::Window &w, Mutex *m): video_driver = xine_open_video_driver(engine, "auto", XINE_VISUAL_TYPE_X11_2, &visual); if(!video_driver) throw runtime_error("Could not open video driver"); + + window.signal_expose.connect(sigc::mem_fun(this, &XineEngine::window_exposed)); } XineEngine::~XineEngine() @@ -53,6 +56,22 @@ XineEngine::~XineEngine() xine_exit(engine); } +void XineEngine::tick() +{ + if(pending_expose) + { + xine_port_send_gui_data(video_driver, XINE_GUI_SEND_EXPOSE_EVENT, &pending_expose->xevent); + delete pending_expose; + pending_expose = 0; + } +} + +void XineEngine::window_exposed(unsigned, unsigned, unsigned, unsigned, const Graphics::Window::Event &event) +{ + delete pending_expose; + pending_expose = new Graphics::Window::Event(event); +} + void XineEngine::dest_size_cb(void *user_data, int, int, double, int *dest_width, int *dest_height, double *dest_pixel_aspect) { XineEngine &engine = *reinterpret_cast(user_data); diff --git a/source/xineengine.h b/source/xineengine.h index 8acb1a5..2949734 100644 --- a/source/xineengine.h +++ b/source/xineengine.h @@ -2,16 +2,17 @@ #define XINEENGINE_H_ #include +#include #include #include #include class XineStream; -class XineEngine +class XineEngine: public sigc::trackable { private: - const Msp::Graphics::Window &window; + Msp::Graphics::Window &window; Msp::Mutex *display_mutex; pthread_t locked_thread; unsigned lock_count; @@ -19,16 +20,21 @@ private: xine_audio_port_t *audio_driver; x11_visual_t visual; xine_video_port_t *video_driver; + Msp::Graphics::Window::Event *pending_expose; public: - XineEngine(const Msp::Graphics::Window &, Msp::Mutex * = 0); + XineEngine(Msp::Graphics::Window &, Msp::Mutex * = 0); ~XineEngine(); xine_t *get_engine() { return engine; } xine_audio_port_t *get_audio_driver() { return audio_driver; } xine_video_port_t *get_video_driver() { return video_driver; } + void tick(); + private: + void window_exposed(unsigned, unsigned, unsigned, unsigned, const Msp::Graphics::Window::Event &); + static void dest_size_cb(void *, int, int, double, int *, int *, double *); static void frame_output_cb(void *, int, int, double, int *, int *, int *, int *, double *, int *, int *); static void lock_cb(void *); diff --git a/source/xinema.cpp b/source/xinema.cpp index fc042e1..feab327 100644 --- a/source/xinema.cpp +++ b/source/xinema.cpp @@ -50,6 +50,7 @@ void Xinema::tick() display.tick(); } + engine->tick(); if(stream) stream->tick();