mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/recorder/openmaxalaudioencoderitftests.cpp
changeset 14 80975da52420
child 16 43d09473c595
equal deleted inserted replaced
12:5a06f39ad45b 14:80975da52420
       
     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 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 //extern  ?external_data;
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES  
       
    28 //extern ?external_function( ?arg_type,?arg_type );
       
    29 
       
    30 // CONSTANTS
       
    31 //const ?type ?constant_var = ?constant;
       
    32 
       
    33 // MACROS
       
    34 //#define ?macro ?macro_def
       
    35 
       
    36 // LOCAL CONSTANTS AND MACROS
       
    37 //const ?type ?constant_var = ?constant;
       
    38 //#define ?macro_name ?macro_def
       
    39 
       
    40 // MODULE DATA STRUCTURES
       
    41 //enum ?declaration
       
    42 //typedef ?declaration
       
    43 
       
    44 // LOCAL FUNCTION PROTOTYPES
       
    45 //?type ?function_name( ?arg_type, ?arg_type );
       
    46 
       
    47 // FORWARD DECLARATIONS
       
    48 //class ?FORWARD_CLASSNAME;
       
    49 
       
    50 // ============================= LOCAL FUNCTIONS ===============================
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // ?function_name ?description.
       
    54 // ?description
       
    55 // Returns: ?value_1: ?description
       
    56 //          ?value_n: ?description_line1
       
    57 //                    ?description_line2
       
    58 // -----------------------------------------------------------------------------
       
    59 //
       
    60 /*
       
    61 ?type ?function_name(
       
    62     ?arg_type arg,  // ?description
       
    63     ?arg_type arg)  // ?description
       
    64     {
       
    65 
       
    66     ?code  // ?comment
       
    67 
       
    68     // ?comment
       
    69     ?code
       
    70     }
       
    71 */
       
    72 
       
    73 TInt COpenMAXALTestModule::al_audioencoderitf_SetEncoderSettings( CStifItemParser& aItem )
       
    74     {
       
    75     TInt status(KErrNone);
       
    76     XAresult res;
       
    77     XAAudioEncoderSettings setting;
       
    78     TUint value(0);
       
    79     TInt i(0);
       
    80     
       
    81     while(aItem.GetNextInt(value) == KErrNone)
       
    82         {
       
    83         switch(i)
       
    84             {
       
    85             case 0:
       
    86                 setting.encoderId = value;
       
    87                 break;
       
    88             case 1:
       
    89                 setting.channelsIn = value;
       
    90                 break;
       
    91             case 2:
       
    92                 setting.channelsOut = value;
       
    93                 break;
       
    94             case 3:
       
    95                 setting.sampleRate = value;
       
    96                 break;
       
    97             case 4:
       
    98                 setting.bitRate = value;
       
    99                 break;
       
   100             case 5:
       
   101                 setting.bitsPerSample = value;
       
   102                 break;
       
   103             case 6:
       
   104                 setting.rateControl = value;
       
   105                 break;
       
   106             case 7:
       
   107                 setting.profileSetting = value;
       
   108                 break;
       
   109             case 8:
       
   110                 setting.levelSetting = value;
       
   111                 break;
       
   112             case 9:
       
   113                 setting.channelMode = value;
       
   114                 break;
       
   115             case 10:
       
   116                 setting.streamFormat = value;
       
   117                 break;
       
   118             case 11:
       
   119                 setting.encodeOptions = value;
       
   120                 break;
       
   121             case 12:
       
   122                 setting.blockAlignment = value;
       
   123                 break;
       
   124             default:
       
   125                 break;
       
   126             }
       
   127         i++;
       
   128         }
       
   129 
       
   130     if(m_AudEncItf)
       
   131         {
       
   132         res = (*m_AudEncItf)->SetEncoderSettings(
       
   133                 m_AudEncItf, &setting);              
       
   134         status = res;
       
   135         }
       
   136     else
       
   137         {
       
   138         status = KErrNotFound;
       
   139         }
       
   140     return status;
       
   141     }
       
   142 
       
   143 TInt COpenMAXALTestModule::al_audioencoderitf_GetEncoderSettings( CStifItemParser& /*aItem*/ )
       
   144     {
       
   145     TInt status(KErrNone);
       
   146     XAresult res;
       
   147     XAAudioEncoderSettings setting;
       
   148     if(m_AudEncItf)
       
   149         {
       
   150         res = (*m_AudEncItf)->GetEncoderSettings(
       
   151                 m_AudEncItf, &setting);
       
   152         iLog->Log(_L("GetEncoderSettings"));
       
   153         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.encoderId);
       
   154         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsIn);
       
   155         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsOut);
       
   156         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.sampleRate);
       
   157         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.bitRate);
       
   158         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.bitsPerSample);
       
   159         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.rateControl);
       
   160         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.profileSetting);
       
   161         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.levelSetting);
       
   162         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelMode);
       
   163         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.streamFormat);
       
   164         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.encodeOptions);
       
   165         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.blockAlignment);
       
   166         status = res;
       
   167         }
       
   168     else
       
   169         {
       
   170         status = KErrNotFound;
       
   171         }
       
   172     return status;
       
   173     }