]> git.sesse.net Git - vlc/blobdiff - modules/gui/beos/VlcWrapper.cpp
* ALL: more intensive use of the VLCWrapper class
[vlc] / modules / gui / beos / VlcWrapper.cpp
index 927e5ad638312d6f5157b2353a0927adab8c4a92..10db5197ae40e7ea1c113066a96f76c319baf087 100644 (file)
@@ -2,7 +2,7 @@
  * intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.10 2002/10/30 06:12:27 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.11 2002/11/26 01:06:08 titer Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
 
 #include "VlcWrapper.h"
 
+/* constructor */
 Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_interface)
 {
     p_intf = p_interface;
+    p_input = NULL;
+    p_aout = NULL;
+    p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
+                                                FIND_ANYWHERE );
 }
 
+/* destructor */
 Intf_VLCWrapper::~Intf_VLCWrapper()
 {
+    if( p_input )
+    {
+        vlc_object_release( p_input );
+    }
+    if( p_playlist )
+    {
+        vlc_object_release( p_playlist );
+    }
+    if( p_aout )
+    {
+        vlc_object_release( p_aout );
+    }
 }
-    
+
+/* UpdateInputAndAOut: updates p_input and p_aout, returns true if the
+   interface needs to be updated */
+bool Intf_VLCWrapper::UpdateInputAndAOut()
+{
+    if( p_input == NULL )
+    {
+        p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
+                                                     FIND_ANYWHERE );
+    }
+    if( p_aout == NULL )
+    {
+        p_aout = (aout_instance_t*)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
+                                                    FIND_ANYWHERE );
+    }
+        
+    if( p_input != NULL )
+    {
+        if( p_input->b_dead )
+        {
+            vlc_object_release( p_input );
+            p_input = NULL;
+            
+            if( p_aout )
+            {
+                vlc_object_release( p_aout );
+                p_aout = NULL;
+            }
+        }
+        return true;
+    }
+    return false;
+}
+
+int Intf_VLCWrapper::InputStatus()
+{
+    return p_input->stream.control.i_status;
+}
+
+int Intf_VLCWrapper::InputRate()
+{
+    return p_input->stream.control.i_rate;
+}
+
+int Intf_VLCWrapper::InputTell()
+{
+    return p_input->stream.p_selected_area->i_tell;
+}
+
+int Intf_VLCWrapper::InputSize()
+{
+    return p_input->stream.p_selected_area->i_size;
+}
+
+int Intf_VLCWrapper::PlaylistSize()
+{
+    return p_playlist->i_size;
+}
+
+char *Intf_VLCWrapper::PlaylistItemName( int i )
+{
+   return p_playlist->pp_items[i]->psz_name;
+}
+
+int Intf_VLCWrapper::PlaylistCurrent()
+{
+    return p_playlist->i_index;
+}
+
+bool Intf_VLCWrapper::HasTitles()
+{
+    return ( p_input->stream.i_area_nb > 1 );
+}
+
+void Intf_VLCWrapper::PrevTitle()
+{
+    int i_id;
+    i_id = p_input->stream.p_selected_area->i_id - 1;
+    if( i_id > 0 )
+    {
+        toggleTitle(i_id);
+    }
+}
+
+void Intf_VLCWrapper::NextTitle()
+{
+    int i_id;
+    i_id = p_input->stream.p_selected_area->i_id + 1;
+    if( i_id < p_input->stream.i_area_nb )
+    {
+        toggleTitle(i_id);
+    }
+}
+
+bool Intf_VLCWrapper::HasChapters()
+{
+    return ( p_input->stream.p_selected_area->i_part_nb > 1 );
+}
+
+void Intf_VLCWrapper::PrevChapter()
+{
+    int i_id;
+    i_id = p_input->stream.p_selected_area->i_part - 1;
+    if( i_id >= 0 )
+    {
+        toggleChapter(i_id);
+    }
+}
+
+void Intf_VLCWrapper::NextChapter()
+{
+    int i_id;
+    i_id = p_input->stream.p_selected_area->i_part + 1;
+    if( i_id >= 0 )
+    {
+        toggleChapter(i_id);
+    }
+}
+
 /* playlist control */
 bool Intf_VLCWrapper::playlistPlay()
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     vlc_mutex_lock( &p_playlist->object_lock );
     if( p_playlist->i_size )
     {
@@ -58,51 +192,41 @@ bool Intf_VLCWrapper::playlistPlay()
     {
         vlc_mutex_unlock( &p_playlist->object_lock );
     }
-
     return( true );
 }
 
 void Intf_VLCWrapper::playlistPause()
 {
     toggle_mute();
-    if( p_intf->p_sys->p_input )
+    if( p_input )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
+        input_SetStatus( p_input, INPUT_STATUS_PAUSE );
     }
 }
 
 void Intf_VLCWrapper::playlistStop()
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
+    volume_mute();
     playlist_Stop( p_playlist );
 }
 
 void Intf_VLCWrapper::playlistNext()
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     playlist_Next( p_playlist );
 }
 
 void Intf_VLCWrapper::playlistPrev()
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     playlist_Prev( p_playlist );
 }
 
 void Intf_VLCWrapper::playlistSkip(int i)
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     playlist_Skip( p_playlist, i );
 }
 
 void Intf_VLCWrapper::playlistGoto(int i)
 {
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     playlist_Goto( p_playlist, i );
 }
 
