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