diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index a10c401fe..83938dd3d 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -1326,7 +1326,6 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = 0, /* ts_periodicity */ {0}, /* ts_layer_id */ }}, - { -1, {NOT_IMPLEMENTED}} }; @@ -1352,6 +1351,7 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) = NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ }, { + 1, /* 1 cfg map */ vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ vp8e_encode, /* vpx_codec_encode_fn_t encode; */ vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c index fb3c236ce..f768b5c47 100644 --- a/vp8/vp8_dx_iface.c +++ b/vp8/vp8_dx_iface.c @@ -804,6 +804,7 @@ CODEC_INTERFACE(vpx_codec_vp8_dx) = NOT_IMPLEMENTED, }, { /* encoder functions */ + 0, NOT_IMPLEMENTED, NOT_IMPLEMENTED, NOT_IMPLEMENTED, diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index b3dc0b11a..23f27576c 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1301,7 +1301,6 @@ static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = { #endif } }, - { -1, {NOT_IMPLEMENTED}} }; #ifndef VERSION_STRING @@ -1324,6 +1323,7 @@ CODEC_INTERFACE(vpx_codec_vp9_cx) = { NOT_IMPLEMENTED // vpx_codec_set_fb_fn_t }, { // NOLINT + 1, // 1 cfg map encoder_usage_cfg_map, // vpx_codec_enc_cfg_map_t encoder_encode, // vpx_codec_encode_fn_t encoder_get_cxdata, // vpx_codec_get_cx_data_fn_t diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c index ef9d10d65..c52884084 100644 --- a/vp9/vp9_dx_iface.c +++ b/vp9/vp9_dx_iface.c @@ -707,6 +707,7 @@ CODEC_INTERFACE(vpx_codec_vp9_dx) = { decoder_set_fb_fn, // vpx_codec_set_fb_fn_t }, { // NOLINT + 0, NOT_IMPLEMENTED, // vpx_codec_enc_cfg_map_t NOT_IMPLEMENTED, // vpx_codec_encode_fn_t NOT_IMPLEMENTED, // vpx_codec_get_cx_data_fn_t diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h index 82d2bc3c0..cdda3406b 100644 --- a/vpx/internal/vpx_codec_internal.h +++ b/vpx/internal/vpx_codec_internal.h @@ -340,6 +340,7 @@ struct vpx_codec_iface { vpx_codec_set_fb_fn_t set_fb_fn; /**< \copydoc ::vpx_codec_set_fb_fn_t */ } dec; struct vpx_codec_enc_iface { + int cfg_map_count; vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */ vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */ vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */ diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c index ece2d0b64..db019957e 100644 --- a/vpx/src/vpx_encoder.c +++ b/vpx/src/vpx_encoder.c @@ -162,6 +162,7 @@ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, unsigned int usage) { vpx_codec_err_t res; vpx_codec_enc_cfg_map_t *map; + int i; if (!iface || !cfg || usage > INT_MAX) res = VPX_CODEC_INVALID_PARAM; @@ -170,7 +171,8 @@ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface, else { res = VPX_CODEC_INVALID_PARAM; - for (map = iface->enc.cfg_maps; map->usage >= 0; map++) { + for (i = 0; i < iface->enc.cfg_map_count; ++i) { + map = iface->enc.cfg_maps + i; if (map->usage == (int)usage) { *cfg = map->cfg; cfg->g_usage = usage;