示例#1
0
        /// <summary>
        /// Store the frames of a stream in the KnownStreams cache, adding a new entry if needed.
        /// If there is a file open, then new streams will be refused with an argument exception
        /// </summary>
        private MediaStream CacheStreamFrames(MediaStream SourceStream)
        {
            var dst_stream = KnownStreams.Where(a => a.TrackId == SourceStream.TrackId).FirstOrDefault();

            if (dst_stream == null)               // not a known stream, so add it.
            {
                if (ActiveFile != null)
                {
                    throw new ArgumentException("Can't add new streams to an open file. Try adding your streams first, then open the file once all streams are known", "SourceStream");
                }
                dst_stream         = new MediaStream();
                dst_stream.FourCC  = SourceStream.FourCC;
                dst_stream.Frames  = new List <GenericMediaFrame>(SourceStream.Frames);
                dst_stream.Height  = SourceStream.Height;
                dst_stream.TrackId = SourceStream.TrackId;
                dst_stream.Width   = SourceStream.Width;
                KnownStreams.Add(dst_stream);
            }
            else
            {
                dst_stream.Frames.AddRange(SourceStream.Frames);
            }
            return(dst_stream);
        }
示例#2
0
 /// <summary>
 /// Output a 'moov' atom and it's children as raw data.
 /// </summary>
 private byte[] GenerateMoov()
 {
     HeaderBoxes.moov header = new HeaderBoxes.moov(KnownStreams.ToArray());
     return(header.deepData());
 }