From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 64D4944805 for ; Sat, 26 Nov 2022 14:47:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C999768BA6B; Sat, 26 Nov 2022 16:47:06 +0200 (EET) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D4AA689CFA for ; Sat, 26 Nov 2022 16:46:59 +0200 (EET) Received: by mail-ed1-f45.google.com with SMTP id f7so9890467edc.6 for ; Sat, 26 Nov 2022 06:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sbyqKG1+aibNFqpFeo5PrPnYbHRtnS2su5FPnEkQkYQ=; b=JRHr41dMNPmnP8ezAVV5xft2eGCDQ0pNTap8h1r56b5Vz4TwSUIPA9oVuXWdTDu2oI XZeSdI9kIGQwJGdal6pq3YDhymp/OacKxriOjCQeKVUsiuneYQfiAcijo9WFsM8rIyKi Z0Vy6xideiNc9GOrRKraad7v2IpMSEV7/xPxYzC+n3OOXAZKi3ZzBKu7dON/cAedrz1l wwk/l3QcswiTpJ4QgPxg0AS8m9ORtYmwTUE78Q0a7T0JwipW8/PsqKLOM4oWpVLWepL7 N1Rn1wGooavEC+/+zMs/2O3DiA9pYaeQdBDWfpV0yUj1k/BmtUH1hG4NyaEx+w4b534V UBcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sbyqKG1+aibNFqpFeo5PrPnYbHRtnS2su5FPnEkQkYQ=; b=ba7z6ZsMpAYuOhy6g/QtfK3fJHwcLRBZm5MsFPXmVHZ5iMOIdorSLC49DiyQ3CCe/a 5CrnSbhhDLA+jijgjiCAcrsGqNkshNsGo2hNaFKrwWoHNUo/kQDF7IqGBvxDExtLpWCm Fl7S/mszsLS1Kogq6Q29pYH0z9IsteU8RvnlQBIiFNWr3yzu1AfKBpiViMfLPCW1J4Sg mOV7IJcy817HbTQySnxUHIAGuc2tf9NjiKkjZAcNaZvzLku9rgnwEMm08qRm98zCd5uH x4m+H1zgNo3Xw4MZ2G9eRGuUkZ6wKtJRLoCTqztXEpAScMnuqJSvzrLzcsUSl1P934i/ jkqQ== X-Gm-Message-State: ANoB5pk4Zv40g8CmAQtFYnXQVKOw8dHuOxZIXA+/8PoajBySmei4P9O3 Vwe3XdUJ5fwZo7UOCEMEMw3xIL/LWm4= X-Google-Smtp-Source: AA0mqf6FB7PEdj4RenDlA8vC79Ybe7WGttqV6keMe/KsjVrM7xSUAa7P76Y0nxP/TJxM79K1OQ2HuA== X-Received: by 2002:a05:6402:691:b0:46b:c11:9f59 with SMTP id f17-20020a056402069100b0046b0c119f59mr427977edy.407.1669474018991; Sat, 26 Nov 2022 06:46:58 -0800 (PST) Received: from MBP-von-Marvin.citadel.scalie.me (84-112-104-25.cable.dynamic.surfer.at. [84.112.104.25]) by smtp.gmail.com with ESMTPSA id ay10-20020a056402202a00b00461cdda400esm3107745edb.4.2022.11.26.06.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Nov 2022 06:46:58 -0800 (PST) From: Marvin Scholz To: ffmpeg-devel@ffmpeg.org Date: Sat, 26 Nov 2022 15:46:19 +0100 Message-Id: <20221126144648.73162-3-epirat07@gmail.com> X-Mailer: git-send-email 2.37.0 (Apple Git-136) In-Reply-To: <20221126144648.73162-1-epirat07@gmail.com> References: <20221125013046.40904-1-epirat07@gmail.com> <20221126144648.73162-1-epirat07@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 02/31] fftools: use av_dict_get_string X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Marvin Scholz Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Instead of manually assembling the string, use av_dict_get_string which handles things like proper escaping too (even though it is not yet needed here). --- fftools/ffmpeg_filter.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index b0c4c8ece3..7eb656dbe5 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -972,39 +972,34 @@ int configure_filtergraph(FilterGraph *fg) if (simple) { OutputStream *ost = fg->outputs[0]->ost; - char args[512]; - const AVDictionaryEntry *e = NULL; if (filter_nbthreads) { ret = av_opt_set(fg->graph, "threads", filter_nbthreads, 0); if (ret < 0) goto fail; } else { + const AVDictionaryEntry *e = NULL; e = av_dict_get(ost->encoder_opts, "threads", NULL, 0); if (e) av_opt_set(fg->graph, "threads", e->value, 0); } - args[0] = 0; - e = NULL; - while ((e = av_dict_get(ost->sws_dict, "", e, - AV_DICT_IGNORE_SUFFIX))) { - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); - } - if (strlen(args)) { - args[strlen(args)-1] = 0; - fg->graph->scale_sws_opts = av_strdup(args); + if (av_dict_count(ost->sws_dict)) { + ret = av_dict_get_string(ost->sws_dict, + &fg->graph->scale_sws_opts, + '=', ':'); + if (ret < 0) + goto fail; } - args[0] = 0; - e = NULL; - while ((e = av_dict_get(ost->swr_opts, "", e, - AV_DICT_IGNORE_SUFFIX))) { - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); + if (av_dict_count(ost->swr_opts)) { + char *args; + ret = av_dict_get_string(ost->swr_opts, &args, '=', ':'); + if (ret < 0) + goto fail; + av_opt_set(fg->graph, "aresample_swr_opts", args, 0); + av_free(args); } - if (strlen(args)) - args[strlen(args)-1] = 0; - av_opt_set(fg->graph, "aresample_swr_opts", args, 0); } else { fg->graph->nb_threads = filter_complex_nbthreads; } -- 2.37.0 (Apple Git-136) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".