how to determin if it is mp3 or wav format of audio from GstCaps * caps from coming rtsp streaming

Michael Gruner michael.gruner at
Wed Feb 8 22:38:39 UTC 2023


Maybe something like the following:

//Grab the first (and likely only) structure in the caps
GstStructure *st = gst_caps_get_structure (caps, 0); 

// Test if it is WAV
gboolean is_wav = gst_structure_has_name (st, “audio/x-wav”);

// Test if it is MP3
gboolean is_mpeg = gst_structure_has_name (st, “audio/mpeg”);

gint mpeg_layer;
gst_structure_get_int (st, “layer”, &mpeg_layer);

gboolean is_mp3 = is_mpeg && mpeg_layer == 3;

Or you could use decodebin which will automatically choose the correct decoder for you.


> On 8 Feb 2023, at 14:13, cfd new via gstreamer-devel <gstreamer-devel at> wrote:
> need to set the right audio decoder for it. 
>    Thanks for your help,
>    Joe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list