summaryrefslogtreecommitdiff
path: root/libavcodec/chomp_bsf.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-17 18:47:25 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-17 18:47:40 +0100
commitaf9cac1be1750ecc0e12c6788a3aeed1f1a778be (patch)
tree2e34226dbd4010774f6ffef448aab4b7d4f88544 /libavcodec/chomp_bsf.c
parent6d160afab2fa8d3bfb216fee96d3537ffc9e86e8 (diff)
parent33d18982fa03feb061c8f744a4f0a9175c1f63ab (diff)
Merge commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab'
* commit '33d18982fa03feb061c8f744a4f0a9175c1f63ab': lavc: add a new bitstream filtering API Conversions-by: Hendrik Leppkes <h.leppkes@gmail.com> Conversions-by: Derek Buitenguis <derek.buitenhuis@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/chomp_bsf.c')
-rw-r--r--libavcodec/chomp_bsf.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index 2b93fa999e..cc94380535 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,7 +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 = {
+const AVBitStreamFilter ff_chomp_bsf = {
.name = "chomp",
.filter = chomp_filter,
};