gstreamermm 1.10.0

Public Member Functions | Public Attributes | List of all members
Gst::Fraction Class Reference
gstreamermm Helper Classes

A class that represents a fraction. More...

`#include <gstreamermm/value.h>`

## Public Member Functions
| Fraction ()
| Constructs a zero Gst::Fraction (0/1). More...
| Fraction (const Fraction& src)
| Constructs a Gst::Fraction from another. More...
| Fraction (int num, int denom)
| Constructs a Gst::Fraction (num/denom). More...
| Fraction (const Glib::ValueBase& gst_fraction_value)
| Constructs a Gst::Fraction from a GST_TYPE_FRACTION. More...
| Fraction (const GValue& gst_fraction_value)
| Constructs a Gst::Fraction from a GST_TYPE_FRACTION. More...
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;
...

Last reviewed on 2016-08-27 (1.8.0)

## Constructor & Destructor Documentation

## ◆ Fraction() [1/5]

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

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

## ◆ Fraction() [2/5]

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

Constructs a Gst::Fraction from another.

## ◆ Fraction() [3/5]

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

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

## ◆ Fraction() [4/5]

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

Constructs a Gst::Fraction from a GST_TYPE_FRACTION.

## ◆ Fraction() [5/5]

Gst::Fraction::Fraction | ( | const GValue & | gst_fraction_value | ) |
| explicit

Constructs a Gst::Fraction from a GST_TYPE_FRACTION.

## Member Function Documentation

## ◆ operator=()

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

## Member Data Documentation

## ◆ denom

int Gst::Fraction::denom

## ◆ num

int Gst::Fraction::num

Glib::Value
Glib::Value::set
void set(const CppType &data)
Gst::Structure
Generic class containing fields of names and values.
Definition: structure.h:75
Glib::ValueBase::init
void init(GType type)
Gst::Fraction
A class that represents a fraction.
Definition: value.h:135