mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/recorder/openmaxalaudioencoderitftests.cpp
changeset 55 e267340986c9
parent 16 43d09473c595
equal deleted inserted replaced
52:4ce423f34688 55:e267340986c9
    17 
    17 
    18 // [INCLUDE FILES] - do not remove
    18 // [INCLUDE FILES] - do not remove
    19 #include <e32svr.h>
    19 #include <e32svr.h>
    20 #include <StifParser.h>
    20 #include <StifParser.h>
    21 #include <StifTestInterface.h>
    21 #include <StifTestInterface.h>
       
    22 #include <strings.h>
    22 #include "openmaxaltestmodule.h"
    23 #include "openmaxaltestmodule.h"
    23 
    24 
    24 // EXTERNAL DATA STRUCTURES
    25 // EXTERNAL DATA STRUCTURES
    25 //extern  ?external_data;
    26 //extern  ?external_data;
    26 
    27 
    75     TInt status(KErrNone);
    76     TInt status(KErrNone);
    76     XAresult res;
    77     XAresult res;
    77     XAAudioEncoderSettings setting;
    78     XAAudioEncoderSettings setting;
    78     TUint value(0);
    79     TUint value(0);
    79     TInt i(0);
    80     TInt i(0);
    80     TInt numItems;
    81     TInt numItems = -1;
       
    82     void* param = (void*)&setting;
       
    83     void* itfPtr = (void*) m_AudEncItf;
       
    84     
       
    85     status = CheckForNull(aItem, itfPtr);
       
    86     RET_ERR_IF_ERR(status);
       
    87     
       
    88     status = CheckForNull(aItem, param);
       
    89     RET_ERR_IF_ERR(status);
    81     
    90     
    82     status = aItem.GetNextInt(numItems);
    91     status = aItem.GetNextInt(numItems);
    83     
    92     
    84     while((numItems != 0) && (status == KErrNone))
    93     while((numItems != 0) && (status == KErrNone))
    85         {
    94         {
   136         }
   145         }
   137 
   146 
   138     if(m_AudEncItf)
   147     if(m_AudEncItf)
   139         {
   148         {
   140         res = (*m_AudEncItf)->SetEncoderSettings(
   149         res = (*m_AudEncItf)->SetEncoderSettings(
   141                 m_AudEncItf, &setting);              
   150                 XAAudioEncoderItf(itfPtr), (XAAudioEncoderSettings*)param);
   142         status = res;
   151         status = res;
   143         }
   152         }
   144     else
   153     else
   145         {
   154         {
   146         status = KErrNotFound;
   155         status = KErrNotFound;
   147         }
   156         }
   148     return status;
   157     return status;
   149     }
   158     }
   150 
   159 
   151 TInt COpenMAXALTestModule::al_audioencoderitf_GetEncoderSettings( CStifItemParser& /*aItem*/ )
   160 TInt COpenMAXALTestModule::al_audioencoderitf_GetEncoderSettings( CStifItemParser& aItem )
   152     {
   161     {
   153     TInt status(KErrNone);
   162     TInt status(KErrNone);
       
   163     TInt status_check(KErrNone);
   154     XAresult res;
   164     XAresult res;
   155     XAAudioEncoderSettings setting;
   165     XAAudioEncoderSettings setting;
       
   166     TUint value(0);
       
   167     TInt i(0);
       
   168     TInt numItems;
       
   169     TPtrC check;
       
   170     
       
   171     void* param = (void*)&setting;
       
   172     void* itfPtr = (void*) m_AudEncItf;
       
   173     
       
   174     status = CheckForNull(aItem, itfPtr);
       
   175     RET_ERR_IF_ERR(status);
       
   176     
       
   177     status = CheckForNull(aItem, param);
       
   178     RET_ERR_IF_ERR(status);
       
   179     
   156     if(m_AudEncItf)
   180     if(m_AudEncItf)
   157         {
   181         {
   158         res = (*m_AudEncItf)->GetEncoderSettings(
   182         res = (*m_AudEncItf)->GetEncoderSettings(
   159                 m_AudEncItf, &setting);
   183                 XAAudioEncoderItf(itfPtr), (XAAudioEncoderSettings*)param);
   160         iLog->Log(_L("GetEncoderSettings"));
   184         iLog->Log(_L("GetEncoderSettings"));
   161         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.encoderId);
   185         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.encoderId);
   162         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsIn);
   186         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsIn);
   163         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsOut);
   187         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.channelsOut);
   164         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.sampleRate);
   188         iLog->Log(_L("GetEncoderSettings value[%d]"),setting.sampleRate);
   175         }
   199         }
   176     else
   200     else
   177         {
   201         {
   178         status = KErrNotFound;
   202         status = KErrNotFound;
   179         }
   203         }
   180     return status;
   204     status_check = aItem.GetNextString(check);
       
   205     
       
   206     if(status_check == KErrNone)
       
   207         {    
       
   208         HBufC8* buf = HBufC8::NewL(check.Length()+1);
       
   209         CleanupStack::PushL(buf);
       
   210         TPtr8 des = buf->Des();
       
   211         des.Copy(check);
       
   212         if(strcasecmp((const char*)des.PtrZ(),"check") == NULL)
       
   213         { 
       
   214         status = aItem.GetNextInt(numItems);
       
   215         while((numItems != 0) && (status == KErrNone))
       
   216                 {
       
   217                 status = aItem.GetNextInt(value);
       
   218                 if(!status)
       
   219                     {
       
   220                     switch(i)
       
   221                         {
       
   222                         case 0:
       
   223                             if(!(setting.encoderId == value))
       
   224                                 status_check = KErrGeneral;
       
   225                             break;
       
   226                             
       
   227                         case 1:
       
   228                             if(!(setting.channelsIn == value))
       
   229                                 status_check = KErrGeneral;
       
   230                             break;
       
   231                         case 2:
       
   232                             if(!(setting.channelsOut == value))
       
   233                                 status_check = KErrGeneral;
       
   234                             break;
       
   235                         case 3:
       
   236                             if(!(setting.sampleRate == value))
       
   237                                 status_check = KErrGeneral;
       
   238                             break;
       
   239                         case 4:
       
   240                             if(!(setting.bitRate == value))
       
   241                             status_check = KErrGeneral;
       
   242                             break;
       
   243                         case 5:
       
   244                             if(!(setting.bitsPerSample == value))
       
   245                             status_check = KErrGeneral;
       
   246                             break;
       
   247                         case 6:
       
   248                             if(!(setting.rateControl == value))
       
   249                             status_check = KErrGeneral;
       
   250                             break;
       
   251                         case 7:
       
   252                             if(!(setting.profileSetting == value))
       
   253                             status_check = KErrGeneral;
       
   254                             break;
       
   255                         case 8:
       
   256                             if(!(setting.levelSetting == value))
       
   257                             status_check = KErrGeneral;
       
   258                             break;
       
   259                         case 9:
       
   260                             if(!(setting.channelMode == value))
       
   261                             status_check = KErrGeneral;
       
   262                             break;
       
   263                         case 10:
       
   264                             if(!(setting.streamFormat == value))
       
   265                             status_check = KErrGeneral;
       
   266                             break;
       
   267                         case 11:
       
   268                             if(!(setting.encodeOptions == value))
       
   269                             status_check = KErrGeneral;
       
   270                             break;
       
   271                         case 12:
       
   272                             if(!(setting.blockAlignment == value))
       
   273                             status_check = KErrGeneral;
       
   274                             break;
       
   275                         default:
       
   276                             break;
       
   277                         }
       
   278                     }
       
   279                 i++;
       
   280                 numItems--;
       
   281                 }
       
   282         
       
   283             }
       
   284         CleanupStack::PopAndDestroy(buf);
       
   285         }
       
   286     if(status_check == KErrNotFound)
       
   287         status_check = KErrNone;
       
   288 
       
   289     return status | status_check;
   181     }
   290     }