---
libavcodec/allcodecs.c | 1 -
libavcodec/bitstream_filters.c | 4 ++++
libavcodec/chomp_bsf.c | 29 ++++++++++++++++-------------
3 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4d03363..35d14c3 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -538,7 +538,6 @@ void avcodec_register_all(void)
REGISTER_PARSER(VP8, vp8);
/* bitstream filters */
- REGISTER_BSF(CHOMP, chomp);
REGISTER_BSF(DUMP_EXTRADATA, dump_extradata);
REGISTER_BSF(H264_MP4TOANNEXB, h264_mp4toannexb);
REGISTER_BSF(HEVC_MP4TOANNEXB, hevc_mp4toannexb);
diff --git a/libavcodec/bitstream_filters.c b/libavcodec/bitstream_filters.c
index 7556bdb..a1277dd 100644
--- a/libavcodec/bitstream_filters.c
+++ b/libavcodec/bitstream_filters.c
@@ -25,11 +25,15 @@
#include "bsf.h"
extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
+extern const AVBitStreamFilter ff_chomp_bsf;
static const AVBitStreamFilter *bitstream_filters[] = {
#if CONFIG_AAC_ADTSTOASC_BSF
&ff_aac_adtstoasc_bsf,
#endif
+#if CONFIG_CHOMP_BSF
+ &ff_chomp_bsf,
+#endif
NULL,
};
diff --git a/libavcodec/chomp_bsf.c b/libavcodec/chomp_bsf.c
index 9ed7496..2e76113 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,
};
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel