示例#1
0
 public MMChunk FindChunk(FourCC fcc)
 {
     foreach (MMChunk ck in m_chunkList)
     {
         if (ck.FourCC == fcc)
         {
             return(ck);
         }
     }
     return(null);
 }
示例#2
0
 public override bool Equals(object obj)
 {
     if (obj is FourCC)
     {
         FourCC fcc = (FourCC)obj;
         //return fcc.m_c1 = c1 && fcc.m_c2 = c2 && fcc.m_c3 = c3 && fcc.m_c4 = c4;
         return(fcc.GetFourCC() == GetFourCC());
     }
     else
     {
         return(base.Equals(obj));
     }
 }
示例#3
0
        public MMChunk(FourCC fourCC, Stream st)
        {
            m_fourCC     = fourCC;
            m_nSize      = 0;
            m_bDirty     = false;
            _stm         = st;
            m_posCurrent = st.Position;
            //m_posStart = st.Position;
            m_chunkList = new ArrayList();

            m_posStart = st.Position;
            //byte[] data = new byte[4];
            //st.Read(data, 0, 4);
            //m_nSize = BitConverter.ToInt32(data, 0);
        }
示例#4
0
        public override MMChunk CreateSubChunk(FourCC fourCC, Stream st)
        {
            MMChunk ck   = base.CreateSubChunk(fourCC, st);
            long    size = 0;

            foreach (MMChunk cck in m_chunkList)
            {
                if (cck != ck)
                {
                    size += cck.Size;
                }
            }
            ck.Start = m_posStart + 4 + size;
            return(ck);
        }
示例#5
0
        static public MMChunk FromStream(Stream st)
        {
            if (!st.CanRead)
            {
                return(null);
            }
            if (st.Position > st.Length - 4)
            {
                return(null);
            }
            byte[] data = new byte[4];
            st.Read(data, 0, 4);
            FourCC fourCC = BitConverter.ToInt32(data, 0);

            if (fourCC == FourCC.Riff)
            {
                RiffChunk ck = new RiffChunk(st);
                ck.LoadFromStream(st);
                return(ck);
            }
            else if (fourCC == FourCC.Fmt)
            {
                FmtChunk ck = new FmtChunk(st, null);
                ck.LoadFromStream(st);
                return(ck);
            }
            else if (fourCC == FourCC.Data)
            {
                DataChunk ck = new DataChunk(st);
                ck.LoadFromStream(st);
                return(ck);
            }
            else
            {
                _RiffChunk ck = new _RiffChunk(fourCC, st);
                ck.LoadFromStream(st);
                return(ck);
            }
        }
示例#6
0
        virtual public MMChunk CreateSubChunk(FourCC fourCC, Stream st)
        {
            if (fourCC == FourCC.Riff)
            {
                MMChunk ck = new RiffChunk(st);
                m_chunkList.Add(ck);
                return(ck);
            }
            else if (fourCC == FourCC.Fmt)
            {
                MMChunk ck = new FmtChunk(st, null);
                m_chunkList.Add(ck);
                return(ck);
            }
            else if (fourCC == FourCC.Data)
            {
                MMChunk ck = new DataChunk(st);
                m_chunkList.Add(ck);
                return(ck);
            }

            return(null);
        }
示例#7
0
 public _RiffChunk(FourCC fourCC, Stream st) : base(fourCC, st)
 {
 }