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