os/mm/mmlibs/mmfw/inc/mmf/common/MmfVideo.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) 2002-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
// Mda\Common\MmfVideo.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __MMF_COMMON_VIDEO_H__
sl@0
    19
#define __MMF_COMMON_VIDEO_H__
sl@0
    20
sl@0
    21
#include <mmf/common/mmfutilities.h>
sl@0
    22
sl@0
    23
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    24
#include <mmf/common/mmfvideoenums.h>
sl@0
    25
#endif
sl@0
    26
sl@0
    27
class CFbsBitmap;
sl@0
    28
sl@0
    29
/**
sl@0
    30
@publishedAll
sl@0
    31
@released
sl@0
    32
sl@0
    33
The use of this constant as either a parameter for
sl@0
    34
CVideoRecorderUtility::SetVideoBitRateL or as a return value from
sl@0
    35
CVideoRecorderUtility::VideoBitRateL signifies that a variable
sl@0
    36
video bit rate is being used.
sl@0
    37
*/
sl@0
    38
const TInt KMMFVariableVideoBitRate = -1;
sl@0
    39
sl@0
    40
/**
sl@0
    41
@publishedAll
sl@0
    42
@released
sl@0
    43
sl@0
    44
CVideoRecorderUtility::SetMaxClipSizeL can take this constant
sl@0
    45
instead of a byte value.  This signifies there should be no max
sl@0
    46
clip size
sl@0
    47
*/
sl@0
    48
const TInt KMMFNoMaxClipSize = -1;
sl@0
    49
sl@0
    50
/**
sl@0
    51
@publishedAll
sl@0
    52
@released
sl@0
    53
sl@0
    54
CVideoPlayerUtility/CVideoRecorderUtility HandleEvent() code :
sl@0
    55
the video source file has been successfully opened
sl@0
    56
*/
sl@0
    57
const TUid KMMFEventCategoryVideoOpenComplete = {0x101F7F85};
sl@0
    58
sl@0
    59
/**
sl@0
    60
@publishedAll
sl@0
    61
@released
sl@0
    62
sl@0
    63
The unique identifier for the event that indicates that the video has been prepared for recording.
sl@0
    64
*/
sl@0
    65
const TUid KMMFEventCategoryVideoPrepareComplete = {0x101F7F86};
sl@0
    66
sl@0
    67
/**
sl@0
    68
@publishedAll
sl@0
    69
@released
sl@0
    70
*/
sl@0
    71
const TUid KMMFEventCategoryVideoLoadingStarted = {0x101F7F87};
sl@0
    72
sl@0
    73
/**
sl@0
    74
@publishedAll
sl@0
    75
@released
sl@0
    76
*/
sl@0
    77
const TUid KMMFEventCategoryVideoLoadingComplete = {0x101F7F88};
sl@0
    78
sl@0
    79
/**
sl@0
    80
@publishedAll
sl@0
    81
@released
sl@0
    82
*/
sl@0
    83
const TUid KMMFEventCategoryVideoPlayerGeneralError = {0x101F8000};
sl@0
    84
sl@0
    85
/**
sl@0
    86
@publishedAll
sl@0
    87
@released
sl@0
    88
*/
sl@0
    89
const TUid KMMFEventCategoryVideoRecorderGeneralError = {0x101F8001};
sl@0
    90
sl@0
    91
sl@0
    92
/**
sl@0
    93
@publishedAll
sl@0
    94
@released
sl@0
    95
sl@0
    96
Defines an absolute rotation in 90 degree increments
sl@0
    97
sl@0
    98
@since  7.0s
sl@0
    99
*/
sl@0
   100
enum TVideoRotation
sl@0
   101
	{
sl@0
   102
	EVideoRotationNone,
sl@0
   103
	EVideoRotationClockwise90,
sl@0
   104
	EVideoRotationClockwise180,
sl@0
   105
	EVideoRotationClockwise270
sl@0
   106
	};
sl@0
   107
sl@0
   108
