This is wrong. Stereo pair encoded as channel_pair_element will stay the same in 5.1 configuration as it was in 2.0 configuration. You will only need to tell the decoder where to send the channels, to front or back pair, and that will be stated in the new header.
Also wrong. Frames are the same size. Be it a long or a short block, decoding one frame always produces 1024 samples at its output. The "short block" is in fact 8 short blocks.[{POST_SNAPBACK}][/a]
I am sorry, it is my memory fault. Daniel, you are right, the channel configuration is part of the header such that inner block issues are not relevant.
Conclusion: It is possible to create a standard 5.1ch aac stream from 4 separate HE-AAC streams. The 5.1 channel configuration inside the stream is then a sequence of middle; front; rear; lfe. The channel configuration field is then: <single_channel_element><channel_pair_element><channel_pair_element><lfe_channel_element><END>
This kind of muxing tool has a very easy implementation.
Regards,
Oki
[a href="index.php?act=findpost&pid=326449"][{POST_SNAPBACK}][/a]
short bufFront[BUF_SIZE];
short bufBack[BUF_SIZE];
short bufCenter[BUF_SIZE];
short bufLFE[BUF_SIZE];
int i;
char* pAAC = (void*) aacBuf;
// Split
for(i=0; i<nBlockSize; i++)
{
/*
default: Center is third and LFE is fourth like in 5.1 WAV
*/
bufFront[i*2] = g_aBuf[i*6+0];
bufFront[i*2+1] = g_aBuf[i*6+1];
bufCenter[i] = g_aBuf[i*6+2];
bufLFE[i] = g_aBuf[i*6+3];
bufBack[i*2] = g_aBuf[i*6+4];
bufBack[i*2+1] = g_aBuf[i*6+5];
}
nSize = 0;
/*
Conclusion:
It is possible to create a standard 5.1ch aac stream from 4 separate HE-AAC streams.
The 5.1 channel configuration inside the stream is then a sequence of
middle; front; rear; lfe.
The channel configuration field is then:
<single_channel_element>
<channel_pair_element>
<channel_pair_element>
<lfe_channel_element>
<END>
*/
Encoder_EncodeBlock(g_encoderCenter, bufCenter, pAAC, &i);
nSize+=i;
pAAC+=i;
Encoder_EncodeBlock(g_encoderFront, bufFront, pAAC, &i);
nSize+=i;
pAAC+=i;
Encoder_EncodeBlock(g_encoderBack, bufBack, pAAC, &i);
nSize+=i;
pAAC+=i;
Encoder_EncodeBlock(g_encoderLFE, bufLFE, pAAC, &i);
nSize+=i;
pAAC+=i;
MP4FileAddFrame( hMp4File,
aacBuf,
nSize );
produce unplayable file
[a href="http://sr1.mytempdir.com/165118]http://sr1.mytempdir.com/165118[/url]