If present, an Access unit information PBU must be the first in an AU.
Unified · Split
| @@ -51,7 +51,24 @@ static int apv_extract_header_info(GetByteContext *gbc) · 50 unmodified lines | ||
| 51 | 51 | if (zero != 0) |
| 52 | 52 | return AVERROR_INVALIDDATA; |
| 53 | 53 | |
| 54 | − if (info->pbu_type != APV_PBU_PRIMARY_FRAME) | |
| 54 | + if (info->pbu_type == APV_PBU_ACCESS_UNIT_INFORMATION) { | |
| 55 | + unsigned int num_frames = bytestream2_get_be16(gbc); | |
| 56 | + int pbu_type; | |
| 57 | + | |
| 58 | + if (num_frames < 1) | |
| 59 | + return AVERROR_INVALIDDATA; | |
| 60 | + | |
| 61 | + info->pbu_type = bytestream2_get_byte(gbc); | |
| 62 | + if (info->pbu_type != APV_PBU_PRIMARY_FRAME && | |
| 63 | + info->pbu_type != APV_PBU_NON_PRIMARY_FRAME && | |
| 64 | + (info->pbu_type < APV_PBU_PREVIEW_FRAME || info->pbu_type > APV_PBU_ALPHA_FRAME)) | |
| 65 | + return AVERROR_INVALIDDATA; | |
| 66 | + | |
| 67 | + bytestream2_skip(gbc, 2); // group_id | |
| 68 | + zero = bytestream2_get_byte(gbc); | |
| 69 | + if (zero != 0) | |
| 70 | + return AVERROR_INVALIDDATA; | |
| 71 | + } else if (info->pbu_type != APV_PBU_PRIMARY_FRAME) | |
| 55 | 72 | return AVERROR_INVALIDDATA; |
| 56 | 73 | |
| 57 | 74 | info->profile_idc = bytestream2_get_byte(gbc); |