summaryrefslogtreecommitdiffstats
path: root/video/out/vo_direct3d.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-04 15:56:04 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:31 +0100
commit191bcbd1f2a0aa7ab64ed0e2768f29fedf2f4c30 (patch)
tree5051c40e3342b47369953605ea0a7edf3d1599eb /video/out/vo_direct3d.c
parent97032f1b58cc4c5c17002939703ee16904691675 (diff)
downloadmpv-191bcbd1f2a0aa7ab64ed0e2768f29fedf2f4c30.tar.bz2
mpv-191bcbd1f2a0aa7ab64ed0e2768f29fedf2f4c30.tar.xz
video/out: make draw_image mandatory, remove VOCTRL_DRAW_IMAGE
Remove VOCTRL_DRAW_IMAGE and always set vo_driver.draw_image in VOs. Make draw_image mandatory: change some VOs (like vo_x11) to support it, and remove the image-to-slices fallback in vf_vo. Remove vo_driver.is_new. This member indicated whether draw_image is supported unconditionally, which is now always the case. draw_image_pts is a hack until the video filter chain is changed to include the PTS as field in mp_image. Then vo_vdpau and vo_lavc will be changed to use draw_image.
Diffstat (limited to 'video/out/vo_direct3d.c')
-rw-r--r--video/out/vo_direct3d.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index 6e4e2dbae2..2b6f39f8d2 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -868,7 +868,7 @@ static void uninit_d3d(d3d_priv *priv)
priv->d3d_handle = NULL;
}
-static uint32_t d3d_upload_and_render_frame_texture(d3d_priv *priv,
+static void d3d_upload_and_render_frame_texture(d3d_priv *priv,
mp_image_t *mpi)
{
if (!(mpi->flags & MP_IMGFLAG_DRAW_CALLBACK))
@@ -880,20 +880,19 @@ static uint32_t d3d_upload_and_render_frame_texture(d3d_priv *priv,
d3dtex_update(priv, &priv->planes[n].texture);
}
- return d3d_draw_frame(priv);
+ d3d_draw_frame(priv);
}
-/** @brief Render a frame on the screen.
- * @param mpi mpi structure with the decoded frame inside
- * @return VO_TRUE on success, VO_ERROR on failure
- */
-static uint32_t d3d_upload_and_render_frame(d3d_priv *priv, mp_image_t *mpi)
+static void draw_image(struct vo *vo, mp_image_t *mpi)
{
+ d3d_priv *priv = vo->priv;
if (!priv->d3d_device)
- return VO_TRUE;
+ return;
- if (priv->use_textures)
- return d3d_upload_and_render_frame_texture(priv, mpi);
+ if (priv->use_textures) {
+ d3d_upload_and_render_frame_texture(priv, mpi);
+ return;
+ }
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
goto skip_upload;
@@ -908,7 +907,7 @@ static uint32_t d3d_upload_and_render_frame(d3d_priv *priv, mp_image_t *mpi)
if (FAILED(IDirect3DSurface9_LockRect(priv->d3d_surface,
&priv->locked_rect, NULL, 0))) {
mp_msg(MSGT_VO, MSGL_ERR, "<vo_direct3d>Surface lock failed.\n");
- return VO_ERROR;
+ return;
}
}
@@ -918,7 +917,7 @@ static uint32_t d3d_upload_and_render_frame(d3d_priv *priv, mp_image_t *mpi)
skip_upload:
d3d_unlock_video_objects(priv);
- return d3d_draw_frame(priv);
+ d3d_draw_frame(priv);
}
static uint32_t d3d_draw_frame(d3d_priv *priv)
@@ -1447,8 +1446,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
switch (request) {
case VOCTRL_QUERY_FORMAT:
return query_format(priv, *(uint32_t*) data);
- case VOCTRL_DRAW_IMAGE:
- return d3d_upload_and_render_frame(priv, data);
case VOCTRL_FULLSCREEN:
vo_w32_fullscreen(vo);
resize_d3d(priv);
@@ -2062,7 +2059,6 @@ static void draw_osd(struct vo *vo, struct osd_state *osd)
#define AUTHOR "Georgi Petrov (gogothebee) <gogothebee@gmail.com> and others"
const struct vo_driver video_out_direct3d = {
- .is_new = true,
.info = &(const vo_info_t) {
"Direct3D 9 Renderer",
"direct3d",
@@ -2072,6 +2068,7 @@ const struct vo_driver video_out_direct3d = {
.preinit = preinit_standard,
.config = config,
.control = control,
+ .draw_image = draw_image,
.draw_slice = draw_slice,
.draw_osd = draw_osd,
.flip_page = flip_page,
@@ -2080,7 +2077,6 @@ const struct vo_driver video_out_direct3d = {
};
const struct vo_driver video_out_direct3d_shaders = {
- .is_new = true,
.info = &(const vo_info_t) {
"Direct3D 9 Renderer (using shaders for YUV conversion)",
"direct3d_shaders",
@@ -2090,6 +2086,7 @@ const struct vo_driver video_out_direct3d_shaders = {
.preinit = preinit_shaders,
.config = config,
.control = control,
+ .draw_image = draw_image,
.draw_slice = draw_slice,
.draw_osd = draw_osd,
.flip_page = flip_page,