Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
 private static extern int LIBMTP_Send_Representative_Sample (MtpDeviceHandle handle, uint id, ref FileSampleData sample);
Ejemplo n.º 3
0
 private static extern void LIBMTP_destroy_filesampledata_t (ref FileSampleData data); // LIBMTP_filesampledata_t *
Ejemplo n.º 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 *
Ejemplo n.º 7
0
 public static extern void LIBMTP_destroy_filesampledata_t(ref FileSampleData data);