summaryrefslogtreecommitdiff
path: root/libavcodec/chomp_bsf.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-23 11:43:13 +0100
committerAnton Khirnov <anton@khirnov.net>2016-03-20 08:15:01 +0100
commit33d18982fa03feb061c8f744a4f0a9175c1f63ab (patch)
tree194f6383561b7acf3315eb7982c13aa95ff5ef67 /libavcodec/chomp_bsf.c
parenta2d1922bde8db2cdac95051918fe81ae18c0376b (diff)
lavc: add a new bitstream filtering API
Deprecate the current bitstream filtering API.
Diffstat (limited to 'libavcodec/chomp_bsf.c')
-rw-r--r--libavcodec/chomp_bsf.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index 9ed7496930..2e7611335f 100644
--- a/libavcodec/chomp_bsf.c
+++ b/libavcodec/chomp_bsf.c
@@ -20,19 +20,23 @@
*/
#include "avcodec.h"
+#include "bsf.h"
#include "internal.h"
-static int chomp_filter(AVBitStreamFilterContext *bsfc,
- AVCodecContext *avctx, const char *args,
- uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size,
- int keyframe)
+static int chomp_filter(AVBSFContext *ctx, AVPacket *out)
{
- while (buf_size > 0 && !buf[buf_size-1])
- buf_size--;
+ AVPacket *in;
+ int ret;
- *poutbuf = (uint8_t*) buf;
- *poutbuf_size = buf_size;
+ ret = ff_bsf_get_packet(ctx, &in);
+ if (ret < 0)
+ return ret;
+
+ while (in->size > 0 && !in->data[in->size - 1])
+ in->size--;
+
+ av_packet_move_ref(out, in);
+ av_packet_free(&in);
return 0;
}
@@ -40,8 +44,7 @@ static int chomp_filter(AVBitStreamFilterContext *bsfc,
/**
* This filter removes a string of NULL bytes from the end of a packet.
*/
-AVBitStreamFilter ff_chomp_bsf = {
- "chomp",
- 0,
- chomp_filter,
+const AVBitStreamFilter ff_chomp_bsf = {
+ .name = "chomp",
+ .filter = chomp_filter,
};