Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-07-08 13:37:59 +0300
committerMarton Balint <cus@passwd.hu>2017-07-09 20:41:58 +0300
commitb406f387c80956a4f04ad69f524b7092660ff823 (patch)
treeba2ca0b1e8bc0bc08eb061723d0253c2f93899db /libavcodec/noise_bsf.c
parentfe9242204d33db070b8a9d907d93c9ead8a6f3ee (diff)
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.c8
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 },
};