os/mm/mmlibs/mmfw/inc/mmf/ControllerFramework/mmfvideosubtitlecustomcommands.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef MMFVIDEOSUBTITLECUSTOMCOMMANDS_H
    17 #define MMFVIDEOSUBTITLECUSTOMCOMMANDS_H
    18 
    19 #include <mmf/common/mmfcontroller.h>
    20 #include <mmf/common/mmfvideo.h>
    21 #include <gdi.h>
    22 #include <w32std.h>
    23 
    24 /**
    25  * Unique identifier for subtitle custom command interface
    26  * @publishedPartner
    27  * @prototype
    28  */
    29 const TUid KUidInterfaceMMFVideoPlaySubtitleSupport = {0x10285C9D};
    30 
    31 /**
    32  * Identifier for subtitle message Crp Ready, used by AviController to indicate 
    33  * the CRP is ready to be drawn.
    34  * @publishedPartner
    35  * @prototype
    36  */
    37 const TUid KMMFEventCategoryVideoSubtitleCrpReady = {0x10285C9E};
    38 
    39 /**
    40  * Class encapsulates all window information required for DevSubtitle to initialize the CRP.
    41  * @publishedPartner
    42  * @prototype
    43  * This class is used to send subtitle window client configuration to controller
    44  */
    45 class TMMFSubtitleWindowConfig
    46 	{
    47 public:
    48 	/** Window unique identifier */
    49 	TInt iWindowId; 
    50 
    51 	/** Video window clip rectangle */
    52 	TRect iWindowClipRect;
    53 
    54 	/** Video window display mode */
    55 	TDisplayMode iDisplayMode;
    56 	
    57 	/** Video rotation angle */
    58 	TVideoRotation iRotation;
    59 	};
    60 
    61 /**
    62  * @publishedPartner 
    63  * @prototype
    64  * 
    65  * Mixin class for subtitle custom commands implemented by the controller. The custom
    66  * command parser calls methods in this class to deliver the requests to the
    67  * controller.
    68  */
    69 class MMMFVideoPlaySubtitleSupportCustomCommandImplementor
    70 	{
    71 public:
    72 	/**
    73 	 * Gets the CRP parameters associated with a display
    74 	 * 
    75 	 * @param aWindowId Unique identifier of the window.
    76 	 * @param aId Return the CRP id associated with the given display id
    77 	 * @param aCrpRect Return the subtitle region for drawing the CRP
    78 	 */
    79 	virtual void MvpsusGetCrpParametersL(TInt aWindowId, TWsGraphicId& aId, TRect& aCrpRect) = 0;
    80 	
    81 	/**
    82 	 * Adds subtitle configuration data for a window.
    83 	 * 
    84 	 * @param aConfig Subtitle configuration data for a window.
    85 	 */
    86 	virtual void MvpsusAddSubtitleConfigL(const TMMFSubtitleWindowConfig& aConfig) = 0;
    87 	
    88 	/**
    89 	 * Removes the subtitle configuration data associated with the given window.
    90 	 * 
    91 	 * @param aWindowId Unique identifier of the window associated with the 
    92 	 * configuration data being removed.
    93 	 */
    94 	virtual void MvpsusRemoveSubtitleConfigL(TInt aWindowId) = 0;
    95 	
    96 	/** 
    97 	 * Reconfigures the subtitle configuration.
    98 	 * 
    99 	 * @param aConfig Subtitle configuration data for a window.
   100 	 */
   101 	virtual void MvpsusUpdateSubtitleConfigL(const TMMFSubtitleWindowConfig& aConfig) = 0;
   102 	
   103 	/** 
   104 	 * Checks if subtitles are available in the current video stream.  
   105 	 * 
   106 	 * @param aAvailable When this method returns, this is set the ETrue if the 
   107 	 * current video stream subtitles.  
   108 	 * @leave KErrNotSupported if the controller does not support subtitles.  Otherwise
   109 	 * another system-wide error code.
   110 	 */
   111 	virtual void MvpsusGetSubtitlesAvailableL(TBool& aAvailable) = 0;
   112 	
   113 	/**
   114 	 * Disables subtitles during video playback.
   115 	 * 
   116 	 * @leave System wide error code
   117 	 */
   118 	virtual void MvpsusDisableSubtitlesL() = 0;
   119 	
   120 	/**
   121 	 * Enables subtitles during video playback.
   122 	 * 
   123 	 * @leave KErrNotSupported if subtitles are not supported
   124 	 * @leave KErrNotFound if subtitle data is not found
   125 	 * @leave Otherwise leaves with any of the system wide error codes.
   126 	 */
   127 	virtual void MvpsusEnableSubtitlesL() = 0;
   128 	
   129 	/**
   130 	 * Gets the current subtitle language
   131 	 * 
   132 	 * @param aLanguage When this method returns, this is set the the current subtitle language.
   133 	 * @leave KErrNotSupported The enabled subtitle does not contain language
   134 	 * information.
   135 	 * @leave Otherwise leaves with any of the system wide error codes.
   136 	 */
   137 	virtual void MvpsusGetSubtitleLanguageL(TLanguage& aLanguage) = 0;
   138 	
   139 	/**
   140 	 * Gets array of all supported languages that are available in the current 
   141 	 * video player.
   142 	 * 
   143 	 * @param aAvailable When this function returns, this array will hold the
   144 	 * supported languages.
   145 	 * @leave KErrNotSupported The enabled subtitle does not contain language 
   146 	 * information
   147 	 * @leave Otherwise leaves with any of the system wide error codes.
   148 	 */
   149 	virtual void MvpsusGetSupportedSubtitleLanguagesL(RArray<TLanguage>& aAvailable) = 0;
   150 	
   151 	/**
   152 	 * Sets the current subtitle language
   153 	 * 
   154 	 * @param aLanguage Language to be used for subtitle stream.
   155 	 * @leave KErrNotSupported The enabled subtitle does not support the requested 
   156 	 * language.
   157 	 * @leave Otherwise leaves with any of the system wide error codes.
   158 	 */
   159 	virtual void MvpsusSetSubtitleLanguageL(TLanguage aLanguage) = 0;
   160 	};
   161 
   162 /**
   163  * @publishedPartner 
   164  * @prototype
   165  * 
   166  * Custom command parser class to be used by controller plugins wishing to support 
   167  * custom subtitle commands in a video play controller.
   168  * 
   169  * The controller plugin must be derived from 
   170  * MMMFVideoPlaySubtitleSupportCustomCommandImplementor to use this class. The 
   171  * controller plugin should create an object of this type and add it to the list of 
   172  * custom command parsers in the controller framework.
   173  * 
   174  * @see MMMFVideoPlaySubtitleSupportCustomCommandImplementor
   175  * @see RMMFVideoPlaySubtitleSupportCustomCommands
   176  */
   177 class CMMFVideoPlaySubtitleSupportCustomCommandParser : public CMMFCustomCommandParserBase
   178 	{
   179 public:
   180 	IMPORT_C static CMMFVideoPlaySubtitleSupportCustomCommandParser* NewL(MMMFVideoPlaySubtitleSupportCustomCommandImplementor& aImplementor);
   181 	IMPORT_C ~CMMFVideoPlaySubtitleSupportCustomCommandParser();
   182 	void HandleRequest(TMMFMessage& aMessage);
   183 	
   184 private:
   185 	CMMFVideoPlaySubtitleSupportCustomCommandParser(MMMFVideoPlaySubtitleSupportCustomCommandImplementor& aImplementor);
   186 	
   187 	void DoHandleRequestL(TMMFMessage& aMessage);
   188 	
   189 	void DoAddSubtitleConfigL(TMMFMessage& aMessage);
   190 	void DoRemoveSubtitleConfigL(TMMFMessage& aMessage);
   191 	void DoUpdateSubtitleConfigL(TMMFMessage& aMessage);
   192 	void DoGetSubtitlesAvailableL(TMMFMessage& aMessage);
   193 	void DoDisableSubtitlesL(TMMFMessage& aMessage);
   194 	void DoEnableSubtitlesL(TMMFMessage& aMessage);
   195 	void DoGetSupportedLanguagesDataL(TMMFMessage& aMessage);
   196 	void DoGetSupportedLanguagesCountL(TMMFMessage& aMessage);
   197 	void DoGetSubtitleLanguageL(TMMFMessage& aMessage);
   198 	void DoSetSubtitleLanguageL(TMMFMessage& aMessage);
   199 	void DoGetCrpParametersL(TMMFMessage& aMessage);
   200 
   201 private:
   202 	MMMFVideoPlaySubtitleSupportCustomCommandImplementor& iImplementor;
   203 	RArray<TLanguage> iAvailableLanguages;
   204 	};
   205 
   206 /**
   207  * @publishedPartner 
   208  * @prototype
   209  * 
   210  * Client class to access functionality specific to a subtitle supported playback 
   211  * controller. The class uses the custom command function of the controller plugin, 
   212  * and removes the necessity for the client to formulate the custom commands.
   213  */
   214 class RMMFVideoPlaySubtitleSupportCustomCommands : public RMMFCustomCommandsBase
   215 	{
   216 public:
   217 
   218 	IMPORT_C RMMFVideoPlaySubtitleSupportCustomCommands(RMMFController& aController);
   219 	IMPORT_C TInt AddSubtitleConfig(const TMMFSubtitleWindowConfig& aConfig);
   220 	IMPORT_C TInt RemoveSubtitleConfig(TInt aWindowId);
   221 	IMPORT_C TInt UpdateSubtitleConfig(const TMMFSubtitleWindowConfig& aConfig);
   222 	IMPORT_C TInt GetSubtitlesAvailable(TBool& aAvailable);
   223 	IMPORT_C TInt DisableSubtitles();
   224 	IMPORT_C TInt EnableSubtitles();
   225 	IMPORT_C TInt GetCrpParameters(TInt aWindowId, TWsGraphicId& aId, TRect& aCrpRect);
   226 	IMPORT_C TInt GetSubtitleLanguage(TLanguage& aLanguage);
   227 	IMPORT_C void GetSupportedSubtitleLanguagesL(RArray<TLanguage>& aSubtitleLanguages);
   228 	IMPORT_C TInt SetSubtitleLanguage(TLanguage aSubtitleLanguage);
   229 	};
   230 
   231 #endif // MMFVIDEOSUBTITLECUSTOMCOMMANDS_H