JarrettVance.ChapterTools.Extractors.BDInfoExtractor.GetStreams C# (CSharp) Méthode

GetStreams() public méthode

public GetStreams ( string location ) : List
location string
Résultat List
        public override List<ChapterInfo> GetStreams(string location)
        {
            ChapterInfo pgc = new ChapterInfo();
              pgc.Chapters = new List<ChapterEntry>();
              pgc.SourceHash = ChapterExtractor.ComputeMD5Sum(location);
              pgc.SourceName = location;
              pgc.Title = Path.GetFileNameWithoutExtension(location);
              pgc.SourceType = "Blu-Ray";
              pgc.Extractor = Application.ProductName + " " + Application.ProductVersion;

              FileInfo fileInfo = new FileInfo(location);

              OnStreamDetected(pgc);
              TSPlaylistFile mpls = new TSPlaylistFile(fileInfo);
              //Dictionary<string, TSStreamClipFile> clips = new Dictionary<string,TSStreamClipFile>();
              mpls.Scan();
              foreach (double d in mpls.Chapters)
              {
            pgc.Chapters.Add(new ChapterEntry()
              {
            Name = string.Empty,
            Time = new TimeSpan((long)(d * (double)TimeSpan.TicksPerSecond))
              });
              }

              pgc.Duration = new TimeSpan((long)(mpls.TotalLength * (double)TimeSpan.TicksPerSecond));

              foreach (TSStreamClip clip in mpls.StreamClips)
              {
              try
              {
              clip.StreamClipFile.Scan();
                foreach (TSStream stream in clip.StreamClipFile.Streams.Values)
                {
                  if (stream.IsVideoStream)
                  {
                    pgc.FramesPerSecond = (double)((TSVideoStream)stream).FrameRateEnumerator /
                    (double)((TSVideoStream)stream).FrameRateDenominator;
                    break;
                  }
                }
                if (pgc.FramesPerSecond != 0) break;
              }
              catch (Exception ex)
              {
              Trace.WriteLine(ex);
              }
              }

              OnChaptersLoaded(pgc);
              OnExtractionComplete();
              return new List<ChapterInfo>() { pgc };
        }

Usage Example

        public override List <ChapterInfo> GetStreams(string location)
        {
            List <ChapterInfo> pgcs = new List <ChapterInfo>();
            string             path = Path.Combine(Path.Combine(location, "BDMV"), "PLAYLIST");

            if (!Directory.Exists(path))
            {
                throw new FileNotFoundException("Could not find PLAYLIST folder on BluRay disc.");
            }

            ChapterExtractor ex = new BDInfoExtractor();

            ex.StreamDetected += (sender, args) => OnStreamDetected(args.ProgramChain);
            ex.ChaptersLoaded += (sender, args) => OnChaptersLoaded(args.ProgramChain);

            string vol = Pathing.VolumeInfo.GetVolumeLabel(new DirectoryInfo(location));

            foreach (string file in Directory.GetFiles(path, "*.mpls"))
            {
                var pgc = ex.GetStreams(file)[0];
                if (!string.IsNullOrEmpty(vol))
                {
                    pgc.VolumeName = vol;
                }
                pgcs.Add(pgc);
            }

            pgcs = pgcs.OrderByDescending(p => p.Duration).ToList();

            OnExtractionComplete();
            return(pgcs);
        }
All Usage Examples Of JarrettVance.ChapterTools.Extractors.BDInfoExtractor::GetStreams
BDInfoExtractor