aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_metadata_bsf.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-11-09 01:03:57 +0000
committerMark Thompson <sw@jkqxz.net>2018-02-20 22:04:12 +0000
commit2651352988212531038326c44754ece1728c4a3b (patch)
tree0a881dcc977760e4181e7018028d790806b72c15 /libavcodec/h264_metadata_bsf.c
parentcc1c94dacd0642ac1a6cad45deb65071f127d91a (diff)
downloadffmpeg-2651352988212531038326c44754ece1728c4a3b.tar.gz
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/h264_metadata_bsf.c')
-rw-r--r--libavcodec/h264_metadata_bsf.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c
index ac0b9823b9..2b579e9d3d 100644
--- a/libavcodec/h264_metadata_bsf.c
+++ b/libavcodec/h264_metadata_bsf.c
@@ -35,7 +35,7 @@ enum {
typedef struct H264MetadataContext {
const AVClass *class;
- CodedBitstreamContext cbc;
+ CodedBitstreamContext *cbc;
CodedBitstreamFragment access_unit;
H264RawAUD aud_nal;
@@ -214,7 +214,7 @@ static int h264_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;
@@ -229,7 +229,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
// If an AUD is present, it must be the first NAL unit.
if (au->units[0].type == H264_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) {
static const int primary_pic_type_table[] = {
@@ -269,7 +269,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
aud->nal_unit_header.nal_unit_type = H264_NAL_AUD;
aud->primary_pic_type = j;
- err = ff_cbs_insert_unit_content(&ctx->cbc, au,
+ err = ff_cbs_insert_unit_content(ctx->cbc, au,
0, H264_NAL_AUD, aud);
if (err < 0) {
av_log(bsf, AV_LOG_ERROR, "Failed to insert AUD.\n");
@@ -314,7 +314,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
sei->nal_unit_header.nal_unit_type = H264_NAL_SEI;
- err = ff_cbs_insert_unit_content(&ctx->cbc, au,
+ err = ff_cbs_insert_unit_content(ctx->cbc, au,
sei_pos, H264_NAL_SEI, sei);
if (err < 0) {
av_log(bsf, AV_LOG_ERROR, "Failed to insert SEI.\n");
@@ -375,7 +375,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
++sei->payload_count;
}
- 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;
@@ -387,7 +387,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
err = 0;
fail:
- ff_cbs_fragment_uninit(&ctx->cbc, au);
+ ff_cbs_fragment_uninit(ctx->cbc, au);
av_freep(&sei_udu_string);
av_packet_free(&in);
@@ -406,7 +406,7 @@ static int h264_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;
@@ -420,7 +420,7 @@ static int h264_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;
@@ -429,7 +429,7 @@ static int h264_metadata_init(AVBSFContext *bsf)
err = 0;
fail:
- ff_cbs_fragment_uninit(&ctx->cbc, au);
+ ff_cbs_fragment_uninit(ctx->cbc, au);
return err;
}