os/mm/mdfdevvideoextensions/nga_mdf_postprocessor/inc/surface_hints.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Surface Manager API
    16 */
    17 
    18 #ifndef __SURFACE_HINTS_LOCAL_H__
    19 #define __SURFACE_HINTS_LOCAL_H__
    20 
    21 //- Include Files  ----------------------------------------------------------
    22 
    23 #include <e32cmn.h>
    24 
    25 
    26 //- Namespace ---------------------------------------------------------------
    27 
    28 namespace surfaceHints
    29 {
    30 
    31 //- Constants ---------------------------------------------------------------
    32 
    33 /** Hint of the surface content.
    34     @see TSurfaceContent for possible values
    35 */
    36 const TInt KSurfaceContent = 0x1;
    37 
    38 /** Hint of the expected update rate of the surface content.
    39     Value for a surface containing e.g. 25 fps video the value should be 25.
    40     For a static UI element the value should be 0.
    41     @see TSurfaceUpdate
    42 */
    43 const TInt KSurfaceUpdate = 0x2;
    44 
    45 /** Hint whether the surface content is copy protected and can it be
    46     shown on external displays.
    47     @see TSurfaceProtection for possible values.
    48 */
    49 const TInt KSurfaceProtection = 0x3;
    50 
    51 /** Hint about the surface’s characteristics or properties,
    52    For example if a surface can be persisted by the effects engine.
    53    @see TSurfaceCharacteristics for possible values.
    54 */
    55 const TInt KSurfaceCharacteristics = 0x4;
    56 
    57 
    58 /** Values used for the KSurfaceContent key */
    59 enum TSurfaceContent
    60     {
    61     /** No specific use-case */
    62     EGeneric,
    63     /** Camera viewfinder frames */
    64     EViewFinder,
    65     /** Images captured by camera */
    66     EStillImage,
    67     /** Decoded video frames */
    68     EVideoPlayback,
    69     /** Video frames from video telephony */
    70     EVideoTelephony,
    71     /** EGL surface */
    72     EGfx,
    73     /** Main UI surface */
    74     EUi,
    75     /** Composition target surface */
    76     ECompositionTarget,
    77     /** Indicates that the surface has to accessible by ARM.
    78         This can be orr'ed with other TSurfaceContent enumerations. */
    79     EArmAccess = 0x80000000
    80     };
    81 
    82 
    83 /** Values used for the KSurfaceProtection key. The values are bitmasks and can be combined
    84 * e.g. EAllowAnalogProtectionRequired | EAllowDigitalProtectionRequired.
    85 */
    86 enum TSurfaceProtection
    87     {
    88     /**
    89     * Not allowed on external outputs
    90     */
    91     EAllowInternalOnly                  = 0x00000000,
    92 
    93     /**
    94     * Allowed on all external outputs
    95     */
    96     EAllowAllExternals                  = 0xFFFFFFFF,
    97 
    98     /**
    99     * Allow passing content over analog outputs,
   100     * e.g. composite and S-video
   101     */
   102     EAllowAnalog                        = 0x00000010,
   103 
   104     /**
   105     * Allow output over an analog output channel which has a protection
   106     * mechanism
   107     */
   108     EAllowAnalogProtectionRequired      = 0x00000020,
   109 
   110     /**
   111     * Allow passing content over digital outputs,
   112     * e.g. DVI and HDMI
   113     */
   114     EAllowDigital                       = 0x00000200,
   115 
   116     /**
   117     * Licensed product must attempt to engage HDCP to protect the content.
   118     * However it should be passed through to HDMI even if HDCP is not engaged or fails to engage.
   119     */
   120     EAllowDigitalProtectionRequested    = 0x00000400,
   121 
   122     /**
   123     * Licensed product is required to engage HDCP to protect the content.
   124     * If HDCP is not engaged or can not be engaged the content must not be passed through to HDMI.
   125     */
   126     EAllowDigitalProtectionRequired     = 0x00000800,
   127     };
   128 
   129 
   130 /** Values used for the KSurfaceCharacteristics key. The values are bitmasks and can be combined.
   131 */
   132 enum TSurfaceCharacteristics
   133     {
   134     /**
   135     * Surface cannot be persisted once it has been closed by the creator
   136     */
   137     ENotPersistable = 1,
   138     };
   139 
   140 
   141 class TSurfaceUpdate
   142     {
   143     /** Constructor.
   144         @param aUpdateRate   How often the surface content is redrawn per second.
   145         @param aTearingFree  When ETrue surface updates should be synchronized
   146                              with display refresh rate, otherwise surface can
   147                              be updated as fast as possible.
   148     */
   149     inline TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree);
   150 
   151     /** Converts a value to TSurfaceUpdate */
   152     inline TSurfaceUpdate(TInt aValue);
   153 
   154     /** Converts TSurfaceUpdate to a signed integer, so it can be used as
   155         a value for KSurfaceUpdate key. */
   156     inline operator TInt() const;
   157 
   158     /** Getter for surface update rate.
   159         @return updates per second
   160     */
   161     inline TUint UpdateRate() const;
   162 
   163     /** Getter for surface update synchronization.
   164         @return ETrue - updates should be synchronized with display refresh rate,
   165                 EFalse - surface can be updated as fast as possible.
   166     */
   167     inline TBool TearingFree() const;
   168 
   169     private:
   170         TUint iValue;
   171     };
   172 
   173 
   174 //- Forward Declarations ----------------------------------------------------
   175 
   176 
   177 //- Class Definitions -------------------------------------------------------
   178 
   179 
   180 //- Inline Functions --------------------------------------------------------
   181 
   182 TSurfaceUpdate::TSurfaceUpdate(TUint aUpdateRate, TBool aTearingFree)
   183     : iValue( ( aUpdateRate & 0xFFFF ) | ( aTearingFree ? 0x80000000 : 0x0 ) )
   184     {
   185     }
   186 TSurfaceUpdate::TSurfaceUpdate(TInt aValue)
   187     : iValue( static_cast<TUint>( aValue ) )
   188     {
   189     }
   190 
   191 TSurfaceUpdate::operator TInt() const
   192     {
   193     return static_cast<TInt>( iValue );
   194     }
   195 
   196 TUint TSurfaceUpdate::UpdateRate() const
   197     {
   198     return ( iValue & 0xFFFF );
   199     }
   200 
   201 TBool TSurfaceUpdate::TearingFree() const
   202     {
   203     return ( iValue & 0x80000000 ) ? ETrue : EFalse;
   204     }
   205 
   206 } //namespace surfaceHints
   207 
   208 #endif //__SURFACE_HINTS_LOCAL_H__
   209 
   210 // End of File
   211