How to read array of strings from GstStructure during caps negotiation?

Sebastian Dröge sebastian at centricular.com
Wed Aug 31 06:55:12 UTC 2016


On Tue, 2016-08-30 at 04:05 -0700, Baby Octopus wrote:
> Hi,
> 
> When my allowed caps in aac encoder has array of stream-formats i.e.,
> stream-format={raw,adts},  gst_structure_get_string() returns NULL
> 
> But when it is a scalar i.e, 
> stream-format={raw} it returns non NULL
> 
> My question is how to read array of strings in GstStructure? I see a
> bug in faac encoder due to this in following lines
>     if ((str = gst_structure_get_string (s, "stream-format"))) {
>       if (strcmp (str, "adts") == 0) {
>         GST_DEBUG_OBJECT (faac, "use ADTS format for output");
>         faac->outputformat = 1;
>       } else if (strcmp (str, "raw") == 0) {
>         GST_DEBUG_OBJECT (faac, "use RAW format for output");
>         faac->outputformat = 0;
>       } else {
>         GST_DEBUG_OBJECT (faac, "unknown stream-format: %s", str);
>         faac->outputformat = 0;
>       }
>     }

Those lines only support a single string, no array. I assume the caps
are fixated before that already so that only a single string is left.

For handling these arrays, check the gst_value_list_*() API.
Note that you don't want the gst_value_array_*() API here.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 931 bytes
Desc: This is a digitally signed message part
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160831/b9d2d5de/attachment.sig>


More information about the gstreamer-devel mailing list