Commit 9d375e11 authored by Mark Thompson's avatar Mark Thompson

h264_metadata: Fix AUD writing

The aud structure exists on the stack, so the variable was previously
out-of-scope when the unit is written.
parent 2b412135
...@@ -220,6 +220,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out) ...@@ -220,6 +220,7 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
AVPacket *in = NULL; AVPacket *in = NULL;
CodedBitstreamFragment *au = &ctx->access_unit; CodedBitstreamFragment *au = &ctx->access_unit;
int err, i, j, has_sps; int err, i, j, has_sps;
H264RawAUD aud;
uint8_t *displaymatrix_side_data = NULL; uint8_t *displaymatrix_side_data = NULL;
size_t displaymatrix_side_data_size = 0; size_t displaymatrix_side_data_size = 0;
...@@ -256,9 +257,6 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out) ...@@ -256,9 +257,6 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
0x3ff, // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 0x3ff, // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
}; };
int primary_pic_type_mask = 0xff; int primary_pic_type_mask = 0xff;
H264RawAUD aud = {
.nal_unit_header.nal_unit_type = H264_NAL_AUD,
};
for (i = 0; i < au->nb_units; i++) { for (i = 0; i < au->nb_units; i++) {
if (au->units[i].type == H264_NAL_SLICE || if (au->units[i].type == H264_NAL_SLICE ||
...@@ -281,7 +279,10 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out) ...@@ -281,7 +279,10 @@ static int h264_metadata_filter(AVBSFContext *bsf, AVPacket *out)
goto fail; goto fail;
} }
aud.primary_pic_type = j; aud = (H264RawAUD) {
.nal_unit_header.nal_unit_type = H264_NAL_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, NULL); 0, H264_NAL_AUD, &aud, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment