Пример #1
0
        public static bool Check(int frequency, int channel, byte[] bs)
        {
            try
            {
                var aac = new AAC_ADTS(bs);
                if (aac.Syncword != 0xfff)
                {
                    return(false);
                }
                if (aac.AACDataLen != aac.GetAACData().Length)
                {
                    return(false);
                }
                var frequencys = new int[] { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 2000, 11025 };

                if (frequencys[aac.MPEG_4_Sampling_Frequency_Index] != frequency)
                {
                    return(false);
                }

                if (aac.MPEG_4_Channel_Configuration != channel)
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #2
0
        public static AAC_ADTS[] GetMultiAAC(byte[] bs)
        {
            var ms   = new MemoryStream(bs);
            var aacs = new List <AAC_ADTS>();

            while (ms.Position + 7 < ms.Length)
            {
                var aac = new AAC_ADTS(ms);
                aacs.Add(aac);
            }
            return(aacs.ToArray());
        }