mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-03 14:32:16 +02: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;
|
ctx->cbc->nb_decompose_unit_types = 0;
|
||||||
|
|
||||||
if (bsf->par_in->extradata) {
|
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) {
|
if (err < 0) {
|
||||||
av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");
|
av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n");
|
||||||
} else {
|
} 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)
|
if (err < 0)
|
||||||
av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n");
|
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;
|
return err;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
typedef struct TraceHeadersContext {
|
typedef struct TraceHeadersContext {
|
||||||
CodedBitstreamContext *cbc;
|
CodedBitstreamContext *cbc;
|
||||||
|
CodedBitstreamFragment fragment;
|
||||||
} TraceHeadersContext;
|
} TraceHeadersContext;
|
||||||
|
|
||||||
|
|
||||||
@ -44,13 +45,13 @@ static int trace_headers_init(AVBSFContext *bsf)
|
|||||||
ctx->cbc->trace_level = AV_LOG_INFO;
|
ctx->cbc->trace_level = AV_LOG_INFO;
|
||||||
|
|
||||||
if (bsf->par_in->extradata) {
|
if (bsf->par_in->extradata) {
|
||||||
CodedBitstreamFragment ps;
|
CodedBitstreamFragment *frag = &ctx->fragment;
|
||||||
|
|
||||||
av_log(bsf, AV_LOG_INFO, "Extradata\n");
|
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;
|
return err;
|
||||||
@ -66,7 +67,7 @@ static void trace_headers_close(AVBSFContext *bsf)
|
|||||||
static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
|
static int trace_headers(AVBSFContext *bsf, AVPacket *pkt)
|
||||||
{
|
{
|
||||||
TraceHeadersContext *ctx = bsf->priv_data;
|
TraceHeadersContext *ctx = bsf->priv_data;
|
||||||
CodedBitstreamFragment au;
|
CodedBitstreamFragment *frag = &ctx->fragment;
|
||||||
char tmp[256] = { 0 };
|
char tmp[256] = { 0 };
|
||||||
int err;
|
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);
|
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)
|
if (err < 0)
|
||||||
av_packet_unref(pkt);
|
av_packet_unref(pkt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user