1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

vaapi: minor simplification

This commit is contained in:
wm4 2015-01-21 22:12:30 +01:00
parent a1ed13869c
commit b2149f7fe1
4 changed files with 6 additions and 9 deletions

View File

@ -284,7 +284,7 @@ static void uninit(struct vf_instance *vf)
static int query_format(struct vf_instance *vf, unsigned int imgfmt)
{
struct vf_priv_s *p = vf->priv;
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->va->image_formats, imgfmt))
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->va, imgfmt))
return vf_next_query_format(vf, IMGFMT_VAAPI);
return 0;
}

View File

@ -177,7 +177,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
static int query_format(struct vo *vo, int imgfmt)
{
struct priv *p = vo->priv;
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->va_image_formats, imgfmt))
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->mpvaapi, imgfmt))
return 1;
return 0;

View File

@ -149,9 +149,9 @@ void va_destroy(struct mp_vaapi_ctx *ctx)
}
}
VAImageFormat *va_image_format_from_imgfmt(const struct va_image_formats *formats,
int imgfmt)
VAImageFormat *va_image_format_from_imgfmt(struct mp_vaapi_ctx *ctx, int imgfmt)
{
struct va_image_formats *formats = ctx->image_formats;
const int fourcc = va_fourcc_from_imgfmt(imgfmt);
if (!formats || !formats->num || !fourcc)
return NULL;
@ -299,8 +299,7 @@ int va_surface_alloc_imgfmt(struct mp_image *img, int imgfmt)
if (p->image.image_id != VA_INVALID_ID &&
va_fourcc_to_imgfmt(p->image.format.fourcc) == imgfmt)
return 0;
VAImageFormat *format =
va_image_format_from_imgfmt(p->ctx->image_formats, imgfmt);
VAImageFormat *format = va_image_format_from_imgfmt(p->ctx, imgfmt);
if (!format)
return -1;
if (va_surface_image_alloc(img, format) < 0)

View File

@ -83,8 +83,6 @@ struct mp_vaapi_ctx {
pthread_mutex_t lock;
};
struct va_image_formats;
bool check_va_status(struct mp_log *log, VAStatus status, const char *msg);
#define CHECK_VA_STATUS(ctx, msg) check_va_status((ctx)->log, status, msg)
@ -99,7 +97,7 @@ void va_destroy(struct mp_vaapi_ctx *ctx);
enum mp_imgfmt va_fourcc_to_imgfmt(uint32_t fourcc);
uint32_t va_fourcc_from_imgfmt(int imgfmt);
VAImageFormat * va_image_format_from_imgfmt(const struct va_image_formats *formats, int imgfmt);
VAImageFormat * va_image_format_from_imgfmt(struct mp_vaapi_ctx *ctx, int imgfmt);
bool va_image_map(struct mp_vaapi_ctx *ctx, VAImage *image, struct mp_image *mpi);
bool va_image_unmap(struct mp_vaapi_ctx *ctx, VAImage *image);