Unified · Split
| @@ -45,6 +45,8 @@ enum { · 44 unmodified lines | ||
| 45 | 45 | #define FLAG_IS_NALFF (1 << 1) |
| 46 | 46 | |
| 47 | 47 | typedef struct HVCCNALUnit { |
| 48 | + uint8_t nuh_layer_id; | |
| 49 | + uint8_t parameter_set_id; | |
| 48 | 50 | uint16_t nalUnitLength; |
| 49 | 51 | const uint8_t *nalUnit; |
| 50 | 52 | } HVCCNALUnit; |
| @@ -378,17 +380,17 @@ static void skip_sub_layer_ordering_info(GetBitContext *gb) · 327 unmodified lines | ||
| 378 | 380 | get_ue_golomb_long(gb); // max_latency_increase_plus1 |
| 379 | 381 | } |
| 380 | 382 | |
| 381 | −static int hvcc_parse_vps(GetBitContext *gb, | |
| 383 | +static int hvcc_parse_vps(GetBitContext *gb, HVCCNALUnit *nal, | |
| 382 | 384 | HEVCDecoderConfigurationRecord *hvcc) |
| 383 | 385 | { |
| 384 | 386 | unsigned int vps_max_sub_layers_minus1; |
| 385 | 387 | |
| 388 | + nal->parameter_set_id = get_bits(gb, 4); | |
| 386 | 389 | /* |
| 387 | − * vps_video_parameter_set_id u(4) | |
| 388 | 390 | * vps_reserved_three_2bits u(2) |
| 389 | 391 | * vps_max_layers_minus1 u(6) |
| 390 | 392 | */ |
| 391 | − skip_bits(gb, 12); | |
| 393 | + skip_bits(gb, 8); | |
| 392 | 394 | |
| 393 | 395 | vps_max_sub_layers_minus1 = get_bits(gb, 3); |
| 394 | 396 | |
| @@ -501,7 +503,7 @@ static int parse_rps(GetBitContext *gb, unsigned int rps_idx, · 106 unmodified lines | ||
| 501 | 503 | return 0; |
| 502 | 504 | } |
| 503 | 505 | |
| 504 | −static int hvcc_parse_sps(GetBitContext *gb, | |
| 506 | +static int hvcc_parse_sps(GetBitContext *gb, HVCCNALUnit *nal, | |
| 505 | 507 | HEVCDecoderConfigurationRecord *hvcc) |
| 506 | 508 | { |
| 507 | 509 | unsigned int i, sps_max_sub_layers_minus1, log2_max_pic_order_cnt_lsb_minus4; |
| @@ -526,7 +528,7 @@ static int hvcc_parse_sps(GetBitContext *gb, · 18 unmodified lines | ||
| 526 | 528 | |
| 527 | 529 | hvcc_parse_ptl(gb, hvcc, sps_max_sub_layers_minus1); |
| 528 | 530 | |
| 529 | − get_ue_golomb_long(gb); // sps_seq_parameter_set_id | |
| 531 | + nal->parameter_set_id = get_ue_golomb_long(gb); | |
| 530 | 532 | |
| 531 | 533 | hvcc->chromaFormat = get_ue_golomb_long(gb); |
| 532 | 534 | |
| @@ -605,12 +607,12 @@ static int hvcc_parse_sps(GetBitContext *gb, · 72 unmodified lines | ||
| 605 | 607 | return 0; |
| 606 | 608 | } |
| 607 | 609 | |
| 608 | −static int hvcc_parse_pps(GetBitContext *gb, | |
| 610 | +static int hvcc_parse_pps(GetBitContext *gb, HVCCNALUnit *nal, | |
| 609 | 611 | HEVCDecoderConfigurationRecord *hvcc) |
| 610 | 612 | { |
| 611 | 613 | uint8_t tiles_enabled_flag, entropy_coding_sync_enabled_flag; |
| 612 | 614 | |
| 613 | − get_ue_golomb_long(gb); // pps_pic_parameter_set_id | |
| 615 | + nal->parameter_set_id = get_ue_golomb_long(gb); // pps_pic_parameter_set_id | |
| 614 | 616 | get_ue_golomb_long(gb); // pps_seq_parameter_set_id |
| 615 | 617 | |
| 616 | 618 | /* |
| @@ -703,6 +705,7 @@ static int hvcc_add_nal_unit(const uint8_t *nal_buf, uint32_t nal_size, · 86 unmodified lines | ||
| 703 | 705 | int is_nalff = !!(flags & FLAG_IS_NALFF); |
| 704 | 706 | int ps_array_completeness = !!(flags & FLAG_ARRAY_COMPLETENESS); |
| 705 | 707 | HVCCNALUnitArray *const array = &hvcc->arrays[array_idx]; |
| 708 | + HVCCNALUnit *nal; | |
| 706 | 709 | GetBitContext gbc; |
| 707 | 710 | uint8_t nal_type, nuh_layer_id; |
| 708 | 711 | uint8_t *rbsp_buf; |
| @@ -745,16 +748,19 @@ static int hvcc_add_nal_unit(const uint8_t *nal_buf, uint32_t nal_size, · 36 unmodified lines | ||
| 745 | 748 | array->array_completeness = ps_array_completeness; |
| 746 | 749 | } |
| 747 | 750 | |
| 751 | + nal = &array->nal[array->numNalus-1]; | |
| 752 | + nal->nuh_layer_id = nuh_layer_id; | |
| 753 | + | |
| 748 | 754 | /* Don't parse parameter sets. We already have the needed information*/ |
| 749 | 755 | if (is_nalff) |
| 750 | 756 | goto end; |
| 751 | 757 | |
| 752 | 758 | if (nal_type == HEVC_NAL_VPS) |
| 753 | − ret = hvcc_parse_vps(&gbc, hvcc); | |
| 759 | + ret = hvcc_parse_vps(&gbc, nal, hvcc); | |
| 754 | 760 | else if (nal_type == HEVC_NAL_SPS) |
| 755 | − ret = hvcc_parse_sps(&gbc, hvcc); | |
| 761 | + ret = hvcc_parse_sps(&gbc, nal, hvcc); | |
| 756 | 762 | else if (nal_type == HEVC_NAL_PPS) |
| 757 | − ret = hvcc_parse_pps(&gbc, hvcc); | |
| 763 | + ret = hvcc_parse_pps(&gbc, nal, hvcc); | |
| 758 | 764 | if (ret < 0) |
| 759 | 765 | goto end; |
| 760 | 766 | |