summaryrefslogtreecommitdiff
path: root/libavcodec/vaapi_encode_mjpeg.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2016-04-12 23:13:31 +0100
committerAnton Khirnov <anton@khirnov.net>2016-04-15 10:07:04 +0200
commitf6b85523692b0e7d4c4efb8449fa201d313424fe (patch)
treeee84ef7e68d38e4dd1db1c3cff9f1e13d4b64b22 /libavcodec/vaapi_encode_mjpeg.c
parent18019f8cb9663dd1032c65aa453eaec18d641905 (diff)
downloadffmpeg-f6b85523692b0e7d4c4efb8449fa201d313424fe.tar.gz
vaapi_encode: Refactor slightly to allow easier setting of global options
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec/vaapi_encode_mjpeg.c')
-rw-r--r--libavcodec/vaapi_encode_mjpeg.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/libavcodec/vaapi_encode_mjpeg.c b/libavcodec/vaapi_encode_mjpeg.c
index 3ab3ab1e9f..e3bf191884 100644
--- a/libavcodec/vaapi_encode_mjpeg.c
+++ b/libavcodec/vaapi_encode_mjpeg.c
@@ -333,17 +333,18 @@ static int vaapi_encode_mjpeg_init_slice_params(AVCodecContext *avctx,
return 0;
}
-static VAConfigAttrib vaapi_encode_mjpeg_config_attributes[] = {
- { .type = VAConfigAttribRTFormat,
- .value = VA_RT_FORMAT_YUV420 },
- { .type = VAConfigAttribEncPackedHeaders,
- .value = VA_ENC_PACKED_HEADER_SEQUENCE },
-};
-
static av_cold int vaapi_encode_mjpeg_init_internal(AVCodecContext *avctx)
{
+ static const VAConfigAttrib default_config_attributes[] = {
+ { .type = VAConfigAttribRTFormat,
+ .value = VA_RT_FORMAT_YUV420 },
+ { .type = VAConfigAttribEncPackedHeaders,
+ .value = VA_ENC_PACKED_HEADER_SEQUENCE },
+ };
+
VAAPIEncodeContext *ctx = avctx->priv_data;
VAAPIEncodeMJPEGContext *priv = ctx->priv_data;
+ int i;
ctx->va_profile = VAProfileJPEGBaseline;
ctx->va_entrypoint = VAEntrypointEncPicture;
@@ -353,9 +354,10 @@ static av_cold int vaapi_encode_mjpeg_init_internal(AVCodecContext *avctx)
ctx->aligned_width = FFALIGN(ctx->input_width, 8);
ctx->aligned_height = FFALIGN(ctx->input_height, 8);
- ctx->config_attributes = vaapi_encode_mjpeg_config_attributes;
- ctx->nb_config_attributes =
- FF_ARRAY_ELEMS(vaapi_encode_mjpeg_config_attributes);
+ for (i = 0; i < FF_ARRAY_ELEMS(default_config_attributes); i++) {
+ ctx->config_attributes[ctx->nb_config_attributes++] =
+ default_config_attributes[i];
+ }
priv->quality = avctx->global_quality;
if (priv->quality < 1 || priv->quality > 100) {