# Gst::Fraction Class Reference
[gstreamermm Helper Classes]

A class that represents a fraction. More...

List of all members.

## Public Member Functions
| Fraction ()
| Constructs a zero Gst::Fraction (0/1).
| Fraction (const Fraction& src)
| Constructs a Gst::Fraction from another.
| Fraction (int num, int denom)
| Constructs a Gst::Fraction (num/denom).
| Fraction (const Glib::ValueBase& gst_fraction_value)
| Constructs a Gst::Fraction from a GST_TYPE_FRACTION.
| Fraction (const GValue& gst_fraction_value)
| Constructs a Gst::Fraction from a GST_TYPE_FRACTION.
Fraction& | operator= (const Fraction& src)
## Public Attributes
int | num
int | denom

## Detailed Description

A class that represents a fraction.

Gst::Fraction is used to store a fraction in Gst::Structures of Gst::Caps as a value representing a property (see GStreamer Application Development Manual section 8.2.2 and GstValue docs). When the value is set, it is transformed to a GStreamer GType so retrieving the value is a bit different. The class can be used in setting and getting a Gst::Structure field like so:

     Glib::Value<Gst::Fraction> value;
     value.init(Glib::Value<Gst::Fraction>::value_type());
     value.set(Gst::Fraction(25,1));

     Gst::Structure structure("my-structure");
     structure.set_field("framerate", value);
     ...
     Glib::ValueBase gst_value;
     structure.get_field("framerate", gst_value);
     Gst::Fraction fract(gst_value);
     int numerator = fract.num;
     ...

## Constructor & Destructor Documentation

Gst::Fraction::Fraction | ( |  | ) |

Constructs a zero Gst::Fraction (0/1).

Gst::Fraction::Fraction | ( | const Fraction& | src | ) |

Constructs a Gst::Fraction from another.

Gst::Fraction::Fraction | ( | int | num,
|  | int | denom |
| ) |  |  |

Constructs a Gst::Fraction (num/denom).

Gst::Fraction::Fraction | ( | const Glib::ValueBase & | gst_fraction_value | ) | `[explicit]`

Constructs a Gst::Fraction from a GST_TYPE_FRACTION.

Gst::Fraction::Fraction | ( | const GValue & | gst_fraction_value | ) | `[explicit]`

Constructs a Gst::Fraction from a GST_TYPE_FRACTION.

## Member Function Documentation

Fraction& Gst::Fraction::operator= | ( | const Fraction& | src | ) |

## Member Data Documentation

int Gst::Fraction::denom

int Gst::Fraction::num

The documentation for this class was generated from the following file:

- gstreamermm/value.h