]> git.sesse.net Git - vlc/blobdiff - src/input/control.c
Small stats improvements
[vlc] / src / input / control.c
index 9ae07321e8d51d52295af4b6ac89cc6a01690266..af74a16dc6e67d646e19b84de9578be3e07807bf 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * control.c
  *****************************************************************************
- * Copyright (C) 1999-2004 VideoLAN
+ * Copyright (C) 1999-2004 the VideoLAN team
  * $Id$
  *
  * Authors: Gildas Bazin <gbazin@videolan.org>
@@ -18,7 +18,7 @@
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 #include <stdlib.h>
@@ -197,13 +197,58 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
         }
         return VLC_SUCCESS;
 
+        case INPUT_DEL_INFO:
+        {
+            char *psz_cat = (char *)va_arg( args, char * );
+            char *psz_name = (char *)va_arg( args, char * );
+
+            info_category_t *p_cat = NULL;
+            int i;
+
+            vlc_mutex_lock( &p_input->input.p_item->lock );
+            for( i = 0; i < p_input->input.p_item->i_categories; i++ )
+            {
+                if( !strcmp( p_input->input.p_item->pp_categories[i]->psz_name,
+                             psz_cat ) )
+                {
+                    p_cat = p_input->input.p_item->pp_categories[i];
+                    break;
+                }
+            }
+            if( p_cat == NULL )
+            {
+                vlc_mutex_unlock( &p_input->input.p_item->lock );
+                return VLC_EGENERIC;
+            }
+
+            for( i = 0; i < p_cat->i_infos; i++ )
+            {
+                if( !strcmp( p_cat->pp_infos[i]->psz_name, psz_name ) )
+                {
+                    free( p_cat->pp_infos[i]->psz_name );
+                    if( p_cat->pp_infos[i]->psz_value )
+                        free( p_cat->pp_infos[i]->psz_value );
+                    free( p_cat->pp_infos[i] );
+                    REMOVE_ELEM( p_cat->pp_infos, p_cat->i_infos, i );
+                    break;
+                }
+            }
+            vlc_mutex_unlock( &p_input->input.p_item->lock );
+
+            if( i >= p_cat->i_infos )
+                return VLC_EGENERIC;
+
+            NotifyPlaylist( p_input );
+        }
+        return VLC_SUCCESS;
+
+
         case INPUT_GET_INFO:
         {
             char *psz_cat = (char *)va_arg( args, char * );
             char *psz_name = (char *)va_arg( args, char * );
             char **ppsz_value = (char **)va_arg( args, char ** );
             int i_ret = VLC_EGENERIC;
-            int i;
             *ppsz_value = NULL;
 
             *ppsz_value = vlc_input_item_GetInfo( p_input->input.p_item,
@@ -488,7 +533,8 @@ static void NotifyPlaylist( input_thread_t *p_input )
                                        FIND_PARENT );
     if( p_playlist )
     {
-        var_SetInteger( p_playlist, "item-change", p_playlist->i_index );
+        var_SetInteger( p_playlist, "item-change",
+                        p_input->input.p_item->i_id );
         vlc_object_release( p_playlist );
     }
 }