]> git.sesse.net Git - vlc/blobdiff - modules/control/hotkeys.c
Use var_InheritString for --decklink-video-connection.
[vlc] / modules / control / hotkeys.c
index cbf1965b0d2312a9db0d617a183c55366195b66c..810fffa31181f85083745fecf23e7869a6d8cc16 100644 (file)
@@ -170,7 +170,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
      * Alternatively, we should keep a reference to the vout thread. */
     if( p_vout && p_vout != p_sys->p_last_vout )
         for( unsigned i = 0; i < CHANNELS_NUMBER; i++ )
-            p_intf->p_sys->p_channels[i] = spu_RegisterChannel( vout_GetSpu( p_vout ) );
+            p_intf->p_sys->p_channels[i] = vout_RegisterSubpictureChannel( p_vout );
     p_sys->p_last_vout = p_vout;
 
     /* Quit */
@@ -783,21 +783,15 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                                 _( "Subtitle delay %i ms" ),
                                  (int)(i_delay/1000) );
             }
-            else if( i_action == ACTIONID_SUBPOS_DOWN )
+            else if( ( i_action == ACTIONID_SUBPOS_DOWN ||
+                       i_action == ACTIONID_SUBPOS_UP ) && p_vout )
             {
-                int i_pos = var_GetInteger( p_input, "sub-margin" );
-                --i_pos;
-                var_SetInteger( p_input, "sub-margin", i_pos );
-                ClearChannels( p_intf, p_vout );
-                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
-                                _( "Subtitle position %i px" ),
-                                 (int)(i_pos) );
-            }
-            else if( i_action == ACTIONID_SUBPOS_UP )
-            {
-                int i_pos = var_GetInteger( p_input, "sub-margin" );
-                ++i_pos;
-                var_SetInteger( p_input, "sub-margin", i_pos );
+                int i_pos;
+                if( i_action == ACTIONID_SUBPOS_DOWN )
+                    i_pos = var_DecInteger( p_vout, "sub-margin" );
+                else
+                    i_pos = var_IncInteger( p_vout, "sub-margin" );
+
                 ClearChannels( p_intf, p_vout );
                 DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Subtitle position %i px" ),
@@ -969,22 +963,27 @@ static void PlayBookmark( intf_thread_t *p_intf, int i_num )
 static void SetBookmark( intf_thread_t *p_intf, int i_num )
 {
     char *psz_bookmark_name;
+    char *psz_uri = NULL;
     if( asprintf( &psz_bookmark_name, "bookmark%i", i_num ) == -1 )
         return;
 
     playlist_t *p_playlist = pl_Get( p_intf );
     var_Create( p_intf, psz_bookmark_name,
                 VLC_VAR_STRING|VLC_VAR_DOINHERIT );
+
+    PL_LOCK;
     playlist_item_t * p_item = playlist_CurrentPlayingItem( p_playlist );
+    if( p_item ) psz_uri = input_item_GetURI( p_item->p_input );
+    PL_UNLOCK;
+
     if( p_item )
     {
-        char *psz_uri = input_item_GetURI( p_item->p_input );
         config_PutPsz( p_intf, psz_bookmark_name, psz_uri);
         msg_Info( p_intf, "setting playlist bookmark %i to %s", i_num, psz_uri);
-        free( psz_uri );
         config_SaveConfigFile( p_intf, "hotkeys" );
     }
 
+    free( psz_uri );
     free( psz_bookmark_name );
 }
 
@@ -1073,9 +1072,8 @@ static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
 {
     if( p_vout )
     {
-        spu_t *p_spu = vout_GetSpu( p_vout );
-        spu_ClearChannel( p_spu, SPU_DEFAULT_CHANNEL );
+        vout_FlushSubpictureChannel( p_vout, SPU_DEFAULT_CHANNEL );
         for( int i = 0; i < CHANNELS_NUMBER; i++ )
-            spu_ClearChannel( p_spu, p_intf->p_sys->p_channels[i]  );
+            vout_FlushSubpictureChannel( p_vout, p_intf->p_sys->p_channels[i]  );
     }
 }