Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm newbie in iPhone programming and i need some help. I'm writing an application which should record audio and video data simultaneously but to different targets because i need to process audio data separately.

So i tried several ways of implementing this and decided to do it with AVFoundation.

The problem is i really don't know how to save output audio data to a file by my own.. What format and other properties should i use for it..

I set up audio input for AVCaptureSession and receive audio data in the following way:

- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
       fromConnection:(AVCaptureConnection *)connection
{
    AudioBufferList audioBufferList;
    CMBlockBufferRef blockBuffer;

    // Here i get AudioBufferList to save audio data
    CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer(
                                                            sampleBuffer, 
                                                            NULL, 
                                                            &audioBufferList, 
                                                            sizeof(audioBufferList), 
                                                            NULL, 
                                                            NULL, 
                                                            0, 
                                                            &blockBuffer);

    // Here should be saving logic
}


Could you please to give me a hint of how it can be implemented and in what way should i look?

Thanx in advance, Jan.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900