summaryrefslogtreecommitdiffstats
path: root/libavcodec/hapqa_extract_bsf.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-13 18:55:49 -0300
committerJames Almer <jamrial@gmail.com>2018-03-13 18:55:49 -0300
commit2b6699f024ae9968244d02d3c81e57737d603b62 (patch)
treeb9de471deace777a282d4e25a4251c3c2706aafe /libavcodec/hapqa_extract_bsf.c
parent3172b31223e1f0a64233fa5b355e11d7a00e477b (diff)
downloadffmpeg-streaming-2b6699f024ae9968244d02d3c81e57737d603b62.zip
ffmpeg-streaming-2b6699f024ae9968244d02d3c81e57737d603b62.tar.gz
avcodec/hapqa_extract: move the reference in the bsf internal buffer
There's no need to allocate a new packet for it. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hapqa_extract_bsf.c')
-rw-r--r--libavcodec/hapqa_extract_bsf.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/libavcodec/hapqa_extract_bsf.c b/libavcodec/hapqa_extract_bsf.c
index 45fe9fb..333efb2 100644
--- a/libavcodec/hapqa_extract_bsf.c
+++ b/libavcodec/hapqa_extract_bsf.c
@@ -45,7 +45,7 @@ static int check_texture(HapqaExtractContext *ctx, int section_type) {
}
}
-static int hapqa_extract(AVBSFContext *bsf, AVPacket *out)
+static int hapqa_extract(AVBSFContext *bsf, AVPacket *pkt)
{
HapqaExtractContext *ctx = bsf->priv_data;
GetByteContext gbc;
@@ -53,14 +53,13 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket *out)
enum HapSectionType section_type;
int start_section_size;
int target_packet_size = 0;
- AVPacket *in;
int ret = 0;
- ret = ff_bsf_get_packet(bsf, &in);
+ ret = ff_bsf_get_packet_ref(bsf, pkt);
if (ret < 0)
return ret;
- bytestream2_init(&gbc, in->data, in->size);
+ bytestream2_init(&gbc, pkt->data, pkt->size);
ret = ff_hap_parse_section_header(&gbc, &section_size, &section_type);
if (ret != 0)
goto fail;
@@ -95,14 +94,12 @@ static int hapqa_extract(AVBSFContext *bsf, AVPacket *out)
}
}
- av_packet_move_ref(out, in);
- out->data += start_section_size;
- out->size = target_packet_size;
+ pkt->data += start_section_size;
+ pkt->size = target_packet_size;
fail:
if (ret < 0)
- av_packet_unref(out);
- av_packet_free(&in);
+ av_packet_unref(pkt);
return ret;
}
OpenPOWER on IntegriCloud