This tutorial describes about enhancing MMF Controller to Support Video Subtitle CRP.
The purpose of this tutorial is to show you how to enhance MMF Controller to support Video Subtitle CRP.
Required Background
CVideoPlayerUtility2 and multimedia framework are extended to support the Video Subtitle CRP functionality. CVideoPlayerUtility is not extended because subtitle support requires graphics surfaces support which may not be present when CVideoPlayerUtiltiy is used.
Introduction
In Video Player Controller MMMFVideoPlaySubtitleSupportCustomCommandImplementor and CMMFVideoPlaySubtitleSupportCustomCommandParser classes are registered to allow Video Client API to use Video Subtitle CRP.
For information about the architectural relationship between Video Player Controller, Subtitle Decoder and Render; and Video Subtitle CRP see the Video Subtitle CRP Overview-Architectural Relationship session.
The following task is covered in this tutorial:
The high-level steps to implement Video Subtitle CRP in MMF Controller are shown here:
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSubtitlesAvailableL(TBool& ) to check if a subtitle source is available for an opened video source.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusEnableSubtitlesL() to enable subtitle support.
The enable subtitle function involves checking if a subtitle source is available and loading the corresponding subtitle decoder. If this function is called during video playback, the subtitle must be displayed when all the required components (such as Subtitle Decoder and Video Subtitle CRP) are ready.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusDisableSubtitlesL() to disable subtitle support.
The disable subtitle function involves stopping the subtitle display, unloading the subtitle decoder, and closing the subtitle source if the source is separate from the video source.
If languages selection is supported in the subtitle source:
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSupportedSubtitleLanguagesL(RArray<TLanguage>& ) to get a list of supported languages that are available in the selected subtitle source.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusSetSubtitleLanguageL(TLanguage ) to set the current subtitle language.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSubtitleLanguageL(TLanguage& ) to return the current subtitle language selected.
The subtitle configuration data for a window is passed to MMF controller by the TMMFSubtitleWindowConfig class. TMMFSubtitleWindowConfig is used to send the subtitle window client configuration to Video Player Controller.
The subtitle client window configuration is given to Video Player Controller so that the properties of the subtitle artwork CRP can be calculated for each window using the window identity as an identifier. The window clip rectangle can be used to calculate the subtitle region (for example, the subtitle region can be restricted to the bottom one-third of the display area ). The rotation value indicates the angle at which the subtitle text should be rotated such that the text is displayed in the same angle as the video. The TMMFSubtitleWindowConfig class is shown in the code below:
class TMMFSubtitleWindowConfig { public: /** Window unique identifier */ TInt iWindowId; /** Video window clip rectangle */ TRect iWindowClipRect; /** Video window display mode */ TDisplayMode iDisplayMode; /** Video rotation angle */ TVideoRotation iRotation; }
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusAddSubtitleConfigL(const TMMFSubtitleWindowConfig) to add subtitle configuration data for a window when subtitles are enabled.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusUpdateSubtitleConfigL(const TMMFSubtitleWindowConfig) to update when any of the window configuration values are changed for a window. For example, the update function can be called during video playback if the rotation setting is changed.
Implement MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusRemoveSubtitleConfigL() to remove window configuration when subtitles are disabled.
When the CRP for an added window or an updated window is ready for display, Video Player Controller sends KMMFEventCategoryVideoSubtitleCrpReady with the corresponding window identity to Video Client. The window identity is passed by the error code to Video Client:
const TUid KMMFEventCategoryVideoSubtitleCrpReady = {0x10285C9E};
After the KMMFEventCategoryVideoSubtitleCrpReady identifier is sent to the Video Client, the MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetCrpParametersL() function is called by MMF Framework to retrieve the Video Subtitle CRP parameters from MMF Controller.
The Video Subtitle CRP graphic identity is returned by the MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetCrpParametersL() function. The Video Subtitle CRP graphic identity is used by the Video Client to send draw request to Window Server. For more information about the graphic identity see the Using Subtitle Graphic tutorial.