public AVIStream(AVIStreamType type, int streamID) { Type = type; FourCC = AVIHelper.StreamFourCC(streamID, AVIHelper.StreamTwoCC(type), false); FormatExtra = new byte[0]; ChunkList = new List <StreamChunkInfo>(); }
public AVIStream(AVIStreamType type) { Type = type; FormatExtra = new byte[0]; ChunkList = new List <StreamChunkInfo>(); ChunkIndex = 0; IsFirstChunk = true; }
public int AddStream(AVIStreamType type) { int streamID = _streamList.Count; if ((type == AVIStreamType.Video) && (_videoStreamID == -1)) { _videoStreamID = streamID; } _streamList.Add(new AVIStream(type, streamID)); return(streamID); }
public static string StreamTwoCC(AVIStreamType streamType) { switch (streamType) { case AVIStreamType.Video: return("dc"); case AVIStreamType.Audio: return("wb"); default: return("xx"); } }
public void Write(string path) { if (!_ranPreview) { Preview(); } _aviWriter = new AVIWriter(path); // Set up the streams for the new file _needsTwoCC = new bool[_aviReader.StreamCount]; for (int i = 0; i < _aviReader.StreamCount; i++) { AVIStreamType streamType = _aviReader.GetStreamType(i); _aviWriter.AddStream(streamType); _aviWriter.SetStreamHeader(i, _aviReader.GetStreamHeader(i)); if (streamType == AVIStreamType.Video) { _aviWriter.SetStreamFormat(i, _aviReader.GetVideoStreamFormat(i)); } else if (streamType == AVIStreamType.Audio) { _aviWriter.SetStreamFormat(i, _aviReader.GetAudioStreamFormat(i)); } _aviWriter.SetStreamFormatExtra(i, _aviReader.GetStreamFormatExtra(i)); _aviWriter.SetStreamName(i, _aviReader.GetStreamName(i)); _needsTwoCC[i] = true; } try { Run(true); } catch { _aviWriter.Close(); File.Delete(path); throw; } _aviWriter.Close(); if (_wasStopped) { File.Delete(path); } }