diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-02-15 00:26:22 +0100 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-02-20 19:17:11 +0100 |
commit | 3d77a275487b64373dde3d1c9b94d5413a467979 (patch) | |
tree | d3aa1b8b5f7ffc0a946837640c9b7ac8aa93d212 /libavfilter/vf_overlay.c | |
parent | 7f07c61c2f6dfee51d81f92d5c41bd8d0b1769ae (diff) | |
download | ffmpeg-3d77a275487b64373dde3d1c9b94d5413a467979.tar.gz |
lavfi/overlay: implement shortest option
Force termination when the overlay stream ends. Simplify scripting logic,
for example when an infinite source is used to generate a background for
a composite video.
Diffstat (limited to 'libavfilter/vf_overlay.c')
-rw-r--r-- | libavfilter/vf_overlay.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavfilter/vf_overlay.c b/libavfilter/vf_overlay.c index 7c615b4f20..857fbafb06 100644 --- a/libavfilter/vf_overlay.c +++ b/libavfilter/vf_overlay.c @@ -91,6 +91,7 @@ typedef struct { int main_pix_step[4]; ///< steps per pixel for each plane of the main output int overlay_pix_step[4]; ///< steps per pixel for each plane of the overlay int hsub, vsub; ///< chroma subsampling values + int shortest; ///< terminate stream when the shortest input terminates char *x_expr, *y_expr; } OverlayContext; @@ -102,6 +103,7 @@ static const AVOption overlay_options[] = { { "x", "set the x expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS }, { "y", "set the y expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "0"}, CHAR_MIN, CHAR_MAX, FLAGS }, {"rgb", "force packed RGB in input and output", OFFSET(allow_packed_rgb), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS }, + { "shortest", "force termination when the shortest input terminates", OFFSET(shortest), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, FLAGS }, {NULL}, }; @@ -560,6 +562,8 @@ static int request_frame(AVFilterLink *outlink) /* EOF on main is reported immediately */ if (ret == AVERROR_EOF && input == OVERLAY) { over->overlay_eof = 1; + if (over->shortest) + return ret; if ((ret = try_filter_next_frame(ctx)) != AVERROR(EAGAIN)) return ret; ret = 0; /* continue requesting frames on main */ |