@@ -132,7 +256,7 @@ void Intf_VLCWrapper::playlistJumpTo( int pos )
 int Intf_VLCWrapper::playlistCurrentPos()
 {
        playlistLock();
-       int pos = p_intf->p_sys->p_playlist->i_index;
+       int pos = p_playlist->i_index;
        playlistUnlock();
        return pos;
 }
@@ -140,19 +264,19 @@ int Intf_VLCWrapper::playlistCurrentPos()
 int Intf_VLCWrapper::playlistSize()
 {
        playlistLock();
-       int size = p_intf->p_sys->p_playlist->i_size;
+       int size = p_playlist->i_size;
        playlistUnlock();
        return size;
 }
 
 void Intf_VLCWrapper::playlistLock()
 {
-       vlc_mutex_lock( &p_intf->p_sys->p_playlist->object_lock );
+       vlc_mutex_lock( &p_playlist->object_lock );
 }
 
 void Intf_VLCWrapper::playlistUnlock()
 {
-       vlc_mutex_unlock( &p_intf->p_sys->p_playlist->object_lock );
+       vlc_mutex_unlock( &p_playlist->object_lock );
 }
 
 void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
@@ -165,35 +289,34 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
                *canSkipNext = false;
                // get playlist info
                playlistLock();
-               int pos = p_intf->p_sys->p_playlist->i_index;
-               int size = p_intf->p_sys->p_playlist->i_size;
+               int pos = p_playlist->i_index;
+               int size = p_playlist->i_size;
                playlistUnlock();
 
-               /* input_thread_t* input = p_input_bank->pp_input[0]; */
-               input_thread_t* input = p_intf->p_sys->p_input;
                // see if we have got a stream going            
-               if ( input )
+               if ( p_input )
                {
-                       vlc_mutex_lock( &input->stream.stream_lock );
+                       vlc_mutex_lock( &p_input->stream.stream_lock );
 
-                       bool hasTitles = input->stream.i_area_nb > 1;
-                       int numChapters = input->stream.p_selected_area->i_part_nb;
+                       bool hasTitles = p_input->stream.i_area_nb > 1;
+                       int numChapters = p_input->stream.p_selected_area->i_part_nb;
                        bool hasChapters = numChapters > 1;
                        // first, look for chapters
                        if ( hasChapters )
                        {
-                               *canSkipPrev = input->stream.p_selected_area->i_part > 0;
-                               *canSkipNext = input->stream.p_selected_area->i_part <
-                                                                        input->stream.p_selected_area->i_part_nb - 1;
+                               *canSkipPrev = p_input->stream.p_selected_area->i_part > 0;
+                               *canSkipNext = p_input->stream.p_selected_area->i_part <
+                                                                        p_input->stream.p_selected_area->i_part_nb - 1;
                        }
                        // if one of the skip capabilities is false,
                        // make it depend on titles instead
                        if ( !*canSkipPrev && hasTitles )
-                               *canSkipPrev = input->stream.p_selected_area->i_id > 1;
+                               *canSkipPrev = p_input->stream.p_selected_area->i_id > 1;
                        if ( !*canSkipNext && hasTitles )
-                               *canSkipNext = input->stream.p_selected_area->i_id < input->stream.i_area_nb - 1;
+                               *canSkipNext = p_input->stream.p_selected_area->i_id <
+                                                  p_input->stream.i_area_nb - 1;
 
-                       vlc_mutex_unlock( &input->stream.stream_lock );
+                       vlc_mutex_unlock( &p_input->stream.stream_lock );
                }
                // last but not least, make capabilities depend on playlist
                if ( !*canSkipPrev )
