diff options
author | Andreas Rheinhardt <andreas.rheinhardt@googlemail.com> | 2019-02-11 23:47:42 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2019-02-25 20:38:57 +0000 |
commit | c5b452ed2f16a0d7bf01d7d84097337f8756987b (patch) | |
tree | 3276ac6dc4a27febaaccc932a644d257714ca506 | |
parent | 976dae8b32f48d17cccfd6b19d2beb01770dfa7c (diff) | |
download | ffmpeg-c5b452ed2f16a0d7bf01d7d84097337f8756987b.tar.gz |
filter_units, trace_headers: Always use fragment from context
This is in preparation for another patch that will stop needless
reallocations of the unit array.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
-rw-r--r-- | libavcodec/filter_units_bsf.c | 8 | ||||
-rw-r--r-- | libavcodec/trace_headers_bsf.c | 13 |
2 files changed, 11 insertions, 10 deletions
diff --git a/libavcodec/filter_units_bsf.c b/libavcodec/filter_units_bsf.c index 1ee0afdf2b..0500dea6b2 100644 --- a/libavcodec/filter_units_bsf.c +++ b/libavcodec/filter_units_bsf.c @@ -199,18 +199,18 @@ static int filter_units_init(AVBSFContext *bsf) ctx->cbc->nb_decompose_unit_types = 0; if (bsf->par_in->extradata) { - CodedBitstreamFragment ps; + CodedBitstreamFragment *frag = &ctx->fragment; - err = ff_cbs_read_extradata(ctx->cbc, &ps, bsf->par_in); + err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n"); } else { - err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, &ps); + err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, frag); if (err < 0) av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n"); } - ff_cbs_fragment_uninit(ctx->cbc, &ps); + ff_cbs_fragment_uninit(ctx->cbc, frag); } return err; diff --git a/libavcodec/trace_headers_bsf.c b/libavcodec/trace_headers_bsf.c index 8322229d4c..61284e615e 100644 --- a/libavcodec/trace_headers_bsf.c +++ b/libavcodec/trace_headers_bsf.c @@ -28,6 +28,7 @@ typedef struct TraceHeadersContext { CodedBitstreamContext *cbc; + CodedBitstreamFragment fragment; } TraceHeadersContext; @@ -44,13 +45,13 @@ static int trace_headers_init(AVBSFContext *bsf) ctx->cbc->trace_level = AV_LOG_INFO; if (bsf->par_in->extradata) { - CodedBitstreamFragment ps; + CodedBitstreamFragment *frag = &ctx->fragment; av_log(bsf, AV_LOG_INFO, "Extradata\n"); - err = ff_cbs_read_extradata(ctx->cbc, &ps, bsf->par_in); + err = ff_cbs_read_extradata(ctx->cbc, frag, bsf->par_in); - ff_cbs_fragment_uninit(ctx->cbc, &ps); + ff_cbs_fragment_uninit(ctx->cbc, frag); } return err; @@ -66,7 +67,7 @@ static void trace_headers_close(AVBSFContext *bsf) static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) { TraceHeadersContext *ctx = bsf->priv_data; - CodedBitstreamFragment au; + CodedBitstreamFragment *frag = &ctx->fragment; char tmp[256] = { 0 }; int err; @@ -92,9 +93,9 @@ static int trace_headers(AVBSFContext *bsf, AVPacket *pkt) av_log(bsf, AV_LOG_INFO, "Packet: %d bytes%s.\n", pkt->size, tmp); - err = ff_cbs_read_packet(ctx->cbc, &au, pkt); + err = ff_cbs_read_packet(ctx->cbc, frag, pkt); - ff_cbs_fragment_uninit(ctx->cbc, &au); + ff_cbs_fragment_uninit(ctx->cbc, frag); if (err < 0) av_packet_unref(pkt); |