/// <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.MainAviHeader == fourCc) { DecodeAviHeader(rp, paddedLength); // Main AVI header } else if (AviRiffData.AviStreamHeader == fourCc) { DecodeAviStream(rp, paddedLength); // Stream header } else if (AviRiffData.AviIsft == fourCc) { var ba = new byte[paddedLength]; rp.ReadData(ba, 0, paddedLength); var sb = new StringBuilder(unpaddedLength); for (int i = 0; i < unpaddedLength; ++i) { if (0 != ba[i]) { sb.Append((char)ba[i]); } } _isft = sb.ToString(); } else { rp.SkipData(paddedLength); // Unknown chunk - skip } }
/// <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, paddedLength); } else if (AviRiffData.ckidAVIStreamHeader == FourCC) { // Stream header DecodeAVIStream(rp, 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); } }
private void ProcessWaveChunk(RiffParser rp, int fourCc, int unpaddedLength, int length) { // Is this a 'fmt' chunk? if (AviRiffData.WaveFmt == fourCc) { DecodeWave(rp, length); } else { rp.SkipData(length); } }
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); } }
/// <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 = ProcessAviChunk; RiffParser.ProcessListElement pal = ProcessAviList; // Is this the header? if (AviRiffData.AviHeaderList == fourCc || AviRiffData.AviStreamList == fourCc || AviRiffData.InfoList == fourCc) { while (length > 0) { if (false == rp.ReadElement(ref length, pac, pal)) { break; } } } else { rp.SkipData(length); // Unknown lists - ignore } }
/// <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 = ProcessAVIChunk; RiffParser.ProcessListElement pal = 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); } }
/// <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 = ProcessAVIChunk; RiffParser.ProcessListElement pal = 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); } }
/// <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, paddedLength); } else if (AviRiffData.ckidAVIStreamHeader == FourCC) { // Stream header DecodeAVIStream(rp, 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); } }
/// <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); }
/// <summary> /// Default list element handler - skip the entire list /// </summary> /// <param name="rp"></param> /// <param name="fourCc"></param> /// <param name="length"></param> private static void ProcessList(RiffParser rp, int fourCc, int length) { rp.SkipData(length); }