diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-09-19 00:28:17 +0300 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-09-19 00:28:17 +0300 |
commit | 3f215c9f8e4d5d95ac9b45376460391669906236 (patch) | |
tree | 1f675ef31908400c3411ace5182ca015c57000aa /libvo/video_out.c | |
parent | 82bbf1a1ab1affc675e9b69b93e33accfa2ed0b8 (diff) | |
parent | c2d0a9c8a78b20ed8e96ff5a7d3e8c936b82cae1 (diff) | |
download | mpv-3f215c9f8e4d5d95ac9b45376460391669906236.tar.bz2 mpv-3f215c9f8e4d5d95ac9b45376460391669906236.tar.xz |
Merge branch 'vdpau' into build
* vdpau: (22 commits)
VO: Prefer vo_vdpau over vo_xv again
vo_vdpau: Fix X event handling bugs
vo_vdpau: Fix memory corruption bug with MP_IMGTYPE_NUMBERED
core/VO: Allow VO drivers to add/modify frames
video_out.h: Cosmetics
VO interface: Remove obsolete draw_frame() from new interface
vo_vdpau: Support recovering from VDPAU display preemption
vo_vdpau: Support updating OSD while paused
vo_vdpau.c: Reindent control() switch statement
vo_vdpau: Allocate one large surface for EOSD content
vo_vdpau.c: cosmetics
vo_vdpau: reindent after GUI code removal
vo_vpdau: Clean up uninit logic
vo_vdpau: Make CHECK_ST macro safer
vo_vdpau: Move all remaining static/global variables to context
vo_vdpau: Move things to context struct
vo_vdpau: Make info struct const
vo_vdpau: Replace global function table with context variable
vo_vdpau: Move VDPAU interface pointers into one struct
vo_vdpau: Add template file for VDPAU functions
...
Diffstat (limited to 'libvo/video_out.c')
-rw-r--r-- | libvo/video_out.c | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c index 01c04f3ca6..7a41fcf1d4 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -21,6 +21,8 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <assert.h> +#include <stdbool.h> #include <unistd.h> //#include <sys/mman.h> @@ -31,6 +33,7 @@ #include "video_out.h" #include "aspect.h" #include "geometry.h" +#include "old_vo_wrapper.h" #include "mp_msg.h" #include "help_mp.h" @@ -162,12 +165,12 @@ const struct vo_driver *video_out_drivers[] = #ifdef CONFIG_3DFX &video_out_3dfx, #endif -#ifdef CONFIG_XV - &video_out_xv, -#endif #if CONFIG_VDPAU &video_out_vdpau, #endif +#ifdef CONFIG_XV + &video_out_xv, +#endif #ifdef CONFIG_X11 &video_out_x11, &video_out_xover, @@ -276,11 +279,41 @@ int vo_control(struct vo *vo, uint32_t request, void *data) return vo->driver->control(vo, request, data); } +// Return -1 if driver appears not to support a draw_image interface, +// 0 otherwise (whether the driver actually drew something or not). +int vo_draw_image(struct vo *vo, struct mp_image *mpi, double pts) +{ + if (!vo->config_ok) + return 0; + if (vo->driver->buffer_frames) { + vo->driver->draw_image(vo, mpi, pts); + return 0; + } + vo->frame_loaded = true; + vo->next_pts = pts; + if (vo_control(vo, VOCTRL_DRAW_IMAGE, mpi) == VO_NOTIMPL) + return -1; + return 0; +} + +int vo_get_buffered_frame(struct vo *vo, bool eof) +{ + if (!vo->config_ok) + return -1; + if (vo->frame_loaded) + return 0; + if (!vo->driver->buffer_frames) + return -1; + vo->driver->get_buffered_frame(vo, eof); + return vo->frame_loaded ? 0 : -1; +} + int vo_draw_frame(struct vo *vo, uint8_t *src[]) { + assert(!vo->driver->is_new); if (!vo->config_ok) return 0; - return vo->driver->draw_frame(vo, src); + return old_vo_draw_frame(vo, src); } int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y) @@ -299,6 +332,8 @@ void vo_flip_page(struct vo *vo) { if (!vo->config_ok) return; + vo->frame_loaded = false; + vo->next_pts = (-1LL<<63); // MP_NOPTS_VALUE vo->driver->flip_page(vo); } @@ -309,6 +344,14 @@ void vo_check_events(struct vo *vo) vo->driver->check_events(vo); } +void vo_seek_reset(struct vo *vo) +{ + if (!vo->config_ok) + return; + vo_control(vo, VOCTRL_RESET, NULL); + vo->frame_loaded = false; +} + void vo_destroy(struct vo *vo) { vo->driver->uninit(vo); |