Commit ed42e1e2 authored by Rafaël Carré's avatar Rafaël Carré

TS Mux: generate lang array directly in the needed format

parent ca66eeb3
...@@ -1019,8 +1019,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -1019,8 +1019,8 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_stream->i_langs = 1+p_input->p_fmt->i_extra_languages; p_stream->i_langs = 1 + p_input->p_fmt->i_extra_languages;
p_stream->lang = calloc(1, p_stream->i_langs*3); p_stream->lang = calloc(1, p_stream->i_langs * 4);
if( !p_stream->lang ) if( !p_stream->lang )
{ {
free( p_stream ); free( p_stream );
...@@ -1041,8 +1041,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input ) ...@@ -1041,8 +1041,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
const char *code = GetIso639_2LangCode(lang); const char *code = GetIso639_2LangCode(lang);
if (*code) if (*code)
{ {
memcpy(&p_stream->lang[i*3], code, 3); memcpy(&p_stream->lang[i*4], code, 3);
msg_Dbg( p_mux, " - lang=%3.3s", &p_stream->lang[i*3] ); p_stream->lang[i*4+3] = 0x00; /* audio type: 0x00 undefined */
msg_Dbg( p_mux, " - lang=%3.3s", &p_stream->lang[i*4] );
} }
} }
...@@ -2397,20 +2398,10 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c ) ...@@ -2397,20 +2398,10 @@ static void GetPMT( sout_mux_t *p_mux, sout_buffer_chain_t *c )
continue; continue;
} }
if( p_stream->lang[0] != 0 ) if( p_stream->i_langs )
{ {
uint8_t data[4*p_stream->i_langs]; dvbpsi_PMTESAddDescriptor( p_es, 0x0a, 4*p_stream->i_langs,
p_stream->lang);
/* I construct the content myself, way faster than looking at
* over complicated/mind broken libdvbpsi way */
for (int i = 0; i < p_stream->i_langs; i++ )
{
data[i*4+0] = p_stream->lang[i*3+0];
data[i*4+1] = p_stream->lang[i*3+1];
data[i*4+2] = p_stream->lang[i*3+2];
data[i*4+3] = 0x00; /* audio type: 0x00 undefined */
}
dvbpsi_PMTESAddDescriptor( p_es, 0x0a, 4*p_stream->i_langs, data );
} }
} }
......
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