@@ -349,12 +472,11 @@ void Intf_VLCWrapper::loop()
 {
     if ( p_intf->p_sys->b_loop )
     {
-        playlist_Delete( p_intf->p_sys->p_playlist,
-                         p_intf->p_sys->p_playlist->i_size - 1 );
+        playlist_Delete( p_playlist, p_playlist->i_size - 1 );
     }
     else
     {
-        playlist_Add( p_intf->p_sys->p_playlist, "vlc:loop",
+        playlist_Add( p_playlist, "vlc:loop",
                       PLAYLIST_APPEND | PLAYLIST_GO,
                       PLAYLIST_END );
     }
@@ -365,11 +487,11 @@ void Intf_VLCWrapper::loop()
     /* playback control */
 void Intf_VLCWrapper::playSlower()
 {
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
+        input_SetStatus( p_input, INPUT_STATUS_SLOWER );
     }
-    if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
+    ifp_input->stream.control.i_rate == DEFAULT_RATE)
     {
         toggle_mute(  );
     }
@@ -381,11 +503,11 @@ void Intf_VLCWrapper::playSlower()
 
 void Intf_VLCWrapper::playFaster()
 {
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
+        input_SetStatus( p_input, INPUT_STATUS_FASTER );
     }
-    if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
+    ifp_input->stream.control.i_rate == DEFAULT_RATE)
     {
         toggle_mute(  );
     }
