@@ -4288,10 +4288,229 @@ void File_Ac3::object_audio_metadata_payload()
4288
4288
Get_S1 (7 , object_count_bits_ext, " object_count_bits_ext" );
4289
4289
num_dynamic_objects += object_count_bits_ext;
4290
4290
}
4291
+ int8u object_count{ num_dynamic_objects };
4291
4292
4292
4293
program_assignment ();
4293
4294
4294
- // TODO: next
4295
+ #ifdef MEDIAINFO_TRACE
4296
+
4297
+ bool b_alternate_object_data_present;
4298
+ Get_SB (b_alternate_object_data_present, " b_alternate_object_data_present" );
4299
+
4300
+ int8u oa_element_count_bits;
4301
+ Get_S1 (4 , oa_element_count_bits, " oa_element_count_bits" );
4302
+ if (oa_element_count_bits == 0xF )
4303
+ {
4304
+ int8u oa_element_count_bits_ext;
4305
+ Get_S1 (3 , oa_element_count_bits_ext, " oa_element_count_bits_ext" );
4306
+ oa_element_count_bits += oa_element_count_bits_ext;
4307
+ }
4308
+ for (int8u i = 0 ; i < oa_element_count_bits; ++i) {
4309
+ Element_Begin1 (" oa_element_md" );
4310
+ int8u oa_element_id_idx;
4311
+ int32u oa_element_size_bits;
4312
+ Get_S1 (4 , oa_element_id_idx, " oa_element_id_idx" );
4313
+ Get_V4 (4 , oa_element_size_bits, " oa_element_size_bits" );
4314
+ size_t oa_element_End = Data_BS_Remain () - (oa_element_size_bits + 1LL ) * 8 ;
4315
+ if (b_alternate_object_data_present)
4316
+ Skip_S1 (4 , " alternate_object_data_id_idx" );
4317
+ Skip_SB ( " b_discard_unknown_element" );
4318
+ switch (oa_element_id_idx)
4319
+ {
4320
+ case 1 : // object_element
4321
+ {
4322
+ Element_Begin1 (" object_element" );
4323
+ Element_Begin1 (" md_update_info" );
4324
+ int8u sample_offset_code;
4325
+ Get_S1 (2 , sample_offset_code, " sample_offset_code" );
4326
+ if (sample_offset_code == 0b01 )
4327
+ Skip_S1 (2 , " sample_offset_idx" );
4328
+ else
4329
+ if (sample_offset_code == 0b10 )
4330
+ Skip_S1 (5 , " sample_offset_bits" );
4331
+ int8u num_obj_info_blocks_bits;
4332
+ Get_S1 (3 , num_obj_info_blocks_bits, " num_obj_info_blocks_bits" );
4333
+ int8u num_obj_info_blocks = num_obj_info_blocks_bits + 1 ;
4334
+ for (int8u blk = 0 ; blk < num_obj_info_blocks; ++blk) {
4335
+ Element_Begin1 (" block_update_info" );
4336
+ Skip_S1 (6 , " block_offset_factor_bits" );
4337
+ int8u ramp_duration_code;
4338
+ Get_S1 (2 , ramp_duration_code, " ramp_duration_code" );
4339
+ if (ramp_duration_code == 0b11 ) {
4340
+ bool b_use_ramp_duration_idx;
4341
+ Get_SB (b_use_ramp_duration_idx, " b_use_ramp_duration_idx" );
4342
+ if (b_use_ramp_duration_idx)
4343
+ Skip_S1 (6 , " ramp_duration_idx" );
4344
+ else
4345
+ Skip_S2 (11 , " ramp_duration_bits" );
4346
+ }
4347
+ Element_End0 (); // block_update_info
4348
+ }
4349
+ Element_End0 (); // md_update_info
4350
+ bool b_reserved_data_not_present;
4351
+ Get_SB (b_reserved_data_not_present, " b_reserved_data_not_present" );
4352
+ if (!b_reserved_data_not_present)
4353
+ Skip_S1 (5 , " reserved" );
4354
+
4355
+ for (int8u j = 0 ; j < object_count; ++j) {
4356
+ Element_Begin1 (" object_data" );
4357
+ for (int8u blk = 0 ; blk < num_obj_info_blocks; ++blk) {
4358
+ Element_Begin1 (" object_info_block" );
4359
+ bool b_object_not_active;
4360
+ int8u object_basic_info_status_idx;
4361
+ Get_SB (b_object_not_active, " b_object_not_active" );
4362
+ if (b_object_not_active)
4363
+ object_basic_info_status_idx = 0b00 ;
4364
+ else {
4365
+ if (blk == 0 )
4366
+ object_basic_info_status_idx = 0b01 ;
4367
+ else
4368
+ Get_S1 (2 , object_basic_info_status_idx, " object_basic_info_status_idx" );
4369
+ }
4370
+ if ((object_basic_info_status_idx == 0b01 ) || (object_basic_info_status_idx == 0b11 )) {
4371
+ Element_Begin1 (" object_basic_info" );
4372
+ bool object_basic_info[2 ]{};
4373
+ if (object_basic_info_status_idx == 0b01 ) {
4374
+ object_basic_info[1 ] = true ;
4375
+ object_basic_info[0 ] = true ;
4376
+ }
4377
+ else {
4378
+ Get_SB (object_basic_info[1 ], " object_basic_info[1]" );
4379
+ Get_SB (object_basic_info[0 ], " object_basic_info[0]" );
4380
+ }
4381
+ if (object_basic_info[1 ]) {
4382
+ int8u object_gain_idx;
4383
+ Get_S1 (2 , object_gain_idx, " object_gain_idx" );
4384
+ if (object_gain_idx == 0b10 )
4385
+ Skip_S1 (6 , " object_gain_bits" );
4386
+ }
4387
+ if (object_basic_info[0 ]) {
4388
+ bool b_default_object_priority;
4389
+ Get_SB (b_default_object_priority, " b_default_object_priority" );
4390
+ if (!b_default_object_priority)
4391
+ Skip_S1 (5 , " object_priority_bits" );
4392
+ }
4393
+ Element_End0 (); // object_basic_info
4394
+ }
4395
+ int8u object_render_info_status_idx{};
4396
+ if (b_object_not_active) {
4397
+ object_render_info_status_idx = 0b00 ;
4398
+ }
4399
+ else {
4400
+ bool b_object_in_bed_or_isf = j < (num_bed_objects + num_isf_objects);
4401
+ if (!b_object_in_bed_or_isf) {
4402
+ if (blk == 0 ) {
4403
+ object_render_info_status_idx = 0b01 ;
4404
+ }
4405
+ else {
4406
+ Get_S1 (2 , object_render_info_status_idx, " object_render_info_status_idx" );
4407
+ }
4408
+ }
4409
+ else {
4410
+ object_render_info_status_idx = 0b00 ;
4411
+ }
4412
+ }
4413
+ if ((object_render_info_status_idx == 0b01 ) || (object_render_info_status_idx == 0b11 )) {
4414
+ Element_Begin1 (" object_render_info" );
4415
+ int8u obj_render_info{};
4416
+ if (object_render_info_status_idx == 0b01 )
4417
+ obj_render_info = 0b1111 ;
4418
+ else
4419
+ Get_S1 (4 , obj_render_info, " obj_render_info" );
4420
+ bool b_differential_position_specified{};
4421
+ if (obj_render_info & 0b0001 ) {
4422
+ if (blk == 0 )
4423
+ b_differential_position_specified = false ;
4424
+ else
4425
+ Get_SB (b_differential_position_specified, " b_differential_position_specified" );
4426
+ if (b_differential_position_specified) {
4427
+ Skip_S1 (3 , " diff_pos3D_X_bits" );
4428
+ Skip_S1 (3 , " diff_pos3D_Y_bits" );
4429
+ Skip_S1 (3 , " diff_pos3D_Z_bits" );
4430
+ }
4431
+ else {
4432
+ Skip_S1 (6 , " pos3D_X_bits" );
4433
+ Skip_S1 (6 , " pos3D_Y_bits" );
4434
+ Skip_SB ( " pos3D_Z_sign_bits" );
4435
+ Skip_S1 (4 , " pos3D_Z_bits" );
4436
+ }
4437
+ bool b_object_distance_specified;
4438
+ Get_SB (b_object_distance_specified, " b_object_distance_specified" );
4439
+ if (b_object_distance_specified) {
4440
+ bool b_object_at_infinity;
4441
+ Get_SB (b_object_at_infinity, " b_object_at_infinity" );
4442
+ if (b_object_at_infinity) {
4443
+ // object_distance = inf
4444
+ }
4445
+ else
4446
+ Skip_S1 (4 , " distance_factor_idx" );
4447
+ }
4448
+ }
4449
+ if (obj_render_info & 0b0010 ) {
4450
+ Skip_S1 (3 , " zone_constraints_idx" );
4451
+ Skip_SB ( " b_enable_elevation" );
4452
+ }
4453
+ if (obj_render_info & 0b0100 ) {
4454
+ int8u object_size_idx;
4455
+ Get_S1 (2 , object_size_idx, " object_size_idx" );
4456
+ if (object_size_idx == 0b01 )
4457
+ Skip_S1 (5 , " object_size_bits" );
4458
+ else {
4459
+ if (object_size_idx == 0b10 ) {
4460
+ Skip_S1 (5 , " object_width_bits" );
4461
+ Skip_S1 (5 , " object_depth_bits" );
4462
+ Skip_S1 (5 , " object_height_bits" );
4463
+ }
4464
+ }
4465
+ }
4466
+ if (obj_render_info & 0b1000 ) {
4467
+ bool b_object_use_screen_ref;
4468
+ Get_SB (b_object_use_screen_ref, " b_object_use_screen_ref" );
4469
+ if (b_object_use_screen_ref) {
4470
+ Skip_S1 (3 , " screen_factor_bits" );
4471
+ Skip_S1 (2 , " depth_factor_idx" );
4472
+ }
4473
+ else {
4474
+ // screen_factor_bits = 0;
4475
+ }
4476
+ }
4477
+ Skip_SB ( " b_object_snap" );
4478
+ Element_End0 (); // object_render_info
4479
+ }
4480
+ bool b_additional_table_data_exists;
4481
+ Get_SB (b_additional_table_data_exists, " b_additional_table_data_exists" );
4482
+ if (b_additional_table_data_exists) {
4483
+ int8u additional_table_data_size_bits;
4484
+ Get_S1 (4 , additional_table_data_size_bits, " additional_table_data_size_bits" );
4485
+ Skip_BS ((additional_table_data_size_bits+1LL )*8 , " additional_table_data" );
4486
+ }
4487
+ Element_End0 (); // object_info_block
4488
+ }
4489
+ Element_End0 (); // object_data
4490
+ }
4491
+
4492
+ Element_End0 (); // object_element
4493
+ break ;
4494
+ }
4495
+
4496
+ // TODO: next
4497
+
4498
+ default :
4499
+ i = oa_element_count_bits; // stop as parsing other elements not implemented
4500
+ break ;
4501
+ }
4502
+ if (i != oa_element_count_bits) {
4503
+ size_t RemainginBits = Data_BS_Remain ();
4504
+ if (RemainginBits >= oa_element_End)
4505
+ {
4506
+ if (RemainginBits > oa_element_End)
4507
+ Skip_BS (RemainginBits - oa_element_End, " padding" );
4508
+ }
4509
+ }
4510
+ Element_End0 (); // oa_element_md
4511
+ }
4512
+
4513
+ #endif // MEDIAINFO_TRACE
4295
4514
4296
4515
Element_End0 ();
4297
4516
}
@@ -4353,8 +4572,12 @@ void File_Ac3::program_assignment()
4353
4572
}
4354
4573
}
4355
4574
4356
- if (content_description_mask & 0x2 )
4357
- Skip_S1 (3 , " intermediate_spatial_format_idx" );
4575
+ if (content_description_mask & 0x2 ) {
4576
+ const int8u num_isf_objects_lookup[] = {4 , 8 , 10 , 14 , 15 , 30 };
4577
+ int8u intermediate_spatial_format_idx;
4578
+ Get_S1 (3 , intermediate_spatial_format_idx, " intermediate_spatial_format_idx" );
4579
+ num_isf_objects = num_isf_objects_lookup[intermediate_spatial_format_idx];
4580
+ }
4358
4581
4359
4582
if (content_description_mask & 0x4 )
4360
4583
{
@@ -4382,6 +4605,13 @@ void File_Ac3::program_assignment()
4382
4605
}
4383
4606
}
4384
4607
4608
+ num_bed_objects = 0 ;
4609
+ int32u n{ nonstd_bed_channel_assignment_mask };
4610
+ while (n) {
4611
+ n &= (n - 1 );
4612
+ ++num_bed_objects;
4613
+ }
4614
+
4385
4615
Element_End0 ();
4386
4616
}
4387
4617
@@ -4654,6 +4884,7 @@ void File_Ac3::HD()
4654
4884
for (int8u i = 0 ; i < HD_SubStreams_Count; ++i) {
4655
4885
Element_Begin1 (" substream_segment" );
4656
4886
auto substream_segment_begin = Element_Offset;
4887
+ #ifdef MEDIAINFO_TRACE
4657
4888
BS_Begin ();
4658
4889
// bool last_block_in_segment;
4659
4890
// do {
@@ -4705,6 +4936,7 @@ void File_Ac3::HD()
4705
4936
// }
4706
4937
4707
4938
BS_End ();
4939
+ #endif // MEDIAINFO_TRACE
4708
4940
Skip_XX (substreams_begin_ptr + substream_end_ptrs[i] * 2LL - (crc_present ? 2 : 0 ) - Element_Offset, " (Not parsed)" );
4709
4941
auto size = Element_Offset - substream_segment_begin;
4710
4942
Element_End0 ();
0 commit comments