CM AAC Encode Pre-record
The cmPrerecAac is an AAC encoder with a cache that is used to encode the audio/x-raw(PCM) data to audio/mpeg(AAC) data by the fdkaac library. It supports set cache duration in seconds for the codec data, mainly used for MP4 records. This is designed for pre-recording.
API Instructions
create/destroy
gpointer cm_prerec_aac_create();
void cm_prerec_aac_destroy(gpointer hd);
start/stop
void cm_prerec_aac_start(gpointer hd);
void cm_prerec_aac_stop(gpointer hd);
parameters
/* @duration Cache time in seconds*/
void cm_prerec_aac_set_duration(gpointer hd, guint64 duration );
/* @return Encode output format, "audio/mpeg,..." */
const char* cm_prerec_aac_get_caps_str(gpointer hd);
data
Demo
Mp4 PreRecord Demo
Structure
Get raw data and use prerecord to encode, then start the mp4 record 3s later.
Main codes
For more details please refer to the demo file.
Test result
The mp4 file can be displayed on the PC, it contains pre-recorded data for about 4s.