Cannot access audio buffer from probe

Nirbheek Chauhan nirbheek.chauhan at gmail.com
Wed May 18 10:30:05 UTC 2022


On Wed, May 18, 2022 at 10:19 AM Abrar Shahriar
<abrar.shahriar at hiperdyne.com> wrote:
>
> Hi,
>
> Thanks for the info!
>
> Also, I could not find any examples of how to best get the audio buffers( for editing purposes) from a GstBuffer. I did find gst_audio_buffer_map() docs but could not find how to get the input parameters like const GstAudioInfo * info and GstMapFlags flags.
>

You need to fetch that from the caps:

1. In your pad probe, you need to get the sticky caps event from the
pad: event = gst_pad_get_sticky_event(pad, GST_EVENT_CAPS, 0)
2. Get the caps from that caps event: gst_event_parse_caps(event, &caps)
3. convert the caps to GstAudioInfo: audio_info =
gst_audio_info_new_from_caps(caps)

GstMapFlags can just be GST_MAP_READ in your case.

Cheers,
Nirbheek


More information about the gstreamer-devel mailing list