diff options
author | Marton Balint <cus@passwd.hu> | 2017-07-08 12:37:59 +0200 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2017-07-09 19:41:58 +0200 |
commit | b406f387c80956a4f04ad69f524b7092660ff823 (patch) | |
tree | ba2ca0b1e8bc0bc08eb061723d0253c2f93899db /libavcodec/noise_bsf.c | |
parent | fe9242204d33db070b8a9d907d93c9ead8a6f3ee (diff) | |
download | ffmpeg-b406f387c80956a4f04ad69f524b7092660ff823.tar.gz |
avcodec/noise_bsf: add support for dropping packets
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec/noise_bsf.c')
-rw-r--r-- | libavcodec/noise_bsf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c index 0aebee1ad6..84b94032ad 100644 --- a/libavcodec/noise_bsf.c +++ b/libavcodec/noise_bsf.c @@ -31,6 +31,7 @@ typedef struct NoiseContext { const AVClass *class; int amount; + int dropamount; unsigned int state; } NoiseContext; @@ -48,6 +49,12 @@ static int noise(AVBSFContext *ctx, AVPacket *out) if (ret < 0) return ret; + if (s->dropamount > 0 && s->state % s->dropamount == 0) { + s->state++; + av_packet_free(&in); + return AVERROR(EAGAIN); + } + ret = av_new_packet(out, in->size); if (ret < 0) goto fail; @@ -73,6 +80,7 @@ fail: #define OFFSET(x) offsetof(NoiseContext, x) static const AVOption options[] = { { "amount", NULL, OFFSET(amount), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX }, + { "dropamount", NULL, OFFSET(dropamount), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX }, { NULL }, }; |