/*-------------------------------------------------------------------------
   Protocol function copy right information

   Copyright (C) 2007-2009. Lin, Rongrong <woody@palmmicro.com>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   This software is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with this library; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-------------------------------------------------------------------------*/

#include "type.h"
#include "core.h"
#include "apps.h"
#include "bank5.h"

// Put SIP/RTP and IAX2 common functions (NOT version.h related) here

void CallTimeZero(CALL_TIME * p)
{
	memset((PCHAR)p, 0, sizeof(CALL_TIME));
}

void CallTimeTick(CALL_TIME * p)
{
	p->iSec ++;
	if (p->iSec == 60)
	{
		p->iSec -= 60;
		p->iMin ++;
		if (p->iMin == 60)
		{
			p->iMin -= 60;
			p->iHour ++;
		}
	}
}

const UCHAR _cFrameTime[VOICE_CODER_NUM] = {G711_FRAME_TIME, G711_FRAME_TIME, G726_FRAME_TIME, GSM610_FRAME_TIME, ILBC_30MS_TIME, SPEEX_FRAME_TIME, G729_FRAME_TIME};

UCHAR GetFrameTime(UCHAR iVoiceCoder)
{
	if (iVoiceCoder == VOICE_CODER_ILBC)
	{
		if (Sys_iIlbcFrame)
		{
			return ILBC_30MS_TIME;
		}
		else
		{
			return ILBC_20MS_TIME;
		}
	}
	else
	{
		return _cFrameTime[iVoiceCoder-1];
	}
}

