summaryrefslogtreecommitdiff
path: root/libavfilter/avf_concat.c
diff options
context:
space:
mode:
authorBodecs Bela <bodecsb@vivanet.hu>2018-02-25 17:07:40 +0100
committerNicolas George <george@nsup.org>2018-03-01 12:54:06 +0100
commitd7239944499687b4329ac3484d0b00bd92617847 (patch)
tree619b530a676beeca7433a9128cd783e9f951372a /libavfilter/avf_concat.c
parent40102a21374096ce0ba05c67c6e7474f176af2d0 (diff)
avfilter/avf_concat: add next command
This patch makes it possible to dinamically close the current segment and step to the next one by introducing command handling capabilities into the filter. This new feature is very usefull when working with real-time sources or live streams as source. Combinig usage with zmqsend tool you can interactively end the current segment and step to next one. Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
Diffstat (limited to 'libavfilter/avf_concat.c')
-rw-r--r--libavfilter/avf_concat.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavfilter/avf_concat.c b/libavfilter/avf_concat.c
index 6198a33d53..46bd42359b 100644
--- a/libavfilter/avf_concat.c
+++ b/libavfilter/avf_concat.c
@@ -418,6 +418,19 @@ static av_cold void uninit(AVFilterContext *ctx)
av_freep(&cat->in);
}
+static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
+ char *res, int res_len, int flags)
+{
+ int ret = AVERROR(ENOSYS);
+
+ if (!strcmp(cmd, "next")) {
+ av_log(ctx, AV_LOG_VERBOSE, "Command received: next\n");
+ return flush_segment(ctx);
+ }
+
+ return ret;
+}
+
AVFilter ff_avf_concat = {
.name = "concat",
.description = NULL_IF_CONFIG_SMALL("Concatenate audio and video streams."),
@@ -429,4 +442,5 @@ AVFilter ff_avf_concat = {
.outputs = NULL,
.priv_class = &concat_class,
.flags = AVFILTER_FLAG_DYNAMIC_INPUTS | AVFILTER_FLAG_DYNAMIC_OUTPUTS,
+ .process_command = process_command,
};