Пример #1
0
        public void Save(byte [] cover_art, uint width, uint height)
        {
            base.Save();
            if (Saved)
            {
                if (cover_art == null)
                {
                    return;
                }

                FileSampleData cover = new FileSampleData();
                cover.data = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(byte)) * cover_art.Length);
                Marshal.Copy(cover_art, 0, cover.data, cover_art.Length);
                cover.size     = (ulong)cover_art.Length;
                cover.width    = width;
                cover.height   = height;
                cover.filetype = FileType.JPEG;

                if (FileSample.LIBMTP_Send_Representative_Sample(Device.Handle, AlbumId, ref cover) != 0)
                {
                    //Console.WriteLine ("Failed to send representative sample file for album {0} (id {1})", Name, AlbumId);
                }
                Marshal.FreeHGlobal(cover.data);
            }
        }
Пример #2
0
 private static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
Пример #3
0
 private static extern void LIBMTP_destroy_filesampledata_t (ref FileSampleData data); // LIBMTP_filesampledata_t *
Пример #4
0
        public void Save (byte [] cover_art, uint width, uint height)
        {
            base.Save ();
            if (Saved) {
                if (cover_art == null) {
                    return;
                }

                FileSampleData cover = new FileSampleData ();
                cover.data = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (byte)) * cover_art.Length);
                Marshal.Copy (cover_art, 0, cover.data, cover_art.Length);
                cover.size = (ulong)cover_art.Length;
                cover.width = width;
                cover.height = height;
                cover.filetype = FileType.JPEG;

                if (FileSample.LIBMTP_Send_Representative_Sample (Device.Handle, AlbumId, ref cover) != 0) {
                    //Console.WriteLine ("Failed to send representative sample file for album {0} (id {1})", Name, AlbumId);
                }
                Marshal.FreeHGlobal (cover.data);
            }
        }
 private static extern int LIBMTP_Send_Representative_Sample(MtpDeviceHandle handle, uint id, ref FileSampleData sample);
 private static extern void LIBMTP_destroy_filesampledata_t(ref FileSampleData data);  // LIBMTP_filesampledata_t *
Пример #7
0
 public static extern void LIBMTP_destroy_filesampledata_t(ref FileSampleData data);