You.i Engine
CYIClosedCaptionsDispatcher Class Reference

Detailed Description

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.

See also

#include <player/YiClosedCaptionsDispatcher.h>

Inheritance diagram for CYIClosedCaptionsDispatcher:

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
- Public Member Functions inherited from IYIClosedCaptionsRenderer
virtual ~IYIClosedCaptionsRenderer ()

Additional Inherited Members

- Public Types inherited from IYIClosedCaptionsRenderer
enum  TextAnchorPoint {
enum  TextHorizontalAlignment {
enum  TextVerticalAlignment {
enum  Lifetime {

Constructor & Destructor Documentation

◆ CYIClosedCaptionsDispatcher()

CYIClosedCaptionsDispatcher::CYIClosedCaptionsDispatcher ( )

Member Function Documentation

◆ AddCue()

virtual void CYIClosedCaptionsDispatcher::AddCue ( const IYIClosedCaptionsRenderer::Cue cue)

Adds a subtitle cue for rendering.

Implements IYIClosedCaptionsRenderer.

◆ Begin()

virtual void CYIClosedCaptionsDispatcher::Begin ( )

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.

◆ Clear()

virtual void CYIClosedCaptionsDispatcher::Clear ( )

Clears any displayed closed captions.

Implements IYIClosedCaptionsRenderer.

◆ End()

virtual void CYIClosedCaptionsDispatcher::End ( )

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.

◆ OnVideoTimeUpdated()

virtual void CYIClosedCaptionsDispatcher::OnVideoTimeUpdated ( uint64_t  videoTimeMs)

Called when the video playback time has been updated. This is used to remove time-based closed captions when they expire.

Implements IYIClosedCaptionsRenderer.

◆ Register()

void CYIClosedCaptionsDispatcher::Register ( IYIClosedCaptionsRenderer pRenderer)

Registers pRenderer as a renderer of closed captions.

A single pRenderer instance can only be registered once.

◆ RemoveCues()

virtual void CYIClosedCaptionsDispatcher::RemoveCues ( const CYIString cueText)

Removes the subtitle cues identified by the text cueText.

Implements IYIClosedCaptionsRenderer.

◆ Unregister()

void CYIClosedCaptionsDispatcher::Unregister ( IYIClosedCaptionsRenderer pRenderer)

Unregisters pRenderer from being a renderer of closed captions. Has no effect if pRenderer is not currently registered.

The documentation for this class was generated from the following file: