CM AAC Encode

The cmAacEncode is used to encode the audio/x-raw(PCM) data to audio/mpeg(AAC) data by the library fdkaac.


API Instructions

create/destroy

gpointer cm_aac_encode_create(); void cm_aac_encode_destroy(gpointer hd);

start/stop

void cm_aac_encode_start(gpointer hd); void cm_aac_encode_stop(gpointer hd);

parameters

/* @format Aac encode format, supports adts, adif, raw */ void cm_aac_encode_set_stream_format(gpointer hd, const char* format); /* @br The aac bitrate */ void cm_aac_encode_set_bitrate(gpointer hd, int br); /* @return Encode output format, "audio/mpeg,..." */ const char* cm_aac_encode_get_caps_str(gpointer hd);

data

The encoder needs to know the actual format of the input before encoding, so must ensure the source is ready to be linked(the media info is ready).

others


Demo

Aac Encode Demo

Structure

Get raw data from the microphone then encode it to AAC.

image-20240520-071617.png

Main codes

For more details please refer to the demo file.
Test result

image-20240520-071703.png

The AAC data can be saved to the file and displayed on the PC.