[Feature][T106][task-view-97] add interface for voice call to rtp,
modification in cp and ap and pub

Only Configure: No
Affected branch: unknown
Affected module: voice call and at
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: yes
Doc Update: no

Change-Id: I5c7bc461e790ee24805a520077ca80b5eeb7bbf1
(cherry picked from commit 13ef23011ea4cd9fc919b82e82202f09c0b2ef3e)
diff --git a/ap/lib/libvoice/voice.c b/ap/lib/libvoice/voice.c
index 61b9c1e..6af0fa6 100755
--- a/ap/lib/libvoice/voice.c
+++ b/ap/lib/libvoice/voice.c
@@ -167,7 +167,7 @@
 	}

 	ret = ioctl(fd, VOICE_IOCTL_VPLOOP, path);

 	if (ret) {

-		printf("voice_Vploop:  ret=%d,path=%p.\n", ret, path);

+		printf("voice_Vploop:  ret=%d,path=%d.\n", ret, *path);

 		close(fd);

 		return  -1;

 	}

@@ -224,18 +224,20 @@
 		}

 	}

 #if defined(_VBUFF_IN_SINGLE_CORE) || defined(_VBUFF_IN_MULTI_CORE)

-	printf("%s: use voice buffer,return!\n",__func__); 

+	printf("%s: ap use voice buffer,return!\n",__func__); 

 	return 0;

 

 #endif	

 #if defined(_ALSA_CODEC_IN_CAP) && defined(_USE_ALSA_AT_INTF)

+	   printf("%s:_ALSA_CODEC_IN_CAP and at intf!\n",__func__);

 

    

-	   printf("%s: i2s and codec not need config,return!\n",__func__); 

+	   printf("%s:ap i2s and codec not need config,return!\n",__func__); 

 	   return 0;

 

 #elif defined(_ALSA_CODEC_IN_CAP)

 

+	   printf("%s:_ALSA_CODEC_IN_CAP!\n",__func__);

 

 	   if(cfgParam->clock_rate == 8000){

 

@@ -261,6 +263,7 @@
     

 #endif

 

+	printf("%s:ap do mixer and pcm opt!\n",__func__); 

 

 	//open mixer dev for codec control

 	voice_mixer = mixer_open(0);

@@ -390,6 +393,93 @@
 }

 

 

+int voice_SetVoiceProcess(int *vp)

+{

+	int ret = 0;

+	int fd = -1;

+	printf("%s:   start vp=%d!\n",__func__,*vp);

+	fd = open(VOICE_DEV_NAME, O_RDONLY);

+	if (fd < 0) {

+		printf("%s: open voice device error.\n",__func__);

+		return  -1;

+	}

+	ret = ioctl(fd, VOICE_IOCTL_SET_VP, vp);

+	if (ret) {

+		printf("%s:  ret=%d,vp=%d.\n",__func__, ret, *vp);

+		close(fd);

+		return  -1;

+	}

+	close(fd);

+	return 0;

+

+}

+int voice_GetVoiceProcess(void)

+{

+	int ret = 0;

+	int fd = -1;

+	int vp = 0;

+	fd = open(VOICE_DEV_NAME, O_RDONLY);

+	if (fd < 0) {

+		printf("%s: open voice device error.\n",__func__);

+		return  -1;

+	}

+	ret = ioctl(fd, VOICE_IOCTL_GET_VP, &vp);

+	if (ret) {

+		printf("%s:  ret=%d,vp=%d.\n",__func__, ret, vp);

+		close(fd);

+		return  -1;

+	}

+	close(fd);

+	printf("%s:  vp=%d!\n",__func__,vp);

+	

+	return vp;

+

+}

 

 

 

+

+int voice_SetVoiceBuffer(T_VoiceBuf_Para *vb)

+{

+	int ret = 0;

+	int fd = -1;

+	printf("%s:   start enable=%d,type=%d!\n",__func__,vb->enable,vb->type);

+	fd = open(VOICE_DEV_NAME, O_RDONLY);

+	if (fd < 0) {

+		printf("%s: open voice device error.\n",__func__);

+		return  -1;

+	}

+	ret = ioctl(fd, VOICE_IOCTL_SET_VBUF, vb);

+	if (ret) {

+		printf("%s:  ret=%d.\n",__func__, ret);

+		close(fd);

+		return  -1;

+	}

+	close(fd);

+	return 0;

+

+}

+

+int voice_GetVoiceBuffer(T_VoiceBuf_Para *vb)

+{

+	int ret = 0;

+	int fd = -1;

+	fd = open(VOICE_DEV_NAME, O_RDONLY);

+	if (fd < 0) {

+		printf("%s: open voice device error.\n",__func__);

+		return  -1;

+	}

+	ret = ioctl(fd, VOICE_IOCTL_GET_VBUF, vb);

+	if (ret) {

+		printf("%s: ret=%d.\n",__func__, ret);

+		close(fd);

+		return  -1;

+	}

+	close(fd);

+	printf("%s:   start fs=%d enable=%d,type=%d!\n",__func__,vb->fs,vb->enable,vb->type);

+	

+	

+	return ret;

+

+}

+