• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# MediaInfoLib.MediaInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中MediaInfoLib.MediaInfo的典型用法代码示例。如果您正苦于以下问题:C# MediaInfo类的具体用法?C# MediaInfo怎么用?C# MediaInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MediaInfo类属于MediaInfoLib命名空间,在下文中一共展示了MediaInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ImportVideo

        internal static bool PopulateMediaSection
            (FileInfo file, IMLSection moviesSection, 
             IMLSection tvSection, IMLSection musicSection, 
             IEnumerable<string> videoexts, int audioDuration, 
             string filesize, MediaInfo mi, DirectoryInfo parent,
             string filecodec, bool isVideo, bool isAudio,
             int videoDuration, string fileName, string parentName,
             IEnumerable<string> combinedSceneTags)
        {


            if (String.IsNullOrEmpty(filecodec) && !isVideo && !isAudio)
                return true;

            //Debugger.LogMessageToFile(Environment.NewLine + "The file " + file.Name +
            //" has been detected as a valid media file." + Environment.NewLine + 
            //" Proceeding to media type recognition...");

            
            if (Helpers.UserCancels(MainImportingEngine.SpecialStatus, null))
                return false;


            ImportVideo(file, moviesSection, tvSection, videoexts, filesize, mi, parent,
                filecodec, isVideo, videoDuration, fileName, parentName, combinedSceneTags);

            if (Helpers.UserCancels(MainImportingEngine.SpecialStatus, null))
                return false;

            ImportAudio(file, musicSection, audioDuration, filesize, mi, filecodec, isAudio, fileName);

            return true;
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:33,代码来源:MediaSectionPopulator.cs


示例2: DetectAndImportMultipartMovie

        internal static bool DetectAndImportMultipartMovie(IMLSection moviesSection, MediaInfo mediaInfo, bool isUNC,
                                                          FileSystemInfo dir, string externalID, ArrayList filesInDir,
                                                          string[] videoexts, int videosCount)
        {

            videosCount = CountVideosInDirectory(videoexts, videosCount, filesInDir);


            if (!Settings.EnableMediaDetection || videosCount <= 1 || videosCount >= 4) return false;

            MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Detecting film parts...");
            int parts = 0;
            string locationTag = String.Empty;
            int count = 1;

            foreach (FileInfo file in filesInDir)
            {
                var fileIsVideo = DetermineIfFileIsVideoByExtensionMatching(videoexts, file);
                parts = DetectMoviePart(parts, mediaInfo, videosCount, fileIsVideo, file, isUNC, ref count, ref locationTag,
                                        ref externalID);
            }


            return OnMultiplePartsDetectionAddToMoviesSection(moviesSection, locationTag, externalID, parts, dir);

        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:26,代码来源:MultipartMovieDetectionEngine.cs


示例3: File

 public File()
 {
     _mediaInfo = new MediaInfo();
     VideoCodecs = new List<string>();
     AudioCodecs = new List<string>();
     AudioLanguages = new List<string>();
 }
开发者ID:bedashii,项目名称:ReturnMedz,代码行数:7,代码来源:File.cs


示例4: MediaViewModel

        public MediaViewModel(string Name = "",
            string ArtistName = "",
            string AlbumName = "",
            Uri Path = null,
            String Length = "00:00:00")
        {
            Dictionary<String, String> tmp = new Dictionary<string, string>();
            if (Path != null)
            {
                try
                {
                    MediaInfo lol = new MediaInfo();
                    if (lol.Open(Uri.UnescapeDataString(Path.AbsolutePath)) == 1)
                    {
                        foreach (string entry in lol.Inform().Split('\n'))
                        {
                            var tokens = entry.Split(':');
                            if (tokens.Length == 2)
                                tmp[tokens[0].Trim()] = tokens[1].Trim();
                        }
                        lol.Close();
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show("MediaInfo: "+ e.Message);
                }
            }

            Song = new Media(tmp.ContainsKey("Track name") ? tmp["Track name"] : "",
                            tmp.ContainsKey("Performer") ? tmp["Performer"] : "",
                            tmp.ContainsKey("Album") ? tmp["Album"] : "",
                            Path, tmp.ContainsKey("Duration") ? getLength(tmp["Duration"]) : "");
        }
开发者ID:Vyko,项目名称:MyWmp,代码行数:34,代码来源:MediaViewModel.cs


示例5:

        internal static bool ScanConstructedArrayAndImportMediaFiles
               (IMLSection moviesSection,
                IMLSection tvSection,
                IMLSection musicSection,
                ref IList<string> extensionsToIgnore,
                string[] filmLocations,
                string[] tvShowsLocations,
                string[] musicLocations,
                string[] videoExtensions,
                string[] audioExtensions,
                IEnumerable<string> combinedSceneTags,
                ICollection<FileInfo> filesToImport, MediaInfo mediaInfo,
                string pluginPath, IEnumerable<string> videoExtensionsCommon)
        {



            if (!Settings.UpdateMediaSectionOnEachImportedItem)
                ImportingEngineHelpers.BeginUpdatingSections();

            if ( !ImportFilesInArray(moviesSection, tvSection,
                musicSection, ref extensionsToIgnore, filmLocations,
                tvShowsLocations, musicLocations, videoExtensions, audioExtensions,
                combinedSceneTags, filesToImport, mediaInfo, pluginPath, videoExtensionsCommon)
               ) return false;


            if (!Settings.UpdateMediaSectionOnEachImportedItem)
                ImportingEngineHelpers.EndUpdatingSections();


            return true;
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:33,代码来源:MediaSnapshotEngine.cs


示例6: GetVideoFileTakenDate

        public static DateTime? GetVideoFileTakenDate(string filePath)
        {
            MediaInfo mediaInfo = null;
            try
            {
                mediaInfo = new MediaInfo();
                mediaInfo.Open(filePath);

                DateTime? result = null;
                string recordedDate = mediaInfo.Get(StreamKind.General, 0, "Recorded_Date");
                if (!string.IsNullOrWhiteSpace(recordedDate))
                {
                    result = DateTime.Parse(recordedDate, CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal);
                }

                if (result == null)
                {
                    recordedDate = mediaInfo.Get(StreamKind.General, 0, "Encoded_Date");
                    if (string.IsNullOrWhiteSpace(recordedDate))
                    {
                        recordedDate = mediaInfo.Get(StreamKind.General, 0, "Tagged_Date");
                    }
                    if (!string.IsNullOrWhiteSpace(recordedDate))
                    {
                        var dateTimeStyles = DateTimeStyles.AssumeUniversal;
                        // Canon records local time as UTC
                        var canonCameraIdentifier = mediaInfo.Get(StreamKind.General, 0, "CodecID/String");
                        if (canonCameraIdentifier.Contains("/CAEP"))
                        {
                            dateTimeStyles = DateTimeStyles.AssumeLocal;
                        }

                        result = DateTime.ParseExact(recordedDate, "\"UTC\" yyyy-MM-dd HH:mm:ss",
                            CultureInfo.InvariantCulture, dateTimeStyles);
                    }
                }

                if (result == null)
                {
                    recordedDate = mediaInfo.Get(StreamKind.General, 0, "Mastered_Date");
                    if (!string.IsNullOrWhiteSpace(recordedDate))
                    {
                        result = DateTime.ParseExact(recordedDate, "ddd MMM dd HH:mm:ss yyyy",
                            CultureInfo.InvariantCulture, DateTimeStyles.AssumeLocal);
                    }
                }
                return result;
            }
            catch (Exception)
            {
            }
            finally
            {
                if (mediaInfo != null)
                {
                    mediaInfo.Close();
                }
            }
            return null;
        }
开发者ID:anton-iermolenko,项目名称:Photo-library-toolkit,代码行数:60,代码来源:VideoInfo.cs


示例7: ExtractInfo

        public static string[] ExtractInfo(string path)
        {
            MediaInfo MI = new MediaInfo();            
            MI.Open(path); 
            string[] returnInfo = new string[5];

            //File name 0
            returnInfo[0] = MI.Get(0, 0, "FileName");

            //Size 1
            string sizeInKBStr = MI.Get(0, 0, "FileSize/String").Substring(
                0, MI.Get(0, 0, "FileSize/String").LastIndexOf(" ")).Replace(" ", "");
            double sizeInKB = Double.Parse(sizeInKBStr);
            double sizeInMB = (double)(sizeInKB / 1024);
            string sizeInMBStr = String.Format("{0:0.00}", sizeInMB); 
            returnInfo[1] = sizeInMBStr + " MB";

            //Date created 2
            returnInfo[2] = MI.Get(0, 0, "File_Created_Date").Substring(
                MI.Get(0, 0, "File_Created_Date").IndexOf(" ") + 1, MI.Get(0, 0, "File_Created_Date").LastIndexOf(".") - 4);

            //Performer 3
            returnInfo[3] = MI.Get(0, 0, "Performer");

            //Length 4
            returnInfo[4] = MI.Get(0, 0, "Duration/String3").Substring(0, MI.Get(0, 0, "Duration/String3").LastIndexOf("."));

            return returnInfo;
        }
开发者ID:angad,项目名称:PeopleBAWX,代码行数:29,代码来源:MIExtractor.cs


示例8: GetCodecs

        private static void GetCodecs(MediaInfo mediaInfo, out string videoCodec, out string audioCodec, out string filecodec)
        {
            filecodec = GetFileCodec(mediaInfo);

            videoCodec = GetVideoCodec(mediaInfo);

            audioCodec = GetAudioCodec(mediaInfo);
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:8,代码来源:MediaInfoExtractor.cs


示例9: FileInput

            public FileInput(string filename)
            {
                this.filename = filename;
                MediaInfo MI = new MediaInfo();
                if (MI.Open(this.GetFileName()) > 0)
                {

                    string s = MI.Option("Info_Parameters");

                    int width = int.Parse(MI.Get(StreamKind.Video, 0, "Width"));
                    int height = int.Parse(MI.Get(StreamKind.Video, 0, "Height"));
                    decimal aspect = (decimal)width / (decimal)height;
                    bool resize = false;
                    if (width > 1280)
                    {
                        width = 1280;
                        height = (int)(width / aspect);
                        resize = true;
                    }
                    if (height > 720)
                    {
                        height = 720;
                        width = (int)(height * aspect);
                        resize = true;
                    }
                    if (resize)
                    {
                        if (width % 2 > 0)
                            width -= 1;
                        if (height % 2 > 0)
                            height -= 1;
                        this._size = " -s " + width + "x" + height;
                    }
                    Log.WriteLine("resize=" + resize + ",size=" + width + "x" + height);


                    int videobitrate = int.Parse(MI.Get(StreamKind.Video, 0, "BitRate"));
                    if (videobitrate > 7 * 1024 * 1024 || resize)
                    {
                        this._parameter = " libx264 -coder 0 -flags -loop -cmp +chroma -partitions -parti8x8-parti4x4-partp8x8-partb8x8 -me_method dia -subq 0 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 0 -i_qfactor 0.71 -b_strategy 0 -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -bf 0 -refs 1 -directpred 1 -trellis 0 -flags2 -bpyramid-mixed_refs-wpred-dct8x8+fastpskip-mbtree -wpredp 0 -b 4096k ";
                    }
                    else
                    {
                        this._parameter = " copy";
                    }
                    this._parameter = " -vcodec " + this._parameter;
                    //Log.WriteLine("media info supported :" + s);

                    MI.Close();
                }


                if (this.GetFileName().ToLower().EndsWith(".mp4") || this.GetFileName().ToLower().EndsWith(".mkv"))
                {
                    this._parameter += " -vbsf h264_mp4toannexb ";
                }
                this._parameter += " -acodec libfaac -ac 2 -ab 192k ";
            }
开发者ID:jorgeantwan18,项目名称:rokumedia,代码行数:58,代码来源:FileHttpLiveStreaming.cs


示例10: Main

        public static void Main()
        {
            MediaInfo MI = new MediaInfo();

            //change the files accordingly, tested with .avi, .mpg, .mpeg - these should be enough
            MI.Open("1.flv"); 

            string display = "";
            display += "FileName: " + MI.Get(0, 0, "FileName") + "\n";
            display += "FileExtension: " + MI.Get(0, 0, "FileExtension") + "\n";
            display += "Title: " + MI.Get(0, 0, "Title") + "\n";
            display += "Subtitle: " + MI.Get(0, 0, "Title/More") + "\n";
            display += "Tags: " + MI.Get(0, 0, "WM/Category") + "\n";
            display += "Comments: " + MI.Get(0, 0, "Comment") + "\n";

            string sizeInKBStr = MI.Get(0, 0, "FileSize/String").Substring(0, MI.Get(0, 0, "FileSize/String").LastIndexOf(" ")).Replace(" ", "");
            double sizeInKB = Double.Parse(sizeInKBStr);
            double sizeInMB = (double)(sizeInKB / 1024);
            string sizeInMBStr = String.Format("{0:0.00}", sizeInMB); 
            display += "Size: " + sizeInMBStr + " MB" + "\n";
            display += "Date created: " + MI.Get(0, 0, "File_Created_Date").Substring(MI.Get(0, 0, "File_Created_Date").IndexOf(" ") + 1, MI.Get(0, 0, "File_Created_Date").LastIndexOf(".")-4) + "\n";
            display += "Date modified: " + MI.Get(0, 0, "File_Modified_Date").Substring(MI.Get(0, 0, "File_Modified_Date").IndexOf(" ") + 1, MI.Get(0, 0, "File_Modified_Date").LastIndexOf(".")-4) + "\n";

            display += "\nVIDEO\n";
            display += "Length: " + MI.Get(0, 0, "Duration/String3").Substring(0, MI.Get(0, 0, "Duration/String3").LastIndexOf(".")) + "\n";
            display += "Frame width: " + MI.Get(StreamKind.Video, 0, "Width/String") + "\n";
            display += "Frame height: " + MI.Get(StreamKind.Video, 0, "Height/String") + "\n";
            if (MI.Get(StreamKind.Video, 0, "BitRate/String") != "")
                display += "Data rate: " + MI.Get(StreamKind.Video, 0, "BitRate/String").Substring(0, MI.Get(StreamKind.Video, 0, "BitRate/String").LastIndexOf(" ")).Replace(" ", "") + " kbps" + "\n";
            else
                display += "Data rate:\n";
            string frameRateOriStr = MI.Get(StreamKind.Video, 0, "FrameRate/String").Substring(0, MI.Get(StreamKind.Video, 0, "FrameRate/String").LastIndexOf(" ")).Replace(" ", "");
            double frameRate = Double.Parse(frameRateOriStr);
            string frameRateStr = String.Format("{0:0}", frameRate);
            display += "Frame rate: " + frameRateStr + " fps" + "\n";

            display += "\nAUDIO\n";
            string bitrateOriStr = MI.Get(StreamKind.Audio, 0, "BitRate/String").Substring(0, MI.Get(StreamKind.Audio, 0, "BitRate/String").LastIndexOf(" ")).Replace(" ", "");
            double bitrateRate = Double.Parse(bitrateOriStr);
            string bitrateRateStr = String.Format("{0:0}", bitrateRate);
            display += "Bitrate: " + bitrateRateStr + " kbps" + "\n";
            display += "Channels: " + MI.Get(StreamKind.Audio, 0, "Channel(s)/String") + "\n";
            string audioSampleRateOriStr = MI.Get(StreamKind.Audio, 0, "SamplingRate/String").Substring(0, MI.Get(StreamKind.Audio, 0, "SamplingRate/String").LastIndexOf(" ")).Replace(" ", "");
            double audioSampleRate = Double.Parse(audioSampleRateOriStr);
            string audioSampleRateStr = String.Format("{0:0}", audioSampleRate);
            display += "Audio sample rate: " + audioSampleRateStr + " kHz" + "\n";

            display += "\nMEDIA\n";
            display += "Artist: " + MI.Get(0, 0, "Performer") + "\n";
            display += "Year: " + MI.Get(0, 0, "Recorded_Date") + "\n";
            display += "Genre: " + MI.Get(0, 0, "Genre") + "\n";            

            MI.Close();

            Console.WriteLine(display);

        }
开发者ID:angad,项目名称:PeopleBAWX,代码行数:57,代码来源:Program.cs


示例11: ImportAudio

        private static void ImportAudio(FileInfo file, IMLSection musicSection, int audioDuration, string filesize, MediaInfo mi,
                                        string filecodec, bool isAudio, string fileName)
        {

            if (!MediaSectionPopulatorHelpers.ProceedToImportAudioTrack(file, isAudio))
                return;

            AddToMusicSection_ImportMediaInfo(file, musicSection, audioDuration, filesize, mi, filecodec, fileName);
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:9,代码来源:MediaSectionPopulator.cs


示例12: Audio

 public Audio(MediaInfo MI, int i)
 {
     this.codec = MI.Get(StreamKind.Audio, i, "Codec/String");
     //this.profile = MI.Get(StreamKind.Audio, i, "Codec_Profile");
     this.bitrate_mode = MI.Get(StreamKind.Audio, i, "BitRate_Mode/String");
     this.bitrate = MI.Get(StreamKind.Audio, i, "BitRate/String");
     this.sampling_frequency = MI.Get(StreamKind.Audio, i, "SamplingRate");
     this.channels = MI.Get(StreamKind.Audio, i, "Channel(s)");
     this.delay = MI.Get(StreamKind.Audio, i, "Video_Delay");
 }
开发者ID:nakamura24,项目名称:MediaInfoInterface,代码行数:10,代码来源:StreamInfo.cs


示例13: Musiikki

 public Musiikki(string nimi, string filePath)
 {
     FilePath = filePath;
     MediaInfo MI = new MediaInfo();
     MI.Open(FilePath);
     Nimi = MI.Get(StreamKind.General, 0, "FileName");
     Pituus = MI.Get(StreamKind.General, 0, "Duration/String");
     SoundEncoding = MI.Get(StreamKind.Audio, 0, "Language/String") + "," + MI.Get(StreamKind.Audio, 0, "SamplingRate/String") + "," + MI.Get(StreamKind.Audio, 0, "Channel(s)/String") + "," + MI.Get(StreamKind.General, 0, "Audio_Format_List");
     TiedostonKoko = MI.Get(StreamKind.General, 0, "FileSize/String");
     MI.Close();
 }
开发者ID:Jeeqqq,项目名称:IIO13200-HTYO-Shareyourmovies,代码行数:11,代码来源:Musiikki.cs


示例14: AudioMetadata

 public AudioMetadata(string Filename)
 {
     var MI = new MediaInfo();
     MI.Open(Filename);
     Title = MI.Get(StreamKind.General, 0, "Title");
     Album = MI.Get(StreamKind.General, 0, "Album");
     Artist = MI.Get(StreamKind.General, 0, "Performer");
     Genre = MI.Get(StreamKind.General, 0, "Genre");
     RecordDate = MI.Get(StreamKind.General, 0, "Recorded_Date");
     var duration = MI.Get(StreamKind.General, 0, "Duration");
     Duration = new TimeSpan(Convert.ToInt64(duration) * 10000);
 }
开发者ID:bngreen,项目名称:Audio-Player,代码行数:12,代码来源:AudioMetadata.cs


示例15: AnalyzeMediaFileGetMediaInformation

        internal static void AnalyzeMediaFileGetMediaInformation(FileSystemInfo file, MediaInfo mediaInfo, out int videoDuration,
                                                                out string videoCodec, out string audioCodec, out int audioDuration,
                                                                out string filesize, out string filecodec)
        {
            OpenMediaFileForProcessing(file, mediaInfo);

            filesize = GetFileSize(mediaInfo);

            GetCodecs(mediaInfo, out videoCodec, out audioCodec, out filecodec);

            GetDurations(mediaInfo, out videoDuration, out audioDuration);
        }
开发者ID:stavrossk,项目名称:Easy_Film_Importer_for_MeediOS,代码行数:12,代码来源:MediaInfoExtractor.cs


示例16: AddToMusicSection_ImportMediaInfo

        // ReSharper disable InconsistentNaming
        private static void AddToMusicSection_ImportMediaInfo(FileSystemInfo file, IMLSection musicSection, int audioDuration,
// ReSharper restore InconsistentNaming
                                                              string filesize, MediaInfo mi, string filecodec, string fileName)
        {
            Application.DoEvents();
            //Debugger.LogMessageToFile("Importing audio track " + fileName + "...");
            MainImportingEngine.ThisProgress.Progress(MainImportingEngine.CurrentProgress, "Importing audio track " + fileName + "...");

            IMLItem item;
            AddFileToSection(out item, musicSection, fileName, file.FullName, file.FullName);
            MediaInformation.ImportMediaInfoforAudio(mi, item, filesize, filecodec, audioDuration);
        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:13,代码来源:MediaSectionPopulator.cs


示例17: Media

 ///<summary>Constructor to create a MediaInfo StreamKind-specific object, such as an audio
 ///stream, for use by an existing MediaFile object.</summary>
 ///<param name="mediaInfo">A pre-initialized MediaInfo object.</param>
 ///<param name="id">The MediaInfo ID for this stream.</param>
 public Media(MediaInfo mediaInfo, int id)
 {
     string errorText;
     this.mediaInfo = mediaInfo;
     if(mediaInfo == null) {
         errorText = "MediaInfo object cannot be null.";
         throw new ArgumentNullException(errorText);
     }
     else if(!isMediaInfoDllCompatible()) {
         errorText = "Incompatible version of MediaInfo.DLL";
         throw new InvalidOperationException(errorText);
     }
     else {
         this.id = id;
     }
 }
开发者ID:x265,项目名称:MediaInfoDotNet,代码行数:20,代码来源:Media.cs


示例18: GetAudioCodec

        private static string GetAudioCodec(MediaInfo mediaInfo)
        {
            Application.DoEvents();

            string audioCodec;
            Debugger.LogMessageToFile("Getting audio codec...");

            try
            {
                audioCodec = mediaInfo.Get(StreamKind.Audio, 0, "Codec");
            }
            catch
            {
                audioCodec = string.Empty;
            }
            return audioCodec;
        }
开发者ID:stavrossk,项目名称:Easy_Film_Importer_for_MeediOS,代码行数:17,代码来源:MediaInfoExtractor.cs


示例19: ExampleWithStream

        public static String ExampleWithStream()
        {
            //Initilaizing MediaInfo
            MediaInfo MI = new MediaInfo();

            //From: preparing an example file for reading
            FileStream From = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

            //From: preparing a memory buffer for reading
            byte[] From_Buffer = new byte[64 * 1024];
            int From_Buffer_Size; //The size of the read file buffer

            //Preparing to fill MediaInfo with a buffer
            MI.Open_Buffer_Init(From.Length, 0);

            //The parsing loop
            do
            {
                //Reading data somewhere, do what you want for this.
                From_Buffer_Size = From.Read(From_Buffer, 0, 64 * 1024);

                //Sending the buffer to MediaInfo
                System.Runtime.InteropServices.GCHandle GC = System.Runtime.InteropServices.GCHandle.Alloc(From_Buffer, System.Runtime.InteropServices.GCHandleType.Pinned);
                IntPtr From_Buffer_IntPtr = GC.AddrOfPinnedObject();
                Status Result = (Status)MI.Open_Buffer_Continue(From_Buffer_IntPtr, (IntPtr)From_Buffer_Size);
                GC.Free();
                if ((Result & Status.Finalized) == Status.Finalized)
                    break;

                //Testing if MediaInfo request to go elsewhere
                if (MI.Open_Buffer_Continue_GoTo_Get() != -1)
                {
                    Int64 Position = From.Seek(MI.Open_Buffer_Continue_GoTo_Get(), SeekOrigin.Begin); //Position the file
                    MI.Open_Buffer_Init(From.Length, Position); //Informing MediaInfo we have seek
                }
            }
            while (From_Buffer_Size > 0);

            //Finalizing
            MI.Open_Buffer_Finalize(); //This is the end of the stream, MediaInfo must finnish some work

            //Get() example
            return "Container format is " + MI.Get(StreamKind.General, 0, "Format");
        }
开发者ID:JoseRochaVidrio,项目名称:MediaInfoTest,代码行数:44,代码来源:Program.cs


示例20: GetAudioDuration

        private static int GetAudioDuration(MediaInfo mediaInfo)
        {

            Application.DoEvents();

            int audioDuration = 0;
            string audioDurationStr;

            Debugger.LogMessageToFile("Getting audio duration...");

            try
            {
                audioDurationStr = mediaInfo.Get(StreamKind.Audio, 0, "Duration");
            }
            catch (Exception e)
            {
                Debugger.LogMessageToFile("[Media File Analyzer] An unexpected error occured while" +
                                          " the Media Analyzer was trying to obtain a media file's Audio Duration." +
                                          " The error was: " + e);

                audioDurationStr = string.Empty;
            }

            try
            {

                if (!String.IsNullOrEmpty(audioDurationStr))
                {
                    Debugger.LogMessageToFile("Converting audio duration...");
                    audioDuration = Convert.ToInt32(audioDurationStr);
                    audioDuration = audioDuration/60/1000;
                    Debugger.LogMessageToFile("Audio duration: " + audioDuration);
                }

            }
            catch (Exception e)
            {
                Debugger.LogMessageToFile("");
            }


            return audioDuration;

        }
开发者ID:stavrossk,项目名称:MeediFier_for_MeediOS,代码行数:44,代码来源:MediaInfoExtractor.cs



注:本文中的MediaInfoLib.MediaInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# General.AbstractProperty类代码示例发布时间:2022-05-26
下一篇:
C# ViewModels.ItemListViewModel类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap