How to get a multi-field from caps

Sebastian Dröge sebastian at centricular.com
Wed Nov 5 07:25:50 PST 2014


On Mi, 2014-11-05 at 16:13 +0100, Alicia Romero wrote:
> Hi List,
> I have a problem getting a field from a capability if the field has
> multiple values.
> One example would be I have this capability:
> 
> video/x-raw, format=(string)YUY2, width=(int)960, height=(int)720,
> pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive,
> framerate=(fraction){ 15/1, 10/1, 5/1 };
> 
> And I want to get the framerate:
> 
> gint *num, *denom;
> GstStructure *str = gst_caps_get_structure (caps, i);
> [...]
> gst_structure_get_fraction (str, "framerate", num, denom);
> 
> 
> The problem is that I only get the last value 5/1 and not all the values.

That field is of type GST_TYPE_VALUE_LIST. You can use
gst_structure_get_value() to get it, and then the gst_value_list*()
functions to work on that.
Each GValue in the list will be a fraction.

-- 
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: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141105/d8a5d08a/attachment.sig>


More information about the gstreamer-devel mailing list