summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-03 00:24:13 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2003-02-03 00:24:13 +0000
commitc9eab8d6d6726f95db5fe267ff50fe3508b0802d (patch)
tree1f4f34efc0853fedffd60ca63230a4c8df128a19 /src
parent983a68964e818a11d0a6412db772f0f049abb2a0 (diff)
downloadxine-lib-c9eab8d6d6726f95db5fe267ff50fe3508b0802d.tar.gz
xine-lib-c9eab8d6d6726f95db5fe267ff50fe3508b0802d.tar.bz2
i guess i've finally made a breakthrought on completion event handling!
add fallback code to get the event directly from XLib in case the gui has not forwarded it yet. this may happen when gui is busy redrawing menus, for example. it should also improve xine robustness to scheduler issues. now we can have smooth playback even if xine-ui hasn't being scheduled in time. CVS patchset: 4098 CVS date: 2003/02/03 00:24:13
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_xshm.c29
-rw-r--r--src/video_out/video_out_xv.c29
2 files changed, 55 insertions, 3 deletions
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index b98130dda..57f2af23c 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xshm.c,v 1.104 2003/02/02 13:38:24 esnel Exp $
+ * $Id: video_out_xshm.c,v 1.105 2003/02/03 00:24:13 miguelfreitas Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -60,6 +60,10 @@
#include "xineutils.h"
#include "vo_scale.h"
+#ifndef XShmGetEventBase
+extern int XShmGetEventBase(Display *);
+#endif
+
/*
#define LOG
*/
@@ -112,7 +116,8 @@ typedef struct xshm_driver_s {
vo_scale_t sc;
int expecting_event; /* completion event */
-
+ int completion_event;
+
xshm_frame_t *cur_frame; /* for completion event handling */
vo_overlay_t *overlay;
@@ -699,6 +704,22 @@ static void xshm_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
#ifdef LOG
printf ("video_out_xshm: display frame...\n");
#endif
+
+ if (this->expecting_event) {
+ XEvent event;
+ int received;
+
+ /*
+ * fallback mechanism: try to get the event directly in case frontend has
+ * not forwarded it to us (yet).
+ */
+ XLockDisplay (this->display);
+ received = XCheckTypedEvent(this->display, this->completion_event, &event);
+ XUnlockDisplay (this->display);
+
+ if(received)
+ this->expecting_event = 0;
+ }
if (this->expecting_event) {
#ifdef LOG
@@ -1163,6 +1184,10 @@ static vo_driver_t *xshm_open_plugin (video_driver_class_t *class_gen, const voi
myimage = create_ximage (this, &myshminfo, 100, 100);
dispose_ximage (this, &myshminfo, myimage);
+ if(this->use_shm)
+ this->completion_event = XShmGetEventBase(display) + ShmCompletion;
+ else
+ this->completion_event = -1;
/*
* Is the same byte order in use on the X11 client and server?
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index c67418ee2..1731bc1c8 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xv.c,v 1.156 2003/01/29 12:37:27 f1rmb Exp $
+ * $Id: video_out_xv.c,v 1.157 2003/02/03 00:24:13 miguelfreitas Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -67,6 +67,10 @@
#include "xineutils.h"
#include "vo_scale.h"
+#ifndef XShmGetEventBase
+extern int XShmGetEventBase(Display *);
+#endif
+
/*
#define LOG
*/
@@ -113,6 +117,7 @@ struct xv_driver_s {
XvPortID xv_port;
XColor black;
int expecting_event; /* completion event handling */
+ int completion_event;
int use_shm;
xv_property_t props[VO_NUM_PROPERTIES];
uint32_t capabilities;
@@ -663,8 +668,25 @@ static void xv_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
/*
printf ("video_out_xv: xv_display_frame...\n");
*/
+
if (this->expecting_event) {
+ XEvent event;
+ int received;
+
+ /*
+ * fallback mechanism: try to get the event directly in case frontend has
+ * not forwarded it to us (yet).
+ */
+ XLockDisplay (this->display);
+ received = XCheckTypedEvent(this->display, this->completion_event, &event);
+ XUnlockDisplay (this->display);
+ if(received)
+ this->expecting_event = 0;
+ }
+
+ if (this->expecting_event) {
+
frame->vo_frame.displayed (&frame->vo_frame);
this->expecting_event--;
#ifdef LOG
@@ -1287,6 +1309,11 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
myimage = create_ximage (this, &myshminfo, 100, 100,
(this->xv_format_yv12 != 0) ? XINE_IMGFMT_YV12 : XINE_IMGFMT_YUY2);
dispose_ximage (this, &myshminfo, myimage);
+
+ if(this->use_shm)
+ this->completion_event = XShmGetEventBase(display) + ShmCompletion;
+ else
+ this->completion_event = -1;
this->deinterlace_method = config->register_enum (config, "video.deinterlace_method", 4,
deinterlace_methods,