speex (ऑडियो की बेहतर गुणवत्ता के लिए आप अलग थ्रेड में डेटा एन्कोड कर सकते हैं, अपने कैप्चर प्रारूप के अनुसार अपना नमूना आकार बदलें) का उपयोग कर ऑडियोक्यू और एनकोड (वाइड बैंड) का उपयोग कर ऑडियो कैप्चरिंग कोड के लिए कोड है।
ऑडियो प्रारूप
mSampleRate = 16000;
mFormatID = kAudioFormatLinearPCM;
mFramesPerPacket = 1;
mChannelsPerFrame = 1;
mBytesPerFrame = 2;
mBytesPerPacket = 2;
mBitsPerChannel = 16;
mReserved = 0;
mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
कब्जा कॉलबैक
void CAudioCapturer::AudioInputCallback(void *inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inStartTime,
UInt32 inNumberPacketDescriptions,
const AudioStreamPacketDescription *inPacketDescs)
{
CAudioCapturer *This = (CMacAudioCapturer *)inUserData;
int len = 640;
char data[640];
char *pSrc = (char *)inBuffer->mAudioData;
while (len <= inBuffer->mAudioDataByteSize)
{
memcpy(data,pSrc,640);
int enclen = encode(buffer,encBuffer);
len=len+640;
pSrc+=640; // 640 is the frame size for WB in speex (320 short)
}
AudioQueueEnqueueBuffer(This->m_audioQueue, inBuffer, 0, NULL);
}
Speex एनकोडर
int encode(char *buffer,char *pDest)
{
int nbBytes=0;
speex_bits_reset(&encbits);
speex_encode_int(encstate, (short*)(buffer) , &encbits);
nbBytes = speex_bits_write(&encbits, pDest ,640/(sizeof(short)));
return nbBytes;
}
मैं कोशिश की है सभी सुझावों आपने दिया है मैंने भाषण के लिए एफएफएमपीईजी संकलित किया है। कृपया इस लिंक का संदर्भ लें http://stackoverflow.com/questions/22935787/compiling-ffmpeg-to-support-speex-decoding। – user2955351