private int ReadHeaderTest(string flacFilePath)
        {
            StartChildProcess();
            SendString("H");
            SendBase64(flacFilePath);

            System.Console.WriteLine("ReadHeaderTest({0}) started", flacFilePath);

            int rv = br.ReadInt32();
            if (rv != 0) {
                StopChildProcess();
                return rv;
            }

            int  nChannels     = br.ReadInt32();
            int  bitsPerSample = br.ReadInt32();
            int  sampleRate    = br.ReadInt32();
            long numFrames     = br.ReadInt64();
            int  numFramesPerBlock = br.ReadInt32();

            string titleStr = br.ReadString();
            string albumStr = br.ReadString();
            string artistStr = br.ReadString();

            int pictureBytes = br.ReadInt32();
            byte[] pictureData = new byte[0];
            if (0 < pictureBytes) {
                br.ReadBytes(pictureBytes);
            }

            var cuesheetTracks = new List<CuesheetTrackInfo>();
            {
                int numCuesheetTracks = br.ReadInt32();
                for (int trackId=0; trackId < numCuesheetTracks; ++trackId) {
                    var cti = new CuesheetTrackInfo();
                    cti.trackNr = br.ReadInt32();
                    cti.offsetSamples = br.ReadInt64();

                    int numCuesheetTrackIndices = br.ReadInt32();
                    for (int indexId=0; indexId < numCuesheetTrackIndices; ++indexId) {
                        var indexInfo = new CuesheetTrackIndexInfo();
                        indexInfo.indexNr = br.ReadInt32();
                        indexInfo.offsetSamples = br.ReadInt64();
                        cti.indices.Add(indexInfo);
                    }
                    cuesheetTracks.Add(cti);
                }
            }

            System.Console.WriteLine("ReadHeaderTest() completed. nChannels={0} bitsPerSample={1} sampleRate={2} numFrames={3} numFramesPerBlock={4}",
                nChannels, bitsPerSample, sampleRate, numFrames, numFramesPerBlock);

            System.Console.WriteLine("TITLE={0}", titleStr);
            System.Console.WriteLine("ALBUM={0}", albumStr);
            System.Console.WriteLine("ARTIST={0}", artistStr);

            StopChildProcess();
            return 0;
        }
Example #2
0
        private int ReadHeaderTest(string flacFilePath)
        {
            StartChildProcess();
            SendString("H");
            SendBase64(flacFilePath);

            System.Console.WriteLine("ReadHeaderTest({0}) started", flacFilePath);

            int rv = br.ReadInt32();

            if (rv != 0)
            {
                StopChildProcess();
                return(rv);
            }

            int  nChannels         = br.ReadInt32();
            int  bitsPerSample     = br.ReadInt32();
            int  sampleRate        = br.ReadInt32();
            long numFrames         = br.ReadInt64();
            int  numFramesPerBlock = br.ReadInt32();

            string titleStr  = br.ReadString();
            string albumStr  = br.ReadString();
            string artistStr = br.ReadString();

            int pictureBytes = br.ReadInt32();

            byte[] pictureData = new byte[0];
            if (0 < pictureBytes)
            {
                br.ReadBytes(pictureBytes);
            }

            var cuesheetTracks = new List <CuesheetTrackInfo>();

            {
                int numCuesheetTracks = br.ReadInt32();
                for (int trackId = 0; trackId < numCuesheetTracks; ++trackId)
                {
                    var cti = new CuesheetTrackInfo();
                    cti.trackNr       = br.ReadInt32();
                    cti.offsetSamples = br.ReadInt64();

                    int numCuesheetTrackIndices = br.ReadInt32();
                    for (int indexId = 0; indexId < numCuesheetTrackIndices; ++indexId)
                    {
                        var indexInfo = new CuesheetTrackIndexInfo();
                        indexInfo.indexNr       = br.ReadInt32();
                        indexInfo.offsetSamples = br.ReadInt64();
                        cti.indices.Add(indexInfo);
                    }
                    cuesheetTracks.Add(cti);
                }
            }

            System.Console.WriteLine("ReadHeaderTest() completed. nChannels={0} bitsPerSample={1} sampleRate={2} numFrames={3} numFramesPerBlock={4}",
                                     nChannels, bitsPerSample, sampleRate, numFrames, numFramesPerBlock);

            System.Console.WriteLine("TITLE={0}", titleStr);
            System.Console.WriteLine("ALBUM={0}", albumStr);
            System.Console.WriteLine("ARTIST={0}", artistStr);

            StopChildProcess();
            return(0);
        }