1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/ControllerFramework/mmfvideosurfacecustomcommands.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,243 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef MMFVIDEOSURFACECUSTOMCOMMANDS_H
1.20 +#define MMFVIDEOSURFACECUSTOMCOMMANDS_H
1.21 +
1.22 +#include <mmf/common/mmfcontroller.h>
1.23 +#include <mmf/common/mmfvideo.h>
1.24 +#include <graphics/surface.h>
1.25 +
1.26 +/**
1.27 +@publishedPartner
1.28 +@prototype
1.29 +*/
1.30 +const TUid KUidInterfaceMMFVideoPlaySurfaceSupport = {0x1028340D};
1.31 +
1.32 +/**
1.33 +@publishedPartner
1.34 +@prototype
1.35 +
1.36 +The controller sends this event when (1) a surface has been created after a play command and
1.37 +the first frame for the stream has been passed to the surface, and (2) when an existing surface
1.38 +should be replaced with a newly created surface.
1.39 +*/
1.40 +const TUid KMMFEventCategoryVideoSurfaceCreated = { 0x1028340F };
1.41 +
1.42 +/**
1.43 +@publishedPartner
1.44 +@prototype
1.45 +*/
1.46 +const TUid KMMFEventCategoryVideoSurfaceParametersChanged = { 0x10283410 };
1.47 +
1.48 +/**
1.49 +@publishedPartner
1.50 +@prototype
1.51 +
1.52 +The controller sends this event when a surface must be replaced with another surface
1.53 +but there are not enough resources to have both created at the same time. The client
1.54 +utility must respond with MvpssSurfaceRemovedL() command.
1.55 +*/
1.56 +const TUid KMMFEventCategoryVideoRemoveSurface = { 0x10283411 };
1.57 +
1.58 +/**
1.59 +@publishedPartner
1.60 +@prototype
1.61 +
1.62 +Mixin class for the custom commands implemented by the controller. The custom command parser calls
1.63 +methods in this class to deliver the requests to the controller.
1.64 +*/
1.65 +class MMMFVideoPlaySurfaceSupportCustomCommandImplementor
1.66 + {
1.67 +public:
1.68 +
1.69 + /**
1.70 + Enables using graphics surfaces for video playback.
1.71 +
1.72 + An interface implemented by either the decoder or the controller.
1.73 + */
1.74 + virtual void MvpssUseSurfacesL() = 0;
1.75 +
1.76 + /**
1.77 + Gets surface parameters.
1.78 +
1.79 + An interface implemented by either the decoder or the controller.
1.80 +
1.81 + @param aSurfaceId
1.82 + Surface id of the current surface.
1.83 + @param aCropRect
1.84 + Cropping rectangle within the surface. The crop rectangle identifies the area of
1.85 + the surface that should be shown on the screen.
1.86 + @param aPixelAspectRatio
1.87 + Video picture pixel aspect ratio.
1.88 + */
1.89 + virtual void MvpssGetSurfaceParametersL(TSurfaceId& aSurfaceId, TRect& aCropRect,
1.90 + TVideoAspectRatio& aPixelAspectRatio) = 0;
1.91 +
1.92 + /**
1.93 + Informs the controller that the surface is no longer in use and can
1.94 + be destroyed.
1.95 +
1.96 + An interface implemented by either the decoder or the controller.
1.97 +
1.98 + @param aSurfaceId
1.99 + Surface that has been removed and can be destroyed.
1.100 + */
1.101 + virtual void MvpssSurfaceRemovedL(const TSurfaceId& aSurfaceId) = 0;
1.102 +
1.103 + };
1.104 +
1.105 +/**
1.106 +@publishedPartner
1.107 +@prototype
1.108 +
1.109 +Custom command parser class to be used by controller plugins wishing to support video surface play
1.110 +controller commands.
1.111 +
1.112 +The controller plugin must be derived from MMMFVideoPlaySurfaceSupportCustomCommandImplementor to use
1.113 +this class. The controller plugin should create an object of this type and add it to the list of
1.114 +custom command parsers in the controller framework.
1.115 +*/
1.116 +
1.117 +class CMMFVideoPlaySurfaceSupportCustomCommandParser : public CMMFCustomCommandParserBase
1.118 + {
1.119 +public:
1.120 +
1.121 + /**
1.122 + Creates a new custom command parser capable of handling video surface support commands.
1.123 +
1.124 + @param aImplementor
1.125 + A reference to the controller plugin that owns this new object.
1.126 +
1.127 + @return A pointer to the object created.
1.128 +
1.129 + */
1.130 + IMPORT_C static CMMFVideoPlaySurfaceSupportCustomCommandParser* NewL(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor);
1.131 +
1.132 + /**
1.133 + Destructor.
1.134 +
1.135 + */
1.136 + IMPORT_C ~CMMFVideoPlaySurfaceSupportCustomCommandParser();
1.137 +
1.138 + /**
1.139 + Handles a request from the client. Called by the controller framework.
1.140 +
1.141 + @param aMessage
1.142 + The message to be handled.
1.143 +
1.144 + */
1.145 + void HandleRequest(TMMFMessage& aMessage);
1.146 +private:
1.147 + /**
1.148 + Constructor.
1.149 +
1.150 + @param aImplementor
1.151 + A reference to the controller plugin that owns this new object.
1.152 +
1.153 + */
1.154 + CMMFVideoPlaySurfaceSupportCustomCommandParser(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor);
1.155 + // Internal request handling methods.
1.156 + void DoHandleRequestL(TMMFMessage& aMessage);
1.157 + TBool DoUseSurfacesL(TMMFMessage& aMessage);
1.158 + TBool DoGetSurfaceParametersL(TMMFMessage& aMessage);
1.159 + TBool DoSurfaceRemovedL(TMMFMessage& aMessage);
1.160 +
1.161 +private:
1.162 + /**
1.163 + The object that implements the video surface support interface
1.164 + */
1.165 + MMMFVideoPlaySurfaceSupportCustomCommandImplementor& iImplementor;
1.166 + };
1.167 +
1.168 +/**
1.169 +@publishedPartner
1.170 +@prototype
1.171 +
1.172 +Client class to access functionality specific to a video surface support playback controller.
1.173 +
1.174 +The class uses the custom command function of the controller plugin, and removes the necessity
1.175 +for the client to formulate the custom commands.
1.176 +*/
1.177 +class RMMFVideoPlaySurfaceSupportCustomCommands : public RMMFCustomCommandsBase
1.178 + {
1.179 +public:
1.180 +
1.181 + /**
1.182 + Constructor.
1.183 +
1.184 + @param aController
1.185 + The client side controller object to be used by this custom command interface.
1.186 + */
1.187 + IMPORT_C RMMFVideoPlaySurfaceSupportCustomCommands(RMMFController& aController);
1.188 +
1.189 + /**
1.190 + Enables using graphics surfaces for video playback.
1.191 +
1.192 + Instructs the controller to use graphics surfaces as destination. Note that direct screen
1.193 + access and graphics surface use is mutually exclusive, enabling one will disable the other.
1.194 +
1.195 + @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the
1.196 + controller or otherwise one of the system wide error codes.
1.197 + */
1.198 + IMPORT_C TInt UseSurfaces() const;
1.199 +
1.200 + /**
1.201 + Gets the surface parameters for a display.
1.202 +
1.203 + The client utility typically calls this in response to KMMFEventCategoryVideoSurfaceCreated and
1.204 + KMMFEventCategoryVideoSurfaceParametersChanged events to retrieve new or updated surface
1.205 + information for a display.
1.206 +
1.207 + @param aSurfaceId
1.208 + Surface id of the current surface.
1.209 + @param aCropRect
1.210 + Cropping rectangle within the surface. The crop rectangle identifies the area of
1.211 + the surface that should be shown on the screen.
1.212 + @param aPixelAspectRatio
1.213 + Video picture pixel aspect ratio.
1.214 +
1.215 + @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the
1.216 + controller or KErrNotReady if no surface is available for the display or otherwise one of the
1.217 + system wide error codes.
1.218 + */
1.219 + IMPORT_C TInt GetSurfaceParameters(TSurfaceId& aSurfaceId, TRect& aCropRect, TVideoAspectRatio& aPixelAspectRatio) const;
1.220 +
1.221 + /**
1.222 + Indicates that the surface is no longer in use and can be destroyed.
1.223 +
1.224 + The client utility typically calls this in response to either:
1.225 +
1.226 + KMMFEventCategoryVideoSurfaceCreated - when a surface is already registered with the utility. This
1.227 + indicates that the client utility should stop using the current surface and use the one supplied
1.228 + in the notification. When the client utility is no longer using the current surface it calls
1.229 + SurfaceRemoved()
1.230 +
1.231 + KMMFEventCategoryVideoRemoveSurface - when the current surface should be removed. This indicates
1.232 + that the client utility should stop using the current surface immediately. When the client utility
1.233 + is no longer using the current surface it calls SurfaceRemoved()
1.234 +
1.235 + @param aSurfaceId
1.236 + Surface which is no longer being used by client utility.
1.237 +
1.238 + @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the
1.239 + controller or KErrNotReady if no surface is available for the display or otherwise one of the
1.240 + system wide error codes.
1.241 + */
1.242 + IMPORT_C TInt SurfaceRemoved(TSurfaceId& aSurfaceId) const;
1.243 +
1.244 + };
1.245 +
1.246 +#endif // MMFVIDEOSURFACECUSTOMCOMMANDS_H