[vlc-commits] codec: zvbi: remove key handling

Thomas Guillem git at videolan.org
Thu Oct 18 13:12:43 CEST 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct 16 16:30:26 2018 +0200| [53e3450aed08cf2dee0c4293bb1e29bca5c4d500] | committer: Thomas Guillem

codec: zvbi: remove key handling

This code need to be handled by the control interface with the new vlc_player
API.

Now, zvbi can only be controlled from outside. This is needed by the next
commit.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=53e3450aed08cf2dee0c4293bb1e29bca5c4d500
---

 modules/codec/zvbi.c | 63 ----------------------------------------------------
 1 file changed, 63 deletions(-)

diff --git a/modules/codec/zvbi.c b/modules/codec/zvbi.c
index 1eb56f6e3e..a81d668a0f 100644
--- a/modules/codec/zvbi.c
+++ b/modules/codec/zvbi.c
@@ -191,8 +191,6 @@ static int RequestPage( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data );
 static int Opaque( vlc_object_t *p_this, char const *psz_cmd,
                    vlc_value_t oldval, vlc_value_t newval, void *p_data );
-static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
-                     vlc_value_t oldval, vlc_value_t newval, void *p_data );
 
 /*****************************************************************************
  * Open: probe the decoder and return score
@@ -273,9 +271,6 @@ static int Open( vlc_object_t *p_this )
 
     p_sys->i_level = var_CreateGetInteger( p_dec, "vbi-level" );
 
-    /* Listen for keys */
-    var_AddCallback( p_dec->obj.libvlc, "key-pressed", EventKey, p_dec );
-
     p_dec->fmt_out.i_codec = p_sys->b_text ? VLC_CODEC_TEXT : VLC_CODEC_RGBA;
 
     p_dec->pf_decode = Decode;
@@ -292,7 +287,6 @@ static void Close( vlc_object_t *p_this )
 
     var_DelCallback( p_dec, "vbi-opaque", Opaque, p_sys );
     var_DelCallback( p_dec, "vbi-page", RequestPage, p_sys );
-    var_DelCallback( p_dec->obj.libvlc, "key-pressed", EventKey, p_dec );
 
     vlc_mutex_destroy( &p_sys->lock );
 
@@ -742,60 +736,3 @@ static int Opaque( vlc_object_t *p_this, char const *psz_cmd,
 
     return VLC_SUCCESS;
 }
-
-static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
-                        vlc_value_t oldval, vlc_value_t newval, void *p_data )
-{
-    decoder_t *p_dec = p_data;
-    decoder_sys_t *p_sys = p_dec->p_sys;
-
-    VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED( p_this );
-
-    /* FIXME: Capture + and - key for subpage browsing */
-    if( newval.i_int == '-' || newval.i_int == '+' )
-    {
-        vlc_mutex_lock( &p_sys->lock );
-        if( p_sys->i_wanted_subpage == VBI_ANY_SUBNO && newval.i_int == '+' )
-            p_sys->i_wanted_subpage = vbi_dec2bcd(1);
-        else if ( newval.i_int == '+' )
-            p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 1);
-        else if( newval.i_int == '-')
-            p_sys->i_wanted_subpage = vbi_add_bcd( p_sys->i_wanted_subpage, 0xF9999999); /* BCD complement - 1 */
-
-        if ( !vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x00 ) || vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x99 ) )
-                p_sys->i_wanted_subpage = VBI_ANY_SUBNO;
-        else
-            msg_Info( p_dec, "subpage: %d",
-                      vbi_bcd2dec( p_sys->i_wanted_subpage) );
-
-        p_sys->b_update = true;
-        vlc_mutex_unlock( &p_sys->lock );
-    }
-
-    /* Capture 0-9 for page selection */
-    if( newval.i_int < '0' || newval.i_int > '9' )
-        return VLC_SUCCESS;
-
-    vlc_mutex_lock( &p_sys->lock );
-    p_sys->i_key[0] = p_sys->i_key[1];
-    p_sys->i_key[1] = p_sys->i_key[2];
-    p_sys->i_key[2] = (int)(newval.i_int - '0');
-    msg_Info( p_dec, "page: %c%c%c", (char)(p_sys->i_key[0]+'0'),
-              (char)(p_sys->i_key[1]+'0'), (char)(p_sys->i_key[2]+'0') );
-
-    int i_new_page = 0;
-
-    if( p_sys->i_key[0] > 0 && p_sys->i_key[0] <= 8 &&
-        p_sys->i_key[1] >= 0 && p_sys->i_key[1] <= 9 &&
-        p_sys->i_key[2] >= 0 && p_sys->i_key[2] <= 9 )
-    {
-        i_new_page = p_sys->i_key[0]*100 + p_sys->i_key[1]*10 + p_sys->i_key[2];
-        p_sys->i_key[0] = p_sys->i_key[1] = p_sys->i_key[2] = '*' - '0';
-    }
-    vlc_mutex_unlock( &p_sys->lock );
-
-    if( i_new_page > 0 )
-        var_SetInteger( p_dec, "vbi-page", i_new_page );
-
-    return VLC_SUCCESS;
-}



More information about the vlc-commits mailing list