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
CYIAbstractVideoPlayer

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

Additional Inherited Members

- Public Types inherited from IYIClosedCaptionsRenderer
enum  TEXT_ANCHOR_POINT {
  TOP_LEFT_OF_TEXT,
  TOP_LEFT_OF_BOX,
  CENTER
}
 
enum  TEXT_HORIZONTAL_ALIGNMENT {
  ALIGN_LEFT,
  ALIGN_CENTER,
  ALIGN_RIGHT
}
 
enum  TEXT_VERTICAL_ALIGNMENT {
  ALIGN_VERTICALLY_TOP,
  ALIGN_VERTICALLY_CENTER,
  ALIGN_VERTICALLY_BOTTOM
}
 
enum  LIFETIME {
  UNTIL_NEXT_BEGIN,
  UNTIL_REMOVED
}
 

Constructor & Destructor Documentation

CYIClosedCaptionsDispatcher::CYIClosedCaptionsDispatcher ( )

Member Function Documentation

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

Adds a subtitle cue for rendering.

Implements IYIClosedCaptionsRenderer.

virtual void CYIClosedCaptionsDispatcher::Begin ( )
overridevirtual

Clears any captions that use the timing mode TIMING_MODE::UNTIL_NEXT_BEGIN and marks the beginning of a new set of rendering commands.

This should be called before any new cues are added.

Implements IYIClosedCaptionsRenderer.

virtual void CYIClosedCaptionsDispatcher::Clear ( )
overridevirtual

Clears any displayed closed captions.

Implements IYIClosedCaptionsRenderer.

virtual void CYIClosedCaptionsDispatcher::End ( )
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.

virtual void CYIClosedCaptionsDispatcher::OnVideoTimeUpdated ( uint64_t  uVideoTimeMs)
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.

Note
A single pRenderer instance can only be registered once.
virtual void CYIClosedCaptionsDispatcher::RemoveCues ( const CYIString cueText)
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.


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