/**
sl@0
   109
@publishedAll
sl@0
   110
@released
sl@0
   111
sl@0
   112
Class used when sending custom commands from the client API
sl@0
   113
to the video controller to get or set the video configuration.
sl@0
   114
*/
sl@0
   115
class TMMFVideoConfig
sl@0
   116
	{
sl@0
   117
public:
sl@0
   118
	inline TMMFVideoConfig();
sl@0
   119
sl@0
   120
public:
sl@0
   121
	/**
sl@0
   122
	A flag indicating whether audio output is enabled. ETrue if teh audio is to be enabled, false if
sl@0
   123
	not.
sl@0
   124
	*/
sl@0
   125
	TBool						iAudioEnabled;
sl@0
   126
	/**
sl@0
   127
	The location of the top left corner of the video window.
sl@0
   128
	*/
sl@0
   129
	TPoint						iTopLeftPt;
sl@0
   130
	/**
sl@0
   131
	Defines the rectangle in which the video clip will be played.
sl@0
   132
	*/
sl@0
   133
	TRect						iClipRect;
sl@0
   134
	/**
sl@0
   135
	A handle to the bitmap into which the decoded frame(s) are put.
sl@0
   136
	*/
sl@0
   137
	TInt						iBitmapHandle;
sl@0
   138
	/**
sl@0
   139
	The current frame number in the video clip.
sl@0
   140
	 */
sl@0
   141
	TInt						iFrameNumber;
sl@0
   142
	/**
sl@0
   143
	The number of frames per second; may not be an integer.
sl@0
   144
	*/
sl@0
   145
	TReal32						iFramesPerSecond;
sl@0
   146
	/**
sl@0
   147
	The width & height of the video frame.
sl@0
   148
	*/
sl@0
   149
	TSize						iVideoFrameSize;
sl@0
   150
	/**
sl@0
   151
	The volume setting of the video device.
sl@0
   152
sl@0
   153
	Should be between 0 and iMaxVolume.
sl@0
   154
	*/
sl@0
   155
	TInt						iVolume;
sl@0
   156
	/**
sl@0
   157
	The maximum volume setting of the video device.
sl@0
   158
sl@0
   159
	This value is platform dependent but is always greater than or equal to one. This is the maximum
sl@0
   160
	value that should be passed to iVolume.
sl@0
   161
	*/
sl@0
   162
	TInt						iMaxVolume;
sl@0
   163
	/**
sl@0
   164
	The balance of the audio channels for the video device. Zero for normal balance.
sl@0
   165
	*/
sl@0
   166
	TInt						iBalance;
sl@0
   167
	/**
sl@0
   168
	The gain of the audio channels for the video device. This can be any value from zero to
sl@0
   169
	iMaxGain.
sl@0
   170
	*/
sl@0
   171
	TInt						iGain;
sl@0
   172
	/**
sl@0
   173
	The maximum gain of the audio channels for the video device.
sl@0
   174
	*/
sl@0
   175
	TInt						iMaxGain;
sl@0
   176
	/**
sl@0
   177
	Unused.
sl@0
   178
sl@0
   179
	Meta data is often contained in the header of multimedia clips and is used to define attributes
sl@0
   180
	such as the author and copyright details.
sl@0
   181
	*/
sl@0
   182
	TInt						iMetaData;
sl@0
   183
	/**
sl@0
   184
	Set the maximum size of the recording, in bytes.
sl@0
   185
	*/
sl@0
   186
	TInt						iMaxFileSize;
sl@0
   187
	/**
sl@0
   188
	The number of channels (mono/stereo) that can be read by the video device.
sl@0
   189
	*/
sl@0
   190
	TUint						iChannels;
sl@0
   191
	/**
sl@0
   192
	The video bit rate of the video device.
sl@0
   193
	*/
sl@0
   194
	TInt						iVideoBitRate;
sl@0
   195
	/**
sl@0
   196
	The audio bit rate of the video device.
sl@0
   197
	*/
sl@0
   198
	TInt						iAudioBitRate;
sl@0
   199
	/**
sl@0
   200
	The unique identifier of the video format handled by the video device.
sl@0
   201
	*/
sl@0
   202
	TUid						iFormatUid;
sl@0
   203
	/**
sl@0
   204
	The video data type represented as a fourCC code.
sl@0
   205
	*/
sl@0
   206
	TFourCC						iVideoCodec;
sl@0
   207
	/**
sl@0
   208
	The audio data type represented as a fourCC code.
sl@0
   209
	*/
sl@0
   210
	TFourCC						iAudioCodec;
sl@0
   211
	/**
sl@0
   212
	The period over which the volume is to rise.
sl@0
   213
	*/
sl@0
   214
	TTimeIntervalMicroSeconds	iRampDuration;
sl@0
   215
	/**
sl@0
   216
	The start position for playback in micro seconds.
sl@0
   217
	 */
sl@0
   218
	TTimeIntervalMicroSeconds	iStartPosition;
sl@0
   219
	/**
sl@0
   220
	The end position for playback in micro seconds.
sl@0
   221
	 */
sl@0
   222
	TTimeIntervalMicroSeconds	iEndPosition;
sl@0
   223
	/**
sl@0
   224
	The (possibly estimated) record time left in the clip.
sl@0
   225
	*/
sl@0
   226
	TTimeIntervalMicroSeconds	iRecordTimeAvailable;
sl@0
   227
	/**
sl@0
   228
	Handle to the bitmap of the current video frame.
sl@0
   229
sl@0
   230
	Used by RMMFVideoPlayControllerCustomCommands::GetFrame()
sl@0
   231
	to pass a bitmap handle to the video controller.
sl@0
   232
	*/
sl@0
   233
	TInt						iFrameBitmapServerHandle;
sl@0
   234
	/**
sl@0
   235
	Defines the window in which the video clip will be played.
sl@0
   236
	 */
sl@0
   237
	TRect						iWindowRect;
sl@0
   238
	/**
sl@0
   239
	A handle to the video camera being used.
sl@0
   240
	*/
sl@0
   241
	TInt						iCameraHandle;
sl@0
   242
	/**
sl@0
   243
	Whether the video display is active
sl@0
   244
	*/
sl@0
   245
	TInt						iDSAEvent;
sl@0
   246
	/**
sl@0
   247
	The percentage of loading/rebuffering completed.
sl@0
   248
	*/
sl@0
   249
	TInt						iLoadingCompletePercentage;
sl@0
   250
	/**
sl@0
   251
	The video rotation.
sl@0
   252
	*/
sl@0
   253
	TVideoRotation				iVideoRotation;
sl@0
   254
	/**
sl@0
   255
	The percentage (100 = original size) by which the width of the video image is scaled.
sl@0
   256
	*/
sl@0
   257
	TReal32						iWidthScalePercentage;
sl@0
   258
	/**
sl@0
   259
	The percentage (100 = original size) by which the height of the video image is scaled.
sl@0
   260
	*/
sl@0
   261
	TReal32						iHeightScalePercentage;
sl@0
   262
	/**
sl@0
   263
	A boolean indicating if anti-aliasing filtering should be used.
sl@0
   264
	*/
sl@0
   265
	TBool						iAntiAliasFiltering;
sl@0
   266
	/**
sl@0
   267
	The crop region currently applied to the image.
sl@0
   268
	*/
sl@0
   269
	TRect						iCropRectangle;
sl@0
   270
private:
sl@0
   271
	/**
sl@0
   272
	This member is internal and not intended for use.
sl@0
   273
	*/
sl@0
   274
	TInt iReserved1;
sl@0
   275
	TInt iReserved2;
sl@0
   276
	TInt iReserved3;
sl@0
   277
	};
sl@0
   278
sl@0
   279
/**
sl@0
   280
Initialises the object with arbitrary values.
sl@0
   281
*/
sl@0
   282
inline TMMFVideoConfig::TMMFVideoConfig() {};
sl@0
   283
sl@0
   284
/**
sl@0
   285
@publishedAll
sl@0
   286
@released
sl@0
   287
sl@0
   288
Interface class to provide a callback to the video controller
sl@0
   289
custom command interface from the controller plug-in
sl@0
   290
(the object that implements the video record controller interface
sl@0
   291
MMMFVideoPlayControllerCustomCommandImplementor) when a GetFrame()
sl@0
   292
request has been issued.
sl@0
   293
sl@0
   294
@see RMMFVideoPlayControllerCustomCommands::GetFrame()
sl@0
   295
*/
sl@0
   296
class MMMFVideoFrameMessage 
sl@0
   297
	{
sl@0
   298
public:
sl@0
   299
	/**
sl@0
   300
	Called when a frame has been successfully decoded.
sl@0
   301
sl@0
   302
	@param  aError
sl@0
   303
	        The result code to be given to the client.
sl@0
   304
	*/
sl@0
   305
	virtual void FrameReady(TInt aError) = 0;
sl@0
   306
	/**
sl@0
   307
	Returns the decoded frame as a bitmap.
sl@0
   308
sl@0
   309
	@return A reference to the video frame.
sl@0
   310
	*/
sl@0
   311
	virtual CFbsBitmap& GetBitmap() = 0;
sl@0
   312
	};
