Class VideoTimeCode
- All Implemented Interfaces:
Proxy
fieldCount
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.
-
Constructor Summary
ConstructorDescriptionVideoTimeCode
(int fpsN, int fpsD, DateTime latestDailyJam, Set<VideoTimeCodeFlags> flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.VideoTimeCode
(int fpsN, int fpsD, DateTime latestDailyJam, VideoTimeCodeFlags flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.VideoTimeCode
(MemorySegment address) Create a VideoTimeCode proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addFrames
(long frames) Adds or subtractsframes
amount of frames to this VideoTimeCode.addInterval
(VideoTimeCodeInterval tcInter) This makes a component-wise addition oftcInter
to this VideoTimeCode.void
clear()
Initializes this VideoTimeCode with empty/zero/NULL values and frees any memory it might currently use.int
compare
(VideoTimeCode tc2) Compares this VideoTimeCode andtc2
.copy()
static VideoTimeCode
empty()
long
void
free()
Frees this VideoTimeCode.static VideoTimeCode
fromDateTime
(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.static VideoTimeCode
fromDateTime
(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.static VideoTimeCode
fromDateTimeFull
(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.static VideoTimeCode
fromDateTimeFull
(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.static VideoTimeCode
fromString
(String tcStr) static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the VideoTimeCode classvoid
Adds one frame to this VideoTimeCode.void
init
(int fpsN, int fpsD, @Nullable DateTime latestDailyJam, Set<VideoTimeCodeFlags> flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.void
init
(int fpsN, int fpsD, @Nullable DateTime latestDailyJam, VideoTimeCodeFlags flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.void
initFromDateTime
(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.void
initFromDateTime
(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.boolean
initFromDateTimeFull
(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.boolean
initFromDateTimeFull
(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.boolean
isValid()
long
Read the value of the fieldconfig
.int
Read the value of the fieldfield_count
.int
Read the value of the fieldframes
.int
Read the value of the fieldhours
.int
Read the value of the fieldminutes
.int
Read the value of the fieldseconds
.The this VideoTimeCode.config->latest_daily_jam is required to be non-NULL.toString()
void
writeConfig
(VideoTimeCodeConfig config) Write a value in the fieldconfig
.void
writeFieldCount
(int fieldCount) Write a value in the fieldfield_count
.void
writeFrames
(int frames) Write a value in the fieldframes
.void
writeHours
(int hours) Write a value in the fieldhours
.void
writeMinutes
(int minutes) Write a value in the fieldminutes
.void
writeSeconds
(int seconds) Write a value in the fieldseconds
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
VideoTimeCode
Create a VideoTimeCode proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
VideoTimeCode
public VideoTimeCode(int fpsN, int fpsD, DateTime latestDailyJam, Set<VideoTimeCodeFlags> flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.latestDaiyJam
reference is stolen from caller.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratelatestDailyJam
- The latest daily jam of theGstVideoTimeCode
flags
-GstVideoTimeCodeFlags
hours
- the hours field ofGstVideoTimeCode
minutes
- the minutes field ofGstVideoTimeCode
seconds
- the seconds field ofGstVideoTimeCode
frames
- the frames field ofGstVideoTimeCode
fieldCount
- Interlaced video field count
-
VideoTimeCode
public VideoTimeCode(int fpsN, int fpsD, DateTime latestDailyJam, VideoTimeCodeFlags flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.latestDaiyJam
reference is stolen from caller.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratelatestDailyJam
- The latest daily jam of theGstVideoTimeCode
flags
-GstVideoTimeCodeFlags
hours
- the hours field ofGstVideoTimeCode
minutes
- the minutes field ofGstVideoTimeCode
seconds
- the seconds field ofGstVideoTimeCode
frames
- the frames field ofGstVideoTimeCode
fieldCount
- Interlaced video field count
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readConfig
Read the value of the fieldconfig
.- Returns:
- The value of the field
config
-
writeConfig
Write a value in the fieldconfig
.- Parameters:
config
- The new value for the fieldconfig
-
readHours
public int readHours()Read the value of the fieldhours
.- Returns:
- The value of the field
hours
-
writeHours
public void writeHours(int hours) Write a value in the fieldhours
.- Parameters:
hours
- The new value for the fieldhours
-
readMinutes
public int readMinutes()Read the value of the fieldminutes
.- Returns:
- The value of the field
minutes
-
writeMinutes
public void writeMinutes(int minutes) Write a value in the fieldminutes
.- Parameters:
minutes
- The new value for the fieldminutes
-
readSeconds
public int readSeconds()Read the value of the fieldseconds
.- Returns:
- The value of the field
seconds
-
writeSeconds
public void writeSeconds(int seconds) Write a value in the fieldseconds
.- Parameters:
seconds
- The new value for the fieldseconds
-
readFrames
public int readFrames()Read the value of the fieldframes
.- Returns:
- The value of the field
frames
-
writeFrames
public void writeFrames(int frames) Write a value in the fieldframes
.- Parameters:
frames
- The new value for the fieldframes
-
readFieldCount
public int readFieldCount()Read the value of the fieldfield_count
.- Returns:
- The value of the field
field_count
-
writeFieldCount
public void writeFieldCount(int fieldCount) Write a value in the fieldfield_count
.- Parameters:
fieldCount
- The new value for the fieldfield_count
-
empty
-
fromDateTime
public static VideoTimeCode fromDateTime(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) 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 gst_video_time_code_new_from_date_time_full() to ensure that you would get
null
instead in that case.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
- the
GstVideoTimeCode
representation ofdt
.
-
fromDateTime
public static VideoTimeCode fromDateTime(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) 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 gst_video_time_code_new_from_date_time_full() to ensure that you would get
null
instead in that case.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
- the
GstVideoTimeCode
representation ofdt
.
-
fromDateTimeFull
public static VideoTimeCode fromDateTimeFull(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
- the
GstVideoTimeCode
representation ofdt
, ornull
if no valid timecode could be created.
-
fromDateTimeFull
public static VideoTimeCode fromDateTimeFull(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
- the
GstVideoTimeCode
representation ofdt
, ornull
if no valid timecode could be created.
-
fromString
-
addFrames
public void addFrames(long frames) Adds or subtractsframes
amount of frames to this VideoTimeCode. tc needs to contain valid data, as verified by gst_video_time_code_is_valid().- Parameters:
frames
- How many frames to add or subtract
-
addInterval
This makes a component-wise addition oftcInter
to this VideoTimeCode. 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.- Parameters:
tcInter
- TheGstVideoTimeCodeInterval
to add to this VideoTimeCode. 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
GstVideoTimeCode
withtcInter
added ornull
if the interval can't be added.
-
clear
public void clear()Initializes this VideoTimeCode with empty/zero/NULL values and frees any memory it might currently use. -
compare
Compares this VideoTimeCode andtc2
. If both have latest daily jam information, it is taken into account. Otherwise, it is assumed that the daily jam of both this VideoTimeCode andtc2
was at the same time. Both time codes must be valid.- Parameters:
tc2
- another validGstVideoTimeCode
- Returns:
- 1 if this VideoTimeCode is after
tc2
, -1 if this VideoTimeCode is beforetc2
, 0 otherwise.
-
copy
-
framesSinceDailyJam
public long framesSinceDailyJam() -
free
public void free()Frees this VideoTimeCode. -
incrementFrame
public void incrementFrame()Adds one frame to this VideoTimeCode. -
init
public void init(int fpsN, int fpsD, @Nullable @Nullable DateTime latestDailyJam, Set<VideoTimeCodeFlags> flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.latestDaiyJam
reference is stolen from caller.Initializes this 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 gst_video_time_code_is_valid().
- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratelatestDailyJam
- The latest daily jam of theGstVideoTimeCode
flags
-GstVideoTimeCodeFlags
hours
- the hours field ofGstVideoTimeCode
minutes
- the minutes field ofGstVideoTimeCode
seconds
- the seconds field ofGstVideoTimeCode
frames
- the frames field ofGstVideoTimeCode
fieldCount
- Interlaced video field count
-
init
public void init(int fpsN, int fpsD, @Nullable @Nullable DateTime latestDailyJam, VideoTimeCodeFlags flags, int hours, int minutes, int seconds, int frames, int fieldCount) fieldCount
is 0 for progressive, 1 or 2 for interlaced.latestDaiyJam
reference is stolen from caller.Initializes this 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 gst_video_time_code_is_valid().
- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratelatestDailyJam
- The latest daily jam of theGstVideoTimeCode
flags
-GstVideoTimeCodeFlags
hours
- the hours field ofGstVideoTimeCode
minutes
- the minutes field ofGstVideoTimeCode
seconds
- the seconds field ofGstVideoTimeCode
frames
- the frames field ofGstVideoTimeCode
fieldCount
- Interlaced video field count
-
initFromDateTime
public void initFromDateTime(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.Will assert on invalid parameters, use gst_video_time_code_init_from_date_time_full() for being able to handle invalid parameters.
- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count
-
initFromDateTime
public void initFromDateTime(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.Will assert on invalid parameters, use gst_video_time_code_init_from_date_time_full() for being able to handle invalid parameters.
- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count
-
initFromDateTimeFull
public boolean initFromDateTimeFull(int fpsN, int fpsD, DateTime dt, Set<VideoTimeCodeFlags> flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
true
if this VideoTimeCode could be correctly initialized to a valid timecode
-
initFromDateTimeFull
public boolean initFromDateTimeFull(int fpsN, int fpsD, DateTime dt, VideoTimeCodeFlags flags, int fieldCount) The resulting config->latest_daily_jam is set to midnight, and timecode is set to the given time.- Parameters:
fpsN
- Numerator of the frame ratefpsD
- Denominator of the frame ratedt
-GDateTime
to convertflags
-GstVideoTimeCodeFlags
fieldCount
- Interlaced video field count- Returns:
true
if this VideoTimeCode could be correctly initialized to a valid timecode
-
isValid
public boolean isValid() -
nsecSinceDailyJam
public long nsecSinceDailyJam() -
toDateTime
The this VideoTimeCode.config->latest_daily_jam is required to be non-NULL.- Returns:
- the
GDateTime
representation of this VideoTimeCode ornull
if this VideoTimeCode has no daily jam.
-
toString
-