@@ -397,12 +519,12 @@ void Intf_VLCWrapper::playFaster()
 
 void Intf_VLCWrapper::volume_mute()
 {
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
     {
            if( !p_intf->p_sys->b_mute )
                {
-                   p_intf->p_sys->i_saved_volume = p_intf->p_sys->p_aout->output.i_volume;
-                   p_intf->p_sys->p_aout->output.i_volume = 0;
+                   p_intf->p_sys->i_saved_volume = p_aout->output.i_volume;
+                   p_aout->output.i_volume = 0;
                    p_intf->p_sys->b_mute = 1;
                }
     }
@@ -411,9 +533,9 @@ void Intf_VLCWrapper::volume_mute()
 
 void Intf_VLCWrapper::volume_restore()
 {
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
     {
-           p_intf->p_sys->p_aout->output.i_volume = p_intf->p_sys->i_saved_volume;
+           p_aout->output.i_volume = p_intf->p_sys->i_saved_volume;
                p_intf->p_sys->i_saved_volume = 0;
            p_intf->p_sys->b_mute = 0;
     }
@@ -422,27 +544,27 @@ void Intf_VLCWrapper::volume_restore()
 
 void Intf_VLCWrapper::set_volume(int value)
 {
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
     {
                // make sure value is within bounds
                if (value < 0)
                        value = 0;
                if (value > AOUT_VOLUME_MAX)
                        value = AOUT_VOLUME_MAX;
-               vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock );
+               vlc_mutex_lock( &p_aout->mixer_lock );
                // unmute volume if muted
                if ( p_intf->p_sys->b_mute )
                {
                        p_intf->p_sys->b_mute = 0;
-            p_intf->p_sys->p_aout->output.i_volume = value;
+            p_aout->output.i_volume = value;
                }
-               vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock );
+               vlc_mutex_unlock( &p_aout->mixer_lock );
     }
 }
 
 void Intf_VLCWrapper::toggle_mute()
 {
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
        {
            if ( p_intf->p_sys->b_mute )
            {
@@ -459,14 +581,14 @@ bool Intf_VLCWrapper::is_muted()
 {
        bool muted = true;
        
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
        {
-               vlc_mutex_lock( &p_intf->p_sys->p_aout->mixer_lock );
-               if( p_intf->p_sys->p_aout->output.i_volume > 0 )
+               vlc_mutex_lock( &p_aout->mixer_lock );
+               if( p_aout->output.i_volume > 0 )
                {
                        muted = false;
                }
-               vlc_mutex_unlock( &p_intf->p_sys->p_aout->mixer_lock );
+               vlc_mutex_unlock( &p_aout->mixer_lock );
 // unfortunately, this is not reliable!
 //             return p_main->p_intf->p_sys->b_mute;
        }
@@ -477,9 +599,9 @@ bool Intf_VLCWrapper::is_playing()
 {
 
        bool playing = false;
-       if ( p_intf->p_sys->p_input )
+       if ( p_input )
        {
-               switch ( p_intf->p_sys->p_input->stream.control.i_status )
+               switch ( p_input->stream.control.i_status )
                {
                        case PLAYING_S:
                        case FORWARD_S:
@@ -500,7 +622,7 @@ bool Intf_VLCWrapper::is_playing()
 
 void Intf_VLCWrapper::maxvolume()
 {
-    if( p_intf->p_sys->p_aout != NULL )
+    if( p_aout != NULL )
     {
            if( p_intf->p_sys->b_mute )
            {
@@ -508,14 +630,14 @@ void Intf_VLCWrapper::maxvolume()
            }
            else
            {
-               p_intf->p_sys->p_aout->output.i_volume = AOUT_VOLUME_MAX;
+               p_aout->output.i_volume = AOUT_VOLUME_MAX;
            }
     }
 }
 
 bool Intf_VLCWrapper::has_audio()
 {
-    return( p_intf->p_sys->p_aout != NULL );
+    return( p_aout != NULL );
 }
 
     /* playback info */
@@ -524,14 +646,14 @@ const char*  Intf_VLCWrapper::getTimeAsString()
 {
     static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
         
-    if( p_intf->p_sys->p_input == NULL )
+    if( p_input == NULL )
     {
         return ("-:--:--");
     }     
    
-    input_OffsetToTime( p_intf->p_sys->p_input, 
+    input_OffsetToTime( p_input, 
                         psz_currenttime, 
-                        p_intf->p_sys->p_input->stream.p_selected_area->i_tell );        
+                        p_input->stream.p_selected_area->i_tell );        
 
     return(psz_currenttime);
 }
@@ -540,10 +662,10 @@ float  Intf_VLCWrapper::getTimeAsFloat()
 {
     float f_time = 0.0;
 
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        f_time = (float)p_intf->p_sys->p_input->stream.p_selected_area->i_tell / 
-                 (float)p_intf->p_sys->p_input->stream.p_selected_area->i_size;
+        f_time = (float)p_input->stream.p_selected_area->i_tell / 
+                 (float)p_input->stream.p_selected_area->i_size;
     }    
     else
     {
@@ -554,10 +676,10 @@ float  Intf_VLCWrapper::getTimeAsFloat()
 
 void   Intf_VLCWrapper::setTimeAsFloat(float f_position)
 {
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        input_Seek( p_intf->p_sys->p_input, 
-                   (long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size
+        input_Seek( p_input, 
+                   (long long int)(p_input->stream.p_selected_area->i_size
                        * f_position / SEEKSLIDER_RANGE ), 
                    INPUT_SEEK_SET);
     }
@@ -571,8 +693,6 @@ void   Intf_VLCWrapper::setTimeAsFloat(float f_position)
 BList  *Intf_VLCWrapper::playlistAsArray()
 { 
     int i;
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
-
     BList* p_list = new BList(p_playlist->i_size);
     
     vlc_mutex_lock( &p_playlist->object_lock );
@@ -592,11 +712,11 @@ Intf_VLCWrapper::getPlaylistInfo( int32& currentIndex, int32& maxIndex )
 {
        currentIndex = -1;
        maxIndex = -1;
-       if ( playlist_t* list = (playlist_t*)p_intf->p_sys->p_playlist )
+       if ( p_playlist )
        {
-               maxIndex = list->i_size;
+               maxIndex = p_playlist->i_size;
                if ( maxIndex > 0 )
-                       currentIndex = list->i_index + 1;
+                       currentIndex = p_playlist->i_index + 1;
                else
                        maxIndex = -1;
        }
@@ -608,17 +728,17 @@ Intf_VLCWrapper::getTitleInfo( int32& currentIndex, int32& maxIndex )
 {
        currentIndex = -1;
        maxIndex = -1;
-       if ( input_thread_t* input = p_intf->p_sys->p_input )
+       if ( p_input )
        {
-               vlc_mutex_lock( &input->stream.stream_lock );
+               vlc_mutex_lock( &p_input->stream.stream_lock );
 
-               maxIndex = input->stream.i_area_nb - 1;
+               maxIndex = p_input->stream.i_area_nb - 1;
                if ( maxIndex > 0)
-                       currentIndex = input->stream.p_selected_area->i_id;
+                       currentIndex = p_input->stream.p_selected_area->i_id;
                else
                        maxIndex = -1;
 
-               vlc_mutex_unlock( &input->stream.stream_lock );
+               vlc_mutex_unlock( &p_input->stream.stream_lock );
        }
 }
 
@@ -628,17 +748,17 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex )
 {
        currentIndex = -1;
        maxIndex = -1;
-       if ( input_thread_t* input = p_intf->p_sys->p_input )
+       if ( p_input )
        {
-               vlc_mutex_lock( &input->stream.stream_lock );
+               vlc_mutex_lock( &p_input->stream.stream_lock );
 
-               maxIndex = input->stream.p_selected_area->i_part_nb - 1;
+               maxIndex = p_input->stream.p_selected_area->i_part_nb - 1;
                if ( maxIndex > 0)
-                       currentIndex = input->stream.p_selected_area->i_part;
+                       currentIndex = p_input->stream.p_selected_area->i_part;
                else
                        maxIndex = -1;
 
-               vlc_mutex_unlock( &input->stream.stream_lock );
+               vlc_mutex_unlock( &p_input->stream.stream_lock );
        }
 }
 
@@ -646,7 +766,6 @@ Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex )
 void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
 {
     BString *o_file;
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
 
     while( ( o_file = (BString *)o_files->LastItem() ) )
     {
@@ -662,7 +781,6 @@ void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, in
     BString o_source("");
     o_source << o_type << ":" << o_device ;
 
-    playlist_t *p_playlist = p_intf->p_sys->p_playlist;
     playlist_Add( p_playlist, o_source.String(),
                   PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
 }
@@ -685,27 +803,27 @@ void Intf_VLCWrapper::toggleProgram(int i_program){}
 
 void Intf_VLCWrapper::toggleTitle(int i_title)
 {
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        input_ChangeArea( p_intf->p_sys->p_input,
-                          p_intf->p_sys->p_input->stream.pp_areas[i_title] );
+        input_ChangeArea( p_input,
+                          p_input->stream.pp_areas[i_title] );
 
-        vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
+        vlc_mutex_lock( &p_input->stream.stream_lock );
 
-        vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
 }
 
 void Intf_VLCWrapper::toggleChapter(int i_chapter)
 {
-    if( p_intf->p_sys->p_input != NULL )
+    if( p_input != NULL )
     {
-        p_intf->p_sys->p_input->stream.p_selected_area->i_part = i_chapter;
-        input_ChangeArea( p_intf->p_sys->p_input,
-                          p_intf->p_sys->p_input->stream.p_selected_area );
+        p_input->stream.p_selected_area->i_part = i_chapter;
+        input_ChangeArea( p_input,
+                          p_input->stream.p_selected_area );
 
-        vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
-        vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+        vlc_mutex_lock( &p_input->stream.stream_lock );
+        vlc_mutex_unlock( &p_input->stream.stream_lock );
     }
 }
 
@@ -715,29 +833,29 @@ void Intf_VLCWrapper::toggleLanguage(int i_language)
     int32 i_old = -1;
     int i_cat = AUDIO_ES;
 
-    vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
-    for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
     {
-        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
+        if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
         {
             i_old = i;
             break;
         }
     }
-    vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
 
     msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_language);
     if( i_language != -1 )
     {
-        input_ToggleES( p_intf->p_sys->p_input, 
-                        p_intf->p_sys->p_input->stream.pp_selected_es[i_language],
+        input_ToggleES( p_input, 
+                        p_input->stream.pp_selected_es[i_language],
                         VLC_TRUE );
     }
 
     if( (i_old != -1) && (i_old != i_language) )
     {
-        input_ToggleES( p_intf->p_sys->p_input, 
-                        p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
+        input_ToggleES( p_input, 
+                        p_input->stream.pp_selected_es[i_old],
                         VLC_FALSE );
     }
 }
@@ -747,34 +865,34 @@ void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
     int32 i_old = -1;
     int i_cat = SPU_ES;
 
-    vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
-    for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
+    vlc_mutex_lock( &p_input->stream.stream_lock );
+    for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
     {
-        if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
+        if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
         {
             i_old = i;
             break;
         }
     }
-    vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
+    vlc_mutex_unlock( &p_input->stream.stream_lock );
     
     msg_Info( p_intf, "Old: %d,  New: %d", i_old, i_subtitle);
     if( i_subtitle != -1 )
     {
-        input_ToggleES( p_intf->p_sys->p_input, 
-                        p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle],
+        input_ToggleES( p_input, 
+                        p_input->stream.pp_selected_es[i_subtitle],
                         VLC_TRUE );
     }
 
     if( (i_old != -1) && (i_old != i_subtitle) )
     {
-        input_ToggleES( p_intf->p_sys->p_input, 
-                        p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
+        input_ToggleES( p_input, 
+                        p_input->stream.pp_selected_es[i_old],
                         VLC_FALSE );
     }
 }
 
 int  Intf_VLCWrapper::inputGetStatus()
 {
-    return p_intf->p_sys->p_playlist->i_status;
+    return p_playlist->i_status;
 }