Commit 072f409f authored by Julian Scheel's avatar Julian Scheel Committed by Jean-Baptiste Kempf

codec/zvbi: Do not follow dead color-links

If a color-key is requested check the stored nav-link to be in the valid page
range before following it. This avoids unexpected disappearance of the
teletext overlay if a color-link does not exist or is not yet loaded.
Signed-off-by: default avatarJulian Scheel <julian@jusst.de>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 47012982
......@@ -661,32 +661,37 @@ static int RequestPage( vlc_object_t *p_this, char const *psz_cmd,
{
decoder_sys_t *p_sys = p_data;
VLC_UNUSED(p_this); VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
int want_navlink = -1;
vlc_mutex_lock( &p_sys->lock );
switch( newval.i_int )
{
case ZVBI_KEY_RED:
p_sys->i_wanted_page = vbi_bcd2dec( p_sys->nav_link[0].pgno );
p_sys->i_wanted_subpage = p_sys->nav_link[0].subno;
want_navlink = 0;
break;
case ZVBI_KEY_GREEN:
p_sys->i_wanted_page = vbi_bcd2dec( p_sys->nav_link[1].pgno );
p_sys->i_wanted_subpage = p_sys->nav_link[1].subno;
want_navlink = 1;
break;
case ZVBI_KEY_YELLOW:
p_sys->i_wanted_page = vbi_bcd2dec( p_sys->nav_link[2].pgno );
p_sys->i_wanted_subpage = p_sys->nav_link[2].subno;
want_navlink = 2;
break;
case ZVBI_KEY_BLUE:
p_sys->i_wanted_page = vbi_bcd2dec( p_sys->nav_link[3].pgno );
p_sys->i_wanted_subpage = p_sys->nav_link[3].subno;
want_navlink = 3;
break;
case ZVBI_KEY_INDEX:
p_sys->i_wanted_page = vbi_bcd2dec( p_sys->nav_link[5].pgno ); /* #4 is SKIPPED */
p_sys->i_wanted_subpage = p_sys->nav_link[5].subno;
want_navlink = 5; /* #4 is SKIPPED */
break;
}
if( newval.i_int > 0 && newval.i_int < 999 )
if (want_navlink > -1)
{
int page = vbi_bcd2dec( p_sys->nav_link[want_navlink].pgno );
if (page > 0 && page < 999) {
p_sys->i_wanted_page = page;
p_sys->i_wanted_subpage = p_sys->nav_link[want_navlink].subno;
}
}
else if( newval.i_int > 0 && newval.i_int < 999 )
{
p_sys->i_wanted_page = newval.i_int;
p_sys->i_wanted_subpage = VBI_ANY_SUBNO;
......
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