GstVideo.VideoTimeCode

Fields

Name

Type

Access

Description

config

GstVideo.VideoTimeCodeConfig

r/w

the corresponding GstVideo.VideoTimeCodeConfig

field_count

int

r/w

Interlaced video field count

frames

int

r/w

the frames field of GstVideo.VideoTimeCode

hours

int

r/w

the hours field of GstVideo.VideoTimeCode

minutes

int

r/w

the minutes field of GstVideo.VideoTimeCode

seconds

int

r/w

the seconds field of GstVideo.VideoTimeCode

Methods

class

new (fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)

class

new_empty ()

class

new_from_date_time (fps_n, fps_d, dt, flags, field_count)

class

new_from_date_time_full (fps_n, fps_d, dt, flags, field_count)

class

new_from_string (tc_str)

add_frames (frames)

add_interval (tc_inter)

clear ()

compare (tc2)

copy ()

frames_since_daily_jam ()

free ()

increment_frame ()

init (fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)

init_from_date_time (fps_n, fps_d, dt, flags, field_count)

init_from_date_time_full (fps_n, fps_d, dt, flags, field_count)

is_valid ()

nsec_since_daily_jam ()

to_date_time ()

to_string ()

Details

class GstVideo.VideoTimeCode

field_count must be 0 for progressive video and 1 or 2 for interlaced.

A representation of a SMPTE time code.

hours must be positive and less than 24. Will wrap around otherwise. minutes and seconds must be positive and less than 60. frames must be less than or equal to config.fps_n / config.fps_d These values are *NOT* automatically normalized.

New in version 1.10.

classmethod new(fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)
Parameters:
Returns:

a new GstVideo.VideoTimeCode with the given values. The values are not checked for being in a valid range. To see if your timecode actually has valid content, use GstVideo.VideoTimeCode.is_valid().

Return type:

GstVideo.VideoTimeCode

field_count is 0 for progressive, 1 or 2 for interlaced. latest_daiy_jam reference is stolen from caller.

New in version 1.10.

classmethod new_empty()
Returns:

a new empty, invalid GstVideo.VideoTimeCode

Return type:

GstVideo.VideoTimeCode

New in version 1.10.

classmethod new_from_date_time(fps_n, fps_d, dt, flags, field_count)
Parameters:
Returns:

the GstVideo.VideoTimeCode representation of dt.

Return type:

GstVideo.VideoTimeCode

The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.

This might return a completely invalid timecode, use GstVideo.VideoTimeCode.new_from_date_time_full() to ensure that you would get None instead in that case.

New in version 1.12.

classmethod new_from_date_time_full(fps_n, fps_d, dt, flags, field_count)
Parameters:
Returns:

the GstVideo.VideoTimeCode representation of dt, or None if no valid timecode could be created.

Return type:

GstVideo.VideoTimeCode or None

The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.

New in version 1.16.

classmethod new_from_string(tc_str)
Parameters:

tc_str (str) – The string that represents the GstVideo.VideoTimeCode

Returns:

a new GstVideo.VideoTimeCode from the given string or None if the string could not be passed.

Return type:

GstVideo.VideoTimeCode or None

New in version 1.12.

add_frames(frames)
Parameters:

frames (int) – How many frames to add or subtract

Adds or subtracts frames amount of frames to self. tc needs to contain valid data, as verified by GstVideo.VideoTimeCode.is_valid().

New in version 1.10.

add_interval(tc_inter)
Parameters:

tc_inter (GstVideo.VideoTimeCodeInterval) – The GstVideo.VideoTimeCodeInterval to add to self. The interval must contain valid values, except that for drop-frame timecode, it may also contain timecodes which would normally be dropped. These are then corrected to the next reasonable timecode.

Returns:

A new GstVideo.VideoTimeCode with tc_inter added or None if the interval can’t be added.

Return type:

GstVideo.VideoTimeCode or None

This makes a component-wise addition of tc_inter to self. For example, adding (“01:02:03:04”, “00:01:00:00”) will return “01:03:03:04”. When it comes to drop-frame timecodes, adding (“00:00:00;00”, “00:01:00:00”) will return “00:01:00;02” because of drop-frame oddities. However, adding (“00:09:00;02”, “00:01:00:00”) will return “00:10:00;00” because this time we can have an exact minute.

New in version 1.12.

clear()

Initializes self with empty/zero/None values and frees any memory it might currently use.

New in version 1.10.

compare(tc2)
Parameters:

tc2 (GstVideo.VideoTimeCode) – another valid GstVideo.VideoTimeCode

Returns:

1 if self is after tc2, -1 if self is before tc2, 0 otherwise.

Return type:

int

Compares self and tc2. If both have latest daily jam information, it is taken into account. Otherwise, it is assumed that the daily jam of both self and tc2 was at the same time. Both time codes must be valid.

New in version 1.10.

copy()
Returns:

a new GstVideo.VideoTimeCode with the same values as self.

Return type:

GstVideo.VideoTimeCode

New in version 1.10.

frames_since_daily_jam()
Returns:

how many frames have passed since the daily jam of self.

Return type:

int

New in version 1.10.

free()

Frees self.

New in version 1.10.

increment_frame()

Adds one frame to self.

New in version 1.10.

init(fps_n, fps_d, latest_daily_jam, flags, hours, minutes, seconds, frames, field_count)
Parameters:

field_count is 0 for progressive, 1 or 2 for interlaced. latest_daiy_jam reference is stolen from caller.

Initializes self with the given values. The values are not checked for being in a valid range. To see if your timecode actually has valid content, use GstVideo.VideoTimeCode.is_valid().

New in version 1.10.

init_from_date_time(fps_n, fps_d, dt, flags, field_count)
Parameters:

The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.

Will assert on invalid parameters, use GstVideo.VideoTimeCode.init_from_date_time_full() for being able to handle invalid parameters.

New in version 1.12.

init_from_date_time_full(fps_n, fps_d, dt, flags, field_count)
Parameters:
Returns:

True if self could be correctly initialized to a valid timecode

Return type:

bool

The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.

New in version 1.16.

is_valid()
Returns:

whether self is a valid timecode (supported frame rate, hours/minutes/seconds/frames not overflowing)

Return type:

bool

New in version 1.10.

nsec_since_daily_jam()
Returns:

how many nsec have passed since the daily jam of self.

Return type:

int

New in version 1.10.

to_date_time()
Returns:

the GLib.DateTime representation of self or None if self has no daily jam.

Return type:

GLib.DateTime or None

The self.config->latest_daily_jam is required to be non-None.

New in version 1.10.

to_string()
Returns:

the SMPTE ST 2059-1:2015 string representation of self. That will take the form hh:mm:py:data::ss<GstVideo.VideoTimeCode.props.ss>:ff. The last separator (between seconds and frames) may vary:

’;’ for drop-frame, non-interlaced content and for drop-frame interlaced field 2 ‘,’ for drop-frame interlaced field 1 ‘:’ for non-drop-frame, non-interlaced content and for non-drop-frame interlaced field 2 ‘.’ for non-drop-frame interlaced field 1

Return type:

str

New in version 1.10.