From 0b71390aac4b0b7971d5c279a87005e4c33d1b45 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Mon, 3 Mar 2014 10:11:58 +0100 Subject: va: drop VAEntrypointMax enumeration. This is an oversight, and that was supposed to be removed earlier. User applications cannot rely on this value to statically allocate an array of possible VA entrypoints. The correct interface is to use vaMaxNumEntrypoints() and dynamically allocate that array. Rationale: VA entrypoints values are maintained sparsely, so this can yield to a large number overall. Signed-off-by: Gwenole Beauchesne --- test/encode/h264encode.c | 12 ++++++++++-- va/va.h | 1 - 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/encode/h264encode.c b/test/encode/h264encode.c index 7a110b3..b2030bc 100644 --- a/test/encode/h264encode.c +++ b/test/encode/h264encode.c @@ -917,8 +917,8 @@ static int process_cmdline(int argc, char *argv[]) static int init_va(void) { VAProfile profile_list[]={VAProfileH264High,VAProfileH264Main,VAProfileH264Baseline,VAProfileH264ConstrainedBaseline}; - VAEntrypoint entrypoints[VAEntrypointMax]={0}; - int num_entrypoints,slice_entrypoint; + VAEntrypoint *entrypoints; + int num_entrypoints, slice_entrypoint; int support_encode = 0; int major_ver, minor_ver; VAStatus va_status; @@ -928,6 +928,13 @@ static int init_va(void) va_status = vaInitialize(va_dpy, &major_ver, &minor_ver); CHECK_VASTATUS(va_status, "vaInitialize"); + num_entrypoints = vaMaxNumEntrypoints(va_dpy); + entrypoints = malloc(num_entrypoints * sizeof(*entrypoints)); + if (!entrypoints) { + fprintf(stderr, "error: failed to initialize VA entrypoints array\n"); + exit(1); + } + /* use the highest profile */ for (i = 0; i < sizeof(profile_list)/sizeof(profile_list[0]); i++) { if ((h264_profile != ~0) && h264_profile != profile_list[i]) @@ -1101,6 +1108,7 @@ static int init_va(void) printf("Support VAConfigAttribEncMacroblockInfo\n"); } + free(entrypoints); return 0; } diff --git a/va/va.h b/va/va.h index 3b1ac32..39f2e3c 100644 --- a/va/va.h +++ b/va/va.h @@ -304,7 +304,6 @@ typedef enum VAEntrypointEncSlice = 6, /* slice level encode */ VAEntrypointEncPicture = 7, /* pictuer encode, JPEG, etc */ VAEntrypointVideoProc = 10, /**< Video pre/post-processing. */ - VAEntrypointMax } VAEntrypoint; /* Currently defined configuration attribute types */ -- cgit v1.2.1