OpenShot Library | libopenshot
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1
8
9
// Copyright (c) 2008-2026 OpenShot Studios, LLC
10
//
11
// SPDX-License-Identifier: LGPL-3.0-or-later
12
13
#ifndef OPENSHOT_TIMER_EFFECT_H
14
#define OPENSHOT_TIMER_EFFECT_H
15
16
#include "
../Color.h
"
17
#include "
../EffectBase.h
"
18
#include "
../Enums.h
"
19
#include "
../Frame.h
"
20
#include "
../Json.h
"
21
#include "
../KeyFrame.h
"
22
23
#include <memory>
24
#include <string>
25
26
namespace
openshot
27
{
28
enum
TimerMode
{
29
TIMER_MODE_COUNT_UP
= 0,
30
TIMER_MODE_COUNT_DOWN
= 1,
31
TIMER_MODE_CLOCK
= 2,
32
TIMER_MODE_TIMECODE
= 3,
33
TIMER_MODE_FRAME_NUMBER
= 4
34
};
35
36
enum
TimerTimeSource
{
37
TIMER_TIME_CLIP
= 0,
38
TIMER_TIME_SOURCE
= 1
39
};
40
41
enum
TimerFormat
{
42
TIMER_FORMAT_MM_SS
= 0,
43
TIMER_FORMAT_HH_MM_SS
= 1,
44
TIMER_FORMAT_HH_MM_SS_MILLISECONDS
= 2,
45
TIMER_FORMAT_TIMECODE
= 3,
46
TIMER_FORMAT_FRAMES
= 4
47
};
48
49
class
Timer
:
public
EffectBase
50
{
51
private
:
52
void
init_effect_details();
53
double
ResolveFps()
const
;
54
int64_t EffectiveFrameNumber(int64_t frame_number)
const
;
55
double
CountdownDuration(int64_t frame_number)
const
;
56
std::string FormatSeconds(
double
seconds,
double
fps,
bool
duration_style)
const
;
57
std::string FormatTimecode(
double
seconds,
double
fps)
const
;
58
std::string TimerLayoutText(int64_t frame_number)
const
;
59
60
public
:
61
int
mode
;
62
int
time_source
;
63
int
format
;
64
int
clamp
;
65
int
gravity
;
66
int
show_background
;
67
std::string
font_name
;
68
std::string
prefix
;
69
std::string
suffix
;
70
Color
color
;
71
Color
stroke
;
72
Color
background
;
73
Keyframe
start_time
;
74
Keyframe
end_time
;
75
Keyframe
font_size
;
76
Keyframe
font_alpha
;
77
Keyframe
stroke_width
;
78
Keyframe
x_offset
;
79
Keyframe
y_offset
;
80
Keyframe
background_alpha
;
81
Keyframe
background_padding
;
82
Keyframe
background_corner
;
83
84
Timer
();
85
86
std::shared_ptr<openshot::Frame>
GetFrame
(int64_t frame_number)
override
{
return
GetFrame
(std::make_shared<openshot::Frame>(), frame_number); }
87
std::shared_ptr<openshot::Frame>
GetFrame
(std::shared_ptr<openshot::Frame> frame, int64_t frame_number)
override
;
88
89
double
TimerSeconds
(int64_t frame_number)
const
;
90
std::string
TimerText
(int64_t frame_number)
const
;
91
92
std::string
Json
()
const override
;
93
void
SetJson
(
const
std::string value)
override
;
94
Json::Value
JsonValue
()
const override
;
95
void
SetJsonValue
(
const
Json::Value root)
override
;
96
std::string
PropertiesJSON
(int64_t requested_frame)
const override
;
97
};
98
}
99
100
#endif
Color.h
Header file for Color class.
EffectBase.h
Header file for EffectBase class.
Enums.h
Header file for TextReader class.
Frame.h
Header file for Frame class.
Json.h
Header file for JSON class.
KeyFrame.h
Header file for the Keyframe class.
openshot::Color
This class represents a color (used on the timeline and clips).
Definition
Color.h:27
openshot::EffectBase
This abstract class is the base class, used by all effects in libopenshot.
Definition
EffectBase.h:57
openshot::Keyframe
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition
KeyFrame.h:53
openshot::Timer::clamp
int clamp
Definition
Timer.h:64
openshot::Timer::suffix
std::string suffix
Definition
Timer.h:69
openshot::Timer::stroke_width
Keyframe stroke_width
Definition
Timer.h:77
openshot::Timer::TimerText
std::string TimerText(int64_t frame_number) const
Definition
Timer.cpp:210
openshot::Timer::x_offset
Keyframe x_offset
Definition
Timer.h:78
openshot::Timer::start_time
Keyframe start_time
Definition
Timer.h:73
openshot::Timer::font_size
Keyframe font_size
Definition
Timer.h:75
openshot::Timer::JsonValue
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition
Timer.cpp:409
openshot::Timer::y_offset
Keyframe y_offset
Definition
Timer.h:79
openshot::Timer::background_padding
Keyframe background_padding
Definition
Timer.h:81
openshot::Timer::mode
int mode
Definition
Timer.h:61
openshot::Timer::background_alpha
Keyframe background_alpha
Definition
Timer.h:80
openshot::Timer::stroke
Color stroke
Definition
Timer.h:71
openshot::Timer::end_time
Keyframe end_time
Definition
Timer.h:74
openshot::Timer::show_background
int show_background
Definition
Timer.h:66
openshot::Timer::TimerSeconds
double TimerSeconds(int64_t frame_number) const
Definition
Timer.cpp:198
openshot::Timer::Timer
Timer()
Definition
Timer.cpp:56
openshot::Timer::SetJson
void SetJson(const std::string value) override
Load JSON string into this object.
Definition
Timer.cpp:438
openshot::Timer::font_name
std::string font_name
Definition
Timer.h:67
openshot::Timer::Json
std::string Json() const override
Generate JSON string of this object.
Definition
Timer.cpp:404
openshot::Timer::PropertiesJSON
std::string PropertiesJSON(int64_t requested_frame) const override
Definition
Timer.cpp:501
openshot::Timer::color
Color color
Definition
Timer.h:70
openshot::Timer::prefix
std::string prefix
Definition
Timer.h:68
openshot::Timer::gravity
int gravity
Definition
Timer.h:65
openshot::Timer::font_alpha
Keyframe font_alpha
Definition
Timer.h:76
openshot::Timer::time_source
int time_source
Definition
Timer.h:62
openshot::Timer::background_corner
Keyframe background_corner
Definition
Timer.h:82
openshot::Timer::format
int format
Definition
Timer.h:63
openshot::Timer::background
Color background
Definition
Timer.h:72
openshot::Timer::SetJsonValue
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition
Timer.cpp:451
openshot::Timer::GetFrame
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
Definition
Timer.h:86
openshot
This namespace is the default namespace for all code in the openshot library.
Definition
AnimatedCurve.h:24
openshot::TimerTimeSource
TimerTimeSource
Definition
Timer.h:36
openshot::TIMER_TIME_SOURCE
@ TIMER_TIME_SOURCE
Definition
Timer.h:38
openshot::TIMER_TIME_CLIP
@ TIMER_TIME_CLIP
Definition
Timer.h:37
openshot::TimerFormat
TimerFormat
Definition
Timer.h:41
openshot::TIMER_FORMAT_HH_MM_SS
@ TIMER_FORMAT_HH_MM_SS
Definition
Timer.h:43
openshot::TIMER_FORMAT_TIMECODE
@ TIMER_FORMAT_TIMECODE
Definition
Timer.h:45
openshot::TIMER_FORMAT_MM_SS
@ TIMER_FORMAT_MM_SS
Definition
Timer.h:42
openshot::TIMER_FORMAT_HH_MM_SS_MILLISECONDS
@ TIMER_FORMAT_HH_MM_SS_MILLISECONDS
Definition
Timer.h:44
openshot::TIMER_FORMAT_FRAMES
@ TIMER_FORMAT_FRAMES
Definition
Timer.h:46
openshot::TimerMode
TimerMode
Definition
Timer.h:28
openshot::TIMER_MODE_COUNT_UP
@ TIMER_MODE_COUNT_UP
Definition
Timer.h:29
openshot::TIMER_MODE_TIMECODE
@ TIMER_MODE_TIMECODE
Definition
Timer.h:32
openshot::TIMER_MODE_FRAME_NUMBER
@ TIMER_MODE_FRAME_NUMBER
Definition
Timer.h:33
openshot::TIMER_MODE_CLOCK
@ TIMER_MODE_CLOCK
Definition
Timer.h:31
openshot::TIMER_MODE_COUNT_DOWN
@ TIMER_MODE_COUNT_DOWN
Definition
Timer.h:30
effects
Timer.h
Generated by
1.17.0