clocks Package

base Module

class ebu_tt_live.clocks.base.Clock[source]

Bases: object

This class represents our timing source that we use to get time related information when document processing happens. Most of the utility functions are meant to stay here and the subclasses should implement get_time only.

clock_mode
get_real_clock_time()[source]

Implemented in descendant classes :return: datetime.timedelta object

get_time()[source]
Returns:datetime.timedelta object
is_fixed_time_mode()[source]

Returns the current status of the fixed-time mode. :return: True if fixed-time mode is currently active, False otherwise.

set_fixed_time(value)[source]

Registers a time in the Clock object. If fixed-time mode is active, e.g. set_fixed_time_mode(true) was called on self, then every call to get_time() will return the registered time. The parameter value must contain the time as a datetime.timedelta. If it is not a datetime.timedelta, a TypeError exception will be raised. :param value: the time to register as the fixed time of the Clock. Must of type datetime.timedelta

set_fixed_time_mode(value)[source]

Used to activate or deactivate the fixed-time mode. If value is True the clock will be set in fixed-time mode, while this mode is active any call to get_time() will return the time registered with set_fixed_time as the fixed time of clock. If value is False, the fixed-time mode is deactivated and the real time of the clock is returned when get_time() is called. If value is not of type bool a TypeError exception will be raised. :param value: a bool. True to activate fixed-time mode, False to deactivate fixed-time mode.

start()[source]
stop()[source]
time_base

local Module

class ebu_tt_live.clocks.local.LocalMachineClock[source]

Bases: ebu_tt_live.clocks.base.Clock

get_real_clock_time()[source]

Implemented in descendant classes :return: datetime.timedelta object

media Module

class ebu_tt_live.clocks.media.MediaClock[source]

Bases: ebu_tt_live.clocks.base.Clock

MediaClock is a reference clock that simulates the mediastream’s time by interpolating the local machine time from the last adjusted reference time.

adjust_time(current_time, local_time=None)[source]

By default the current local time is used as reference point but optionally can be adjusted to a given time :param current_time: :param local_time: :return:

get_machine_time()[source]
get_media_time(real_clock_timedelta)[source]
get_real_clock_time()[source]

Implemented in descendant classes :return: datetime.timedelta object

class ebu_tt_live.clocks.media.ReferenceTime(local, remote)

Bases: tuple

local

Alias for field number 0

remote

Alias for field number 1

class ebu_tt_live.clocks.media.SMPTEClock[source]

Bases: ebu_tt_live.clocks.media.MediaClock