mmserv/tms/tmsimpl/src/tmsformatimpl.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 17:11:02 +0300
branchRCL_3
changeset 13 f5c5c82a163e
parent 10 3d8c721bf319
child 16 43d09473c595
permissions -rw-r--r--
Revision: 201015 Kit: 201017

/*
 * 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 "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()
    {
    TRACE_PRN_FN_ENT;
    TRACE_PRN_FN_EXT;
    }

TMSFormatImpl::~TMSFormatImpl()
    {
    TRACE_PRN_FN_ENT;
    TRACE_PRN_FN_EXT;
    }

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 (static_cast<TMSPCMFormatImpl*>(tmsfmt));
            tmsfmt = NULL;
            break;
        case TMS_FORMAT_AMR:
            delete (static_cast<TMSAMRFormatImpl*>(tmsfmt));
            tmsfmt = NULL;
            break;
        case TMS_FORMAT_G711:
            delete (static_cast<TMSG711FormatImpl*>(tmsfmt));
            tmsfmt = NULL;
            break;
        case TMS_FORMAT_G729:
            delete (static_cast<TMSG729FormatImpl*>(tmsfmt));
            tmsfmt = NULL;
            break;
        case TMS_FORMAT_ILBC:
            delete (static_cast<TMSILBCFormatImpl*>(tmsfmt));
            tmsfmt = NULL;
            break;
        default:
            break;
        }

    TRACE_PRN_FN_EXT;
    return ret;
    }

// End of file