aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/remove_extradata_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-11 13:45:19 -0300
committerJames Almer <jamrial@gmail.com>2018-03-11 15:41:15 -0300
commita1a0859ad52e8f5161b1ba15cc951783e52b5ff8 (patch)
tree26dd6482912caaa9e19856f9e48ce29c10732c4f /libavcodec/remove_extradata_bsf.c
parent11bef2fe7232d290541a112efb2d360600c7b917 (diff)
downloadffmpeg-a1a0859ad52e8f5161b1ba15cc951783e52b5ff8.tar.gz
avcodec/remove_extradata: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/remove_extradata_bsf.c')
-rw-r--r--libavcodec/remove_extradata_bsf.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/libavcodec/remove_extradata_bsf.c b/libavcodec/remove_extradata_bsf.c
index a54bbdbacf..d74391e547 100644
--- a/libavcodec/remove_extradata_bsf.c
+++ b/libavcodec/remove_extradata_bsf.c
@@ -38,30 +38,26 @@ typedef struct RemoveExtradataContext {
AVCodecContext *avctx;
} RemoveExtradataContext;
-static int remove_extradata(AVBSFContext *ctx, AVPacket *out)
+static int remove_extradata(AVBSFContext *ctx, AVPacket *pkt)
{
RemoveExtradataContext *s = ctx->priv_data;
- AVPacket *in;
int ret;
- ret = ff_bsf_get_packet(ctx, &in);
+ ret = ff_bsf_get_packet_ref(ctx, pkt);
if (ret < 0)
return ret;
if (s->parser && s->parser->parser->split) {
if (s->freq == REMOVE_FREQ_ALL ||
- (s->freq == REMOVE_FREQ_NONKEYFRAME && !(in->flags & AV_PKT_FLAG_KEY)) ||
- (s->freq == REMOVE_FREQ_KEYFRAME && in->flags & AV_PKT_FLAG_KEY)) {
- int i = s->parser->parser->split(s->avctx, in->data, in->size);
- in->data += i;
- in->size -= i;
+ (s->freq == REMOVE_FREQ_NONKEYFRAME && !(pkt->flags & AV_PKT_FLAG_KEY)) ||
+ (s->freq == REMOVE_FREQ_KEYFRAME && pkt->flags & AV_PKT_FLAG_KEY)) {
+ int i = s->parser->parser->split(s->avctx, pkt->data, pkt->size);
+ pkt->data += i;
+ pkt->size -= i;
}
}
- av_packet_move_ref(out, in);
- av_packet_free(&in);
-
return 0;
}