コード例 #1
0
        /**
         * The code profile, Sample rate, channel Count is used to
         * produce the AAC Codec SpecificData.
         * Android 4.4.2/frameworks/av/media/libstagefright/avc_utils.cpp refer
         * to the portion of the code written.
         * 
         * MPEG-4 Audio refer : http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Audio_Specific_Config
         * 
         * @param audioProfile is MPEG-4 Audio Object Types
         * @param sampleRate
         * @param channelConfig
         * @return MediaFormat
         */
        private MediaFormat makeAACCodecSpecificData(int audioProfile, int sampleRate, int channelConfig)
        {
            MediaFormat format = new MediaFormat();
            format.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm");
            format.setInteger(MediaFormat.KEY_SAMPLE_RATE, sampleRate);
            format.setInteger(MediaFormat.KEY_CHANNEL_COUNT, channelConfig);

            int samplingFreq[] = {