libkate 0.4.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
Granule calculations

## Functions
int | kate_granule_shift (const kate_info *ki)
kate_int64_t | kate_time_granule (const kate_info *ki, kate_float base, kate_float offset)
int | kate_granule_split_time (const kate_info *ki, kate_int64_t granulepos, kate_float *base, kate_float *offset)
kate_float | kate_granule_time (const kate_info *ki, kate_int64_t granulepos)
kate_int64_t | kate_duration_granule (const kate_info *ki, kate_float duration)
kate_float | kate_granule_duration (const kate_info *ki, kate_int64_t duration)

## Detailed Description

## Function Documentation

kate_int64_t kate_duration_granule | ( | const kate_info * | ki,
|  | kate_float | duration
| ) |  |

Converts a duration to a granule duration

Parameters

  ki | the kate_info structure describing the granule encoding setup
  duration | the duration in seconds to convert to a granulepos offset

Returns
  >=0 the time corresponding to the granulepos
  KATE_E_* error

References kate_info::gps_denominator, kate_info::gps_numerator, KATE_E_BAD_GRANULE, and KATE_E_INVALID_PARAMETER.

Referenced by kate_encode_finish(), kate_encode_keepalive(), kate_encode_repeat(), and kate_encode_text().

kate_float kate_granule_duration | ( | const kate_info * | ki,
|  | kate_int64_t | duration
| ) |  |

Converts a granule offset position to a time in seconds.

Parameters

  ki | the kate_info structure describing the granule encoding setup
  duration | the granulepos offset to convert to a time

Returns
  >=0 the time corresponding to the granulepos offset
  KATE_E_* error

References kate_info::gps_denominator, kate_info::gps_numerator, and KATE_E_INVALID_PARAMETER.

int kate_granule_shift | ( | const kate_info * | ki | ) |

Returns the granule shift for the given stream

Parameters

  ki | the kate_info structure describing the granule encoding setup

Returns
  >=0 the granule shift
  KATE_E_* error

References kate_info::granule_shift, and KATE_E_INVALID_PARAMETER.

int kate_granule_split_time | ( | const kate_info * | ki,
|  | kate_int64_t | granulepos,
|  | kate_float * | base,
|  | kate_float * | offset
| ) |  |

Converts a granule position to a base+offset time representation in seconds.

Parameters

  ki | the kate_info structure describing the granule encoding setup
  granulepos | the granulepos to convert to a time representation
  base | a pointer where to store the base part of the time corresponding to the granulepos
  offset | a pointer where to store the offset part of the time corresponding to the granulepos

Returns
  0 success
  KATE_E_* error

References kate_info::gps_denominator, kate_info::gps_numerator, kate_info::granule_shift, and KATE_E_INVALID_PARAMETER.

Referenced by kate_granule_time().

kate_float kate_granule_time | ( | const kate_info * | ki,
|  | kate_int64_t | granulepos
| ) |  |

Converts a granule position to a time in seconds.

Parameters

  ki | the kate_info structure describing the granule encoding setup
  granulepos | the granulepos to convert to a time

Returns
  >=0 the time corresponding to the granulepos
  KATE_E_* error

References kate_granule_split_time().

kate_int64_t kate_time_granule | ( | const kate_info * | ki,
|  | kate_float | base,
|  | kate_float | offset
| ) |  |

Converts a base/offset pair in seconds to a granule position

Parameters

  ki | the kate_info structure describing the granule encoding setup
  base | the base time in seconds to convert
  offset | the time offset in seconds to convert

Returns
  >=0 the granule corresponding to the base/offset pair
  KATE_E_* error

References kate_info::gps_denominator, kate_info::gps_numerator, kate_info::granule_shift, KATE_E_INVALID_PARAMETER, and KATE_E_LIMIT.