Example #1
0
 public Playlist(MtpDevice device, string name) : base(device, name)
 {
     this.playlist = new PlaylistStruct();
     TracksPtr     = IntPtr.Zero;
     Name          = name;
     Count         = 0;
 }
Example #2
0
 internal Playlist(MtpDevice device, PlaylistStruct playlist) : base(device, playlist.tracks, playlist.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Playlist constructor is finished.
     this.playlist = playlist;
     TracksPtr     = IntPtr.Zero;
 }
Example #3
0
 public Playlist(MtpDevice device, string name)
     : base(device)
 {
     this.playlist = new PlaylistStruct ();
     Name = name;
     Count = 0;
 }
Example #4
0
 internal Playlist (MtpDevice device, PlaylistStruct playlist) : base (device, playlist.tracks, playlist.no_tracks)
 {
     // Once we've loaded the tracks, set the TracksPtr to NULL as it
     // will be freed when the Playlist constructor is finished.
     this.playlist = playlist;
     TracksPtr = IntPtr.Zero;
 }
 public Playlist (MtpDevice device, string name) : base (device, name)
 {
     this.playlist = new PlaylistStruct ();
     TracksPtr = IntPtr.Zero;
     Name = name;
     Count = 0;
 }
Example #6
0
        public List <Playlist> GetPlaylists()
        {
            List <Playlist> playlists = new List <Playlist> ();

            IntPtr ptr = Playlist.LIBMTP_Get_Playlist_List(Handle);

            while (ptr != IntPtr.Zero)
            {
                PlaylistStruct d = (PlaylistStruct)Marshal.PtrToStructure(ptr, typeof(PlaylistStruct));
                playlists.Add(new Playlist(this, d));
                ptr = d.next;
            }

            return(playlists);
        }
Example #7
0
        internal static List <Playlist> GetPlaylists(MtpDevice device)
        {
            List <Playlist> playlists = new List <Playlist> ();
            IntPtr          ptr       = Playlist.LIBMTP_Get_Playlist_List(device.Handle);

            while (ptr != IntPtr.Zero)
            {
                // Destroy the struct *after* we use it to ensure we don't access freed memory
                // for the 'tracks' variable
                PlaylistStruct d = (PlaylistStruct)Marshal.PtrToStructure(ptr, typeof(PlaylistStruct));
                playlists.Add(new Playlist(device, d));
                LIBMTP_destroy_playlist_t(ptr);
                ptr = d.next;
            }
            return(playlists);
        }
Example #8
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata, uint parentHandle);
Example #9
0
 internal Playlist(MtpDevice device, PlaylistStruct playlist) : base(device, playlist.tracks, playlist.no_tracks)
 {
     this.playlist = playlist;
 }
Example #10
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
Example #11
0
 public Playlist(MtpDevice device, string name) : base(device)
 {
     this.playlist = new PlaylistStruct();
     Name          = name;
     Count         = 0;
 }
Example #12
0
 private static extern int LIBMTP_Update_Playlist(MtpDeviceHandle handle, ref PlaylistStruct playlist);
Example #13
0
 private static extern int LIBMTP_Create_New_Playlist(MtpDeviceHandle handle, ref PlaylistStruct metadata);
 internal Playlist (MtpDevice device, PlaylistStruct playlist) : base (device, playlist.tracks, playlist.no_tracks)
 {
     this.playlist = playlist;
 }