CM OPUS Decode

The cmOpusDecode is used to decode the audio/x-opus data to audio/x-raw(PCM) data by the OPUS library.


API Instructions

create/destroy

gpointer cm_opus_decode_create(); void cm_opus_decode_destroy(gpointer hd);

start/stop

void cm_opus_decode_start(gpointer hd); void cm_opus_decode_stop(gpointer hd);

parameters

Set the opus decode option. The default rate of the output data is 48000hz, if need other formats, set the caps str1 that decode supports.

/* @caps_str0 The input fomat, "audio/x-opus,channel-mapping-family=0,..." */ void cm_opus_decode_set_caps_str0(gpointer hd, const gchar* caps_str0); /* @caps_str1 The output fomat, "audio/x-raw,rate=x,..." */ void cm_opus_decode_set_caps_str1(gpointer hd, const gchar* caps_str1); /* @return The output format, "audio/x-raw,..." */ const char* cm_opus_decode_get_caps_str(gpointer had); /*The decode parse the audio/x-raw media information done*/ gboolean cm_opus_decode_is_ready(gpointer hd);

data

Use the way 1 or way 2 to input opus data.

others


Demo

Opus PV to PB Demo

Structure

Get opus data and decode it to PCM data.

image-20240520-072042.png

Main codes

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

opusdec-20240520-093316.png

The PCM data can be played on the PC.