summaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-07-08 12:37:59 +0200
committerMarton Balint <cus@passwd.hu>2017-07-09 19:41:58 +0200
commitb406f387c80956a4f04ad69f524b7092660ff823 (patch)
treeba2ca0b1e8bc0bc08eb061723d0253c2f93899db /libavcodec
parentfe9242204d33db070b8a9d907d93c9ead8a6f3ee (diff)
downloadffmpeg-streaming-b406f387c80956a4f04ad69f524b7092660ff823.zip
ffmpeg-streaming-b406f387c80956a4f04ad69f524b7092660ff823.tar.gz
avcodec/noise_bsf: add support for dropping packets
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/noise_bsf.c8
-rw-r--r--libavcodec/version.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/libavcodec/noise_bsf.c b/libavcodec/noise_bsf.c
index 0aebee1..84b9403 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 },
};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 3c5fea9..096b062 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 100
-#define LIBAVCODEC_VERSION_MICRO 103
+#define LIBAVCODEC_VERSION_MICRO 104
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
OpenPOWER on IntegriCloud