Browse Source

decoder: use the internal CC codec

It must be the same as the one given in arguments.
pull/162/head
Thomas Guillem 3 years ago
committed by Steve Lhomme
parent
commit
419e2b0897
  1. 18
      src/input/decoder.c
  2. 4
      src/input/decoder.h
  3. 8
      src/input/es_out.c

18
src/input/decoder.c

@ -2255,7 +2255,7 @@ void vlc_input_decoder_Delete( vlc_input_decoder_t *p_owner )
if( p_owner->cc.b_supported )
{
for( int i = 0; i < MAX_CC_DECODERS; i++ )
vlc_input_decoder_SetCcState( p_owner, VLC_CODEC_CEA608, i, false );
vlc_input_decoder_SetCcState( p_owner, i, false );
}
/* Delete decoder */
@ -2445,16 +2445,16 @@ void vlc_input_decoder_Flush( vlc_input_decoder_t *p_owner )
}
static bool vlc_input_decoder_HasCCChanFlag( vlc_input_decoder_t *p_owner,
vlc_fourcc_t codec, int i_channel )
int i_channel )
{
int i_max_channels;
uint64_t i_bitmap;
if( codec == VLC_CODEC_CEA608 )
if( p_owner->cc.selected_codec == VLC_CODEC_CEA608 )
{
i_max_channels = 4;
i_bitmap = p_owner->cc.desc.i_608_channels;
}
else if( codec == VLC_CODEC_CEA708 )
else if( p_owner->cc.selected_codec == VLC_CODEC_CEA708 )
{
i_max_channels = 64;
i_bitmap = p_owner->cc.desc.i_708_channels;
@ -2465,13 +2465,13 @@ static bool vlc_input_decoder_HasCCChanFlag( vlc_input_decoder_t *p_owner,
( i_bitmap & ((uint64_t)1 << i_channel) ) );
}
int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t codec,
int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner,
int i_channel, bool b_decode )
{
decoder_t *p_dec = &p_owner->dec;
vlc_mutex_lock(&p_owner->cc.lock);
if( !vlc_input_decoder_HasCCChanFlag( p_owner, codec, i_channel ) )
if( !vlc_input_decoder_HasCCChanFlag( p_owner, i_channel ) )
{
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_EGENERIC;
@ -2482,7 +2482,7 @@ int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t cod
vlc_input_decoder_t *p_ccowner;
es_format_t fmt;
es_format_Init( &fmt, SPU_ES, codec );
es_format_Init( &fmt, SPU_ES, p_owner->cc.selected_codec );
fmt.subs.cc.i_channel = i_channel;
fmt.subs.cc.i_reorder_depth = p_owner->cc.desc.i_reorder_depth;
@ -2525,11 +2525,11 @@ int vlc_input_decoder_SetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t cod
return VLC_SUCCESS;
}
int vlc_input_decoder_GetCcState( vlc_input_decoder_t *p_owner, vlc_fourcc_t codec,
int vlc_input_decoder_GetCcState( vlc_input_decoder_t *p_owner,
int i_channel, bool *pb_decode )
{
vlc_mutex_lock(&p_owner->cc.lock);
if( !vlc_input_decoder_HasCCChanFlag( p_owner, codec, i_channel ) )
if( !vlc_input_decoder_HasCCChanFlag( p_owner, i_channel ) )
{
vlc_mutex_unlock(&p_owner->cc.lock);
return VLC_EGENERIC;

4
src/input/decoder.h

@ -106,13 +106,13 @@ bool vlc_input_decoder_IsEmpty( vlc_input_decoder_t * );
/**
* This function activates the request closed caption channel.
*/
int vlc_input_decoder_SetCcState( vlc_input_decoder_t *, vlc_fourcc_t, int i_channel, bool b_decode );
int vlc_input_decoder_SetCcState( vlc_input_decoder_t *, int i_channel, bool b_decode );
/**
* This function returns an error if the requested channel does not exist and
* set pb_decode to the channel status(active or not) otherwise.
*/
int vlc_input_decoder_GetCcState( vlc_input_decoder_t *, vlc_fourcc_t, int i_channel, bool *pb_decode );
int vlc_input_decoder_GetCcState( vlc_input_decoder_t *, int i_channel, bool *pb_decode );
/**
* This function forces the display of the next picture

8
src/input/es_out.c

@ -2201,8 +2201,7 @@ static bool EsIsSelected( es_out_id_t *es )
if( es->p_master->p_dec )
{
int i_channel = EsOutGetClosedCaptionsChannel( &es->fmt );
vlc_input_decoder_GetCcState( es->p_master->p_dec, es->fmt.i_codec,
i_channel, &b_decode );
vlc_input_decoder_GetCcState( es->p_master->p_dec, i_channel, &b_decode );
}
return b_decode;
}
@ -2383,8 +2382,7 @@ static void EsOutSelectEs( es_out_t *out, es_out_id_t *es, bool b_force )
i_channel = EsOutGetClosedCaptionsChannel( &es->fmt );
if( i_channel == -1 ||
vlc_input_decoder_SetCcState( es->p_master->p_dec, es->fmt.i_codec,
i_channel, true ) )
vlc_input_decoder_SetCcState( es->p_master->p_dec, i_channel, true ) )
return;
}
else
@ -2508,7 +2506,7 @@ static void EsOutUnselectEs( es_out_t *out, es_out_id_t *es, bool b_update )
{
int i_channel = EsOutGetClosedCaptionsChannel( &es->fmt );
if( i_channel != -1 )
vlc_input_decoder_SetCcState( es->p_master->p_dec, es->fmt.i_codec,
vlc_input_decoder_SetCcState( es->p_master->p_dec,
i_channel, false );
}
}

Loading…
Cancel
Save