Symbian3/SDK/Source/GUID-354240A8-2DDD-5181-9A36-9A054D239B62.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 11 Jun 2010 15:24:34 +0100
changeset 9 59758314f811
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-354240A8-2DDD-5181-9A36-9A054D239B62"><title>Video Subtitle CRP Support From MMF Tutorial</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>This tutorial describes about enhancing MMF Controller to Support Video Subtitle CRP. </p> <p> </p> <section><title>Purpose</title> <p>The purpose of this tutorial is to show you how to enhance MMF Controller to support Video Subtitle CRP. </p> <p><b>Required Background</b> </p> <p> <xref href="GUID-42D1182F-46D8-3C78-8D3C-C1BB465FCA1F.dita"><apiname>CVideoPlayerUtility2</apiname></xref> and multimedia framework are extended to support the Video Subtitle CRP functionality. <xref href="GUID-0F1F8AC6-B99F-3274-A785-9977197AF762.dita"><apiname>CVideoPlayerUtility</apiname></xref> is not extended because subtitle support requires <xref href="GUID-ADA8CECB-0E70-5B9C-8F36-0714AAF0CD13.dita">graphics surfaces</xref> support which may not be present when <xref href="GUID-164490D2-7622-3B09-9EF6-9F463C0796AC.dita"><apiname>CVideoPlayerUtiltiy</apiname></xref> is used. </p> <p><b>Introduction</b> </p> <p>In Video Player Controller <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor</apiname></xref> and <xref href="GUID-4905EA66-9185-3A48-8D00-3ADBFE3F7A9C.dita"><apiname>CMMFVideoPlaySubtitleSupportCustomCommandParser</apiname></xref> classes are registered to allow Video Client API to use Video Subtitle CRP. </p> <p>For information about the architectural relationship between Video Player Controller, Subtitle Decoder and Render; and Video Subtitle CRP see the <xref href="GUID-80E8BA3A-FDF3-50A5-BF44-181C40C31F09.dita#GUID-80E8BA3A-FDF3-50A5-BF44-181C40C31F09/GUID-845818F1-02CA-59FE-85F8-22623880759D">Video Subtitle CRP Overview-Architectural Relationship</xref> session. </p> </section> <section><title>Using to support Video Subtitle CRP for MMF </title> <p>The following task is covered in this tutorial: </p> <ul><li id="GUID-9B4AD645-7BC2-5B80-A1C9-CE65FC88DBAA"><p><xref href="GUID-354240A8-2DDD-5181-9A36-9A054D239B62.dita#GUID-354240A8-2DDD-5181-9A36-9A054D239B62/GUID-8E71E2E4-6FB4-5AB2-997C-F6018427C425">How to enhance MMF Controller to support Video Subtitle CRP</xref>  </p> </li> </ul> <p id="GUID-8E71E2E4-6FB4-5AB2-997C-F6018427C425"><b>Basic Procedure</b> </p> <p>The high-level steps to implement Video Subtitle CRP in MMF Controller are shown here: </p> <ul><li id="GUID-B9761E39-BC47-558E-82FB-43E89309C2F4"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-633D92A6-786D-32ED-B311-4C1975A832D1"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSubtitlesAvailableL(TBool&amp;
                  )</apiname></xref> to check if a subtitle source is available for an opened video source. </p> </li> <li id="GUID-3AC95E6E-5B51-52CB-A4A9-650E2ABF30C1"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-10C9057C-7E06-335D-9860-7199A9A935DD"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusEnableSubtitlesL()</apiname></xref> to enable subtitle support. </p> <p>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. </p> </li> <li id="GUID-C75C1ECF-1402-5C6B-8D6C-8D7EDFCB5BA2"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-1B56C375-2236-3488-9B77-4A5821798168"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusDisableSubtitlesL()</apiname></xref> to disable subtitle support. </p> <p>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. </p> </li> <li id="GUID-D617586D-E528-5DE8-8920-243161B49DAB"><p>If languages selection is supported in the subtitle source: </p> <ol id="GUID-BD0BAF46-DDF7-5498-B05A-156C115B4EAB"><li id="GUID-ED27DF2B-09BF-5324-8A95-EB74A7FC5AC6"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-B8B73319-D5CB-3370-A828-6A4903A6C86E"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSupportedSubtitleLanguagesL(RArray&lt;TLanguage&gt;&amp;
                        )</apiname></xref> to get a list of supported languages that are available in the selected subtitle source. </p> </li> <li id="GUID-18D50682-DF82-50F6-AE9E-299E111FE6D8"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-D2CD472D-DCBB-3A7B-9D1E-BCED722BFADE"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusSetSubtitleLanguageL(TLanguage
                        )</apiname></xref> to set the current subtitle language. </p> </li> <li id="GUID-2DAFA0C8-9464-5A4F-8548-23F0DCA77499"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-B3CC4815-2030-3FB4-8C41-FF9C2D981C12"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetSubtitleLanguageL(TLanguage&amp;
                        )</apiname></xref> to return the current subtitle language selected. </p> </li> </ol> </li> <li id="GUID-2E45DBA4-2AB1-5872-B435-69081BE21DB4"><p>The subtitle configuration data for a window is passed to MMF controller by the <xref href="GUID-014F48C6-EA09-36BA-A2ED-B45BA128A6EC.dita"><apiname>TMMFSubtitleWindowConfig</apiname></xref> class. <codeph>TMMFSubtitleWindowConfig</codeph> is used to send the subtitle window client configuration to Video Player Controller. </p> <p>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 <codeph>TMMFSubtitleWindowConfig</codeph> class is shown in the code below: </p> <codeblock id="GUID-A936EF7E-781D-5FF1-A24A-6C28AEEF7B7E" xml:space="preserve">

 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;
 }

</codeblock> <ul><li id="GUID-72726FC6-AF9B-5F20-B353-FEA69429196B"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-B3A167EE-FA21-308F-9AF7-463657EA7035"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusAddSubtitleConfigL(const
                        TMMFSubtitleWindowConfig)</apiname></xref> to add subtitle configuration data for a window when subtitles are enabled. </p> </li> <li id="GUID-E6444516-E776-52E4-BBFC-5836A95DF74B"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-572D4F35-09B0-39B3-B06A-EAA5A8426778"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusUpdateSubtitleConfigL(const
                        TMMFSubtitleWindowConfig) </apiname></xref> 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. </p> </li> <li id="GUID-81DBAA0F-0338-590B-AA0B-3BC4CA28F289"><p>Implement <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-11966D68-114C-3034-8A71-4C5ECC7E49C0"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusRemoveSubtitleConfigL()</apiname></xref> to remove window configuration when subtitles are disabled. </p> </li> <li id="GUID-BE488713-AE93-5EE4-BADB-7935B2FDEA9C"><p>When the CRP for an added window or an updated window is ready for display, Video Player Controller sends <xref href="GUID-D60E4CF8-EAD8-3E32-8CFE-967C0131CC82.dita"><apiname>KMMFEventCategoryVideoSubtitleCrpReady</apiname></xref> with the corresponding window identity to Video Client. The window identity is passed by the error code to Video Client: </p> <codeblock id="GUID-EFB08910-6B9F-526B-9428-EC085D387E75" xml:space="preserve">
const TUid KMMFEventCategoryVideoSubtitleCrpReady = {0x10285C9E};
</codeblock> </li> <li id="GUID-E6B62291-1840-54E7-9E53-D4030AE13552"><p>After the <codeph>KMMFEventCategoryVideoSubtitleCrpReady</codeph> identifier is sent to the Video Client, the <xref href="GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A.dita#GUID-54D2B15E-E40D-3C65-91BB-2BFEF708FD2A/GUID-6B92F4F8-9D7A-377C-97B9-BF8EBDE1B211"><apiname>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetCrpParametersL()</apiname></xref> function is called by MMF Framework to retrieve the Video Subtitle CRP parameters from MMF Controller. </p> <p>The Video Subtitle CRP graphic identity is returned by the <codeph>MMMFVideoPlaySubtitleSupportCustomCommandImplementor::MvpsusGetCrpParametersL()</codeph> 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 <xref href="GUID-A4354C8C-2A00-50C1-8DC6-6CE748BC01EB.dita">Using Subtitle Graphic</xref> tutorial. </p> </li> </ul> </li> </ul> </section> </conbody><related-links><link href="GUID-A9803A57-BB43-53F3-97BA-3B5E91D925F0.dita"><linktext>Subtitle Graphic Library
                Overview</linktext> </link> <link href="GUID-A4354C8C-2A00-50C1-8DC6-6CE748BC01EB.dita"><linktext> Using Subtitle
                Graphic</linktext> </link> </related-links></concept>