GStreamer how define fraction property that will accept '4/3'

105 Views Asked by At

I am adding a property to a GStreamer element which is an euclidean fraction, so numerator and denominator.

It works fine so long as the numerator is smaller than the denominator but not otherwise.

So pixel-aspect-ratio=3/4 works, but pixel-aspect-ratio=4/3 returns the following error:

GLib-GObject-WARNING **: 22:26:35.974: value "4/3" of type
'GstFraction' is invalid or out of range for property
'pixel-aspect-ratio' of type 'GstFraction'

Below my code to define the property. I have tried various combinations for the min_num, min_denom, max_num and max_denom to no avail. There is not enough detail in the doc. I am hoping someone here can spot the obvious mistake so I do not have to sieve through the code for gst_value_compare () which appears to be the function that produces the error.

  g_object_class_install_property (gobject_class, PROP_PIXEL_ASPECT_RATIO,
      gst_param_spec_fraction ("pixel-aspect-ratio",
          "Pixel aspect ratio",
          "Pixel aspect ratio of frames in the stream",
          0, G_MAXINT, G_MAXINT, G_MAXINT,
          DEFAULT_PIXEL_ASPECT_RATIO_NUM, DEFAULT_PIXEL_ASPECT_RATIO_DEN,
          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
      );

I should add that my understanding of the fraction type is that it allows to express a euclidean division as num and den and avoids using floats. Let me know if I misunderstand the concept. Either the doc is too sparse or I have not found the right info.

0

There are 0 best solutions below