From 92bf4781a11300ad51c9c1b2a8c8d096322570e9 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 2 Oct 2015 01:23:47 +0100 Subject: [PATCH] Added Q Mode 4 (CD-Video). --- ChangeLog | 5 ++++ Program.cs | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/ChangeLog b/ChangeLog index a263b71..a747379 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-10-02 Natalia Portillo + + * Program.cs: + Added Q Mode 4 (CD-Video). + 2015-10-02 Natalia Portillo * CD+G.cs: diff --git a/Program.cs b/Program.cs index cb33a5e..c14bad9 100644 --- a/Program.cs +++ b/Program.cs @@ -35,6 +35,7 @@ namespace SubChannelDecoder const int QMode1 = 0x01; const int QMode2 = 0x02; const int QMode3 = 0x03; + const int QMode4 = 0x04; const int QMode5 = 0x05; static readonly char[] ISRCTable = @@ -412,6 +413,83 @@ namespace SubChannelDecoder Console.WriteLine("ISRC: {0}", new string(isrc)); Console.WriteLine("\tAbsolute Frame {0:X2}", q[9]); } + else if ((q[0] & 0x0F) == QMode4) + { + Console.WriteLine("Q Mode 1: CD-Video"); + if (q[1] == 0x00) + { + Console.WriteLine("\tLead-in"); + + Console.WriteLine("\tRelative Address {0:X2}:{1:X2}:{2:X2}", q[3], q[4], q[5]); + + switch (q[2]) + { + case 0xA0: + { + Console.WriteLine("\tFirst video track is track {0:X2}", q[7]); + switch (q[9]) + { + case 10: + Console.WriteLine("\tDisc type: {0}", "NTSC video single with stereo sound"); + break; + case 11: + Console.WriteLine("\tDisc type: {0}", "NTSC video single with bilingual sound"); + break; + case 12: + Console.WriteLine("\tDisc type: {0}", "NTSC LV disc with stereo sound"); + break; + case 13: + Console.WriteLine("\tDisc type: {0}", "NTSC LV disc with bilingual sound"); + break; + case 20: + Console.WriteLine("\tDisc type: {0}", "PAL video single with stereo sound"); + break; + case 21: + Console.WriteLine("\tDisc type: {0}", "PAL video single with bilingual sound"); + break; + case 22: + Console.WriteLine("\tDisc type: {0}", "PAL LV disc with stereo sound"); + break; + case 23: + Console.WriteLine("\tDisc type: {0}", "PAL LV disc with bilingual sound"); + break; + default: + Console.WriteLine("\tUnknown disc type: {0}", q[9]); + break; + } + break; + } + case 0xA1: + { + Console.WriteLine("\tLast video track is track {0:X2}", q[7]); + break; + } + case 0xA2: + { + Console.WriteLine("\tLead-Out starts at Address {0:X2}:{1:X2}:{2:X2}", q[7], q[8], q[9]); + break; + } + default: + { + Console.WriteLine("\tVideo track {0:X}", q[2]); + Console.WriteLine("\tTrack Starting Address {0:X2}:{1:X2}:{2:X2}", q[7], q[8], q[9]); + break; + } + } + } + else + { + if (q[1] == 0xAA) + Console.WriteLine("\tLead-out"); + else + Console.WriteLine("\tTrack {0:X}", q[1]); + + Console.WriteLine("\tIndex {0:X}", q[2]); + Console.WriteLine("\tRelative Address {0:X2}:{1:X2}:{2:X2}", q[3], q[4], q[5]); + + Console.WriteLine("\tAbsolute Video Address {0:X2}:{1:X2}:{2:X2}", q[7], q[8], q[9]); + } + } else if ((q[0] & 0x0F) == QMode5) { Console.WriteLine("Q Mode 5: Recordable information");