diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-01-06 12:27:46 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2017-01-06 12:27:46 +0100 |
commit | 520c0736fd2079f04a2a0ba09562bae49f62f472 (patch) | |
tree | ed32abfac9aa944d4a9533a488fbe4c3068c2801 /libavfilter | |
parent | d1f3e475f9807b445ba37ff2fd23f71c4645de79 (diff) | |
download | ffmpeg-520c0736fd2079f04a2a0ba09562bae49f62f472.tar.gz |
avfilter/vf_shuffleframes: allow also dropping frames
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/vf_shuffleframes.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavfilter/vf_shuffleframes.c b/libavfilter/vf_shuffleframes.c index bfbf4bd268..8e595111b8 100644 --- a/libavfilter/vf_shuffleframes.c +++ b/libavfilter/vf_shuffleframes.c @@ -68,7 +68,7 @@ static av_cold int init(AVFilterContext *ctx) return AVERROR(EINVAL); } - if (s->map[n] < 0 || s->map[n] >= nb_items) { + if (s->map[n] < -1 || s->map[n] >= nb_items) { av_log(ctx, AV_LOG_ERROR, "Index out of range.\n"); av_free(mapping); return AVERROR(EINVAL); @@ -99,11 +99,13 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) AVFrame *out; x = s->map[n]; - out = av_frame_clone(s->frames[x]); - if (!out) - return AVERROR(ENOMEM); - out->pts = s->pts[n]; - ret = ff_filter_frame(ctx->outputs[0], out); + if (x >= 0) { + out = av_frame_clone(s->frames[x]); + if (!out) + return AVERROR(ENOMEM); + out->pts = s->pts[n]; + ret = ff_filter_frame(ctx->outputs[0], out); + } s->in_frames--; } |