os/mm/mmlibs/mmfw/inc/mmf/common/MmfVideo.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmlibs/mmfw/inc/mmf/common/MmfVideo.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,459 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Mda\Common\MmfVideo.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#ifndef __MMF_COMMON_VIDEO_H__
    1.22 +#define __MMF_COMMON_VIDEO_H__
    1.23 +
    1.24 +#include <mmf/common/mmfutilities.h>
    1.25 +
    1.26 +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    1.27 +#include <mmf/common/mmfvideoenums.h>
    1.28 +#endif
    1.29 +
    1.30 +class CFbsBitmap;
    1.31 +
    1.32 +/**
    1.33 +@publishedAll
    1.34 +@released
    1.35 +
    1.36 +The use of this constant as either a parameter for
    1.37 +CVideoRecorderUtility::SetVideoBitRateL or as a return value from
    1.38 +CVideoRecorderUtility::VideoBitRateL signifies that a variable
    1.39 +video bit rate is being used.
    1.40 +*/
    1.41 +const TInt KMMFVariableVideoBitRate = -1;
    1.42 +
    1.43 +/**
    1.44 +@publishedAll
    1.45 +@released
    1.46 +
    1.47 +CVideoRecorderUtility::SetMaxClipSizeL can take this constant
    1.48 +instead of a byte value.  This signifies there should be no max
    1.49 +clip size
    1.50 +*/
    1.51 +const TInt KMMFNoMaxClipSize = -1;
    1.52 +
    1.53 +/**
    1.54 +@publishedAll
    1.55 +@released
    1.56 +
    1.57 +CVideoPlayerUtility/CVideoRecorderUtility HandleEvent() code :
    1.58 +the video source file has been successfully opened
    1.59 +*/
    1.60 +const TUid KMMFEventCategoryVideoOpenComplete = {0x101F7F85};
    1.61 +
    1.62 +/**
    1.63 +@publishedAll
    1.64 +@released
    1.65 +
    1.66 +The unique identifier for the event that indicates that the video has been prepared for recording.
    1.67 +*/
    1.68 +const TUid KMMFEventCategoryVideoPrepareComplete = {0x101F7F86};
    1.69 +
    1.70 +/**
    1.71 +@publishedAll
    1.72 +@released
    1.73 +*/
    1.74 +const TUid KMMFEventCategoryVideoLoadingStarted = {0x101F7F87};
    1.75 +
    1.76 +/**
    1.77 +@publishedAll
    1.78 +@released
    1.79 +*/
    1.80 +const TUid KMMFEventCategoryVideoLoadingComplete = {0x101F7F88};
    1.81 +
    1.82 +/**
    1.83 +@publishedAll
    1.84 +@released
    1.85 +*/
    1.86 +const TUid KMMFEventCategoryVideoPlayerGeneralError = {0x101F8000};
    1.87 +
    1.88 +/**
    1.89 +@publishedAll
    1.90 +@released
    1.91 +*/
    1.92 +const TUid KMMFEventCategoryVideoRecorderGeneralError = {0x101F8001};
    1.93 +
    1.94 +
    1.95 +/**
    1.96 +@publishedAll
    1.97 +@released
    1.98 +
    1.99 +Defines an absolute rotation in 90 degree increments
   1.100 +
   1.101 +@since  7.0s
   1.102 +*/
   1.103 +enum TVideoRotation
   1.104 +	{
   1.105 +	EVideoRotationNone,
   1.106 +	EVideoRotationClockwise90,
   1.107 +	EVideoRotationClockwise180,
   1.108 +	EVideoRotationClockwise270
   1.109 +	};
   1.110 +
   1.111 +/**
   1.112 +@publishedAll
   1.113 +@released
   1.114 +
   1.115 +Class used when sending custom commands from the client API
   1.116 +to the video controller to get or set the video configuration.
   1.117 +*/
   1.118 +class TMMFVideoConfig
   1.119 +	{
   1.120 +public:
   1.121 +	inline TMMFVideoConfig();
   1.122 +
   1.123 +public:
   1.124 +	/**
   1.125 +	A flag indicating whether audio output is enabled. ETrue if teh audio is to be enabled, false if
   1.126 +	not.
   1.127 +	*/
   1.128 +	TBool						iAudioEnabled;
   1.129 +	/**
   1.130 +	The location of the top left corner of the video window.
   1.131 +	*/
   1.132 +	TPoint						iTopLeftPt;
   1.133 +	/**
   1.134 +	Defines the rectangle in which the video clip will be played.
   1.135 +	*/
   1.136 +	TRect						iClipRect;
   1.137 +	/**
   1.138 +	A handle to the bitmap into which the decoded frame(s) are put.
   1.139 +	*/
   1.140 +	TInt						iBitmapHandle;
   1.141 +	/**
   1.142 +	The current frame number in the video clip.
   1.143 +	 */
   1.144 +	TInt						iFrameNumber;
   1.145 +	/**
   1.146 +	The number of frames per second; may not be an integer.
   1.147 +	*/
   1.148 +	TReal32						iFramesPerSecond;
   1.149 +	/**
   1.150 +	The width & height of the video frame.
   1.151 +	*/
   1.152 +	TSize						iVideoFrameSize;
   1.153 +	/**
   1.154 +	The volume setting of the video device.
   1.155 +
   1.156 +	Should be between 0 and iMaxVolume.
   1.157 +	*/
   1.158 +	TInt						iVolume;
   1.159 +	/**
   1.160 +	The maximum volume setting of the video device.
   1.161 +
   1.162 +	This value is platform dependent but is always greater than or equal to one. This is the maximum
   1.163 +	value that should be passed to iVolume.
   1.164 +	*/
   1.165 +	TInt						iMaxVolume;
   1.166 +	/**
   1.167 +	The balance of the audio channels for the video device. Zero for normal balance.
   1.168 +	*/
   1.169 +	TInt						iBalance;
   1.170 +	/**
   1.171 +	The gain of the audio channels for the video device. This can be any value from zero to
   1.172 +	iMaxGain.
   1.173 +	*/
   1.174 +	TInt						iGain;
   1.175 +	/**
   1.176 +	The maximum gain of the audio channels for the video device.
   1.177 +	*/
   1.178 +	TInt						iMaxGain;
   1.179 +	/**
   1.180 +	Unused.
   1.181 +
   1.182 +	Meta data is often contained in the header of multimedia clips and is used to define attributes
   1.183 +	such as the author and copyright details.
   1.184 +	*/
   1.185 +	TInt						iMetaData;
   1.186 +	/**
   1.187 +	Set the maximum size of the recording, in bytes.
   1.188 +	*/
   1.189 +	TInt						iMaxFileSize;
   1.190 +	/**
   1.191 +	The number of channels (mono/stereo) that can be read by the video device.
   1.192 +	*/
   1.193 +	TUint						iChannels;
   1.194 +	/**
   1.195 +	The video bit rate of the video device.
   1.196 +	*/
   1.197 +	TInt						iVideoBitRate;
   1.198 +	/**
   1.199 +	The audio bit rate of the video device.
   1.200 +	*/
   1.201 +	TInt						iAudioBitRate;
   1.202 +	/**
   1.203 +	The unique identifier of the video format handled by the video device.
   1.204 +	*/
   1.205 +	TUid						iFormatUid;
   1.206 +	/**
   1.207 +	The video data type represented as a fourCC code.
   1.208 +	*/
   1.209 +	TFourCC						iVideoCodec;
   1.210 +	/**
   1.211 +	The audio data type represented as a fourCC code.
   1.212 +	*/
   1.213 +	TFourCC						iAudioCodec;
   1.214 +	/**
   1.215 +	The period over which the volume is to rise.
   1.216 +	*/
   1.217 +	TTimeIntervalMicroSeconds	iRampDuration;
   1.218 +	/**
   1.219 +	The start position for playback in micro seconds.
   1.220 +	 */
   1.221 +	TTimeIntervalMicroSeconds	iStartPosition;
   1.222 +	/**
   1.223 +	The end position for playback in micro seconds.
   1.224 +	 */
   1.225 +	TTimeIntervalMicroSeconds	iEndPosition;
   1.226 +	/**
   1.227 +	The (possibly estimated) record time left in the clip.
   1.228 +	*/
   1.229 +	TTimeIntervalMicroSeconds	iRecordTimeAvailable;
   1.230 +	/**
   1.231 +	Handle to the bitmap of the current video frame.
   1.232 +
   1.233 +	Used by RMMFVideoPlayControllerCustomCommands::GetFrame()
   1.234 +	to pass a bitmap handle to the video controller.
   1.235 +	*/
   1.236 +	TInt						iFrameBitmapServerHandle;
   1.237 +	/**
   1.238 +	Defines the window in which the video clip will be played.
   1.239 +	 */
   1.240 +	TRect						iWindowRect;
   1.241 +	/**
   1.242 +	A handle to the video camera being used.
   1.243 +	*/
   1.244 +	TInt						iCameraHandle;
   1.245 +	/**
   1.246 +	Whether the video display is active
   1.247 +	*/
   1.248 +	TInt						iDSAEvent;
   1.249 +	/**
   1.250 +	The percentage of loading/rebuffering completed.
   1.251 +	*/
   1.252 +	TInt						iLoadingCompletePercentage;
   1.253 +	/**
   1.254 +	The video rotation.
   1.255 +	*/
   1.256 +	TVideoRotation				iVideoRotation;
   1.257 +	/**
   1.258 +	The percentage (100 = original size) by which the width of the video image is scaled.
   1.259 +	*/
   1.260 +	TReal32						iWidthScalePercentage;
   1.261 +	/**
   1.262 +	The percentage (100 = original size) by which the height of the video image is scaled.
   1.263 +	*/
   1.264 +	TReal32						iHeightScalePercentage;
   1.265 +	/**
   1.266 +	A boolean indicating if anti-aliasing filtering should be used.
   1.267 +	*/
   1.268 +	TBool						iAntiAliasFiltering;
   1.269 +	/**
   1.270 +	The crop region currently applied to the image.
   1.271 +	*/
   1.272 +	TRect						iCropRectangle;
   1.273 +private:
   1.274 +	/**
   1.275 +	This member is internal and not intended for use.
   1.276 +	*/
   1.277 +	TInt iReserved1;
   1.278 +	TInt iReserved2;
   1.279 +	TInt iReserved3;
   1.280 +	};
   1.281 +
   1.282 +/**
   1.283 +Initialises the object with arbitrary values.
   1.284 +*/
   1.285 +inline TMMFVideoConfig::TMMFVideoConfig() {};
   1.286 +
   1.287 +/**
   1.288 +@publishedAll
   1.289 +@released
   1.290 +
   1.291 +Interface class to provide a callback to the video controller
   1.292 +custom command interface from the controller plug-in
   1.293 +(the object that implements the video record controller interface
   1.294 +MMMFVideoPlayControllerCustomCommandImplementor) when a GetFrame()
   1.295 +request has been issued.
   1.296 +
   1.297 +@see RMMFVideoPlayControllerCustomCommands::GetFrame()
   1.298 +*/
   1.299 +class MMMFVideoFrameMessage 
   1.300 +	{
   1.301 +public:
   1.302 +	/**
   1.303 +	Called when a frame has been successfully decoded.
   1.304 +
   1.305 +	@param  aError
   1.306 +	        The result code to be given to the client.
   1.307 +	*/
   1.308 +	virtual void FrameReady(TInt aError) = 0;
   1.309 +	/**
   1.310 +	Returns the decoded frame as a bitmap.
   1.311 +
   1.312 +	@return A reference to the video frame.
   1.313 +	*/
   1.314 +	virtual CFbsBitmap& GetBitmap() = 0;
   1.315 +	};
   1.316 +
   1.317 +/**
   1.318 +@publishedAll
   1.319 +@released
   1.320 +
   1.321 +Represents the video aspect ratio as a fraction: iNumerator/iDenominator.
   1.322 +*/
   1.323 +class TVideoAspectRatio
   1.324 +    {
   1.325 +public:
   1.326 +    /**
   1.327 +    Aspect ratio numerator.
   1.328 +    */
   1.329 +    TInt iNumerator;
   1.330 +    
   1.331 +    /**
   1.332 +    Aspect ratio denominator.
   1.333 +    */
   1.334 +    TInt iDenominator;
   1.335 +
   1.336 +    /** 
   1.337 +    Constructs a default aspect ratio object. The default aspect ratio is
   1.338 +    1:1 (square).
   1.339 +    */
   1.340 +    inline TVideoAspectRatio();
   1.341 +
   1.342 +    /** 
   1.343 +    Constructs an aspect ratio object from a numerator and a denominator.
   1.344 +    
   1.345 +    @param 	aNumerator 
   1.346 +    		Aspect ratio numerator.
   1.347 +    @param 	aDenominator 
   1.348 +    		Aspect ratio denominator.
   1.349 +    */
   1.350 +    inline TVideoAspectRatio(TInt aNumerator, TInt aDenominator);
   1.351 +
   1.352 +    /** 
   1.353 +    Compares two aspect ratio object for equality. The objects are
   1.354 +    considered equal if the numerator and denominator match. 
   1.355 +    Note that the implementation will not attempt to reduce the fractions 
   1.356 +    before comparison.
   1.357 +    */
   1.358 +    inline TBool operator==(const TVideoAspectRatio& aAspectRatio) const;
   1.359 +
   1.360 +    /** 
   1.361 +    Compares two aspect ratio object for equality. The objects are
   1.362 +    considered inequal if either the numerators or the denominators differ.
   1.363 +    Note that the implementation will not attempt to reduce the fractions
   1.364 +    before comparison.
   1.365 +    */
   1.366 +    inline TBool operator!=(const TVideoAspectRatio& aAspectRatio) const;
   1.367 +    };
   1.368 +
   1.369 +inline TVideoAspectRatio::TVideoAspectRatio()
   1.370 +	: iNumerator(1),iDenominator(1)
   1.371 +	{
   1.372 +	}
   1.373 +
   1.374 +inline TVideoAspectRatio::TVideoAspectRatio(TInt aNumerator, TInt aDenominator)
   1.375 +	: iNumerator(aNumerator),iDenominator(aDenominator)
   1.376 +	{
   1.377 +	}
   1.378 +
   1.379 +inline TBool TVideoAspectRatio::operator==(const TVideoAspectRatio& aAspectRatio) const
   1.380 +	{
   1.381 +	return ((iNumerator == aAspectRatio.iNumerator) && (iDenominator == aAspectRatio.iDenominator));
   1.382 +	}
   1.383 +	
   1.384 +inline TBool TVideoAspectRatio::operator!=(const TVideoAspectRatio& aAspectRatio) const
   1.385 +	{
   1.386 +	return ((iNumerator != aAspectRatio.iNumerator) || (iDenominator != aAspectRatio.iDenominator));
   1.387 +	}
   1.388 +
   1.389 +/**
   1.390 +Automatic scaling type.
   1.391 +
   1.392 +@publishedAll
   1.393 +@released
   1.394 +
   1.395 +@see CVideoPlayerUtility::SetAutoScaleL
   1.396 +*/
   1.397 +enum TAutoScaleType
   1.398 +    {
   1.399 +    /** No automatic scaling */
   1.400 +    EAutoScaleNone = 0,
   1.401 +    
   1.402 +    /**
   1.403 +    Best fit: The picture is scaled to fit the window without
   1.404 +    clipping while maintaining aspect ratio. If window and
   1.405 +    picture aspect ratios do not match, window background color
   1.406 +    is used to fill the borders.
   1.407 +    */
   1.408 +    EAutoScaleBestFit,
   1.409 +
   1.410 +    /**
   1.411 +    Clip: The picture is scaled to fit in the window, scaled in both
   1.412 +    directions while maintaining aspect ratio. If window and
   1.413 +    picture aspect ratios do not match, some of the video
   1.414 +    picture will be clipped.
   1.415 +    */
   1.416 +    EAutoScaleClip,
   1.417 +
   1.418 +    /**
   1.419 +    Stretch: The picture is scaled to fit in the window without
   1.420 +    maintaining aspect ratio. If window and picture aspect
   1.421 +    ratios do not match, the picture will be distorted.
   1.422 +    */
   1.423 +    EAutoScaleStretch
   1.424 +    };
   1.425 +
   1.426 +/**
   1.427 +Horizontal alignment for automatic scaling.
   1.428 +
   1.429 +@publishedAll
   1.430 +@released
   1.431 +
   1.432 +@see SetAutoScaleL
   1.433 +*/
   1.434 +enum THorizontalAlign
   1.435 +	{
   1.436 +	/** The picture is horizontally centered */
   1.437 +	EHorizontalAlignCenter = 0x70000000, 
   1.438 +	/** The picture is left-aligned */
   1.439 +	EHorizontalAlignLeft,
   1.440 +	/** The picture is right-aligned */
   1.441 +	EHorizontalAlignRight
   1.442 +	};
   1.443 +		
   1.444 +/**
   1.445 +Vertical alignment for automatic scaling.
   1.446 +
   1.447 +@publishedAll
   1.448 +@released
   1.449 +
   1.450 +@see SetAutoScaleL
   1.451 +*/
   1.452 +enum TVerticalAlign
   1.453 +	{
   1.454 +	/** The picture is vertically centered */
   1.455 +	EVerticalAlignCenter = 0x70000000,
   1.456 +	/** The picture is top-aligned */
   1.457 +	EVerticalAlignTop, 
   1.458 +	/** The picture is bottom-aligned */
   1.459 +	EVerticalAlignBottom 
   1.460 +	};
   1.461 +	
   1.462 +#endif