multimediacommsengine/tsrc/MMCTestDriver/MCETester/src/TCmdGetSupportedCodecs.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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:    Implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "MCEConstants.h"
       
    21 #include "TCmdGetSupportedCodecs.h"
       
    22 #include "CTcMCEContext.h"
       
    23 
       
    24 #include <MCEAudioCodec.h>
       
    25 #include <MCEVideoCodec.h>
       
    26 
       
    27 void TCmdGetSupportedCodecs::ExecuteL()
       
    28 	{	
       
    29 	// ---------- Setup --------------------------------------------------------
       
    30 
       
    31 	// ---------- Execution ----------------------------------------------------
       
    32 
       
    33     // Get supported audio codecs
       
    34 	// Array for codec names
       
    35 	CDesC8Array* audioCodecs = new(ELeave)CDesC8ArraySeg(1);
       
    36 	CleanupStack::PushL( audioCodecs );
       
    37 
       
    38     const RPointerArray<const CMceAudioCodec>& managerAudioCodecs =
       
    39                 iContext.MCEManager().SupportedAudioCodecs();
       
    40 
       
    41     for ( TInt i = 0; i < managerAudioCodecs.Count(); i++ )
       
    42         {
       
    43         const CMceAudioCodec* managerAudioCodec = managerAudioCodecs[i];
       
    44         
       
    45         audioCodecs->AppendL( managerAudioCodec->SdpName() );
       
    46         }
       
    47 	
       
    48  // Get supported video codecs  
       
    49    	CDesC8Array* avideoCodecs = new(ELeave)CDesC8ArraySeg(1);
       
    50 	CleanupStack::PushL( avideoCodecs );
       
    51 
       
    52     const RPointerArray<const CMceVideoCodec>& managerVideoCodecs =
       
    53                 iContext.MCEManager().SupportedVideoCodecs();
       
    54 
       
    55     for ( TInt i = 0; i < managerVideoCodecs.Count(); i++ )
       
    56         {
       
    57         const CMceVideoCodec* c_videoCodec = managerVideoCodecs[i];
       
    58         
       
    59         avideoCodecs->AppendL( c_videoCodec->SdpName() );
       
    60         }
       
    61 	
       
    62 	// ---------- Response creation --------------------------------------------
       
    63 
       
    64 	if ( audioCodecs->Count() || avideoCodecs->Count() )
       
    65 		{	
       
    66         AddArrayResponseL( KResponseSupportedAudioCodecs, *audioCodecs );
       
    67         AddArrayResponseL( KResponseSupportedVideoCodecs, *avideoCodecs );
       
    68 		}
       
    69 		
       
    70 	CleanupStack::Pop( avideoCodecs );
       
    71 	CleanupStack::Pop( audioCodecs );	
       
    72 
       
    73 	}
       
    74 	
       
    75 TBool TCmdGetSupportedCodecs::Match( const TTcIdentifier& aId )
       
    76 	{
       
    77 	return TTcMceCommandBase::Match( aId, _L8("GetSupportedCodecs") );
       
    78 	}
       
    79 
       
    80 TTcCommandBase* TCmdGetSupportedCodecs::CreateL( MTcTestContext& aContext )
       
    81 	{
       
    82 	return new( ELeave ) TCmdGetSupportedCodecs( aContext );
       
    83 	}