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