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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Baby Octopus
Administrator
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;
      }
    }
Reply | Threaded
Open this post in threaded view
|

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

Sebastian Dröge-3
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
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Baby Octopus
Administrator

On Wed, Aug 31, 2016 at 12:27 PM, Sebastian Dröge-3 [via GStreamer-devel] <[hidden email]> wrote:
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.
I don't think we can assume that. Can we? When the encoder and the muxer support multiple stream-formats, its upto the encoder to decide
which stream-format to choose. Isn't it?
 

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

Thank you very much. Let me try this 

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment



To unsubscribe from How to read array of strings from GstStructure during caps negotiation?, click here.
NAML