class TimelineRate

Defined at line 19 of file ../../src/media/audio/lib/timeline/timeline_rate.h

TimelineRate expresses the relative rate of a timeline as the ratio between two uint64_t values

subject_delta / reference_delta. "subject" refers to the timeline whose rate is being

represented, and "reference" refers to the timeline relative to which the rate is expressed.

Public Members

static const int64_t kOverflow
static const int64_t kUnderflow
static TimelineRate Zero
static TimelineRate NsPerSecond

Public Methods

void TimelineRate ()

Defined at line 34 of file ../../src/media/audio/lib/timeline/timeline_rate.h

void TimelineRate (float rate_as_float)

Creates a TimelineRate based on a floating-point value. ASSERTs on negative values.

Defined at line 40 of file ../../src/media/audio/lib/timeline/timeline_rate.h

void TimelineRate (double rate_as_double)

Defined at line 41 of file ../../src/media/audio/lib/timeline/timeline_rate.h

TimelineRate Product (TimelineRate a, TimelineRate b, bool exact)

Returns the product of the rates. If exact is true, DCHECKs on loss of

precision.

Defined at line 48 of file ../../sdk/lib/media/cpp/timeline_rate.h

bool invertible ()

Determines whether this |TimelineRate| is invertible.

Defined at line 50 of file ../../src/media/audio/lib/timeline/timeline_rate.h

TimelineRate Inverse ()

Returns the inverse of the rate. DCHECKs if the subject_delta of this rate is zero.

Defined at line 53 of file ../../src/media/audio/lib/timeline/timeline_rate.h

void TimelineRate (uint32_t subject_delta)

Defined at line 58 of file ../../sdk/lib/media/cpp/timeline_rate.h

uint64_t subject_delta ()

Defined at line 75 of file ../../src/media/audio/lib/timeline/timeline_rate.h

uint64_t reference_delta ()

Defined at line 76 of file ../../src/media/audio/lib/timeline/timeline_rate.h

void TimelineRate (uint32_t subject_delta, uint32_t reference_delta)

Defined at line 76 of file ../../sdk/lib/media/cpp/timeline_rate.h

void Reduce (uint32_t * subject_delta, uint32_t * reference_delta)

Reduces the ratio of *subject_delta and *reference_delta.

Defined at line 147 of file ../../sdk/lib/media/cpp/timeline_rate.cc

void TimelineRate (uint64_t subject_delta, uint64_t reference_delta)

Creates a TimelineRate from a numerator and denominator.

Defined at line 98 of file ../../src/media/audio/lib/timeline/timeline_rate.cc

int64_t Scale (int64_t value)

Scales the value by this rate. Returns kOverflow on overflow.

Defined at line 101 of file ../../sdk/lib/media/cpp/timeline_rate.h

int64_t ScaleInverse (int64_t value)

Scales the value by the inverse of this rate.

Defined at line 104 of file ../../sdk/lib/media/cpp/timeline_rate.h

void Product (uint32_t a_subject_delta, uint32_t a_reference_delta, uint32_t b_subject_delta, uint32_t b_reference_delta, uint32_t * product_subject_delta, uint32_t * product_reference_delta, bool exact)

Produces the product of the rates. If exact is true, DCHECKs on loss of

precision.

Defined at line 152 of file ../../sdk/lib/media/cpp/timeline_rate.cc

int64_t Scale (int64_t value, uint32_t subject_delta, uint32_t reference_delta)

Produces the product of the rates and the int64_t as an int64_t. Returns

kOverflow on overflow.

Defined at line 190 of file ../../sdk/lib/media/cpp/timeline_rate.cc

int64_t Scale (int64_t value, RoundingMode mode)

Scales the value by this rate. Returns kOverflow on overflow and kUnderflow on underflow.

Defined at line 160 of file ../../src/media/audio/lib/timeline/timeline_rate.cc

Enumerations

enum RoundingMode
Name Value
Truncate 0
Floor 1
Ceiling 2

Rounding mode for Scale operations.

Defined at line 66 of file ../../src/media/audio/lib/timeline/timeline_rate.h