Commit 2482ac28 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: ts: apply pmt registration first (fix #11545)

If someone has an HDMV/ LPCM DVD to test.

Francois
parent e154f7f7
...@@ -240,9 +240,9 @@ typedef enum ...@@ -240,9 +240,9 @@ typedef enum
typedef enum typedef enum
{ {
TS_REGISTRATION_OTHER = 0, TS_PMT_REGISTRATION_NONE = 0,
TS_REGISTRATION_HDMV TS_PMT_REGISTRATION_HDMV
} ts_registration_type_t; } ts_pmt_registration_type_t;
typedef struct typedef struct
{ {
...@@ -3830,7 +3830,8 @@ static void PMTSetupEs0x83( const dvbpsi_pmt_t *p_pmt, ts_pid_t *pid ) ...@@ -3830,7 +3830,8 @@ static void PMTSetupEs0x83( const dvbpsi_pmt_t *p_pmt, ts_pid_t *pid )
es_format_Init( &pid->es->fmt, AUDIO_ES, VLC_CODEC_DVD_LPCM ); es_format_Init( &pid->es->fmt, AUDIO_ES, VLC_CODEC_DVD_LPCM );
} }
static void PMTSetupEsHDMV( ts_pid_t *pid, const dvbpsi_pmt_es_t *p_es ) static bool PMTSetupEsHDMV( demux_t *p_demux, ts_pid_t *pid,
const dvbpsi_pmt_es_t *p_es )
{ {
es_format_t *p_fmt = &pid->es->fmt; es_format_t *p_fmt = &pid->es->fmt;
...@@ -3865,12 +3866,17 @@ static void PMTSetupEsHDMV( ts_pid_t *pid, const dvbpsi_pmt_es_t *p_es ) ...@@ -3865,12 +3866,17 @@ static void PMTSetupEsHDMV( ts_pid_t *pid, const dvbpsi_pmt_es_t *p_es )
break; break;
case 0x91: /* Interactive graphics */ case 0x91: /* Interactive graphics */
case 0x92: /* Subtitle */ case 0x92: /* Subtitle */
return false;
default: default:
msg_Info( p_demux, "HDMV registration not implemented for pid 0x%x type 0x%x",
p_es->i_pid, p_es->i_type );
return false;
break; break;
} }
return true;
} }
static void PMTSetupEsRegistration( demux_t *p_demux, ts_pid_t *pid, static bool PMTSetupEsRegistration( demux_t *p_demux, ts_pid_t *pid,
const dvbpsi_pmt_es_t *p_es ) const dvbpsi_pmt_es_t *p_es )
{ {
static const struct static const struct
...@@ -3898,9 +3904,10 @@ static void PMTSetupEsRegistration( demux_t *p_demux, ts_pid_t *pid, ...@@ -3898,9 +3904,10 @@ static void PMTSetupEsRegistration( demux_t *p_demux, ts_pid_t *pid,
p_fmt->i_codec = p_regs[i].i_codec; p_fmt->i_codec = p_regs[i].i_codec;
if (p_es->i_type == 0x87) if (p_es->i_type == 0x87)
p_fmt->i_codec = VLC_CODEC_EAC3; p_fmt->i_codec = VLC_CODEC_EAC3;
return; return true;
} }
} }
return false;
} }
static char *GetAudioTypeDesc(demux_t *p_demux, int type) static char *GetAudioTypeDesc(demux_t *p_demux, int type)
...@@ -4045,8 +4052,8 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -4045,8 +4052,8 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
if( ProgramIsSelected( p_demux, prg->i_number ) ) if( ProgramIsSelected( p_demux, prg->i_number ) )
SetPIDFilter( p_demux, prg->i_pid_pcr, true ); /* Set demux filter */ SetPIDFilter( p_demux, prg->i_pid_pcr, true ); /* Set demux filter */
/* Parse descriptor */ /* Parse PMT descriptors */
ts_registration_type_t registration_type = TS_REGISTRATION_OTHER; ts_pmt_registration_type_t registration_type = TS_PMT_REGISTRATION_NONE;
dvbpsi_descriptor_t *p_dr; dvbpsi_descriptor_t *p_dr;
for( p_dr = p_pmt->p_first_descriptor; p_dr != NULL; p_dr = p_dr->p_next ) for( p_dr = p_pmt->p_first_descriptor; p_dr != NULL; p_dr = p_dr->p_next )
switch(p_dr->i_tag) switch(p_dr->i_tag)
...@@ -4070,7 +4077,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -4070,7 +4077,7 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
{ {
msg_Dbg( p_demux, " * descriptor : registration %4.4s", p_dr->p_data ); msg_Dbg( p_demux, " * descriptor : registration %4.4s", p_dr->p_data );
if( !memcmp( p_dr->p_data, "HDMV", 4 ) || !memcmp( p_dr->p_data, "HDPR", 4 ) ) if( !memcmp( p_dr->p_data, "HDMV", 4 ) || !memcmp( p_dr->p_data, "HDPR", 4 ) )
registration_type = TS_REGISTRATION_HDMV; /* Blu-Ray */ registration_type = TS_PMT_REGISTRATION_HDMV; /* Blu-Ray */
} }
break; break;
...@@ -4123,36 +4130,52 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt ) ...@@ -4123,36 +4130,52 @@ static void PMTCallBack( void *data, dvbpsi_pmt_t *p_pmt )
pid->i_pid = p_es->i_pid; pid->i_pid = p_es->i_pid;
pid->b_seen = p_sys->pid[p_es->i_pid].b_seen; pid->b_seen = p_sys->pid[p_es->i_pid].b_seen;
switch( p_es->i_type )
bool b_registration_applied = false;
if ( p_es->i_type >= 0x80 ) /* non standard, extensions */
{ {
case 0x10: if ( registration_type == TS_PMT_REGISTRATION_HDMV )
case 0x11: {
case 0x12: if (( b_registration_applied = PMTSetupEsHDMV( p_demux, pid, p_es ) ))
case 0x0f: msg_Dbg( p_demux, "es HDMV registration applied to pid 0x%x type 0x%x",
PMTSetupEsISO14496( p_demux, pid, prg, p_es ); p_es->i_pid, p_es->i_type );
break; }
case 0x06: else
PMTSetupEs0x06( p_demux, pid, p_es ); {
break; if (( b_registration_applied = PMTSetupEsRegistration( p_demux, pid, p_es ) ))
case 0x83: msg_Dbg( p_demux, "es registration applied to pid 0x%x type 0x%x",
/* LPCM (audio) */ p_es->i_pid, p_es->i_type );
PMTSetupEs0x83( p_pmt, pid ); }
break; }
case 0xa0:
PMTSetupEs0xA0( p_demux, pid, p_es ); if ( !b_registration_applied )
break; {
case 0xd1: switch( p_es->i_type )
PMTSetupEs0xD1( p_demux, pid, p_es ); {
break; case 0x10:
case 0xEA: case 0x11:
PMTSetupEs0xEA( p_demux, pid, p_es ); case 0x12:
break; case 0x0f:
default: PMTSetupEsISO14496( p_demux, pid, prg, p_es );
if( registration_type == TS_REGISTRATION_HDMV ) break;
PMTSetupEsHDMV( pid, p_es ); case 0x06:
else if( p_es->i_type >= 0x80 ) PMTSetupEs0x06( p_demux, pid, p_es );
PMTSetupEsRegistration( p_demux, pid, p_es ); break;
break; case 0x83:
/* LPCM (audio) */
PMTSetupEs0x83( p_pmt, pid );
break;
case 0xa0:
PMTSetupEs0xA0( p_demux, pid, p_es );
break;
case 0xd1:
PMTSetupEs0xD1( p_demux, pid, p_es );
break;
case 0xEA:
PMTSetupEs0xEA( p_demux, pid, p_es );
default:
break;
}
} }
if( pid->es->fmt.i_cat == AUDIO_ES || if( pid->es->fmt.i_cat == AUDIO_ES ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment