mmlibs/mmfw/inc/mmf/ControllerFramework/mmfvideosurfacecustomcommands.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2007-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 MMFVIDEOSURFACECUSTOMCOMMANDS_H
       
    17 #define MMFVIDEOSURFACECUSTOMCOMMANDS_H
       
    18 
       
    19 #include <mmf/common/mmfcontroller.h>
       
    20 #include <mmf/common/mmfvideo.h>
       
    21 #include <graphics/surface.h>
       
    22 
       
    23 /**
       
    24 @publishedPartner
       
    25 @prototype
       
    26 */
       
    27 const TUid KUidInterfaceMMFVideoPlaySurfaceSupport = {0x1028340D};
       
    28 
       
    29 /**
       
    30 @publishedPartner 
       
    31 @prototype
       
    32 
       
    33 The controller sends this event when (1) a surface has been created after a play command and
       
    34 the first frame for the stream has been passed to the surface, and (2) when an existing surface
       
    35 should be replaced with a newly created surface. 
       
    36 */
       
    37 const TUid KMMFEventCategoryVideoSurfaceCreated = { 0x1028340F };
       
    38 
       
    39 /**
       
    40 @publishedPartner 
       
    41 @prototype
       
    42 */
       
    43 const TUid KMMFEventCategoryVideoSurfaceParametersChanged = { 0x10283410 };
       
    44 
       
    45 /**
       
    46 @publishedPartner 
       
    47 @prototype
       
    48 
       
    49 The controller sends this event when a surface must be replaced with another surface
       
    50 but there are not enough resources to have both created at the same time. The client
       
    51 utility must respond with MvpssSurfaceRemovedL() command.
       
    52 */
       
    53 const TUid KMMFEventCategoryVideoRemoveSurface = { 0x10283411 };
       
    54 
       
    55 /**
       
    56 @publishedPartner 
       
    57 @prototype
       
    58 
       
    59 Mixin class for the custom commands implemented by the controller. The custom command parser calls 
       
    60 methods in this class to deliver the requests to the controller.
       
    61 */
       
    62 class MMMFVideoPlaySurfaceSupportCustomCommandImplementor
       
    63 	{
       
    64 public:
       
    65 
       
    66 	/**
       
    67 	Enables using graphics surfaces for video playback.
       
    68 
       
    69 	An interface implemented by either the decoder or the controller.
       
    70 	*/
       
    71 	virtual void MvpssUseSurfacesL() = 0;
       
    72 
       
    73 	/**
       
    74 	Gets surface parameters.
       
    75 	
       
    76 	An interface implemented by either the decoder or the controller.
       
    77 
       
    78 	@param  aSurfaceId
       
    79 	        Surface id of the current surface.
       
    80 	@param  aCropRect
       
    81 	        Cropping rectangle within the surface. The crop rectangle identifies the area of 
       
    82 	        the surface that should be shown on the screen.
       
    83 	@param  aPixelAspectRatio
       
    84 	        Video picture pixel aspect ratio.
       
    85 	*/
       
    86 	virtual void MvpssGetSurfaceParametersL(TSurfaceId& aSurfaceId, TRect& aCropRect,
       
    87 											TVideoAspectRatio& aPixelAspectRatio) = 0;
       
    88 
       
    89 	/**
       
    90 	Informs the controller that the surface is no longer in use and can
       
    91 	be destroyed.
       
    92 	
       
    93 	An interface implemented by either the decoder or the controller.
       
    94 
       
    95 	@param  aSurfaceId
       
    96 	        Surface that has been removed and can be destroyed.
       
    97 	*/
       
    98 	virtual void MvpssSurfaceRemovedL(const TSurfaceId& aSurfaceId) = 0;
       
    99 
       
   100 	};
       
   101 
       
   102 /**
       
   103 @publishedPartner 
       
   104 @prototype
       
   105 
       
   106 Custom command parser class to be used by controller plugins wishing to support video surface play 
       
   107 controller commands.
       
   108 
       
   109 The controller plugin must be derived from MMMFVideoPlaySurfaceSupportCustomCommandImplementor to use 
       
   110 this class. The controller plugin should create an object of this type and add it to the list of 
       
   111 custom command parsers in the controller framework.
       
   112 */
       
   113 
       
   114 class CMMFVideoPlaySurfaceSupportCustomCommandParser : public CMMFCustomCommandParserBase
       
   115 	{
       
   116 public:
       
   117 
       
   118 	/**
       
   119 	Creates a new custom command parser capable of handling video surface support commands.
       
   120 
       
   121 	@param  aImplementor
       
   122 	        A reference to the controller plugin that owns this new object.
       
   123 
       
   124 	@return A pointer to the object created.
       
   125 
       
   126 	*/
       
   127 	IMPORT_C static CMMFVideoPlaySurfaceSupportCustomCommandParser* NewL(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor);
       
   128 
       
   129 	/**
       
   130 	Destructor.
       
   131 
       
   132 	*/
       
   133 	IMPORT_C ~CMMFVideoPlaySurfaceSupportCustomCommandParser();
       
   134 
       
   135 	/**
       
   136 	Handles a request from the client. Called by the controller framework.
       
   137 
       
   138 	@param  aMessage
       
   139 	        The message to be handled.
       
   140 
       
   141 	*/
       
   142 	void HandleRequest(TMMFMessage& aMessage);
       
   143 private:
       
   144 	/**
       
   145 	Constructor.
       
   146 
       
   147 	@param  aImplementor
       
   148 	        A reference to the controller plugin that owns this new object.
       
   149 
       
   150 	*/
       
   151 	CMMFVideoPlaySurfaceSupportCustomCommandParser(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor);
       
   152 	// Internal request handling methods.
       
   153 	void DoHandleRequestL(TMMFMessage& aMessage);
       
   154 	TBool DoUseSurfacesL(TMMFMessage& aMessage);
       
   155 	TBool DoGetSurfaceParametersL(TMMFMessage& aMessage);
       
   156 	TBool DoSurfaceRemovedL(TMMFMessage& aMessage);
       
   157 	
       
   158 private:
       
   159 	/** 
       
   160 	The object that implements the video surface support interface 
       
   161 	*/
       
   162 	MMMFVideoPlaySurfaceSupportCustomCommandImplementor& iImplementor;
       
   163 	};
       
   164 
       
   165 /**
       
   166 @publishedPartner 
       
   167 @prototype
       
   168 
       
   169 Client class to access functionality specific to a video surface support playback controller.
       
   170 
       
   171 The class uses the custom command function of the controller plugin, and removes the necessity
       
   172 for the client to formulate the custom commands.
       
   173 */
       
   174 class RMMFVideoPlaySurfaceSupportCustomCommands : public RMMFCustomCommandsBase
       
   175 	{
       
   176 public:
       
   177 
       
   178 	/**
       
   179 	Constructor.
       
   180 
       
   181 	@param  aController
       
   182 	        The client side controller object to be used by this custom command interface.
       
   183 	*/
       
   184 	IMPORT_C RMMFVideoPlaySurfaceSupportCustomCommands(RMMFController& aController);
       
   185 
       
   186 	/**
       
   187 	Enables using graphics surfaces for video playback.
       
   188 
       
   189 	Instructs the controller to use graphics surfaces as destination. Note that direct screen 
       
   190 	access and graphics surface use is mutually exclusive, enabling one will disable the other.
       
   191 	
       
   192 	@return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the 
       
   193 	controller or otherwise one of the system wide error codes.
       
   194 	*/
       
   195 	IMPORT_C TInt UseSurfaces() const;
       
   196 
       
   197 	/**
       
   198 	Gets the surface parameters for a display.
       
   199 	
       
   200 	The client utility typically calls this in response to KMMFEventCategoryVideoSurfaceCreated and 
       
   201 	KMMFEventCategoryVideoSurfaceParametersChanged events to retrieve new or updated surface 
       
   202 	information for a display.
       
   203 
       
   204 	@param  aSurfaceId
       
   205 	        Surface id of the current surface.
       
   206 	@param  aCropRect
       
   207 	        Cropping rectangle within the surface. The crop rectangle identifies the area of 
       
   208 	        the surface that should be shown on the screen.
       
   209 	@param  aPixelAspectRatio
       
   210 	        Video picture pixel aspect ratio.
       
   211 
       
   212 	@return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the 
       
   213 	controller or KErrNotReady if no surface is available for the display or otherwise one of the 
       
   214 	system wide error codes.
       
   215 	*/
       
   216 	IMPORT_C TInt GetSurfaceParameters(TSurfaceId& aSurfaceId, TRect& aCropRect, TVideoAspectRatio& aPixelAspectRatio) const;
       
   217 
       
   218 	/**
       
   219 	Indicates that the surface is no longer in use and can be destroyed.
       
   220 	
       
   221 	The client utility typically calls this in response to either:
       
   222 	
       
   223 	KMMFEventCategoryVideoSurfaceCreated  - when a surface is already registered with the utility. This
       
   224 	indicates that the client utility should stop using the current surface and use the one supplied
       
   225 	in the notification. When the client utility is no longer using the current surface it calls
       
   226 	SurfaceRemoved()
       
   227 	
       
   228 	KMMFEventCategoryVideoRemoveSurface  - when the current surface should be removed. This indicates
       
   229 	that the client utility should stop using the current surface immediately. When the client utility
       
   230 	is no longer using the current surface it calls	SurfaceRemoved()
       
   231 	
       
   232 	@param  aSurfaceId
       
   233 	        Surface which is no longer being used by client utility.
       
   234 
       
   235 	@return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the 
       
   236 	controller or KErrNotReady if no surface is available for the display or otherwise one of the 
       
   237 	system wide error codes.
       
   238 	*/
       
   239 	IMPORT_C TInt SurfaceRemoved(TSurfaceId& aSurfaceId) const;
       
   240 	
       
   241 	};
       
   242 
       
   243 #endif // MMFVIDEOSURFACECUSTOMCOMMANDS_H