OpenShot Library | libopenshot 1.1.1
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
26namespace openshot
27{
35
40
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;
63 int format;
64 int clamp;
67 std::string font_name;
68 std::string prefix;
69 std::string suffix;
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
Header file for Color class.
Header file for EffectBase class.
Header file for TextReader class.
Header file for Frame class.
Header file for JSON class.
Header file for the Keyframe class.
This class represents a color (used on the timeline and clips).
Definition Color.h:27
This abstract class is the base class, used by all effects in libopenshot.
Definition EffectBase.h:57
A Keyframe is a collection of Point instances, which is used to vary a number or property over time.
Definition KeyFrame.h:53
std::string suffix
Definition Timer.h:69
Keyframe stroke_width
Definition Timer.h:77
std::string TimerText(int64_t frame_number) const
Definition Timer.cpp:210
Keyframe x_offset
Definition Timer.h:78
Keyframe start_time
Definition Timer.h:73
Keyframe font_size
Definition Timer.h:75
Json::Value JsonValue() const override
Generate Json::Value for this object.
Definition Timer.cpp:409
Keyframe y_offset
Definition Timer.h:79
Keyframe background_padding
Definition Timer.h:81
Keyframe background_alpha
Definition Timer.h:80
Color stroke
Definition Timer.h:71
Keyframe end_time
Definition Timer.h:74
int show_background
Definition Timer.h:66
double TimerSeconds(int64_t frame_number) const
Definition Timer.cpp:198
void SetJson(const std::string value) override
Load JSON string into this object.
Definition Timer.cpp:438
std::string font_name
Definition Timer.h:67
std::string Json() const override
Generate JSON string of this object.
Definition Timer.cpp:404
std::string PropertiesJSON(int64_t requested_frame) const override
Definition Timer.cpp:501
Color color
Definition Timer.h:70
std::string prefix
Definition Timer.h:68
Keyframe font_alpha
Definition Timer.h:76
int time_source
Definition Timer.h:62
Keyframe background_corner
Definition Timer.h:82
Color background
Definition Timer.h:72
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Definition Timer.cpp:451
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
This namespace is the default namespace for all code in the openshot library.
TimerTimeSource
Definition Timer.h:36
@ TIMER_TIME_SOURCE
Definition Timer.h:38
@ TIMER_TIME_CLIP
Definition Timer.h:37
TimerFormat
Definition Timer.h:41
@ TIMER_FORMAT_HH_MM_SS
Definition Timer.h:43
@ TIMER_FORMAT_TIMECODE
Definition Timer.h:45
@ TIMER_FORMAT_MM_SS
Definition Timer.h:42
@ TIMER_FORMAT_HH_MM_SS_MILLISECONDS
Definition Timer.h:44
@ TIMER_FORMAT_FRAMES
Definition Timer.h:46
TimerMode
Definition Timer.h:28
@ TIMER_MODE_COUNT_UP
Definition Timer.h:29
@ TIMER_MODE_TIMECODE
Definition Timer.h:32
@ TIMER_MODE_FRAME_NUMBER
Definition Timer.h:33
@ TIMER_MODE_CLOCK
Definition Timer.h:31
@ TIMER_MODE_COUNT_DOWN
Definition Timer.h:30