mmfenh/advancedaudiocontroller/audiocontrollerpluginsvariant/3gpaudioplaycontroller/Src/3GPAudioPlayControllerDecoderBuilder.cpp
changeset 0 71ca22bcf22a
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 is a builder class for decoder object.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include	"3GPAudioPlayControllerDecoderBuilder.h"
       
    22 #include	"AACAudioPlayControllerDecoder.h"
       
    23 #include	"AWBAudioPlayControllerDecoder.h"
       
    24 #include	"AMRAudioPlayControllerDecoder.h"
       
    25 
       
    26 // ============================ MEMBER FUNCTIONS ===============================
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // C3GPAudioPlayControllerDecoderBuilder::C3GPAudioPlayControllerDecoderBuilder
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 C3GPAudioPlayControllerDecoderBuilder::C3GPAudioPlayControllerDecoderBuilder()
       
    35     {
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // C3GPAudioPlayControllerDecoderBuilder::ConstructL
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 void C3GPAudioPlayControllerDecoderBuilder::ConstructL()
       
    44 	{
       
    45 #ifdef _DEBUG
       
    46 	RDebug::Print(_L("C3GPAudioPlayControllerDecoderBuilder::ConstructL"));
       
    47 #endif
       
    48 	}
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // C3GPAudioPlayControllerDecoderBuilder::NewL
       
    52 // Two-phased constructor.
       
    53 // -----------------------------------------------------------------------------
       
    54 //
       
    55 C3GPAudioPlayControllerDecoderBuilder* C3GPAudioPlayControllerDecoderBuilder::NewL()
       
    56 	{
       
    57 #ifdef _DEBUG
       
    58 	RDebug::Print(_L("C3GPAudioPlayControllerDecoderBuilder::NewL"));
       
    59 #endif
       
    60 	C3GPAudioPlayControllerDecoderBuilder* self = new(ELeave) C3GPAudioPlayControllerDecoderBuilder();
       
    61 	CleanupStack::PushL(self);
       
    62 	self->ConstructL();
       
    63 	CleanupStack::Pop(self); // self
       
    64 	return self;
       
    65 	}
       
    66 
       
    67 // Destructor
       
    68 C3GPAudioPlayControllerDecoderBuilder::~C3GPAudioPlayControllerDecoderBuilder()
       
    69 	{
       
    70 	}
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // C3GPAudioPlayControllerDecoderBuilder::BuildDecoderL
       
    74 // Creates a decoder of specified type.
       
    75 // -----------------------------------------------------------------------------
       
    76 //
       
    77 CAdvancedAudioDecoder* C3GPAudioPlayControllerDecoderBuilder::BuildDecoderL(
       
    78 	TInt /*aType*/,
       
    79 	const TFourCC& aSrcDatatype )
       
    80 	{
       
    81 #ifdef _DEBUG
       
    82 	RDebug::Print(_L("C3GPAudioPlayControllerDecoderBuilder::BuildDecoderL"));
       
    83 #endif
       
    84 	// For CMMFCodec version, we use same decoder for play and conversion
       
    85 	if (aSrcDatatype == TFourCC(' ','A','M','R'))
       
    86 		{
       
    87 		CAMRAudioPlayControllerDecoder* decoder = CAMRAudioPlayControllerDecoder::NewL();
       
    88 		return decoder;
       
    89 		}
       
    90 	else if (aSrcDatatype == TFourCC(' ','A','W','B'))
       
    91 		{
       
    92 		CAWBAudioPlayControllerDecoder* decoder = CAWBAudioPlayControllerDecoder::NewL();
       
    93 		return decoder;
       
    94 		}
       
    95 	else if (aSrcDatatype == TFourCC(' ','E','A','C'))
       
    96 		{
       
    97 		CAACAudioPlayControllerDecoder* decoder = CAACAudioPlayControllerDecoder::NewL();
       
    98 		return decoder;
       
    99 		}
       
   100 	else
       
   101 		{
       
   102 		User::Leave(KErrNotSupported);
       
   103 		}
       
   104 	return NULL; //to suppress warning
       
   105 	}
       
   106 
       
   107 //  End of File