diff options
author | Mark Thompson <sw@jkqxz.net> | 2017-11-09 04:03:57 +0300 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2018-02-21 01:04:12 +0300 |
commit | 2651352988212531038326c44754ece1728c4a3b (patch) | |
tree | 0a881dcc977760e4181e7018028d790806b72c15 /libavcodec/h265_metadata_bsf.c | |
parent | cc1c94dacd0642ac1a6cad45deb65071f127d91a (diff) |
cbs: Allocate the context inside the init function
... instead of making callers allocate it themselves. This is more
consistent with other APIs in libav.
Diffstat (limited to 'libavcodec/h265_metadata_bsf.c')
-rw-r--r-- | libavcodec/h265_metadata_bsf.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavcodec/h265_metadata_bsf.c b/libavcodec/h265_metadata_bsf.c index aef4a55fb7..ffaf7f2873 100644 --- a/libavcodec/h265_metadata_bsf.c +++ b/libavcodec/h265_metadata_bsf.c @@ -33,7 +33,7 @@ enum { typedef struct H265MetadataContext { const AVClass *class; - CodedBitstreamContext cbc; + CodedBitstreamContext *cbc; CodedBitstreamFragment access_unit; H265RawAUD aud_nal; @@ -241,7 +241,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out) if (err < 0) goto fail; - err = ff_cbs_read_packet(&ctx->cbc, au, in); + err = ff_cbs_read_packet(ctx->cbc, au, in); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to read packet.\n"); goto fail; @@ -256,7 +256,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out) // If an AUD is present, it must be the first NAL unit. if (au->units[0].type == HEVC_NAL_AUD) { if (ctx->aud == REMOVE) - ff_cbs_delete_unit(&ctx->cbc, au, 0); + ff_cbs_delete_unit(ctx->cbc, au, 0); } else { if (ctx->aud == INSERT) { H265RawAUD *aud = &ctx->aud_nal; @@ -288,7 +288,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out) }; aud->pic_type = pic_type; - err = ff_cbs_insert_unit_content(&ctx->cbc, au, + err = ff_cbs_insert_unit_content(ctx->cbc, au, 0, HEVC_NAL_AUD, aud); if (err) { av_log(bsf, AV_LOG_ERROR, "Failed to insert AUD.\n"); @@ -310,7 +310,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out) } } - err = ff_cbs_write_packet(&ctx->cbc, out, au); + err = ff_cbs_write_packet(ctx->cbc, out, au); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to write packet.\n"); goto fail; @@ -322,7 +322,7 @@ static int h265_metadata_filter(AVBSFContext *bsf, AVPacket *out) err = 0; fail: - ff_cbs_fragment_uninit(&ctx->cbc, au); + ff_cbs_fragment_uninit(ctx->cbc, au); av_packet_free(&in); @@ -340,7 +340,7 @@ static int h265_metadata_init(AVBSFContext *bsf) return err; if (bsf->par_in->extradata) { - err = ff_cbs_read_extradata(&ctx->cbc, au, bsf->par_in); + err = ff_cbs_read_extradata(ctx->cbc, au, bsf->par_in); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to read extradata.\n"); goto fail; @@ -359,7 +359,7 @@ static int h265_metadata_init(AVBSFContext *bsf) } } - err = ff_cbs_write_extradata(&ctx->cbc, bsf->par_out, au); + err = ff_cbs_write_extradata(ctx->cbc, bsf->par_out, au); if (err < 0) { av_log(bsf, AV_LOG_ERROR, "Failed to write extradata.\n"); goto fail; @@ -368,7 +368,7 @@ static int h265_metadata_init(AVBSFContext *bsf) err = 0; fail: - ff_cbs_fragment_uninit(&ctx->cbc, au); + ff_cbs_fragment_uninit(ctx->cbc, au); return err; } |