sl@0
   313
sl@0
   314
/**
sl@0
   315
@publishedAll
sl@0
   316
@released
sl@0
   317
sl@0
   318
Represents the video aspect ratio as a fraction: iNumerator/iDenominator.
sl@0
   319
*/
sl@0
   320
class TVideoAspectRatio
sl@0
   321
    {
sl@0
   322
public:
sl@0
   323
    /**
sl@0
   324
    Aspect ratio numerator.
sl@0
   325
    */
sl@0
   326
    TInt iNumerator;
sl@0
   327
    
sl@0
   328
    /**
sl@0
   329
    Aspect ratio denominator.
sl@0
   330
    */
sl@0
   331
    TInt iDenominator;
sl@0
   332
sl@0
   333
    /** 
sl@0
   334
    Constructs a default aspect ratio object. The default aspect ratio is
sl@0
   335
    1:1 (square).
sl@0
   336
    */
sl@0
   337
    inline TVideoAspectRatio();
sl@0
   338
sl@0
   339
    /** 
sl@0
   340
    Constructs an aspect ratio object from a numerator and a denominator.
sl@0
   341
    
sl@0
   342
    @param 	aNumerator 
sl@0
   343
    		Aspect ratio numerator.
sl@0
   344
    @param 	aDenominator 
sl@0
   345
    		Aspect ratio denominator.
sl@0
   346
    */
sl@0
   347
    inline TVideoAspectRatio(TInt aNumerator, TInt aDenominator);
sl@0
   348
sl@0
   349
    /** 
sl@0
   350
    Compares two aspect ratio object for equality. The objects are
sl@0
   351
    considered equal if the numerator and denominator match. 
sl@0
   352
    Note that the implementation will not attempt to reduce the fractions 
sl@0
   353
    before comparison.
sl@0
   354
    */
sl@0
   355
    inline TBool operator==(const TVideoAspectRatio& aAspectRatio) const;
sl@0
   356
sl@0
   357
    /** 
sl@0
   358
    Compares two aspect ratio object for equality. The objects are
sl@0
   359
    considered inequal if either the numerators or the denominators differ.
sl@0
   360
    Note that the implementation will not attempt to reduce the fractions
sl@0
   361
    before comparison.
sl@0
   362
    */
sl@0
   363
    inline TBool operator!=(const TVideoAspectRatio& aAspectRatio) const;
sl@0
   364
    };
sl@0
   365
sl@0
   366
inline TVideoAspectRatio::TVideoAspectRatio()
sl@0
   367
	: iNumerator(1),iDenominator(1)
sl@0
   368
	{
sl@0
   369
	}
sl@0
   370
sl@0
   371
inline TVideoAspectRatio::TVideoAspectRatio(TInt aNumerator, TInt aDenominator)
sl@0
   372
	: iNumerator(aNumerator),iDenominator(aDenominator)
