mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerResource.cpp
changeset 0 71ca22bcf22a
child 18 2eb3b066cc7d
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2004 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 class provides the main API for the specific codec resources.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	<3GPAudioPlayControllerResource.rsg>
       
    22 #include	"3GPAudioPlayControllerResource.h"
       
    23 #include 	<data_caging_path_literals.hrh>
       
    24 
       
    25 // LOCAL CONSTANTS AND MACROS
       
    26 _LIT(KDirAndFile, "z:3GPAudioPlayControllerResource.rsc");
       
    27 
       
    28 
       
    29 // ============================ MEMBER FUNCTIONS ===============================
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // C3GPAudioPlayControllerResource::C3GPAudioPlayControllerResource
       
    33 // C++ default constructor can NOT contain any code, that
       
    34 // might leave.
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 C3GPAudioPlayControllerResource::C3GPAudioPlayControllerResource()
       
    38 	:	iResourceType(0)
       
    39     {
       
    40     }
       
    41 
       
    42 // -----------------------------------------------------------------------------
       
    43 // C3GPAudioPlayControllerResource::ConstructL
       
    44 // Symbian 2nd phase constructor can leave.
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 void C3GPAudioPlayControllerResource::ConstructL(
       
    48 	TInt aResourceType )
       
    49 	{
       
    50 #ifdef _DEBUG
       
    51 	RDebug::Print(_L("C3GPAudioPlayControllerResource::ConstructL(%d)\n"), aResourceType);
       
    52 #endif
       
    53 	TInt resourceId = 0;
       
    54 	switch ( aResourceType )
       
    55 		{
       
    56 		case K3GPResourceAAC:
       
    57 			resourceId = AACDECODER;
       
    58 			break;
       
    59 		case K3GPResourceAMR:
       
    60 			resourceId = AMRDECODER;
       
    61 			break;
       
    62 		case K3GPResourceAWB:
       
    63 			resourceId = AWBDECODER;
       
    64 			break;
       
    65 		default:
       
    66 			User::Leave(KErrArgument);
       
    67 			break;
       
    68 		}
       
    69 	iResourceType = aResourceType;
       
    70 
       
    71 //	ReadResourceFileL(KResourceFile, resourceId);
       
    72 	TParse* fp = new(ELeave) TParse();
       
    73 	fp->Set(KDirAndFile, &KDC_RESOURCE_FILES_DIR, NULL);
       
    74 
       
    75 	ReadResourceFileL(fp->FullName(), resourceId);
       
    76 	delete fp;
       
    77 	}
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CAdvancedAudioControllerResource::NewL
       
    81 // Two-phased constructor.
       
    82 // -----------------------------------------------------------------------------
       
    83 //
       
    84 C3GPAudioPlayControllerResource* C3GPAudioPlayControllerResource::NewL(
       
    85 	TInt aResourceType )
       
    86 	{
       
    87 #ifdef _DEBUG
       
    88 	RDebug::Print(_L("C3GPAudioPlayControllerResource::NewL\n"));
       
    89 #endif
       
    90 	C3GPAudioPlayControllerResource* self = new(ELeave) C3GPAudioPlayControllerResource();
       
    91 	CleanupStack::PushL(self);
       
    92 	self->ConstructL(aResourceType);
       
    93 	CleanupStack::Pop(self); // self
       
    94 	return self;
       
    95 	}
       
    96 
       
    97 // Destructor
       
    98 C3GPAudioPlayControllerResource::~C3GPAudioPlayControllerResource()
       
    99 	{
       
   100 	}
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // C3GPAudioPlayControllerResource::ReadCodecConfigParametersL
       
   104 // Reads the configuration parameters for the specified codec.
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void C3GPAudioPlayControllerResource::ReadCodecConfigParametersL()
       
   108 	{
       
   109 	switch ( iResourceType )
       
   110 		{
       
   111 		case K3GPResourceAAC:
       
   112 
       
   113 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [0] Input Sampling Frequency
       
   114 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [1] Input Channels
       
   115 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [2] Input Profile
       
   116 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [3] Input Frame Length
       
   117 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [4] Down Mixing
       
   118 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [5] Output Channel Selection
       
   119 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [6] Decimation Factor
       
   120 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [7] Downsample mode
       
   121 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [8] Sample Size
       
   122 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [9] Output Sampling Frequency
       
   123 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [10] Extension Object Type
       
   124 		    iCodecConfigParams.Append(NULL);                        // [11] frame table pointer
       
   125 		    iCodecConfigParams.Append(NULL);                        // [12] format type - TEAacPlusFormat
       
   126 		    iCodecConfigParams.Append(NULL);						// [13] render control
       
   127 		    iCodecConfigParams.Append(NULL);						// [14] mark play end control
       
   128 		    iCodecConfigParams.Append(NULL);						// [15] enable / disable
       
   129 
       
   130 			break;
       
   131 
       
   132 		case K3GPResourceAMR:
       
   133 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [0] Concealment Level
       
   134 		    iCodecConfigParams.Append(NULL);                        // [1] frame table pointer
       
   135 		    iCodecConfigParams.Append(NULL);						// [2] render control
       
   136 		    iCodecConfigParams.Append(NULL);						// [3] mark play end control
       
   137 		    iCodecConfigParams.Append(NULL);						// [4] enable / disable
       
   138 			break;
       
   139 
       
   140 		case K3GPResourceAWB:
       
   141 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [0] Decimation Factor
       
   142 			iCodecConfigParams.Append(iResourceReader.ReadInt32());	// [1] Concealment Level
       
   143 		    iCodecConfigParams.Append(NULL);                        // [2] frame table pointer
       
   144 		    iCodecConfigParams.Append(NULL);						// [3] render control
       
   145 		    iCodecConfigParams.Append(NULL);						// [4] mark play end control
       
   146 		    iCodecConfigParams.Append(NULL);						// [5] enable / disable
       
   147 			break;
       
   148 
       
   149 		default:
       
   150 			User::Leave(KErrArgument);
       
   151 			break;
       
   152 		}
       
   153 	}
       
   154 
       
   155 //  End of File