[FFmpeg-devel] [PATCH 3/5] fftools: move check_avoptions and remove_avoptions to cmdutils
Marton Balint
cus at passwd.hu
Sat May 18 19:11:14 EEST 2024
Signed-off-by: Marton Balint <cus at passwd.hu>
---
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
More information about the ffmpeg-devel
mailing list