Commit 73f01617 authored by Rafaël Carré's avatar Rafaël Carré

TS Mux GetPMT(): factor out mpeg4 code

parent d6399cf3
...@@ -2084,76 +2084,9 @@ static uint32_t GetDescriptorLength24b( int i_length ) ...@@ -2084,76 +2084,9 @@ static uint32_t GetDescriptorLength24b( int i_length )
return( 0x808000 | ( i_l3 << 16 ) | ( i_l2 << 8 ) | i_l1 ); return( 0x808000 | ( i_l3 << 16 ) | ( i_l2 << 8 ) | i_l1 );
} }
static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) static void GetPMTmpeg4(sout_mux_t *p_mux)
{ {
sout_mux_sys_t *p_sys = p_mux->p_sys; sout_mux_sys_t *p_sys = p_mux->p_sys;
if( p_sys->dvbpmt == NULL )
{
p_sys->dvbpmt = malloc( p_sys->i_num_pmt * sizeof(dvbpsi_pmt_t) );
if( !p_sys->dvbpmt )
{
return;
}
}
dvbpsi_sdt_t sdt;
if( p_sys->b_sdt )
dvbpsi_InitSDT( &sdt, p_sys->i_tsid, 1, 1, p_sys->i_netid );
for (int i = 0; i < p_sys->i_num_pmt; i++ )
{
dvbpsi_InitPMT( &p_sys->dvbpmt[i],
p_sys->i_pmt_program_number[i], /* program number */
p_sys->i_pmt_version_number,
1, /* b_current_next */
p_sys->i_pcr_pid );
if( p_sys->b_sdt )
{
dvbpsi_sdt_service_t *p_service = dvbpsi_SDTAddService( &sdt,
p_sys->i_pmt_program_number[i], /* service id */
0, /* eit schedule */
0, /* eit present */
4, /* running status ("4=RUNNING") */
0 ); /* free ca */
#define psz_sdtprov p_sys->sdt_descriptors[i].psz_provider
#define psz_sdtserv p_sys->sdt_descriptors[i].psz_service_name
/* FIXME: Ineffecient malloc's & ugly code...... */
if( ( psz_sdtprov != NULL ) && ( psz_sdtserv != NULL ) )
{
uint8_t *psz_sdt_desc = malloc( 3 + strlen(psz_sdtprov)
+ strlen(psz_sdtserv) );
if( psz_sdt_desc )
{
psz_sdt_desc[0] = 0x01; /* digital television service */
/* service provider name length */
psz_sdt_desc[1] = (char)strlen(psz_sdtprov);
memcpy( &psz_sdt_desc[2], psz_sdtprov, strlen(psz_sdtprov) );
/* service name length */
psz_sdt_desc[ 2 + strlen(psz_sdtprov) ]
= (char)strlen(psz_sdtserv);
memcpy( &psz_sdt_desc[3+strlen(psz_sdtprov)], psz_sdtserv,
strlen(psz_sdtserv) );
dvbpsi_SDTServiceAddDescriptor( p_service, 0x48,
3 + strlen(psz_sdtprov) + strlen(psz_sdtserv),
(uint8_t *)psz_sdt_desc );
free( psz_sdt_desc );
psz_sdt_desc = NULL;
}
}
#undef psz_sdtprov
#undef psz_sdtserv
}
}
if( p_sys->i_mpeg4_streams > 0 )
{
uint8_t iod[4096]; uint8_t iod[4096];
bits_buffer_t bits; bits_buffer_t bits;
bits_buffer_t bits_fix_IOD; bits_buffer_t bits_fix_IOD;
...@@ -2289,8 +2222,77 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -2289,8 +2222,77 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
dvbpsi_PMTAddDescriptor( &p_sys->dvbpmt[0], 0x1d, bits.i_data, dvbpsi_PMTAddDescriptor( &p_sys->dvbpmt[0], 0x1d, bits.i_data,
bits.p_data ); bits.p_data );
}
static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
{
sout_mux_sys_t *p_sys = p_mux->p_sys;
if( p_sys->dvbpmt == NULL )
{
p_sys->dvbpmt = malloc( p_sys->i_num_pmt * sizeof(dvbpsi_pmt_t) );
if( p_sys->dvbpmt == NULL )
return;
} }
dvbpsi_sdt_t sdt;
if( p_sys->b_sdt )
dvbpsi_InitSDT( &sdt, p_sys->i_tsid, 1, 1, p_sys->i_netid );
for (int i = 0; i < p_sys->i_num_pmt; i++ )
{
dvbpsi_InitPMT( &p_sys->dvbpmt[i],
p_sys->i_pmt_program_number[i], /* program number */
p_sys->i_pmt_version_number,
1, /* b_current_next */
p_sys->i_pcr_pid );
if( p_sys->b_sdt )
{
dvbpsi_sdt_service_t *p_service = dvbpsi_SDTAddService( &sdt,
p_sys->i_pmt_program_number[i], /* service id */
0, /* eit schedule */
0, /* eit present */
4, /* running status ("4=RUNNING") */
0 ); /* free ca */
#define psz_sdtprov p_sys->sdt_descriptors[i].psz_provider
#define psz_sdtserv p_sys->sdt_descriptors[i].psz_service_name
/* FIXME: Ineffecient malloc's & ugly code...... */
if( ( psz_sdtprov != NULL ) && ( psz_sdtserv != NULL ) )
{
uint8_t *psz_sdt_desc = malloc( 3 + strlen(psz_sdtprov)
+ strlen(psz_sdtserv) );
if( psz_sdt_desc )
{
psz_sdt_desc[0] = 0x01; /* digital television service */
/* service provider name length */
psz_sdt_desc[1] = (char)strlen(psz_sdtprov);
memcpy( &psz_sdt_desc[2], psz_sdtprov, strlen(psz_sdtprov) );
/* service name length */
psz_sdt_desc[ 2 + strlen(psz_sdtprov) ]
= (char)strlen(psz_sdtserv);
memcpy( &psz_sdt_desc[3+strlen(psz_sdtprov)], psz_sdtserv,
strlen(psz_sdtserv) );
dvbpsi_SDTServiceAddDescriptor( p_service, 0x48,
3 + strlen(psz_sdtprov) + strlen(psz_sdtserv),
(uint8_t *)psz_sdt_desc );
free( psz_sdt_desc );
psz_sdt_desc = NULL;
}
}
#undef psz_sdtprov
#undef psz_sdtserv
}
}
if( p_sys->i_mpeg4_streams > 0 )
GetPMTmpeg4(p_mux);
for (int i_stream = 0; i_stream < p_mux->i_nb_inputs; i_stream++ ) for (int i_stream = 0; i_stream < p_mux->i_nb_inputs; i_stream++ )
{ {
ts_stream_t *p_stream = (ts_stream_t*)p_mux->pp_inputs[i_stream]->p_sys; ts_stream_t *p_stream = (ts_stream_t*)p_mux->pp_inputs[i_stream]->p_sys;
......
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