diff -r 000000000000 -r 71ca22bcf22a mmserv/tms/tmsimpl/src/tmsformatimpl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsimpl/src/tmsformatimpl.cpp Tue Feb 02 01:08:46 2010 +0200 @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#include +#include "tmsutility.h" +#include "tmsamrformatimpl.h" +#include "tmsg711formatimpl.h" +#include "tmsg729formatimpl.h" +#include "tmsilbcformatimpl.h" +#include "tmspcmformatimpl.h" +#include "tmsformatbodyimpl.h" +#include "tmsformatimpl.h" + +using namespace TMS; + +TMSFormatImpl::TMSFormatImpl() + { + } + +EXPORT_C gint TMSFormatImpl::Create(TMSFormatType fmttype, TMSFormat*& tmsfmt) + { + gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); + TRACE_PRN_FN_ENT; + + switch (fmttype) + { + case TMS_FORMAT_PCM: + ret = TMSPCMFormatImpl::Create(tmsfmt); + break; + case TMS_FORMAT_AMR: + ret = TMSAMRFormatImpl::Create(tmsfmt); + break; + case TMS_FORMAT_G711: + ret = TMSG711FormatImpl::Create(tmsfmt); + break; + case TMS_FORMAT_G729: + ret = TMSG729FormatImpl::Create(tmsfmt); + break; + case TMS_FORMAT_ILBC: + ret = TMSILBCFormatImpl::Create(tmsfmt); + break; + default: + ret = TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED; + break; + } + + TRACE_PRN_FN_EXT; + return ret; + } + +EXPORT_C gint TMSFormatImpl::Delete(TMSFormat*& tmsfmt) + { + gint ret(TMS_RESULT_FORMAT_TYPE_NOT_SUPPORTED); + TRACE_PRN_FN_ENT; + TMSFormatType fmttype; + ret = tmsfmt->GetType(fmttype); + switch (fmttype) + { + case TMS_FORMAT_PCM: + delete (TMSPCMFormatImpl*) (tmsfmt); + tmsfmt = NULL; + break; + case TMS_FORMAT_AMR: + delete (TMSAMRFormatImpl*) (tmsfmt); + tmsfmt = NULL; + break; + case TMS_FORMAT_G711: + delete (TMSG711FormatImpl*) (tmsfmt); + tmsfmt = NULL; + break; + case TMS_FORMAT_G729: + delete (TMSG729FormatImpl*) (tmsfmt); + tmsfmt = NULL; + break; + case TMS_FORMAT_ILBC: + delete (TMSILBCFormatImpl*) (tmsfmt); + tmsfmt = NULL; + break; + default: + break; + } + + TRACE_PRN_FN_EXT; + return ret; + } + +// End of file