Created
June 18, 2019 11:19
-
-
Save sabiou/8244860f37e5c4d626bb2aa1d0f6a0a3 to your computer and use it in GitHub Desktop.
MPEG 2 TS ISOMEDIA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addADTStoPacket(byte[] packet, int packetLen) { | |
int profile = 2; //AAC LC //39=MediaCodecInfo.CodecProfileLevel.AACObjectELD; | |
int freqIdx = 4; //44.1KHz | |
int chanCfg = 2; //CPE | |
// fill in ADTS data | |
packet[0] = (byte)0xFF; // conversion hexadecimal a decimal - il y a seize unités de 0 à F, on parle donc d'hexadécimal. | |
packet[1] = (byte)0xF1; // installe l'entete ADTS dans MPEG-2 (0xF1) au lieu de MPEG-4 (0xF9) | |
packet[2] = (byte)(((profile-1)<<6) + (freqIdx<<2) +(chanCfg>>2)); | |
packet[3] = (byte)(((chanCfg&3)<<6) + (packetLen>>11)); | |
packet[4] = (byte)((packetLen&0x7FF) >> 3); | |
packet[5] = (byte)(((packetLen&7)<<5) + 0x1F); | |
packet[6] = (byte)0xFC; // 0xFC est également correct si vous ne connaissez pas la valeur de la plénitude du tampon | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment