コード例 #1
0
 public AVIStream(AVIStreamType type, int streamID)
 {
     Type        = type;
     FourCC      = AVIHelper.StreamFourCC(streamID, AVIHelper.StreamTwoCC(type), false);
     FormatExtra = new byte[0];
     ChunkList   = new List <StreamChunkInfo>();
 }
コード例 #2
0
 public AVIStream(AVIStreamType type)
 {
     Type         = type;
     FormatExtra  = new byte[0];
     ChunkList    = new List <StreamChunkInfo>();
     ChunkIndex   = 0;
     IsFirstChunk = true;
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        public static string StreamTwoCC(AVIStreamType streamType)
        {
            switch (streamType)
            {
            case AVIStreamType.Video:
                return("dc");

            case AVIStreamType.Audio:
                return("wb");

            default:
                return("xx");
            }
        }
コード例 #5
0
        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);
            }
        }