sl@0
   373
	{
sl@0
   374
	}
sl@0
   375
sl@0
   376
inline TBool TVideoAspectRatio::operator==(const TVideoAspectRatio& aAspectRatio) const
sl@0
   377
	{
sl@0
   378
	return ((iNumerator == aAspectRatio.iNumerator) && (iDenominator == aAspectRatio.iDenominator));
sl@0
   379
	}
sl@0
   380
	
sl@0
   381
inline TBool TVideoAspectRatio::operator!=(const TVideoAspectRatio& aAspectRatio) const
sl@0
   382
	{
sl@0
   383
	return ((iNumerator != aAspectRatio.iNumerator) || (iDenominator != aAspectRatio.iDenominator));
sl@0
   384
	}
sl@0
   385
sl@0
   386
/**
sl@0
   387
Automatic scaling type.
sl@0
   388
sl@0
   389
@publishedAll
sl@0
   390
@released
sl@0
   391
sl@0
   392
@see CVideoPlayerUtility::SetAutoScaleL
sl@0
   393
*/
sl@0
   394
enum TAutoScaleType
sl@0
   395
    {
sl@0
   396
    /** No automatic scaling */
sl@0
   397
    EAutoScaleNone = 0,
sl@0
   398
    
sl@0
   399
    /**
sl@0
   400
    Best fit: The picture is scaled to fit the window without
sl@0
   401
    clipping while maintaining aspect ratio. If window and
sl@0
   402
    picture aspect ratios do not match, window background color
sl@0
   403
    is used to fill the borders.
sl@0
   404
    */
sl@0
   405
    EAutoScaleBestFit,
sl@0
   406
sl@0
   407
    /**
sl@0
   408
    Clip: The picture is scaled to fit in the window, scaled in both
sl@0
   409
    directions while maintaining aspect ratio. If window and
sl@0
   410
    picture aspect ratios do not match, some of the video
sl@0
   411
    picture will be clipped.
sl@0
   412
    */
sl@0
   413
    EAutoScaleClip,
sl@0
   414
sl@0
   415
    /**
sl@0
   416
    Stretch: The picture is scaled to fit in the window without
sl@0
   417
    maintaining aspect ratio. If window and picture aspect
sl@0
   418
    ratios do not match, the picture will be distorted.
sl@0
   419
    */
sl@0
   420
    EAutoScaleStretch
sl@0
   421
    };
sl@0
   422
sl@0
   423
/**
sl@0
   424
Horizontal alignment for automatic scaling.
sl@0
   425
sl@0
   426
@publishedAll
sl@0
   427
@released
sl@0
   428
sl@0
   429
@see SetAutoScaleL
sl@0
   430
*/
sl@0
   431
enum THorizontalAlign
sl@0
   432
	{
sl@0
   433
	/** The picture is horizontally centered */
sl@0
   434
	EHorizontalAlignCenter = 0x70000000, 
sl@0
   435
	/** The picture is left-aligned */
sl@0
   436
	EHorizontalAlignLeft,
sl@0
   437
	/** The picture is right-aligned */
sl@0
   438
	EHorizontalAlignRight
sl@0
   439
	};
sl@0
   440
		
sl@0
   441
/**
sl@0
   442
Vertical alignment for automatic scaling.
sl@0
   443
sl@0
   444
@publishedAll
sl@0
   445
@released
sl@0
   446
sl@0
   447
@see SetAutoScaleL
sl@0
   448
*/
sl@0
   449
enum TVerticalAlign
sl@0
   450
	{
sl@0
   451
	/** The picture is vertically centered */
sl@0
   452
	EVerticalAlignCenter = 0x70000000,
sl@0
   453
	/** The picture is top-aligned */
sl@0
   454
	EVerticalAlignTop, 
sl@0
   455
	/** The picture is bottom-aligned */
sl@0
   456
	EVerticalAlignBottom 
sl@0
   457
	};
sl@0
   458
	
sl@0
   459
#endif