From patchwork Wed Dec 25 21:43:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 16955 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 87D39449BB5 for ; Wed, 25 Dec 2019 23:45:00 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6C72068AC51; Wed, 25 Dec 2019 23:45:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 13EAD68AC45 for ; Wed, 25 Dec 2019 23:44:58 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id CD254E1D26; Wed, 25 Dec 2019 22:44:58 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T7KIDgxwwAyb; Wed, 25 Dec 2019 22:44:56 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id AEE1DE3C9D; Wed, 25 Dec 2019 22:44:56 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Dec 2019 22:43:13 +0100 Message-Id: <20191225214314.15879-12-cus@passwd.hu> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191225214314.15879-1-cus@passwd.hu> References: <20191225214314.15879-1-cus@passwd.hu> Subject: [FFmpeg-devel] [PATCH 12/13] avcodec/libxavs2: use AV_OPT_TYPE_DICT for xavs2-params X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavcodec/libxavs2.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/libavcodec/libxavs2.c b/libavcodec/libxavs2.c index 2f8460ab8e..76b57e731e 100644 --- a/libavcodec/libxavs2.c +++ b/libavcodec/libxavs2.c @@ -48,7 +48,7 @@ typedef struct XAVS2EContext { int log_level; void *encoder; - char *xavs2_opts; + AVDictionary *xavs2_opts; xavs2_outpacket_t packet; xavs2_param_t *param; @@ -92,16 +92,10 @@ static av_cold int xavs2_init(AVCodecContext *avctx) xavs2_opt_set2("OpenGOP", "%d", !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)); - if (cae->xavs2_opts) { - AVDictionary *dict = NULL; + { AVDictionaryEntry *en = NULL; - - if (!av_dict_parse_string(&dict, cae->xavs2_opts, "=", ":", 0)) { - while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { - xavs2_opt_set2(en->key, "%s", en->value); - } - av_dict_free(&dict); - } + while ((en = av_dict_get(cae->xavs2_opts, "", en, AV_DICT_IGNORE_SUFFIX))) + xavs2_opt_set2(en->key, "%s", en->value); } /* Rate control */ @@ -267,7 +261,7 @@ static const AVOption options[] = { { "min_qp" , "min qp for rate control" , OFFSET(min_qp) , AV_OPT_TYPE_INT, {.i64 = 20 }, 0, 63, VE }, { "speed_level" , "Speed level, higher is better but slower", OFFSET(preset_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 9, VE }, { "log_level" , "log level: -1: none, 0: error, 1: warning, 2: info, 3: debug", OFFSET(log_level) , AV_OPT_TYPE_INT, {.i64 = 0 }, -1, 3, VE }, - { "xavs2-params" , "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { "xavs2-params" , "set the xavs2 configuration using a :-separated list of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE }, { NULL }, };