diff options
-rw-r--r-- | src/video_out/video_out_xshm.c | 29 | ||||
-rw-r--r-- | src/video_out/video_out_xv.c | 29 |
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, |