A managed representation of the multimedia MPEGLAYER3WAVEFORMATEX structure declared in mmreg.h.
This was designed for usage in an environment where PInvokes are not allowed.
        /// <summary>
        /// Generate a "Codec Private Data" string for an AAC stream (values approximate).
        /// </summary>
        private string GenerateAAC_Private()
        {
            MpegLayer3WaveFormat wfmt = new MpegLayer3WaveFormat();

            wfmt.BitratePaddingMode = 0;
            wfmt.BlockSize          = 312;
            wfmt.CodecDelay         = 0;
            wfmt.FramesPerBlock     = 1;
            wfmt.Id = 1;

            wfmt.WaveFormatExtensible = new WaveFormatExtensible();
            wfmt.WaveFormatExtensible.AverageBytesPerSecond = 96000 / 8;
            wfmt.WaveFormatExtensible.BitsPerSample         = 0;
            wfmt.WaveFormatExtensible.BlockAlign            = 1;
            wfmt.WaveFormatExtensible.Channels      = 1;
            wfmt.WaveFormatExtensible.FormatTag     = 0xFF;
            wfmt.WaveFormatExtensible.SamplesPerSec = 44100;
            wfmt.WaveFormatExtensible.Size          = 12;

            return(wfmt.ToHexString());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generate a "Codec Private Data" string for an MP3 stream (values approximate).
        /// </summary>
        private string GenerateMP3_Private()
        {
            MpegLayer3WaveFormat wfmt = new MpegLayer3WaveFormat();
            wfmt.BitratePaddingMode = 0;
            wfmt.BlockSize = 312;
            wfmt.CodecDelay = 0;
            wfmt.FramesPerBlock = 1;
            wfmt.Id = 1;

            wfmt.WaveFormatExtensible = new WaveFormatExtensible();
            wfmt.WaveFormatExtensible.AverageBytesPerSecond = 96000 / 8;
            wfmt.WaveFormatExtensible.BitsPerSample = 0;
            wfmt.WaveFormatExtensible.BlockAlign = 1;
            wfmt.WaveFormatExtensible.Channels = 1;
            wfmt.WaveFormatExtensible.FormatTag = 85;
            wfmt.WaveFormatExtensible.SamplesPerSec = 44100;
            wfmt.WaveFormatExtensible.Size = 12;

            return wfmt.ToHexString();
        }