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 5B9C44A897 for ; Sat, 18 May 2024 16:11:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E374C68CED8; Sat, 18 May 2024 19:11:36 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C8DAA68C094 for ; Sat, 18 May 2024 19:11:29 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id A47A7EA694; Sat, 18 May 2024 18:11:29 +0200 (CEST) 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 rPcPq-k7Y-y2; Sat, 18 May 2024 18:11:27 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 9BDE5EA69C; Sat, 18 May 2024 18:11:26 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Sat, 18 May 2024 18:11:14 +0200 Message-Id: <20240518161116.8661-3-cus@passwd.hu> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240518161116.8661-1-cus@passwd.hu> References: <20240518161116.8661-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/5] fftools: move check_avoptions and remove_avoptions to cmdutils 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: Marton Balint 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: Signed-off-by: Marton Balint --- fftools/cmdutils.c | 20 ++++++++++++++++++++ fftools/cmdutils.h | 6 ++++++ fftools/ffmpeg.c | 20 -------------------- fftools/ffmpeg.h | 3 --- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index a8f5c6d89b..8953b21e23 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -1146,3 +1146,23 @@ char *file_read(const char *filename) return NULL; return str; } + +void remove_avoptions(AVDictionary **a, AVDictionary *b) +{ + const AVDictionaryEntry *t = NULL; + + while ((t = av_dict_iterate(b, t))) { + av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE); + } +} + +int check_avoptions(AVDictionary *m) +{ + const AVDictionaryEntry *t; + if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { + av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); + return AVERROR_OPTION_NOT_FOUND; + } + + return 0; +} diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h index d0c773663b..2125f791d0 100644 --- a/fftools/cmdutils.h +++ b/fftools/cmdutils.h @@ -483,4 +483,10 @@ double get_rotation(const int32_t *displaymatrix); /* read file contents into a string */ char *file_read(const char *filename); +/* Remove keys in dictionary b from dictionary a */ +void remove_avoptions(AVDictionary **a, AVDictionary *b); + +/* Check if any keys exist in dictionary m */ +int check_avoptions(AVDictionary *m); + #endif /* FFTOOLS_CMDUTILS_H */ diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 1f50ed6805..88ce3007e8 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -473,26 +473,6 @@ const FrameData *packet_data_c(AVPacket *pkt) return ret < 0 ? NULL : (const FrameData*)pkt->opaque_ref->data; } -void remove_avoptions(AVDictionary **a, AVDictionary *b) -{ - const AVDictionaryEntry *t = NULL; - - while ((t = av_dict_iterate(b, t))) { - av_dict_set(a, t->key, NULL, AV_DICT_MATCH_CASE); - } -} - -int check_avoptions(AVDictionary *m) -{ - const AVDictionaryEntry *t; - if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { - av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); - return AVERROR_OPTION_NOT_FOUND; - } - - return 0; -} - void update_benchmark(const char *fmt, ...) { if (do_benchmark_all) { diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 885a7c0c10..fe75706afd 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -710,9 +710,6 @@ void term_exit(void); void show_usage(void); -void remove_avoptions(AVDictionary **a, AVDictionary *b); -int check_avoptions(AVDictionary *m); - int assert_file_overwrite(const char *filename); AVDictionary *strip_specifiers(const AVDictionary *dict); int find_codec(void *logctx, const char *name, -- 2.35.3 _______________________________________________ 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".