Exemplo n.º 1
0
        private static CueFile TOCtoCUE(List <TOCEntry> tocEntries, string dataPath)
        {
            var cueFile = new CueFileEntry()
            {
                FileName = dataPath,
                Tracks   = new List <CueTrack>(),
                FileType = "BINARY"
            };

            var audioLeadin = new IndexPosition {
                Seconds = 2
            };

            foreach (var track in tocEntries)
            {
                var position = new IndexPosition
                {
                    Minutes = track.Minutes,
                    Seconds = track.Seconds,
                    Frames  = track.Frames,
                };

                var indexes = new List <CueIndex>();

                if (track.TrackType == TrackTypeEnum.Audio)
                {
                    indexes.Add(new CueIndex()
                    {
                        Number   = 0,
                        Position = position - audioLeadin,
                    });
                }

                indexes.Add(new CueIndex()
                {
                    Number   = 1,
                    Position = position,
                });

                var cueTrack = new CueTrack()
                {
                    DataType = TOCHelper.GetDataType(track.TrackType),
                    Indexes  = indexes,
                    Number   = track.TrackNo
                };


                cueFile.Tracks.Add(cueTrack);
            }

            return(new CueFile(new[] { cueFile }));
        }
Exemplo n.º 2
0
        private CueFile ExtractTOC(ExtractIsoInfo extractInfo, PbpStream stream)
        {
            var cueFile = new CueFile()
            {
                FileName = Path.GetFileName(extractInfo.DestinationIso),
                Tracks   = new List <CueTrack>(),
                FileType = "BINARY"
            };

            var audioLeadin = new IndexPosition {
                Seconds = 2
            };

            foreach (var track in stream.TOC)
            {
                var position = new IndexPosition
                {
                    Minutes = track.Minutes,
                    Seconds = track.Seconds,
                    Frames  = track.Frames,
                };

                var indexes = new List <CueIndex>();

                if (track.TrackType == TrackTypeEnum.Audio)
                {
                    indexes.Add(new CueIndex()
                    {
                        Number   = 0,
                        Position = position - audioLeadin,
                    });
                }

                indexes.Add(new CueIndex()
                {
                    Number   = 1,
                    Position = position,
                });

                var cueTrack = new CueTrack()
                {
                    DataType = Helper.GetDataType(track.TrackType),
                    Indexes  = indexes,
                    Number   = track.TrackNo
                };


                cueFile.Tracks.Add(cueTrack);
            }

            return(cueFile);
        }
Exemplo n.º 3
0
        public static IndexPosition PositionFromFrames(long frames)
        {
            int totalSeconds = (int)(frames / 75);
            int minutes      = totalSeconds / 60;
            int seconds      = totalSeconds % 60;

            frames = frames % 75;

            var position = new IndexPosition()
            {
                Minutes = minutes,
                Seconds = seconds,
                Frames  = (int)frames,
            };

            return(position);
        }