summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-22 21:46:22 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commit0c5311f17cb9078f0ddde7c41cad61d00aea4a94 (patch)
treee8254feab42d21e0c6932ce68a34228529247f66 /video/out
parent15c7f7a33968edebe305e2845b32eb2383457d46 (diff)
downloadmpv-0c5311f17cb9078f0ddde7c41cad61d00aea4a94.tar.bz2
mpv-0c5311f17cb9078f0ddde7c41cad61d00aea4a94.tar.xz
video: cleanup: replace old mp_image function names
mp_image_alloc() also changes argument order compared to alloc_mpi(). The format now comes first, then width/height.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/gl_common.c2
-rw-r--r--video/out/vo.h2
-rw-r--r--video/out/vo_direct3d.c6
-rw-r--r--video/out/vo_lavc.c6
-rw-r--r--video/out/vo_opengl.c4
-rw-r--r--video/out/vo_opengl_old.c4
-rw-r--r--video/out/vo_sdl.c21
-rw-r--r--video/out/vo_vdpau.c2
-rw-r--r--video/out/vo_x11.c3
-rw-r--r--video/out/vo_xv.c2
10 files changed, 25 insertions, 27 deletions
diff --git a/video/out/gl_common.c b/video/out/gl_common.c
index 42d035337f..b7b30702a6 100644
--- a/video/out/gl_common.c
+++ b/video/out/gl_common.c
@@ -1978,7 +1978,7 @@ mp_image_t *glGetWindowScreenshot(GL *gl)
{
GLint vp[4]; //x, y, w, h
gl->GetIntegerv(GL_VIEWPORT, vp);
- mp_image_t *image = alloc_mpi(vp[2], vp[3], IMGFMT_RGB24);
+ mp_image_t *image = mp_image_alloc(IMGFMT_RGB24, vp[2], vp[3]);
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
gl->PixelStorei(GL_PACK_ALIGNMENT, 0);
gl->PixelStorei(GL_PACK_ROW_LENGTH, 0);
diff --git a/video/out/vo.h b/video/out/vo.h
index 6ea2f930e8..eb55417f4c 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -98,7 +98,7 @@ struct voctrl_screenshot_args {
// implemented.
int full_window;
// Will be set to a newly allocated image, that contains the screenshot.
- // The caller has to free the pointer with free_mp_image().
+ // The caller has to free the image with talloc_free().
// It is not specified whether the image data is a copy or references the
// image data directly.
// Is never NULL. (Failure has to be indicated by returning VO_FALSE.)
diff --git a/video/out/vo_direct3d.c b/video/out/vo_direct3d.c
index d3c907f944..51caaf2be9 100644
--- a/video/out/vo_direct3d.c
+++ b/video/out/vo_direct3d.c
@@ -1616,7 +1616,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
if (!get_video_buffer(priv, &buffer))
return;
- copy_mpi(&buffer, mpi);
+ mp_image_copy(&buffer, mpi);
d3d_unlock_video_objects(priv);
@@ -1697,7 +1697,7 @@ static mp_image_t *get_window_screenshot(d3d_priv *priv)
if (width < 1 || height < 1)
goto error_exit;
- image = alloc_mpi(width, height, IMGFMT_BGR32);
+ image = mp_image_alloc(IMGFMT_BGR32, width, height);
IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, 0);
@@ -1712,7 +1712,7 @@ static mp_image_t *get_window_screenshot(d3d_priv *priv)
error_exit:
if (image)
- free_mp_image(image);
+ talloc_free(image);
if (surface)
IDirect3DSurface9_Release(surface);
return NULL;
diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c
index cdb7f71797..aa9077fb17 100644
--- a/video/out/vo_lavc.c
+++ b/video/out/vo_lavc.c
@@ -89,7 +89,7 @@ static void uninit(struct vo *vo)
// palette hack
if (vc->lastimg->imgfmt == IMGFMT_PAL8)
vc->lastimg->planes[1] = NULL;
- free_mp_image(vc->lastimg);
+ talloc_free(vc->lastimg);
vc->lastimg = NULL;
}
@@ -171,7 +171,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
vc->buffer = talloc_size(vc, vc->buffer_size);
- vc->lastimg = alloc_mpi(width, height, format);
+ vc->lastimg = mp_image_alloc(format, width, height);
// palette hack
if (vc->lastimg->imgfmt == IMGFMT_PAL8)
@@ -455,7 +455,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
mp_msg(MSGT_ENCODE, MSGL_INFO,
"vo-lavc: Frame at pts %d got displayed %d times\n",
(int) vc->lastframeipts, vc->lastdisplaycount);
- copy_mpi(vc->lastimg, mpi);
+ mp_image_copy(vc->lastimg, mpi);
vc->lastimg_wants_osd = true;
// palette hack
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index aa6f9243f3..665e008178 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -1321,8 +1321,8 @@ static mp_image_t *get_screenshot(struct gl_priv *p)
{
GL *gl = p->gl;
- mp_image_t *image = alloc_mpi(p->texture_width, p->texture_height,
- p->image_format);
+ mp_image_t *image = mp_image_alloc(p->image_format, p->texture_width,
+ p->texture_height);
// NOTE about image formats with alpha plane: we don't even have the alpha
// anymore. We never upload it to any texture, as it would be a waste of
diff --git a/video/out/vo_opengl_old.c b/video/out/vo_opengl_old.c
index d708d6fcb6..6605876226 100644
--- a/video/out/vo_opengl_old.c
+++ b/video/out/vo_opengl_old.c
@@ -791,8 +791,8 @@ static mp_image_t *get_screenshot(struct vo *vo)
struct gl_priv *p = vo->priv;
GL *gl = p->gl;
- mp_image_t *image = alloc_mpi(p->texture_width, p->texture_height,
- p->image_format);
+ mp_image_t *image = mp_image_alloc(p->image_format, p->texture_width,
+ p->texture_height);
glDownloadTex(gl, p->target, p->gl_format, p->gl_type, image->planes[0],
image->stride[0]);
diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c
index 2eeed1b66a..c3ed3c6774 100644
--- a/video/out/vo_sdl.c
+++ b/video/out/vo_sdl.c
@@ -448,7 +448,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
return -1;
}
- vc->ssmpi = alloc_mpi(width, height, format);
+ vc->ssmpi = mp_image_alloc(format, width, height);
resize(vo, d_width, d_height);
@@ -593,7 +593,7 @@ static void uninit(struct vo *vo)
{
struct priv *vc = vo->priv;
destroy_renderer(vo);
- free_mp_image(vc->ssmpi);
+ talloc_free(vc->ssmpi);
SDL_QuitSubSystem(SDL_INIT_VIDEO);
talloc_free(vc);
}
@@ -857,7 +857,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
if (color_add > 255)
color_add = 255;
- // typically this runs in parallel with the following copy_mpi call
+ // typically this runs in parallel with the following mp_image_copy call
SDL_SetRenderDrawColor(vc->renderer, color_add, color_add, color_add, 255);
SDL_RenderClear(vc->renderer);
@@ -894,7 +894,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
texmpi->stride[2] = pitch / 2;
}
}
- copy_mpi(texmpi, mpi);
+ mp_image_copy(texmpi, mpi);
SDL_UnlockTexture(vc->tex);
}
@@ -909,7 +909,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
dst.w = vc->dst_rect.x1 - vc->dst_rect.x0;
dst.h = vc->dst_rect.y1 - vc->dst_rect.y0;
- // typically this runs in parallel with the following copy_mpi call
+ // typically this runs in parallel with the following mp_image_copy call
if (color_mod > 255) {
SDL_SetTextureColorMod(vc->tex, color_mod / 2, color_mod / 2, color_mod / 2);
SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
@@ -919,7 +919,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
SDL_RenderCopy(vc->renderer, vc->tex, &src, &dst);
}
if (mpi)
- copy_mpi(vc->ssmpi, mpi);
+ mp_image_copy(vc->ssmpi, mpi);
}
static void update_screeninfo(struct vo *vo)
@@ -940,19 +940,18 @@ static void update_screeninfo(struct vo *vo)
static struct mp_image *get_screenshot(struct vo *vo)
{
struct priv *vc = vo->priv;
- mp_image_t *image = alloc_mpi(vc->ssmpi->w, vc->ssmpi->h, vc->ssmpi->imgfmt);
- copy_mpi(image, vc->ssmpi);
- return image;
+ return mp_image_new_copy(vc->ssmpi);
}
static struct mp_image *get_window_screenshot(struct vo *vo)
{
struct priv *vc = vo->priv;
- mp_image_t *image = alloc_mpi(vo->dwidth, vo->dheight, vc->osd_format.mpv);
+ struct mp_image *image = mp_image_alloc(vc->osd_format.mpv, vo->dwidth,
+ vo->dheight);
if (SDL_RenderReadPixels(vc->renderer, NULL, vc->osd_format.sdl,
image->planes[0], image->stride[0])) {
mp_msg(MSGT_VO, MSGL_ERR, "[sdl] SDL_RenderReadPixels failed\n");
- free_mp_image(image);
+ talloc_free(image);
return NULL;
}
return image;
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 48080ba186..42c8bc6a24 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -1339,7 +1339,7 @@ static struct mp_image *read_output_surface(struct vdpctx *vc,
{
VdpStatus vdp_st;
struct vdp_functions *vdp = vc->vdp;
- struct mp_image *image = alloc_mpi(width, height, IMGFMT_BGR32);
+ struct mp_image *image = mp_image_alloc(IMGFMT_BGR32, width, height);
image->colorspace = MP_CSP_RGB;
image->levels = vc->colorspace.levels_out; // hardcoded with conv. matrix
diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c
index 4bdb209891..5a81648233 100644
--- a/video/out/vo_x11.c
+++ b/video/out/vo_x11.c
@@ -449,8 +449,7 @@ static mp_image_t *get_screenshot(struct vo *vo)
struct priv *p = vo->priv;
struct mp_image img = get_x_buffer(p);
- struct mp_image *res = alloc_mpi(img.w, img.h, img.imgfmt);
- copy_mpi(res, &img);
+ struct mp_image *res = mp_image_new_copy(&img);
mp_draw_sub_backup_restore(p->osd_backup, res);
return res;
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index 8bfe3e1777..d5225cd7cd 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -406,7 +406,7 @@ static void draw_image(struct vo *vo, mp_image_t *mpi)
struct xvctx *ctx = vo->priv;
struct mp_image xv_buffer = get_xv_buffer(vo, ctx->current_buf);
- copy_mpi(&xv_buffer, mpi);
+ mp_image_copy(&xv_buffer, mpi);
mp_draw_sub_backup_reset(ctx->osd_backup);
}