mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxalvideoppitftests.cpp
changeset 53 eabc8c503852
equal deleted inserted replaced
48:a493a607b5bf 53:eabc8c503852
       
     1 /*
       
     2 * Copyright (c) 2009 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: This file contains testclass implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 // [INCLUDE FILES] - do not remove
       
    19 #include <e32svr.h>
       
    20 #include <StifParser.h>
       
    21 #include <StifTestInterface.h>
       
    22 #include "openmaxaltestmodule.h"
       
    23 #include "profileutilmacro.h"
       
    24 
       
    25 // EXTERNAL DATA STRUCTURES
       
    26 //extern  ?external_data;
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES
       
    29 //extern ?external_function( ?arg_type,?arg_type );
       
    30 
       
    31 // CONSTANTS
       
    32 //const ?type ?constant_var = ?constant;
       
    33 
       
    34 // MACROS
       
    35 //#define ?macro ?macro_def
       
    36 
       
    37 // LOCAL CONSTANTS AND MACROS
       
    38 //const ?type ?constant_var = ?constant;
       
    39 //#define ?macro_name ?macro_def
       
    40 
       
    41 // MODULE DATA STRUCTURES
       
    42 //enum ?declaration
       
    43 //typedef ?declaration
       
    44 
       
    45 // LOCAL FUNCTION PROTOTYPES
       
    46 //?type ?function_name( ?arg_type, ?arg_type );
       
    47 
       
    48 // FORWARD DECLARATIONS
       
    49 //class ?FORWARD_CLASSNAME;
       
    50 
       
    51 // ============================= LOCAL FUNCTIONS ===============================
       
    52 
       
    53 // -----------------------------------------------------------------------------
       
    54 // ?function_name ?description.
       
    55 // ?description
       
    56 // Returns: ?value_1: ?description
       
    57 //          ?value_n: ?description_line1
       
    58 //                    ?description_line2
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 /*
       
    62 ?type ?function_name(
       
    63     ?arg_type arg,  // ?description
       
    64     ?arg_type arg)  // ?description
       
    65     {
       
    66 
       
    67     ?code  // ?comment
       
    68 
       
    69     // ?comment
       
    70     ?code
       
    71     }
       
    72 */
       
    73 
       
    74 TInt COpenMAXALTestModule::al_videoppitf_SetRotation( CStifItemParser& aItem )
       
    75     {
       
    76     TInt status(KErrNone);
       
    77     XAresult res;
       
    78     TInt rotation;
       
    79     void* selfPtr = (void*) m_VideoPP;
       
    80 
       
    81     status = CheckForNull(aItem, selfPtr);
       
    82     RET_ERR_IF_ERR(status);
       
    83 
       
    84     status = aItem.GetNextInt(rotation);
       
    85     RET_ERR_IF_ERR(status);
       
    86 
       
    87     if(m_VideoPP)
       
    88         {
       
    89         TAG_TIME_PROFILING_BEGIN;
       
    90         res = (*m_VideoPP)->SetRotation((XAVideoPostProcessingItf)selfPtr, rotation);
       
    91         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
    92         status = res;
       
    93         }
       
    94     else
       
    95         {
       
    96         status = KErrNotFound;
       
    97         }
       
    98 
       
    99     return status;
       
   100     }
       
   101 
       
   102 TInt COpenMAXALTestModule::al_videoppitf_IsArbitraryRotationSupported( CStifItemParser& aItem )
       
   103     {
       
   104     TInt status(KErrNone);
       
   105     XAresult res;
       
   106     XAboolean supported;
       
   107     void* supportedParam = (void*) &supported;
       
   108     void* selfPtr = (void*) m_VideoPP;
       
   109 
       
   110     status = CheckForNull(aItem, selfPtr);
       
   111     RET_ERR_IF_ERR(status);
       
   112 
       
   113     status = CheckForNullParam(aItem, supportedParam);
       
   114     RET_ERR_IF_ERR(status);
       
   115 
       
   116     if(m_VideoPP)
       
   117         {
       
   118         TAG_TIME_PROFILING_BEGIN;
       
   119         res = (*m_VideoPP)->IsArbitraryRotationSupported((XAVideoPostProcessingItf)selfPtr, (XAboolean*)supportedParam);
       
   120         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   121         status = res;
       
   122         iLog->Log(_L("al_videoppitf_IsArbitraryRotationSupported Supported =%d"),supported);
       
   123         }
       
   124     else
       
   125         {
       
   126         status = KErrNotFound;
       
   127         }
       
   128 
       
   129     return status;
       
   130     }
       
   131 
       
   132 TInt COpenMAXALTestModule::al_videoppitf_SetScaleOptions( CStifItemParser& aItem )
       
   133     {
       
   134     TInt status(KErrNone);
       
   135     XAresult res;
       
   136     TInt options(0);
       
   137     TInt backGColor(0);
       
   138     TInt hints(0);
       
   139     void* selfPtr = (void*) m_VideoPP;
       
   140 
       
   141     status = CheckForNull(aItem, selfPtr);
       
   142     RET_ERR_IF_ERR(status);
       
   143 
       
   144     status = aItem.GetNextInt(options);
       
   145     RET_ERR_IF_ERR(status);
       
   146 
       
   147     status = aItem.GetNextInt(backGColor);
       
   148     RET_ERR_IF_ERR(status);
       
   149 
       
   150     status = aItem.GetNextInt(hints);
       
   151     RET_ERR_IF_ERR(status);
       
   152 
       
   153     if(m_VideoPP)
       
   154         {
       
   155         TAG_TIME_PROFILING_BEGIN;
       
   156         res = (*m_VideoPP)->SetScaleOptions((XAVideoPostProcessingItf)selfPtr, options, backGColor, hints);
       
   157         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   158         status = res;
       
   159         }
       
   160     else
       
   161         {
       
   162         status = KErrNotFound;
       
   163         }
       
   164 
       
   165     return status;
       
   166     }
       
   167 
       
   168 TInt COpenMAXALTestModule::al_videoppitf_SetSourceRectangle( CStifItemParser& aItem )
       
   169     {
       
   170     TInt status(KErrNone);
       
   171     XAresult res;
       
   172     XARectangle rect;
       
   173     TInt top;
       
   174     TInt left ;
       
   175     TInt width;
       
   176     TInt height;
       
   177     void* rectParam = (void*) &rect;
       
   178     void* selfPtr = (void*) m_VideoPP;
       
   179 
       
   180     status = CheckForNull(aItem, selfPtr);
       
   181     RET_ERR_IF_ERR(status);
       
   182 
       
   183     status = CheckForNull(aItem, rectParam);
       
   184     RET_ERR_IF_ERR(status);
       
   185 
       
   186     if ((XARectangle*)rectParam != NULL)
       
   187         {
       
   188         status = aItem.GetNextInt(top);
       
   189         RET_ERR_IF_ERR(status);
       
   190         rect.top = top;
       
   191 
       
   192         status = aItem.GetNextInt(left);
       
   193         RET_ERR_IF_ERR(status);
       
   194         rect.left = left;
       
   195 
       
   196         status = aItem.GetNextInt(width);
       
   197         RET_ERR_IF_ERR(status);
       
   198         rect.width = width;
       
   199 
       
   200         status = aItem.GetNextInt(height);
       
   201         RET_ERR_IF_ERR(status);
       
   202         rect.height = height;
       
   203         }
       
   204 
       
   205     if(m_VideoPP)
       
   206         {
       
   207         TAG_TIME_PROFILING_BEGIN;
       
   208         res = (*m_VideoPP)->SetSourceRectangle((XAVideoPostProcessingItf)selfPtr, (XARectangle*)rectParam);
       
   209         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   210         status = res;
       
   211         }
       
   212     else
       
   213         {
       
   214         status = KErrNotFound;
       
   215         }
       
   216 
       
   217     return status;
       
   218     }
       
   219 
       
   220 TInt COpenMAXALTestModule::al_videoppitf_SetDestinationRectangle( CStifItemParser& aItem )
       
   221     {
       
   222     TInt status(KErrNone);
       
   223     XAresult res;
       
   224     XARectangle rect;
       
   225     TInt top;
       
   226     TInt left ;
       
   227     TInt width;
       
   228     TInt height;
       
   229 
       
   230     void* rectParam = (void*) &rect;
       
   231     void* selfPtr = (void*) m_VideoPP;
       
   232 
       
   233     status = CheckForNull(aItem, selfPtr);
       
   234     RET_ERR_IF_ERR(status);
       
   235 
       
   236     status = CheckForNull(aItem, rectParam);
       
   237     RET_ERR_IF_ERR(status);
       
   238 
       
   239     if ((XARectangle*)rectParam != NULL)
       
   240         {
       
   241         status = aItem.GetNextInt(top);
       
   242         RET_ERR_IF_ERR(status);
       
   243         rect.top = top;
       
   244 
       
   245         status = aItem.GetNextInt(left);
       
   246         RET_ERR_IF_ERR(status);
       
   247         rect.left = left;
       
   248 
       
   249         status = aItem.GetNextInt(width);
       
   250         RET_ERR_IF_ERR(status);
       
   251         rect.width = width;
       
   252 
       
   253         status = aItem.GetNextInt(height);
       
   254         RET_ERR_IF_ERR(status);
       
   255         rect.height = height;
       
   256         }
       
   257 
       
   258     if(m_VideoPP)
       
   259         {
       
   260         TAG_TIME_PROFILING_BEGIN;
       
   261         res = (*m_VideoPP)->SetDestinationRectangle((XAVideoPostProcessingItf)selfPtr, (XARectangle*)rectParam);
       
   262         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   263         status = res;
       
   264         }
       
   265     else
       
   266         {
       
   267         status = KErrNotFound;
       
   268         }
       
   269 
       
   270     return status;
       
   271     }
       
   272 
       
   273 TInt COpenMAXALTestModule::al_videoppitf_SetMirror( CStifItemParser& aItem )
       
   274     {
       
   275     TInt status(KErrNone);
       
   276     XAresult res;
       
   277     TInt mirror;
       
   278     void* selfPtr = (void*) m_VideoPP;
       
   279 
       
   280     status = CheckForNull(aItem, selfPtr);
       
   281     RET_ERR_IF_ERR(status);
       
   282 
       
   283     status = aItem.GetNextInt(mirror);
       
   284     RET_ERR_IF_ERR(status);
       
   285 
       
   286     if(m_VideoPP)
       
   287         {
       
   288         TAG_TIME_PROFILING_BEGIN;
       
   289         res = (*m_VideoPP)->SetMirror((XAVideoPostProcessingItf)selfPtr, mirror);
       
   290         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   291         status = res;
       
   292         }
       
   293     else
       
   294         {
       
   295         status = KErrNotFound;
       
   296         }
       
   297 
       
   298     return status;
       
   299     }
       
   300 
       
   301 TInt COpenMAXALTestModule::al_videoppitf_Commit( CStifItemParser& aItem )
       
   302     {
       
   303     TInt status(KErrNone);
       
   304     XAresult res;
       
   305     void* selfPtr = (void*) m_VideoPP;
       
   306 
       
   307     status = CheckForNull(aItem, selfPtr);
       
   308     RET_ERR_IF_ERR(status);
       
   309 
       
   310     if(m_VideoPP)
       
   311         {
       
   312         TAG_TIME_PROFILING_BEGIN;
       
   313         res = (*m_VideoPP)->Commit((XAVideoPostProcessingItf)selfPtr);
       
   314         TAG_TIME_PROFILING_END; PRINT_TO_CONSOLE_TIME_DIFF;
       
   315         status = res;
       
   316         }
       
   317     else
       
   318         {
       
   319         status = KErrNotFound;
       
   320         }
       
   321 
       
   322     return status;
       
   323     }
       
   324 
       
   325 
       
   326