]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/commands/cmd_vars.cpp
skins2: fix memory leak (a malloc not paired with a free)
[vlc] / modules / gui / skins2 / commands / cmd_vars.cpp
index 3aa169a52e43f378b070114a43498575082c639e..b14c402d745337175424712b79f5a70c86bb4d4d 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * cmd_vars.cpp
  *****************************************************************************
- * Copyright (C) 2004 VideoLAN
+ * Copyright (C) 2004 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include "cmd_vars.hpp"
 #include "../src/vlcproc.hpp"
-#include "../vars/stream.hpp"
-#include "../vars/playlist.hpp"
+#include "../utils/var_text.hpp"
+#include "../vars/equalizer.hpp"
+#include "../vars/playtree.hpp"
 
 
-void CmdNotifyPlaylist::execute()
+void CmdPlaytreeChanged::execute()
 {
-    // Notify the playlist variable
-    Playlist &rVar = VlcProc::instance( getIntf() )->getPlaylistVar();
-    rVar.onChange();
+    VlcProc::instance( getIntf() )->getPlaytreeVar().onChange();
 }
 
+void CmdPlaytreeUpdate::execute()
+{
+    if( !m_pItem )
+        return;
+
+    playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
+    playlist_Lock( pPlaylist );
+    playlist_item_t* p_plItem = playlist_ItemGetByInput( pPlaylist, m_pItem );
+    int id = p_plItem ? p_plItem->i_id : 0;
+    playlist_Unlock( pPlaylist );
+
+    if( id )
+        VlcProc::instance( getIntf() )->getPlaytreeVar().onUpdateItem( id );
+}
+
+bool CmdPlaytreeUpdate::checkRemove( CmdGeneric *pQueuedCommand ) const
+{
+    // We don't use RTTI - Use C-style cast
+    CmdPlaytreeUpdate *pUpdateCommand = (CmdPlaytreeUpdate *)(pQueuedCommand);
+    return m_pItem == pUpdateCommand->m_pItem;
+}
+
+
+void CmdPlaytreeAppend::execute()
+{
+    VlcProc::instance( getIntf() )->getPlaytreeVar().onAppend( m_pAdd );
+}
 
-void CmdSetStream::execute()
+void CmdPlaytreeDelete::execute()
 {
-    // Change the stream variable
-    m_rStream.set( m_name, m_updateVLC );
+    VlcProc::instance( getIntf() )->getPlaytreeVar().onDelete( m_id );
 }
 
+void CmdSetText::execute()
+{
+    m_rText.set( m_value );
+}
+
+
+void CmdSetEqBands::execute()
+{
+    m_rEqBands.set( m_value );
+}
+
+
+void CmdSetEqPreamp::execute()
+{
+    m_rPreamp.set( m_value, false );
+}