Esempio n. 1
0
        /// <summary>
        /// 获取一个视频文件的文件信息
        /// </summary>
        /// <param name="path">文件路径</param>
        /// <returns>VideoFileInfo类型,没有豆瓣ID</returns>
        public VideoFileInfo.Storage.VideoFileInfo GetVideoFileInfo(string path)
        {
            var video = new VideoFileInfo.Storage.VideoFileInfo();

            VideoEncoder.Encoder enc = new VideoEncoder.Encoder();
            enc.FFmpegPath = "ffmpeg.exe";

            VideoEncoder.VideoFile videoFile = new VideoEncoder.VideoFile(path);
            enc.GetVideoInfo(videoFile);

            System.TimeSpan totatp    = videoFile.Duration;
            string          totalTime = string.Format("{0:00}:{1:00}:{2:00}", (int)totatp.Hours, (int)totatp.Minutes, (int)totatp.Seconds);

            video.audioBitRate = (float)videoFile.AudioBitRate;
            video.audioFormat  = videoFile.AudioFormat;
            video.bitRate      = (float)videoFile.BitRate;
            video.duration     = totalTime;
            video.extension    = System.IO.Path.GetExtension(path).Substring(1);
            video.frameRate    = (float)videoFile.FrameRate;
            video.height       = videoFile.Height;
            video.path         = path;
            video.totalFrames  = videoFile.TotalFrames;
            video.userRating   = -1;
            video.videoBitRate = (float)videoFile.VideoBitRate;
            video.videoFormat  = videoFile.VideoFormat;
            video.width        = videoFile.Width;

            return(video);
        }
 //open
 private void Open_Click(object sender, RoutedEventArgs e)
 {
     VideoFileInfo.Storage.VideoFileInfo tmp = getSelectFileInfo();
     if (tmp != null)
     {
         Fish.MovieManager.VideoFileInfo.Class1.Instance.PlayVideo(tmp.path);
     }
 }
        private VideoFileInfo.Storage.VideoFileInfo getSelectFileInfo()
        {
            int now       = movie_Tab.SelectedIndex;
            int showIndex = 0;

            if (now == 0)
            {
                showIndex = movieList.SelectedIndex;
            }
            else
            {
                showIndex = movieGrid.SelectedIndex;
            }
            if (showIndex < 0)
            {
                return(null);
            }
            var t = movieGrid.Items[showIndex] as DataListView;

            VideoFileInfo.Storage.VideoFileInfo tmp = Fish.MovieManager.VideoControl.Class1.Instance.GetFileInfo(t.id);
            return(tmp);
        }