示例#1
0
        // Process a RIFF chunk element (skip the data)
        public void ProcessChunk(RiffParser rp, int FourCC, int length, int paddedLength)
        {
            string type = RiffParser.FromFourCC(FourCC);

            Debug.WriteLine("Found chunk element of type \"" +
                            type + "\" and length " + length.ToString());

            if (type.Trim() == "fmt")
            {
                BinaryReader br = new BinaryReader(rp.m_stream);


                var format     = br.ReadUInt16();
                var channels   = br.ReadUInt16();
                var sampleRate = br.ReadUInt32();
                var bytePerSec = br.ReadUInt32();
                var blockSize  = br.ReadUInt16();
                var bit        = br.ReadUInt16();

                Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    this.Info.Text = $"{channels} channels / {sampleRate} hz / {bit} bit / {bytePerSec} bytes/sec";
                });

                rp.SkipData(paddedLength - 16);
            }
            else
            {
                // Skip data and update bytesleft
                rp.SkipData(paddedLength);
            }
        }
示例#2
0
        /// <summary>
        /// Handle chunk elements found in the AVI file. Ignores unknown chunks and
        /// </summary>
        /// <param name="rp"></param>
        /// <param name="FourCC"></param>
        /// <param name="unpaddedLength"></param>
        /// <param name="paddedLength"></param>
        private void ProcessAVIChunk(RiffParser rp, int FourCC, int unpaddedLength, int paddedLength)
        {
            if (AviRiffData.ckidMainAVIHeader == FourCC)
            {
                // Main AVI header
                DecodeAVIHeader(rp, unpaddedLength, paddedLength);
            }
            else if (AviRiffData.ckidAVIStreamHeader == FourCC)
            {
                // Stream header
                DecodeAVIStream(rp, unpaddedLength, paddedLength);
            }
            else if (AviRiffData.ckidAVIISFT == FourCC)
            {
                Byte[] ba = new byte[paddedLength];
                rp.ReadData(ba, 0, paddedLength);
                StringBuilder sb = new StringBuilder(unpaddedLength);
                for (int i = 0; i < unpaddedLength; ++i)
                {
                    if (0 != ba[i])
                    {
                        sb.Append((char)ba[i]);
                    }
                }

                m_isft = sb.ToString();
            }
            else
            {
                // Unknon chunk - skip
                rp.SkipData(paddedLength);
            }
        }
示例#3
0
 private void ProcessWaveChunk(RiffParser rp, int FourCC, int unpaddedLength, int length)
 {
     // Is this a 'fmt' chunk?
     if (AviRiffData.ckidWaveFMT == FourCC)
     {
         DecodeWave(rp, length);
     }
     else
     {
         rp.SkipData(length);
     }
 }
示例#4
0
        /// <summary>
        /// Handle List elements found in the AVI file. Ignores unknown lists and recursively looks
        /// at the content of known lists.
        /// </summary>
        /// <param name="rp"></param>
        /// <param name="FourCC"></param>
        /// <param name="length"></param>
        private void ProcessAVIList(RiffParser rp, int FourCC, int length)
        {
            RiffParser.ProcessChunkElement pac = new RiffParser.ProcessChunkElement(ProcessAVIChunk);
            RiffParser.ProcessListElement  pal = new RiffParser.ProcessListElement(ProcessAVIList);

            // Is this the header?
            if ((AviRiffData.ckidAVIHeaderList == FourCC) ||
                (AviRiffData.ckidAVIStreamList == FourCC) ||
                (AviRiffData.ckidINFOList == FourCC))
            {
                while (length > 0)
                {
                    if (false == rp.ReadElement(ref length, pac, pal))
                    {
                        break;
                    }
                }
            }
            else
            {
                // Unknown lists - ignore
                rp.SkipData(length);
            }
        }
示例#5
0
 private void ProcessCDRList(RiffParser rp, int FourCC, int length)
 {
     Console.WriteLine(String.Format("LIST:{0:s}", RiffParser.FromFourCC(FourCC)));
     rp.SkipData(length);
 }
示例#6
0
 private void ProcessCDRChunk(RiffParser rp, int FourCC, int unpaddedLength, int length)
 {
     Console.WriteLine(String.Format("Chunk:{0:s}", RiffParser.FromFourCC(FourCC)));
     rp.SkipData(length);
 }
示例#7
0
 /// <summary>
 /// Default list element handler - skip the entire list
 /// </summary>
 /// <param name="rp"></param>
 /// <param name="FourCC"></param>
 /// <param name="length"></param>
 private void ProcessList(RiffParser rp, int FourCC, int length)
 {
     rp.SkipData(length);
 }
示例#8
0
 /// <summary>
 /// Defaulkt chunk handler - skip chunk data
 /// </summary>
 /// <param name="rp"></param>
 /// <param name="FourCC"></param>
 /// <param name="unpaddedLength"></param>
 /// <param name="paddedLength"></param>
 private void ProcessChunk(RiffParser rp, int FourCC, int unpaddedLength, int paddedLength)
 {
     rp.SkipData(paddedLength);
 }