mmserv/tms/tmsimpl/src/tmsformatimpl.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 22:29:45 +0300
branchRCL_3
changeset 10 3d8c721bf319
parent 0 71ca22bcf22a
child 13 f5c5c82a163e
permissions -rw-r--r--
Revision: 201011 Kit: 201013

/*
 * 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 (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