summaryrefslogtreecommitdiff
path: root/libavfilter/f_metadata.c
diff options
context:
space:
mode:
authorGyan Doshi <ffmpeg@gyani.pro>2020-01-07 17:30:34 +0530
committerGyan Doshi <ffmpeg@gyani.pro>2020-01-10 21:44:26 +0530
commit22a06a539ddba083b0a496a1871a90afb8d51627 (patch)
tree22290d2dc3bb8f8d53b55a52dcbfaf833d900893 /libavfilter/f_metadata.c
parentc4c96d5942ac48ff247be224363f5200198844a6 (diff)
downloadffmpeg-22a06a539ddba083b0a496a1871a90afb8d51627.tar.gz
avfilter/f_metadata: allow direct flushing when printing to file
Useful for monitoring sparse data in realtime
Diffstat (limited to 'libavfilter/f_metadata.c')
-rw-r--r--libavfilter/f_metadata.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 3bf4bb17f5..bf298e9d39 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -88,6 +88,8 @@ typedef struct MetadataContext {
int (*compare)(struct MetadataContext *s,
const char *value1, const char *value2);
void (*print)(AVFilterContext *ctx, const char *msg, ...) av_printf_format(2, 3);
+
+ int direct; // reduces buffering when printing to user-supplied URL
} MetadataContext;
#define OFFSET(x) offsetof(MetadataContext, x)
@@ -111,6 +113,7 @@ static const AVOption filt_name##_options[] = { \
{ "ends_with", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = METADATAF_ENDS_WITH }, 0, 0, FLAGS, "function" }, \
{ "expr", "set expression for expr function", OFFSET(expr_str), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, FLAGS }, \
{ "file", "set file where to print metadata information", OFFSET(file_str), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, FLAGS }, \
+ { "direct", "reduce buffering when printing to user-set file or pipe", OFFSET(direct), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, FLAGS }, \
{ NULL } \
}
@@ -274,6 +277,9 @@ static av_cold int init(AVFilterContext *ctx)
s->file_str, buf);
return ret;
}
+
+ if (s->direct)
+ s->avio_context->direct = AVIO_FLAG_DIRECT;
}
return 0;