libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
timecodeoverlaynode.h
Go to the documentation of this file.
1
8#pragma once
9
11#include <promeki/core/string.h>
15
17
38 PROMEKI_OBJECT(TimecodeOverlayNode, MediaNode)
39 public:
50
56
58 virtual ~TimecodeOverlayNode() = default;
59
64 void setFontPath(const FilePath &path) { _fontPath = path; return; }
65
67 const FilePath &fontPath() const { return _fontPath; }
68
73 void setFontSize(int points) { _fontSize = points; return; }
74
76 int fontSize() const { return _fontSize; }
77
86 void setPosition(Position pos) { _position = pos; return; }
87
96 void setPosition(int x, int y) {
97 _position = Custom;
98 _customX = x;
99 _customY = y;
100 return;
101 }
102
104 Position position() const { return _position; }
105
113 _colorR = r; _colorG = g; _colorB = b;
114 return;
115 }
116
121 void setDrawBackground(bool enable) { _drawBackground = enable; return; }
122
124 bool drawBackground() const { return _drawBackground; }
125
130 void setCustomText(const String &text) { _customText = text; return; }
131
133 const String &customText() const { return _customText; }
134
135 // ---- Lifecycle overrides ----
136
145 Error configure() override;
146
154 void process() override;
155
156 private:
157 FilePath _fontPath;
158 int _fontSize = 36;
159 Position _position = BottomCenter;
160 int _customX = 0;
161 int _customY = 0;
162 uint16_t _colorR = 65535;
163 uint16_t _colorG = 65535;
164 uint16_t _colorB = 65535;
165 bool _drawBackground = true;
166 String _customText;
167
168 FontPainter _fontPainter;
169
179 void computePosition(int frameWidth, int frameHeight, int textWidth, int totalHeight, int &x, int &y) const;
180};
181
Lightweight error code wrapper for the promeki library.
Definition error.h:39
Simple value type wrapping std::filesystem::path.
Definition filepath.h:27
Renders text into an image using a TrueType font.
Definition fontpainter.h:23
Dynamic array container wrapping std::vector.
Definition list.h:40
Base class for all pipeline processing nodes.
Definition medianode.h:81
Base object for promeki.
Definition objectbase.h:129
ObjectBase * parent() const
Returns the parent object, if one. nullptr if none.
Definition objectbase.h:258
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Burns timecode text into video frames using FontPainter.
Definition timecodeoverlaynode.h:37
void setDrawBackground(bool enable)
Enables or disables drawing a dark background behind the text.
Definition timecodeoverlaynode.h:121
Position position() const
Returns the current position preset.
Definition timecodeoverlaynode.h:104
virtual ~TimecodeOverlayNode()=default
Destructor.
int fontSize() const
Returns the font size in points.
Definition timecodeoverlaynode.h:76
void setFontSize(int points)
Sets the font size in points.
Definition timecodeoverlaynode.h:73
void setPosition(Position pos)
Sets the text position using a named preset.
Definition timecodeoverlaynode.h:86
void process() override
Reads timecode from the input image's metadata and renders it as text.
Position
Named position presets for text placement.
Definition timecodeoverlaynode.h:41
@ BottomCenter
Bottom center.
Definition timecodeoverlaynode.h:46
@ TopCenter
Top center.
Definition timecodeoverlaynode.h:43
@ Custom
Custom x/y coordinates.
Definition timecodeoverlaynode.h:48
@ BottomRight
Bottom-right corner.
Definition timecodeoverlaynode.h:47
@ TopLeft
Top-left corner.
Definition timecodeoverlaynode.h:42
@ TopRight
Top-right corner.
Definition timecodeoverlaynode.h:44
@ BottomLeft
Bottom-left corner.
Definition timecodeoverlaynode.h:45
const FilePath & fontPath() const
Returns the font path.
Definition timecodeoverlaynode.h:67
void setPosition(int x, int y)
Sets a custom text position.
Definition timecodeoverlaynode.h:96
void setTextColor(uint16_t r, uint16_t g, uint16_t b)
Sets the text color.
Definition timecodeoverlaynode.h:112
TimecodeOverlayNode(ObjectBase *parent=nullptr)
Constructs a TimecodeOverlayNode.
const String & customText() const
Returns the custom text.
Definition timecodeoverlaynode.h:133
void setFontPath(const FilePath &path)
Sets the path to the TrueType font file.
Definition timecodeoverlaynode.h:64
bool drawBackground() const
Returns true if background drawing is enabled.
Definition timecodeoverlaynode.h:124
Error configure() override
Validates the font path and initializes the FontPainter.
void setCustomText(const String &text)
Sets additional custom text to render below the timecode.
Definition timecodeoverlaynode.h:130
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19