Exemplo n.º 1
0
		void AddIndex(CUE_File.Command.INDEX indexCommand)
		{
			var newindex = new CompiledCueIndex();
			newindex.FileMSF = indexCommand.Timestamp;
			newindex.Number = indexCommand.Number;
			curr_track.Indexes.Add(newindex);
		}
Exemplo n.º 2
0
		void OpenTrack(CUE_File.Command.TRACK trackCommand)
		{
			curr_track = new CompiledCueTrack();

			//spill cdtext data into this track
			curr_cdtext = curr_track.CDTextData;
		
			curr_track.BlobIndex = curr_blobIndex;
			curr_track.Number = trackCommand.Number;
			curr_track.TrackType = trackCommand.Type;

			//default flags
			if (curr_track.TrackType != CueTrackType.Audio)
				curr_track.Flags = CueTrackFlags.DATA;

			if (!curr_fileHasTrack)
			{
				curr_fileHasTrack = curr_track.IsFirstInFile = true;
			}

			UpdateDiscInfo(trackCommand);
		}
Exemplo n.º 3
0
		void UpdateDiscInfo(CUE_File.Command.TRACK trackCommand)
		{
			if (OUT_CompiledDiscInfo.FirstRecordedTrackNumber == 0)
				OUT_CompiledDiscInfo.FirstRecordedTrackNumber = trackCommand.Number;
			OUT_CompiledDiscInfo.LastRecordedTrackNumber = trackCommand.Number;
			if (!discinfo_session1Format_determined)
			{
				switch (trackCommand.Type)
				{
					case CueTrackType.Mode2_2336:
					case CueTrackType.Mode2_2352:
						OUT_CompiledDiscInfo.SessionFormat = SessionFormat.Type20_CDXA;
						discinfo_session1Format_determined = true;
						break;

					case CueTrackType.CDI_2336:
					case CueTrackType.CDI_2352:
						OUT_CompiledDiscInfo.SessionFormat = SessionFormat.Type10_CDI;
						discinfo_session1Format_determined = true;
						break;

					default:
						break;
				}
			}
		}
Exemplo n.º 4
0
		void OpenFile(CUE_File.Command.FILE f)
		{
			if (curr_file != null)
				CloseFile();

			curr_blobIndex++;
			curr_fileHasTrack = false;

			var Resolver = IN_CueContext.Resolver;

			//TODO - smart audio file resolving only for AUDIO types. not BINARY or MOTOROLA or AIFF or ECM or what have you

			var options = Resolver.Resolve(f.Path);
			string choice = null;
			if (options.Count == 0)
			{
				Error(string.Format("Couldn't resolve referenced cue file: {0} ; you can commonly repair the cue file yourself, or a file might be missing", f.Path));
				//add a null entry to keep the count from being wrong later (quiets a warning)
				OUT_CompiledCueFiles.Add(null);
				return;
			}
			else
			{
				choice = options[0];
				if (options.Count > 1)
					Warn("Multiple options resolving referenced cue file; choosing: " + Path.GetFileName(choice));
			}

			var cfi = new CompiledCueFile();
			OUT_CompiledCueFiles.Add(cfi);

			cfi.FullPath = choice;

			//determine the CueFileInfo's type, based on extension and extra checking
			//TODO - once we reorganize the file ID stuff, do legit checks here (this is completely redundant with the fileID system
			//TODO - decode vs stream vs unpossible policies in input policies object (including ffmpeg availability-checking callback (results can be cached))
			string blobPathExt = Path.GetExtension(choice).ToUpperInvariant();
			if (blobPathExt == ".BIN" || blobPathExt == ".IMG") cfi.Type = CompiledCueFileType.BIN;
			else if (blobPathExt == ".ISO") cfi.Type = CompiledCueFileType.BIN;
			else if (blobPathExt == ".WAV")
			{
				//quickly, check the format. turn it to DecodeAudio if it can't be supported
				//TODO - fix exception-throwing inside
				//TODO - verify stream-disposing semantics
				var fs = File.OpenRead(choice);
				using (var blob = new Disc.Blob_WaveFile())
				{
					try
					{
						blob.Load(fs);
						cfi.Type = CompiledCueFileType.WAVE;
					}
					catch
					{
						cfi.Type = CompiledCueFileType.DecodeAudio;
					}
				}
			}
			else if (blobPathExt == ".APE") cfi.Type = CompiledCueFileType.DecodeAudio;
			else if (blobPathExt == ".MP3") cfi.Type = CompiledCueFileType.DecodeAudio;
			else if (blobPathExt == ".MPC") cfi.Type = CompiledCueFileType.DecodeAudio;
			else if (blobPathExt == ".FLAC") cfi.Type = CompiledCueFileType.DecodeAudio;
			else if (blobPathExt == ".ECM")
			{
				cfi.Type = CompiledCueFileType.ECM;
				if (!Disc.Blob_ECM.IsECM(choice))
				{
					Error("an ECM file was specified or detected, but it isn't a valid ECM file: " + Path.GetFileName(choice));
					cfi.Type = CompiledCueFileType.Unknown;
				}
			}
			else
			{
				Error("Unknown cue file type. Since it's likely an unsupported compression, this is an error: ", Path.GetFileName(choice));
				cfi.Type = CompiledCueFileType.Unknown;
			}

			//TODO - check for mismatches between track types and file types, or is that best done when interpreting the commands?
		}
Exemplo n.º 5
0
		void OpenTrack(CUE_File.Command.TRACK trackCommand)
		{
			//assert that a file is open
			if(curr_file == null)
			{
				Error("Track command encountered with no active file");
				throw new DiscJobAbortException();
			}

			curr_track = new CompiledCueTrack();

			//spill cdtext data into this track
			curr_cdtext = curr_track.CDTextData;
		
			curr_track.BlobIndex = curr_blobIndex;
			curr_track.Number = trackCommand.Number;
			curr_track.TrackType = trackCommand.Type;

			//default flags
			if (curr_track.TrackType != CueTrackType.Audio)
				curr_track.Flags = CueTrackFlags.DATA;

			if (!curr_fileHasTrack)
			{
				curr_fileHasTrack = curr_track.IsFirstInFile = true;
			}

			UpdateDiscInfo(trackCommand);
		}