mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-11 06:58:18 +00:00
avformat/av1: support av1C extradata in ff_av1_parse_seq_header()
Fixes dash manifest creation for av1 streams with av1C formatted extradata. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
b6c7f82db7
commit
76e10325fc
@ -335,10 +335,43 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int
|
||||
{
|
||||
int64_t obu_size;
|
||||
int start_pos, type, temporal_id, spatial_id;
|
||||
int is_av1c;
|
||||
|
||||
if (size <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
is_av1c = !!(buf[0] & 0x80);
|
||||
if (is_av1c) {
|
||||
GetBitContext gb;
|
||||
int ret, version = buf[0] & 0x7F;
|
||||
|
||||
if (version != 1 || size < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
ret = init_get_bits8(&gb, buf, 4);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
memset(seq, 0, sizeof(*seq));
|
||||
|
||||
skip_bits(&gb, 8);
|
||||
seq->profile = get_bits(&gb, 3);
|
||||
seq->level = get_bits(&gb, 5);
|
||||
seq->tier = get_bits(&gb, 1);
|
||||
seq->bitdepth = get_bits(&gb, 1) * 2 + 8;
|
||||
seq->bitdepth += get_bits(&gb, 1) * 2;
|
||||
seq->monochrome = get_bits(&gb, 1);
|
||||
seq->chroma_subsampling_x = get_bits(&gb, 1);
|
||||
seq->chroma_subsampling_y = get_bits(&gb, 1);
|
||||
seq->chroma_sample_position = get_bits(&gb, 2);
|
||||
seq->color_primaries = AVCOL_PRI_UNSPECIFIED;
|
||||
seq->transfer_characteristics = AVCOL_TRC_UNSPECIFIED;
|
||||
seq->matrix_coefficients = AVCOL_SPC_UNSPECIFIED;
|
||||
|
||||
size -= 4;
|
||||
buf += 4;
|
||||
}
|
||||
|
||||
while (size > 0) {
|
||||
int len = parse_obu_header(buf, size, &obu_size, &start_pos,
|
||||
&type, &temporal_id, &spatial_id);
|
||||
@ -358,7 +391,7 @@ int ff_av1_parse_seq_header(AV1SequenceParameters *seq, const uint8_t *buf, int
|
||||
buf += len;
|
||||
}
|
||||
|
||||
return AVERROR_INVALIDDATA;
|
||||
return is_av1c ? 0 : AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
int ff_isom_write_av1c(AVIOContext *pb, const uint8_t *buf, int size)
|
||||
|
Loading…
Reference in New Issue
Block a user