textcolorsoverlaygstreamerpango

Format of values for GstBaseTextOverlay's color property


The GstBaseTextOverlay object used for GStreamer's Pango-based plugins (textoverlay, clockoverlay, etc.) has a color property. Its documentation describes it as follows:

“color” guint

Color of the rendered text.

Flags : Read / Write

Default value : -1

A guint is an unsigned 32-bit integer, but the default value specified here (-1) is signed. The color component order is also unspecified (presumably red, green, blue, and alpha are each allocated eight bits).

Although these plugins use Pango, in Pango colors are represented using the PangoColor struct (it contains three guint16 values, one for each of red, green, and blue), which doesn't appear to be used in the context of GStreamer.

What is the format of values for GstBaseTextOverlay's color property?


Solution

  • The color component order is ARGB, or, in hex notation, 0xAARRGGBB. For example:

    This is mentioned in the description of the outline-color property:

    “outline-color” guint

    Color to use for outline the text (big-endian ARGB).

    Flags : Read / Write

    Default value : -16777216

    It's odd that the default values are presented as signed integers given that both properties use the guint type, but in big-endian form the default values correspond to the following: