Dispatches closed captioning cues to registered captions renderers.
If captions rendering is not handled implicitly by the CYIAbstractVideoPlayer implementation, an instance of CYIClosedCaptionsDispatcher will be used to send cue information to registered IYIClosedCaptionsRenderer instances. CYIVideoSurfaceView automatically instantiates a IYIClosedCaptionsRenderer when interoperating with a CYIAbstractVideoPlayer which makes use of a dispatcher.
In order to support closed captioning implementers of CYIAbstractVideoPlayer are required either to instantiate a CYIClosedCaptionsDispatcher and pass cue information from the player to the dispatcher, or ensure that the cues are rendered natively on the platform.
The Video Player documentation contains more detailed explanation of the interplay between the classes involved in closed captions rendering.
#include <player/YiClosedCaptionsDispatcher.h>
Public Member Functions | |
CYIClosedCaptionsDispatcher () | |
void | Register (IYIClosedCaptionsRenderer *pRenderer) |
void | Unregister (IYIClosedCaptionsRenderer *pRenderer) |
virtual void | Clear () override |
virtual void | Begin () override |
virtual void | End () override |
virtual void | AddCue (const IYIClosedCaptionsRenderer::Cue &cue) override |
virtual void | RemoveCues (const CYIString &cueText) override |
virtual void | OnVideoTimeUpdated (uint64_t videoTimeMs) override |
![]() | |
virtual | ~IYIClosedCaptionsRenderer () |
Additional Inherited Members | |
![]() | |
enum | TextAnchorPoint { TextAnchorPoint::TopLeftOfText, TextAnchorPoint::TopLeftOfBox, TextAnchorPoint::Center } |
enum | TextHorizontalAlignment { TextHorizontalAlignment::Left, TextHorizontalAlignment::Center, TextHorizontalAlignment::Right } |
enum | TextVerticalAlignment { TextVerticalAlignment::Top, TextVerticalAlignment::Center, TextVerticalAlignment::Bottom } |
enum | Lifetime { Lifetime::UntilNextBegin, Lifetime::UntilRemoved } |
CYIClosedCaptionsDispatcher::CYIClosedCaptionsDispatcher | ( | ) |
|
overridevirtual |
Adds a subtitle cue for rendering.
Implements IYIClosedCaptionsRenderer.
|
overridevirtual |
Clears any captions that use the timing mode TIMING_MODE::Lifetime::UntilNextBegin and marks the beginning of a new set of rendering commands.
This should be called before any new cues are added.
Implements IYIClosedCaptionsRenderer.
|
overridevirtual |
Clears any displayed closed captions.
Implements IYIClosedCaptionsRenderer.
|
overridevirtual |
Marks the end of a set of rendering commands.
This should be called once all of the cues necessary to complete the closed captions presentation have been submitted.
Implements IYIClosedCaptionsRenderer.
|
overridevirtual |
Called when the video playback time has been updated. This is used to remove time-based closed captions when they expire.
Implements IYIClosedCaptionsRenderer.
void CYIClosedCaptionsDispatcher::Register | ( | IYIClosedCaptionsRenderer * | pRenderer | ) |
Registers pRenderer as a renderer of closed captions.
|
overridevirtual |
Removes the subtitle cues identified by the text cueText.
Implements IYIClosedCaptionsRenderer.
void CYIClosedCaptionsDispatcher::Unregister | ( | IYIClosedCaptionsRenderer * | pRenderer | ) |
Unregisters pRenderer from being a renderer of closed captions. Has no effect if pRenderer is not currently registered.