summaryrefslogtreecommitdiffstats
path: root/video/vaapi.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-06 21:12:20 +0100
committerwm4 <wm4@nowhere>2015-11-06 21:12:20 +0100
commit9693e0f57ac75bd5c5d8313dd933989dd3e64d31 (patch)
treed60148c9d7906da869157f8d9b5aa49042af5543 /video/vaapi.c
parent647b360a0aa0a3f8cce75812f9d7eac5a78b7a06 (diff)
downloadmpv-9693e0f57ac75bd5c5d8313dd933989dd3e64d31.tar.bz2
mpv-9693e0f57ac75bd5c5d8313dd933989dd3e64d31.tar.xz
Remove some VLAs
They are evil and should be eradicated. Some of these were pretty dumb anyway. There are probably some more around in platform specific code or other code not enabled by default on Linux.
Diffstat (limited to 'video/vaapi.c')
-rw-r--r--video/vaapi.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/video/vaapi.c b/video/vaapi.c
index a8d27d50e4..1b4cdf6000 100644
--- a/video/vaapi.c
+++ b/video/vaapi.c
@@ -95,19 +95,16 @@ struct va_image_formats {
static void va_get_formats(struct mp_vaapi_ctx *ctx)
{
- int num = vaMaxNumImageFormats(ctx->display);
- VAImageFormat entries[num];
- VAStatus status = vaQueryImageFormats(ctx->display, entries, &num);
+ struct va_image_formats *formats = talloc_ptrtype(ctx, formats);
+ formats->num = vaMaxNumImageFormats(ctx->display);
+ formats->entries = talloc_array(formats, VAImageFormat, formats->num);
+ VAStatus status = vaQueryImageFormats(ctx->display, formats->entries,
+ &formats->num);
if (!CHECK_VA_STATUS(ctx, "vaQueryImageFormats()"))
return;
- struct va_image_formats *formats = talloc_ptrtype(ctx, formats);
- formats->entries = talloc_array(formats, VAImageFormat, num);
- formats->num = num;
- MP_VERBOSE(ctx, "%d image formats available:\n", num);
- for (int i = 0; i < num; i++) {
- formats->entries[i] = entries[i];
- MP_VERBOSE(ctx, " %s\n", VA_STR_FOURCC(entries[i].fourcc));
- }
+ MP_VERBOSE(ctx, "%d image formats available:\n", formats->num);
+ for (int i = 0; i < formats->num; i++)
+ MP_VERBOSE(ctx, " %s\n", VA_STR_FOURCC(formats->entries[i].fourcc));
ctx->image_formats = formats;
}