@@ -292,7 +292,8 @@ typedef enum
292
292
{
293
293
TS_PMT_REGISTRATION_NONE = 0 ,
294
294
TS_PMT_REGISTRATION_BLURAY ,
295
- TS_PMT_REGISTRATION_ATSC
295
+ TS_PMT_REGISTRATION_ATSC ,
296
+ TS_PMT_REGISTRATION_ARIB ,
296
297
} ts_pmt_registration_type_t ;
297
298
298
299
typedef enum
@@ -5282,7 +5283,9 @@ static void FillPESFromDvbpsiES( demux_t *p_demux,
5282
5283
static void ParsePMTRegistrations ( demux_t * p_demux , const dvbpsi_descriptor_t * p_firstdr ,
5283
5284
ts_pmt_t * p_pmt , ts_pmt_registration_type_t * p_registration_type )
5284
5285
{
5286
+ demux_sys_t * p_sys = p_demux -> p_sys ;
5285
5287
ts_pmt_registration_type_t registration_type = * p_registration_type ;
5288
+ int i_arib_score_flags = 0 ; /* Descriptors can be repeated */
5286
5289
5287
5290
for ( const dvbpsi_descriptor_t * p_dr = p_firstdr ; p_dr != NULL ; p_dr = p_dr -> p_next )
5288
5291
{
@@ -5320,9 +5323,13 @@ static void ParsePMTRegistrations( demux_t *p_demux, const dvbpsi_descriptor_t
5320
5323
break ;
5321
5324
5322
5325
case 0x09 :
5323
- msg_Dbg ( p_demux , " * PMT descriptor : CA (0x9) SysID 0x%x" ,
5324
- (p_dr -> p_data [0 ] << 8 ) | p_dr -> p_data [1 ] );
5325
- break ;
5326
+ {
5327
+ dvbpsi_ca_dr_t * p_cadr = dvbpsi_DecodeCADr ( p_dr );
5328
+ msg_Dbg ( p_demux , " * PMT descriptor : CA (0x09) SysID 0x%x" ,
5329
+ p_cadr -> i_ca_system_id );
5330
+ i_arib_score_flags |= (p_cadr -> i_ca_system_id == 0x05 );
5331
+ }
5332
+ break ;
5326
5333
5327
5334
case 0x0f :
5328
5335
msg_Dbg ( p_demux , " * PMT descriptor : Private Data (0x0f)" );
@@ -5340,6 +5347,11 @@ static void ParsePMTRegistrations( demux_t *p_demux, const dvbpsi_descriptor_t
5340
5347
5341
5348
case 0xC1 :
5342
5349
msg_Dbg ( p_demux , " * PMT descriptor : Digital copy control (0xC1)" );
5350
+ i_arib_score_flags |= 1 << 2 ;
5351
+ break ;
5352
+
5353
+ case 0xF6 :
5354
+ i_arib_score_flags |= 1 << 1 ;
5343
5355
break ;
5344
5356
5345
5357
default :
@@ -5348,6 +5360,14 @@ static void ParsePMTRegistrations( demux_t *p_demux, const dvbpsi_descriptor_t
5348
5360
}
5349
5361
}
5350
5362
5363
+ if ( p_sys -> arib .e_mode == ARIBMODE_AUTO &&
5364
+ registration_type == TS_PMT_REGISTRATION_NONE &&
5365
+ i_arib_score_flags == 0x07 ) //0b111
5366
+ {
5367
+ registration_type = TS_PMT_REGISTRATION_ARIB ;
5368
+ p_sys -> arib .e_mode = ARIBMODE_ENABLED ;
5369
+ }
5370
+
5351
5371
* p_registration_type = registration_type ;
5352
5372
}
5353
5373
@@ -5423,36 +5443,6 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
5423
5443
5424
5444
/* Parse PMT descriptors */
5425
5445
ts_pmt_registration_type_t registration_type = TS_PMT_REGISTRATION_NONE ;
5426
- dvbpsi_descriptor_t * p_dr ;
5427
-
5428
- /* First pass for standard detection */
5429
- if ( p_sys -> arib .e_mode == ARIBMODE_AUTO )
5430
- {
5431
- int i_arib_flags = 0 ; /* Descriptors can be repeated */
5432
- for ( p_dr = p_dvbpsipmt -> p_first_descriptor ; p_dr != NULL ; p_dr = p_dr -> p_next )
5433
- {
5434
- switch (p_dr -> i_tag )
5435
- {
5436
- case 0x09 :
5437
- {
5438
- dvbpsi_ca_dr_t * p_cadr = dvbpsi_DecodeCADr ( p_dr );
5439
- i_arib_flags |= (p_cadr -> i_ca_system_id == 0x05 );
5440
- }
5441
- break ;
5442
- case 0xF6 :
5443
- i_arib_flags |= 1 << 1 ;
5444
- break ;
5445
- case 0xC1 :
5446
- i_arib_flags |= 1 << 2 ;
5447
- break ;
5448
- default :
5449
- break ;
5450
- }
5451
- }
5452
- if ( i_arib_flags == 0x07 ) //0b111
5453
- p_sys -> arib .e_mode = ARIBMODE_ENABLED ;
5454
- }
5455
-
5456
5446
ParsePMTRegistrations ( p_demux , p_dvbpsipmt -> p_first_descriptor , p_pmt , & registration_type );
5457
5447
5458
5448
dvbpsi_pmt_es_t * p_dvbpsies ;
@@ -5529,10 +5519,10 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
5529
5519
msg_Dbg ( p_demux , " * pid=%d type=0x%x %s" ,
5530
5520
p_dvbpsies -> i_pid , p_dvbpsies -> i_type , psz_typedesc );
5531
5521
5532
- for ( p_dr = p_dvbpsies -> p_first_descriptor ; p_dr != NULL ;
5533
- p_dr = p_dr -> p_next )
5522
+ for ( dvbpsi_descriptor_t * p_dr = p_dvbpsies -> p_first_descriptor ;
5523
+ p_dr != NULL ; p_dr = p_dr -> p_next )
5534
5524
{
5535
- msg_Dbg ( p_demux , " - descriptor tag 0x%x" ,
5525
+ msg_Dbg ( p_demux , " - ES descriptor tag 0x%x" ,
5536
5526
p_dr -> i_tag );
5537
5527
}
5538
5528
@@ -5583,10 +5573,10 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_dvbpsipmt )
5583
5573
p_dvbpsies -> i_pid , (char * )& p_pes -> p_es -> fmt .i_codec );
5584
5574
}
5585
5575
5586
- p_dr = PMTEsFindDescriptor ( p_dvbpsies , 0x09 );
5576
+ dvbpsi_descriptor_t * p_dr = PMTEsFindDescriptor ( p_dvbpsies , 0x09 );
5587
5577
if ( p_dr && p_dr -> i_length >= 2 )
5588
5578
{
5589
- msg_Dbg ( p_demux , " * PMT descriptor : CA (0x9) SysID 0x%x" ,
5579
+ msg_Dbg ( p_demux , " - ES descriptor : CA (0x9) SysID 0x%x" ,
5590
5580
(p_dr -> p_data [0 ] << 8 ) | p_dr -> p_data [1 ] );
5591
5581
}
5592
5582
0 commit comments