Esempio n. 1
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.Wave )
			{
				MMChunk ck = new WaveChunk(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;
		}
Esempio n. 2
0
		public MMChunk FindChunk(FourCC fcc)
		{
			foreach(MMChunk ck in m_chunkList)
			{
				if ( ck.FourCC == fcc )
				{
					return ck;
				}
			}
			return null;
		}
Esempio n. 3
0
		public MMChunk(FourCC fourCC, Stream st)
		{
			m_fourCC = fourCC;
			m_nSize = 0;
			m_bDirty = false;
			m_str = st;
			m_posCurrent = st.Position;
			m_posStart = st.Position;
			m_chunkList = new ArrayList();
			m_ckType = ChunkType.Riff;
		}
Esempio n. 4
0
 public MMChunk(FourCC fourCC, Stream st)
 {
     m_fourCC     = fourCC;
     m_nSize      = 0;
     m_bDirty     = false;
     m_str        = st;
     m_posCurrent = st.Position;
     m_posStart   = st.Position;
     m_chunkList  = new ArrayList();
     m_ckType     = ChunkType.Riff;
 }
Esempio n. 5
0
 public MMChunk FindChunk(FourCC fcc)
 {
     foreach (MMChunk ck in m_chunkList)
     {
         if (ck.FourCC == fcc)
         {
             return(ck);
         }
     }
     return(null);
 }
Esempio n. 6
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));
     }
 }
Esempio n. 7
0
        public override MMChunk CreateSubChunk(FourCC fourCC, Stream st)
        {
            MMChunk ck   = base.CreateSubChunk(fourCC, st);
            int     size = 0;

            foreach (MMChunk cck in m_chunkList)
            {
                if (cck != ck)
                {
                    size += cck.GetSize();
                }
            }
            ck.SetStart(m_posStart + 4 + size);
            return(ck);
        }
Esempio n. 8
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.Wave)
            {
                WaveChunk ck = new WaveChunk(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
            {
                return(new MMChunk(fourCC, st));
            }
        }
Esempio n. 9
0
 public _RiffChunk(FourCC fourCC, Stream st) : base(fourCC, st)
 {
     m_ckType = ChunkType.Riff;
 }
Esempio n. 10
0
 public ListChunk(FourCC fourCC, Stream st) : base(fourCC, st)
 {
     m_ckType = ChunkType.List;
 }
Esempio n. 11
0
		public _RiffChunk(FourCC fourCC, Stream st): base(fourCC, st)
		{
			m_ckType = ChunkType.Riff;
		}