/// <summary> /// Synthesizes a crudely estimated TOCRaw from the disc structure. /// </summary> public void Synthesize_TOCRawFromStructure() { TOCRaw = new DiscTOCRaw(); TOCRaw.FirstRecordedTrackNumber = 1; TOCRaw.LastRecordedTrackNumber = Structure.Sessions[0].Tracks.Count; int lastEnd = 0; for (int i = 0; i < Structure.Sessions[0].Tracks.Count; i++) { var track = Structure.Sessions[0].Tracks[i]; TOCRaw.TOCItems[i + 1].Control = track.Control; TOCRaw.TOCItems[i + 1].Exists = true; //TOCRaw.TOCItems[i + 1].LBATimestamp = new Timestamp(track.Start_ABA - 150); //AUGH. see comment in Start_ABA //TOCRaw.TOCItems[i + 1].LBATimestamp = new Timestamp(track.Indexes[1].LBA); //ZOUNDS! //TOCRaw.TOCItems[i + 1].LBATimestamp = new Timestamp(track.Indexes[1].LBA + 150); //WHATEVER, I DONT KNOW. MAKES IT MATCH THE CCD, BUT THERES MORE PROBLEMS TOCRaw.TOCItems[i + 1].LBATimestamp = new Timestamp(track.Indexes[1].LBA); //WHAT?? WE NEED THIS AFTER ALL! ZOUNDS MEANS, THERE WAS JUST SOME OTHER BUG lastEnd = track.LengthInSectors + track.Indexes[1].LBA; } TOCRaw.LeadoutTimestamp = new Timestamp(lastEnd); }
public void Run() { SynthesizeFromRawTOCEntriesJob job = this; DiscTOCRaw ret = new DiscTOCRaw(); //just in case this doesnt get set... ret.FirstRecordedTrackNumber = 0; ret.LastRecordedTrackNumber = 0; int maxFoundTrack = 0; foreach (var te in job.Entries) { var q = te.QData; int point = q.q_index; //see ECMD-394 page 5-14 for info about point = 0xA0, 0xA1, 0xA2 if (point == 0x00) { job.Log.Add("unexpected POINT=00 in lead-in Q-channel"); } else if (point <= 99) { maxFoundTrack = Math.Max(maxFoundTrack, point); ret.TOCItems[point].LBATimestamp = q.AP_Timestamp; ret.TOCItems[point].Control = q.CONTROL; ret.TOCItems[point].Exists = true; } else if (point == 0xA0) { ret.FirstRecordedTrackNumber = q.ap_min.DecimalValue; if (q.ap_frame.DecimalValue != 0) { job.Log.Add("PFRAME should be 0 for POINT=0xA0"); } if (q.ap_sec.DecimalValue == 0x00) { ret.Session1Format = DiscTOCRaw.SessionFormat.Type00_CDROM_CDDA; } else if (q.ap_sec.DecimalValue == 0x10) { ret.Session1Format = DiscTOCRaw.SessionFormat.Type10_CDI; } else if (q.ap_sec.DecimalValue == 0x20) { ret.Session1Format = DiscTOCRaw.SessionFormat.Type20_CDXA; } else { job.Log.Add("Unrecognized session format: PSEC should be one of {0x00,0x10,0x20} for POINT=0xA0"); } } else if (point == 0xA1) { ret.LastRecordedTrackNumber = q.ap_min.DecimalValue; if (q.ap_sec.DecimalValue != 0) { job.Log.Add("PSEC should be 0 for POINT=0xA1"); } if (q.ap_frame.DecimalValue != 0) { job.Log.Add("PFRAME should be 0 for POINT=0xA1"); } } else if (point == 0xA2) { ret.LeadoutTimestamp = q.AP_Timestamp; } } //this is speculative: //well, nothing to be done here.. if (ret.FirstRecordedTrackNumber == 0) { } if (ret.LastRecordedTrackNumber == 0) { ret.LastRecordedTrackNumber = maxFoundTrack; } job.Result = ret; }
public void Run() { SynthesizeFromRawTOCEntriesJob job = this; DiscTOCRaw ret = new DiscTOCRaw(); //just in case this doesnt get set... ret.FirstRecordedTrackNumber = 0; ret.LastRecordedTrackNumber = 0; int maxFoundTrack = 0; foreach (var te in job.Entries) { var q = te.QData; int point = q.q_index; //see ECMD-394 page 5-14 for info about point = 0xA0, 0xA1, 0xA2 if (point == 0x00) job.Log.Add("unexpected POINT=00 in lead-in Q-channel"); else if (point <= 99) { maxFoundTrack = Math.Max(maxFoundTrack, point); ret.TOCItems[point].LBATimestamp = q.AP_Timestamp; ret.TOCItems[point].Control = q.CONTROL; ret.TOCItems[point].Exists = true; } else if (point == 0xA0) { ret.FirstRecordedTrackNumber = q.ap_min.DecimalValue; if (q.ap_frame.DecimalValue != 0) job.Log.Add("PFRAME should be 0 for POINT=0xA0"); if (q.ap_sec.DecimalValue == 0x00) ret.Session1Format = DiscTOCRaw.SessionFormat.Type00_CDROM_CDDA; else if (q.ap_sec.DecimalValue == 0x10) ret.Session1Format = DiscTOCRaw.SessionFormat.Type10_CDI; else if (q.ap_sec.DecimalValue == 0x20) ret.Session1Format = DiscTOCRaw.SessionFormat.Type20_CDXA; else job.Log.Add("Unrecognized session format: PSEC should be one of {0x00,0x10,0x20} for POINT=0xA0"); } else if (point == 0xA1) { ret.LastRecordedTrackNumber = q.ap_min.DecimalValue; if (q.ap_sec.DecimalValue != 0) job.Log.Add("PSEC should be 0 for POINT=0xA1"); if (q.ap_frame.DecimalValue != 0) job.Log.Add("PFRAME should be 0 for POINT=0xA1"); } else if (point == 0xA2) { ret.LeadoutTimestamp = q.AP_Timestamp; } } //this is speculative: //well, nothing to be done here.. if (ret.FirstRecordedTrackNumber == 0) { } if (ret.LastRecordedTrackNumber == 0) { ret.LastRecordedTrackNumber = maxFoundTrack; } job.Result = ret; }