From patchwork Wed Dec 25 21:43:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 16953 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 7D869449BB5 for ; Wed, 25 Dec 2019 23:44:55 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 61BE368AC1D; Wed, 25 Dec 2019 23:44:55 +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 7DE4268AC3B for ; Wed, 25 Dec 2019 23:44:53 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4C34AE1D26; Wed, 25 Dec 2019 22:44:53 +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 dH0vDdS1_zlQ; Wed, 25 Dec 2019 22:44:52 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 0AFA8E3478; Wed, 25 Dec 2019 22:44:52 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 25 Dec 2019 22:43:11 +0100 Message-Id: <20191225214314.15879-10-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 10/13] avcodec/libx264: use AV_OPT_TYPE_DICT for x264-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/libx264.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index bfd91bb900..77bf88748f 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -95,7 +95,7 @@ typedef struct X264Context { int scenechange_threshold; int noise_reduction; - char *x264_params; + AVDictionary *x264_params; int nb_reordered_opaque, next_reordered_opaque; int64_t *reordered_opaque; @@ -892,19 +892,14 @@ FF_ENABLE_DEPRECATION_WARNINGS } } - if (x4->x264_params) { - AVDictionary *dict = NULL; - AVDictionaryEntry *en = NULL; - - if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) { - while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) { - if (x264_param_parse(&x4->params, en->key, en->value) < 0) - av_log(avctx, AV_LOG_WARNING, - "Error parsing option '%s = %s'.\n", - en->key, en->value); - } - av_dict_free(&dict); + { + AVDictionaryEntry *en = NULL; + while (en = av_dict_get(x4->x264_params, "", en, AV_DICT_IGNORE_SUFFIX)) { + if (x264_param_parse(&x4->params, en->key, en->value) < 0) + av_log(avctx, AV_LOG_WARNING, + "Error parsing option '%s = %s'.\n", + en->key, en->value); } } @@ -1116,7 +1111,7 @@ static const AVOption options[] = { { "sc_threshold", "Scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE }, { "noise_reduction", "Noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX, VE }, - { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_STRING, { 0 }, 0, 0, VE }, + { "x264-params", "Override the x264 configuration using a :-separated list of key=value parameters", OFFSET(x264_params), AV_OPT_TYPE_DICT, { 0 }, 0, 0, VE }, { NULL }, };