コード例 #1
0
ファイル: ZPlay.cs プロジェクト: Lokukarawita/MediaPlayer
 public bool LoadFileID3Ex(
     string FileName,
     TStreamFormat Format,
     ref TID3InfoEx Info,
     bool fDecodePicture)
 {
     ZPlay.TID3InfoEx_Internal pId3Info = new ZPlay.TID3InfoEx_Internal();
     if (ZPlay.zplay_LoadFileID3ExW(this.objptr, FileName, Convert.ToInt32((object)Format), ref pId3Info, 0) != 1)
     {
         return(false);
     }
     Info.Album                  = Marshal.PtrToStringUni(pId3Info.Album);
     Info.Artist                 = Marshal.PtrToStringUni(pId3Info.Artist);
     Info.Comment                = Marshal.PtrToStringUni(pId3Info.Comment);
     Info.Genre                  = Marshal.PtrToStringUni(pId3Info.Genre);
     Info.Title                  = Marshal.PtrToStringUni(pId3Info.Title);
     Info.Track                  = Marshal.PtrToStringUni(pId3Info.Track);
     Info.Year                   = Marshal.PtrToStringUni(pId3Info.Year);
     Info.AlbumArtist            = Marshal.PtrToStringUni(pId3Info.AlbumArtist);
     Info.Composer               = Marshal.PtrToStringUni(pId3Info.Composer);
     Info.OriginalArtist         = Marshal.PtrToStringUni(pId3Info.OriginalArtist);
     Info.Copyright              = Marshal.PtrToStringUni(pId3Info.Copyright);
     Info.Encoder                = Marshal.PtrToStringUni(pId3Info.Encoder);
     Info.Publisher              = Marshal.PtrToStringUni(pId3Info.Publisher);
     Info.BPM                    = pId3Info.BPM;
     Info.Picture.PicturePresent = false;
     if (fDecodePicture)
     {
         try
         {
             if (pId3Info.PicturePresent == 1)
             {
                 byte[] numArray = new byte[Convert.ToInt32(pId3Info.PictureDataSize) + 1];
                 Marshal.Copy(pId3Info.PictureData, numArray, 0, pId3Info.PictureDataSize);
                 Info.Picture.BitStream = new MemoryStream();
                 Info.Picture.BitStream.Write(numArray, 0, pId3Info.PictureDataSize);
                 Info.Picture.Bitmap         = new Bitmap((Stream)Info.Picture.BitStream);
                 Info.Picture.PictureType    = pId3Info.PictureType;
                 Info.Picture.Description    = Marshal.PtrToStringUni(pId3Info.Description);
                 Info.Picture.PicturePresent = true;
             }
             else
             {
                 Info.Picture.Bitmap = new Bitmap(1, 1);
             }
             return(true);
         }
         catch
         {
             Info.Picture.PicturePresent = false;
         }
     }
     return(false);
 }
コード例 #2
0
ファイル: libZPlay.cs プロジェクト: stufkan/DeadDog.Audio
        public bool LoadFileID3Ex(string FileName, TStreamFormat Format, ref TID3InfoEx Info, bool fDecodePicture)
        {
            TID3InfoEx_Internal tmp = new TID3InfoEx_Internal();

            if (zplay_LoadFileID3ExW(objptr, FileName, System.Convert.ToInt32(Format), ref tmp, 0) == 1)
            {
                Info.Album = Marshal.PtrToStringUni(tmp.Album);
                Info.Artist = Marshal.PtrToStringUni(tmp.Artist);
                Info.Comment = Marshal.PtrToStringUni(tmp.Comment);
                Info.Genre = Marshal.PtrToStringUni(tmp.Genre);
                Info.Title = Marshal.PtrToStringUni(tmp.Title);
                Info.Track = Marshal.PtrToStringUni(tmp.Track);
                Info.Year = Marshal.PtrToStringUni(tmp.Year);

                Info.AlbumArtist = Marshal.PtrToStringUni(tmp.AlbumArtist);
                Info.Composer = Marshal.PtrToStringUni(tmp.Composer);
                Info.OriginalArtist = Marshal.PtrToStringUni(tmp.OriginalArtist);
                Info.Copyright = Marshal.PtrToStringUni(tmp.Copyright);
                Info.Encoder = Marshal.PtrToStringUni(tmp.Encoder);
                Info.Publisher = Marshal.PtrToStringUni(tmp.Publisher);
                Info.BPM = tmp.BPM;


                Info.Picture.PicturePresent = false;
                if (fDecodePicture)
                {
                    try
                    {
                        if (tmp.PicturePresent == 1)
                        {
                            byte[] stream_data = new byte[System.Convert.ToInt32(tmp.PictureDataSize) + 1];
                            Marshal.Copy(tmp.PictureData, stream_data, 0, tmp.PictureDataSize);
                            Info.Picture.BitStream = new System.IO.MemoryStream();
                            Info.Picture.BitStream.Write(stream_data, 0, tmp.PictureDataSize);
                            Info.Picture.Bitmap = new Bitmap(Info.Picture.BitStream);
                            Info.Picture.PictureType = tmp.PictureType;
                            Info.Picture.Description = Marshal.PtrToStringUni(tmp.Description);
                            Info.Picture.PicturePresent = true;
                        }
                        else
                        {
                            Info.Picture.Bitmap = new Bitmap(1, 1);
                        }
                        return true;

                    }
                    catch
                    {
                        Info.Picture.PicturePresent = false;
                    }
                }

            }
            else
            {
                return false;
            }

            return false;
        }
コード例 #3
0
        /// <summary>
        /// Show info
        /// </summary>
        /// <remarks></remarks>
        public void showinfo()
        {
            Label3.Text = "";
            Label4.Text = "";
            Label5.Text = "";
            Label6.Text = "";
            Label7.Text = "";
            Label8.Text = "";
            Label9.Text = "";

            TID3InfoEx info = new TID3InfoEx();
            if (player.LoadID3Ex(ref info, true))
            {
                 Label3.Text = info.Title;
                Label4.Text = info.Artist;
                Label5.Text = info.Album;
                Label6.Text = info.Year;
                Label7.Text = info.Track;
                Label8.Text = info.Encoder;
                Label9.Text = info.Comment;

            }

            descr.Text = "Format:" + System.Environment.NewLine + "Length:" + System.Environment.NewLine + "Samplerate:" + System.Environment.NewLine + "Bitrate:" + System.Environment.NewLine + "Channel:" + System.Environment.NewLine + "VBR:";

            TStreamInfo StreamInfo = new TStreamInfo();
            player.GetStreamInfo(ref StreamInfo);
            descr1.Text = StreamInfo.Description + System.Environment.NewLine + System.Convert.ToString(StreamInfo.Length.hms.hour) + " : " + System.Convert.ToString(StreamInfo.Length.hms.minute) + " : " + System.Convert.ToString(StreamInfo.Length.hms.second) + System.Environment.NewLine + System.Convert.ToString(StreamInfo.SamplingRate) + " Hz" + System.Environment.NewLine + System.Convert.ToString(StreamInfo.Bitrate) + " kbps" + System.Environment.NewLine + System.Convert.ToString(StreamInfo.ChannelNumber) + System.Environment.NewLine + System.Convert.ToString(StreamInfo.VBR);

            if (info.Picture.PicturePresent)
                pictureBox2.Image = info.Picture.Bitmap;

            ProgressBar1.Minimum = 0;
            ProgressBar1.Maximum = System.Convert.ToInt32((int)(StreamInfo.Length.sec));
            ProgressBar1.Value = 0;

            Timer1.Enabled = true;
            Timer2.Enabled = true;
        }