summaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2015-10-17 23:46:09 +0200
committerMarton Balint <cus@passwd.hu>2015-10-22 19:03:01 +0200
commitddc6bd8c95868b14aec385b2e7bb519559583042 (patch)
tree3356e7f8ecdffb2515d539cc57418a2e1d907fc4 /ffmpeg_opt.c
parent5821244b225b34dbabcd5bf6cf1c0a9dc3e529dc (diff)
downloadffmpeg-streaming-ddc6bd8c95868b14aec385b2e7bb519559583042.zip
ffmpeg-streaming-ddc6bd8c95868b14aec385b2e7bb519559583042.tar.gz
ffmpeg: add abort_on option to allow aborting on empty output
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 0da1ffd..8f6416c 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -106,6 +106,7 @@ int start_at_zero = 0;
int copy_tb = -1;
int debug_ts = 0;
int exit_on_error = 0;
+int abort_on_flags = 0;
int print_stats = -1;
int qp_hist = 0;
int stdin_interaction = 1;
@@ -199,6 +200,24 @@ static AVDictionary *strip_specifiers(AVDictionary *dict)
return ret;
}
+static int opt_abort_on(void *optctx, const char *opt, const char *arg)
+{
+ static const AVOption opts[] = {
+ { "abort_on" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" },
+ { "empty_output" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = ABORT_ON_FLAG_EMPTY_OUTPUT }, .unit = "flags" },
+ { NULL },
+ };
+ static const AVClass class = {
+ .class_name = "",
+ .item_name = av_default_item_name,
+ .option = opts,
+ .version = LIBAVUTIL_VERSION_INT,
+ };
+ const AVClass *pclass = &class;
+
+ return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags);
+}
+
static int opt_sameq(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. "
@@ -3123,6 +3142,8 @@ const OptionDef options[] = {
"timestamp error delta threshold", "threshold" },
{ "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error },
"exit on error", "error" },
+ { "abort_on", HAS_ARG | OPT_EXPERT, { .func_arg = opt_abort_on },
+ "abort on the specified condition flags", "flags" },
{ "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC |
OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) },
"copy initial non-keyframes" },
OpenPOWER on IntegriCloud