Changeset 143

Show
Ignore:
Timestamp:
03/07/07 14:45:48 (2 years ago)
Author:
mgeske2
Message:

Fixed delete from playlist function in NativeLibVlc?; songs can now be removed from the playlist.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dmp/trunk/vlc.NET/NativeLibVlc.cs

    r133 r143  
    427427                        int OptionsCount); 
    428428        [DllImport("libvlc")] 
    429         static extern VlcError playlist_DeleteFromInput(IntPtr p_playlist, Int32 id, int locked); 
     429        static extern int libvlc_playlist_delete_item(ref libvlc_instance_t libvlc, Int32 id, ref libvlc_exception_t p_exception); 
    430430 
    431431                [UnmanagedFunctionPointer(CallingConvention.Cdecl)] 
     
    13751375            try 
    13761376            { 
    1377                 using (VlcObject vobj = new VlcObject(this.vlcHandle, ObjectType.VLC_OBJECT_PLAYLIST)) 
    1378                
    1379                     if (vobj.SubObject != IntPtr.Zero) 
     1377                using(VlcPlaylistObject vpobj = new VlcPlaylistObject(this.vlcHandle)) 
     1378                               
     1379                    if (vpobj.SubObject != IntPtr.Zero) 
    13801380                    { 
    1381                         VlcError enmErr = playlist_DeleteFromInput(vobj.SubObject, itemId, 1); 
    1382                         return enmErr; 
    1383                     } 
    1384                     else 
    1385                     { 
    1386                         return VlcError.NoObj; 
     1381                        libvlc_playlist_delete_item(ref vpobj.libvlc, itemId, ref vpobj.exception); 
     1382                        if (!vpobj.exception.WasExceptionRaised()) 
     1383                        { 
     1384                            return VlcError.Success; 
     1385                        } 
    13871386                    } 
    13881387                } 
     1388                return VlcError.Generic; 
    13891389            } 
    13901390            catch (Exception ex) 
     
    14091409                                { 
    14101410                                        if(vobj.SubObject != IntPtr.Zero) 
    1411                                        
     1411                                   
    14121412                                                VlcError enmErr = playlist_AddExt(vobj.SubObject, target, target, Mode.Append, 
    14131413                                                        EndOfPlaylist, -1L, options, optionsCount); 
  • dmp/trunk/vlc.NET/VlcUserControl.cs

    r133 r143  
    10201020        public void RemoveFromPlaylist(int itemId) 
    10211021        { 
    1022             Debug.WriteLine("Trying to remove item from playlist "); 
    1023             this.nativeVlc.RemoveTarget(itemId); 
    1024             Debug.WriteLine("Removed item from playlist "); 
     1022            Debug.WriteLine("Trying to remove item with id " + itemId.ToString() + " from playlist "); 
     1023            if (this.nativeVlc.RemoveTarget(itemId) == VlcError.Success) 
     1024            { 
     1025                Debug.WriteLine("Removed item from playlist."); 
     1026            } 
     1027            else 
     1028            { 
     1029                Debug.WriteLine("Could not remove item from playlist."); 
     1030            } 
    10251031        } 
    10261032