Parsing caps

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

Parsing caps

Ilya Aleshkov
Hi,

I'd like to parse GstCaps. It's pretty trivial:

GstDevice *device = ... // Get "Video/Source" devices from GstDeviceMonitor

GstCaps *devCaps = gst_device_get_caps(device);
uint size = gst_caps_get_size(devCaps);

for (uint i = 0; i < size; ++i) {
    GstStructure *s = gst_caps_get_structure(devCaps, i);
    GType framerate = gst_structure_get_field_type(s, "framerate");
    qDebug() << g_type_name(framerate);
      ...
}

Output: GstFraction or GstFractionRange

I can easily get a fraction with:

gst_structure_get_fraction(s, "framerate", &numerator, &denominator)

But there is no such method for a fraction range.

I can get a GValue for a fraction range:

GValue *fractionRange = gst_structure_get_value(s, "framerate");

But I don't know how to extract a range from it.

What did I miss?

Thanks,
Ilya

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Parsing caps

Michael Gruner
Hi Iiya

You can try gst_value_get_fraction_range_min and gst_value_get_fraction_range_max, where the GValue returned is of type GST_TYPE_FRACTION_RANGE.

Michael
RidgeRun

On Jan 17, 2019, at 10:59 AM, Ilya Aleshkov <[hidden email]> wrote:

Hi,

I'd like to parse GstCaps. It's pretty trivial:

GstDevice *device = ... // Get "Video/Source" devices from GstDeviceMonitor

GstCaps *devCaps = gst_device_get_caps(device);
uint size = gst_caps_get_size(devCaps);

for (uint i = 0; i < size; ++i) {
    GstStructure *s = gst_caps_get_structure(devCaps, i);
    GType framerate = gst_structure_get_field_type(s, "framerate");
    qDebug() << g_type_name(framerate);
      ...
}

Output: GstFraction or GstFractionRange

I can easily get a fraction with:

gst_structure_get_fraction(s, "framerate", &numerator, &denominator)

But there is no such method for a fraction range.

I can get a GValue for a fraction range:

GValue *fractionRange = gst_structure_get_value(s, "framerate");

But I don't know how to extract a range from it.

What did I miss?

Thanks,
Ilya
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Parsing caps

Ilya Aleshkov
Hi Michael,

Thank you so much! This is exactly what i'm looking for.

Ilya

On Thu, Jan 17, 2019 at 8:17 PM Michael Gruner <[hidden email]> wrote:
Hi Iiya

You can try gst_value_get_fraction_range_min and gst_value_get_fraction_range_max, where the GValue returned is of type GST_TYPE_FRACTION_RANGE.

Michael
RidgeRun

On Jan 17, 2019, at 10:59 AM, Ilya Aleshkov <[hidden email]> wrote:

Hi,

I'd like to parse GstCaps. It's pretty trivial:

GstDevice *device = ... // Get "Video/Source" devices from GstDeviceMonitor

GstCaps *devCaps = gst_device_get_caps(device);
uint size = gst_caps_get_size(devCaps);

for (uint i = 0; i < size; ++i) {
    GstStructure *s = gst_caps_get_structure(devCaps, i);
    GType framerate = gst_structure_get_field_type(s, "framerate");
    qDebug() << g_type_name(framerate);
      ...
}

Output: GstFraction or GstFractionRange

I can easily get a fraction with:

gst_structure_get_fraction(s, "framerate", &numerator, &denominator)

But there is no such method for a fraction range.

I can get a GValue for a fraction range:

GValue *fractionRange = gst_structure_get_value(s, "framerate");

But I don't know how to extract a range from it.

What did I miss?

Thanks,
Ilya
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel