sl@0: // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef MMFVIDEOSURFACECUSTOMCOMMANDS_H sl@0: #define MMFVIDEOSURFACECUSTOMCOMMANDS_H sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: const TUid KUidInterfaceMMFVideoPlaySurfaceSupport = {0x1028340D}; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: sl@0: The controller sends this event when (1) a surface has been created after a play command and sl@0: the first frame for the stream has been passed to the surface, and (2) when an existing surface sl@0: should be replaced with a newly created surface. sl@0: */ sl@0: const TUid KMMFEventCategoryVideoSurfaceCreated = { 0x1028340F }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: const TUid KMMFEventCategoryVideoSurfaceParametersChanged = { 0x10283410 }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: sl@0: The controller sends this event when a surface must be replaced with another surface sl@0: but there are not enough resources to have both created at the same time. The client sl@0: utility must respond with MvpssSurfaceRemovedL() command. sl@0: */ sl@0: const TUid KMMFEventCategoryVideoRemoveSurface = { 0x10283411 }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: sl@0: Mixin class for the custom commands implemented by the controller. The custom command parser calls sl@0: methods in this class to deliver the requests to the controller. sl@0: */ sl@0: class MMMFVideoPlaySurfaceSupportCustomCommandImplementor sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Enables using graphics surfaces for video playback. sl@0: sl@0: An interface implemented by either the decoder or the controller. sl@0: */ sl@0: virtual void MvpssUseSurfacesL() = 0; sl@0: sl@0: /** sl@0: Gets surface parameters. sl@0: sl@0: An interface implemented by either the decoder or the controller. sl@0: sl@0: @param aSurfaceId sl@0: Surface id of the current surface. sl@0: @param aCropRect sl@0: Cropping rectangle within the surface. The crop rectangle identifies the area of sl@0: the surface that should be shown on the screen. sl@0: @param aPixelAspectRatio sl@0: Video picture pixel aspect ratio. sl@0: */ sl@0: virtual void MvpssGetSurfaceParametersL(TSurfaceId& aSurfaceId, TRect& aCropRect, sl@0: TVideoAspectRatio& aPixelAspectRatio) = 0; sl@0: sl@0: /** sl@0: Informs the controller that the surface is no longer in use and can sl@0: be destroyed. sl@0: sl@0: An interface implemented by either the decoder or the controller. sl@0: sl@0: @param aSurfaceId sl@0: Surface that has been removed and can be destroyed. sl@0: */ sl@0: virtual void MvpssSurfaceRemovedL(const TSurfaceId& aSurfaceId) = 0; sl@0: sl@0: }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: sl@0: Custom command parser class to be used by controller plugins wishing to support video surface play sl@0: controller commands. sl@0: sl@0: The controller plugin must be derived from MMMFVideoPlaySurfaceSupportCustomCommandImplementor to use sl@0: this class. The controller plugin should create an object of this type and add it to the list of sl@0: custom command parsers in the controller framework. sl@0: */ sl@0: sl@0: class CMMFVideoPlaySurfaceSupportCustomCommandParser : public CMMFCustomCommandParserBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Creates a new custom command parser capable of handling video surface support commands. sl@0: sl@0: @param aImplementor sl@0: A reference to the controller plugin that owns this new object. sl@0: sl@0: @return A pointer to the object created. sl@0: sl@0: */ sl@0: IMPORT_C static CMMFVideoPlaySurfaceSupportCustomCommandParser* NewL(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor); sl@0: sl@0: /** sl@0: Destructor. sl@0: sl@0: */ sl@0: IMPORT_C ~CMMFVideoPlaySurfaceSupportCustomCommandParser(); sl@0: sl@0: /** sl@0: Handles a request from the client. Called by the controller framework. sl@0: sl@0: @param aMessage sl@0: The message to be handled. sl@0: sl@0: */ sl@0: void HandleRequest(TMMFMessage& aMessage); sl@0: private: sl@0: /** sl@0: Constructor. sl@0: sl@0: @param aImplementor sl@0: A reference to the controller plugin that owns this new object. sl@0: sl@0: */ sl@0: CMMFVideoPlaySurfaceSupportCustomCommandParser(MMMFVideoPlaySurfaceSupportCustomCommandImplementor& aImplementor); sl@0: // Internal request handling methods. sl@0: void DoHandleRequestL(TMMFMessage& aMessage); sl@0: TBool DoUseSurfacesL(TMMFMessage& aMessage); sl@0: TBool DoGetSurfaceParametersL(TMMFMessage& aMessage); sl@0: TBool DoSurfaceRemovedL(TMMFMessage& aMessage); sl@0: sl@0: private: sl@0: /** sl@0: The object that implements the video surface support interface sl@0: */ sl@0: MMMFVideoPlaySurfaceSupportCustomCommandImplementor& iImplementor; sl@0: }; sl@0: sl@0: /** sl@0: @publishedPartner sl@0: @prototype sl@0: sl@0: Client class to access functionality specific to a video surface support playback controller. sl@0: sl@0: The class uses the custom command function of the controller plugin, and removes the necessity sl@0: for the client to formulate the custom commands. sl@0: */ sl@0: class RMMFVideoPlaySurfaceSupportCustomCommands : public RMMFCustomCommandsBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Constructor. sl@0: sl@0: @param aController sl@0: The client side controller object to be used by this custom command interface. sl@0: */ sl@0: IMPORT_C RMMFVideoPlaySurfaceSupportCustomCommands(RMMFController& aController); sl@0: sl@0: /** sl@0: Enables using graphics surfaces for video playback. sl@0: sl@0: Instructs the controller to use graphics surfaces as destination. Note that direct screen sl@0: access and graphics surface use is mutually exclusive, enabling one will disable the other. sl@0: sl@0: @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the sl@0: controller or otherwise one of the system wide error codes. sl@0: */ sl@0: IMPORT_C TInt UseSurfaces() const; sl@0: sl@0: /** sl@0: Gets the surface parameters for a display. sl@0: sl@0: The client utility typically calls this in response to KMMFEventCategoryVideoSurfaceCreated and sl@0: KMMFEventCategoryVideoSurfaceParametersChanged events to retrieve new or updated surface sl@0: information for a display. sl@0: sl@0: @param aSurfaceId sl@0: Surface id of the current surface. sl@0: @param aCropRect sl@0: Cropping rectangle within the surface. The crop rectangle identifies the area of sl@0: the surface that should be shown on the screen. sl@0: @param aPixelAspectRatio sl@0: Video picture pixel aspect ratio. sl@0: sl@0: @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the sl@0: controller or KErrNotReady if no surface is available for the display or otherwise one of the sl@0: system wide error codes. sl@0: */ sl@0: IMPORT_C TInt GetSurfaceParameters(TSurfaceId& aSurfaceId, TRect& aCropRect, TVideoAspectRatio& aPixelAspectRatio) const; sl@0: sl@0: /** sl@0: Indicates that the surface is no longer in use and can be destroyed. sl@0: sl@0: The client utility typically calls this in response to either: sl@0: sl@0: KMMFEventCategoryVideoSurfaceCreated - when a surface is already registered with the utility. This sl@0: indicates that the client utility should stop using the current surface and use the one supplied sl@0: in the notification. When the client utility is no longer using the current surface it calls sl@0: SurfaceRemoved() sl@0: sl@0: KMMFEventCategoryVideoRemoveSurface - when the current surface should be removed. This indicates sl@0: that the client utility should stop using the current surface immediately. When the client utility sl@0: is no longer using the current surface it calls SurfaceRemoved() sl@0: sl@0: @param aSurfaceId sl@0: Surface which is no longer being used by client utility. sl@0: sl@0: @return KErrNone if successful. KErrNotSupported if graphic surfaces are not supported by the sl@0: controller or KErrNotReady if no surface is available for the display or otherwise one of the sl@0: system wide error codes. sl@0: */ sl@0: IMPORT_C TInt SurfaceRemoved(TSurfaceId& aSurfaceId) const; sl@0: sl@0: }; sl@0: sl@0: #endif // MMFVIDEOSURFACECUSTOMCOMMANDS_H