mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-24 03:39:45 +00:00
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>
This commit is contained in:
parent
976dae8b32
commit
c5b452ed2f
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user