You.i Engine
YiClosedCaptionsRenderer.h
Go to the documentation of this file.
1 #ifndef _YI_CLOSED_CAPTIONS_RENDERER_H_
2 #define _YI_CLOSED_CAPTIONS_RENDERER_H_
3 
6 #include "utility/YiColor.h"
7 #include "utility/YiString.h"
8 
17 {
18 public:
23  {
36  };
37 
42  {
46  };
47 
52  {
56  };
57 
61  enum LIFETIME
62  {
65  };
66 
72  struct Span
73  {
74  Span();
75 
77 
79  bool bItalic;
80  bool bBold;
81  bool bUnderline;
82  float fFontSize;
83 
86  };
87 
91  struct Cue
92  {
93  Cue();
94 
98  CYIString GetText() const;
99 
103  void RestyleCue(const CYIClosedCaptionsStylingBridge::Style &userStyle, float fVideoHeight);
104 
108  std::vector<CYITextSceneNode::YI_TEXT_STYLE_DEF> GenerateTextSceneNodeStyles() const;
109 
110 
111  std::vector<Span> spans;
112 
114 
115  glm::vec2 position;
119 
120  float fTextWidth;
121  float fTextHeight;
122 
124  uint64_t uExpirationTimeMs;
125  };
126 
128 
132  virtual void Clear() = 0;
133 
139  virtual void Begin() = 0;
140 
146  virtual void End() = 0;
147 
151  virtual void AddCue(const Cue &cue) = 0;
152 
156  virtual void RemoveCues(const CYIString &cueText) = 0;
157 
161  virtual void OnVideoTimeUpdated(uint64_t uVideoTimeMs) = 0;
162 };
163 
164 #endif
An interface that describes a class that can render closed captions.
Definition: YiClosedCaptionsRenderer.h:16
CYIColor fontColor
The font color. Defaults to white.
Definition: YiClosedCaptionsRenderer.h:84
CYIColor characterBackgroundColor
The character background color. Defaults to transparent.
Definition: YiClosedCaptionsRenderer.h:85
CYIColor windowColor
The window background color. Defaults to 50% transparent black.
Definition: YiClosedCaptionsRenderer.h:113
virtual void Clear()=0
bool bBold
True if the font should be bold.
Definition: YiClosedCaptionsRenderer.h:80
virtual void RemoveCues(const CYIString &cueText)=0
TEXT_ANCHOR_POINT eAnchorPoint
The anchor point of the text box. Defaults to CENTER.
Definition: YiClosedCaptionsRenderer.h:116
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
The cue should be rendered until manually removed by a call to RemoveCues(). The cue may also be remo...
Definition: YiClosedCaptionsRenderer.h:64
CYIString text
Definition: YiClosedCaptionsRenderer.h:76
Definition: YiClosedCaptionsRenderer.h:44
uint64_t uExpirationTimeMs
The time at which the cue should be removed, in video time. If 0, the cue remains until removed by th...
Definition: YiClosedCaptionsRenderer.h:124
Definition: YiClosedCaptionsRenderer.h:43
Definition: YiClosedCaptionsRenderer.h:54
virtual void AddCue(const Cue &cue)=0
Definition: YiClosedCaptionsRenderer.h:72
TEXT_ANCHOR_POINT
Definition: YiClosedCaptionsRenderer.h:22
Definition: YiClosedCaptionsRenderer.h:35
virtual ~IYIClosedCaptionsRenderer()
Definition: YiClosedCaptionsRenderer.h:127
TEXT_HORIZONTAL_ALIGNMENT
Definition: YiClosedCaptionsRenderer.h:41
virtual void End()=0
bool bUnderline
True if the font should be underlined.
Definition: YiClosedCaptionsRenderer.h:81
virtual void OnVideoTimeUpdated(uint64_t uVideoTimeMs)=0
Definition: YiClosedCaptionsStylingBridge.h:72
std::vector< Span > spans
The spans of text.
Definition: YiClosedCaptionsRenderer.h:111
The cue should be rendered until the next call to Begin(). The cue may also be removed if it has a du...
Definition: YiClosedCaptionsRenderer.h:63
TEXT_VERTICAL_ALIGNMENT eVerticalAlignment
The vertical alignment of the text within the box. Defaults to ALIGN_VERTICALLY_TOP.
Definition: YiClosedCaptionsRenderer.h:118
glm::vec2 position
The position within the video frame. In pixels.
Definition: YiClosedCaptionsRenderer.h:115
Definition: YiClosedCaptionsRenderer.h:27
virtual void Begin()=0
Definition: YiClosedCaptionsRenderer.h:53
float fTextHeight
The height of the text box. Defaults to 0. This is used for positionning only – the height of the te...
Definition: YiClosedCaptionsRenderer.h:121
TEXT_VERTICAL_ALIGNMENT
Definition: YiClosedCaptionsRenderer.h:51
bool bItalic
True if the font should be italic.
Definition: YiClosedCaptionsRenderer.h:79
LIFETIME eLifetime
An indication of when the cue should be removed.
Definition: YiClosedCaptionsRenderer.h:123
Definition: YiClosedCaptionsRenderer.h:91
LIFETIME
Definition: YiClosedCaptionsRenderer.h:61
Definition: YiClosedCaptionsRenderer.h:45
float fFontSize
The font size in pixels, relative to the video height.
Definition: YiClosedCaptionsRenderer.h:82
TEXT_HORIZONTAL_ALIGNMENT eHorizontalAlignment
The horizontal alignment of the text within the box. Defaults to ALIGN_CENTER.
Definition: YiClosedCaptionsRenderer.h:117
Definition: YiClosedCaptionsRenderer.h:55
A class used to represent a color value.
Definition: YiColor.h:31
float fTextWidth
The width of the text box. Defaults to -1, which indicates &#39;use full video width&#39;.
Definition: YiClosedCaptionsRenderer.h:120
Definition: YiClosedCaptionsRenderer.h:31
CYIString fontFamily
Definition: YiClosedCaptionsRenderer.h:78