3756
- 收藏
- 点赞
- 分享
- 举报
hisi3520dv400 音频输出,立体声模式,可以输出声音 但是声音左右声道都在一起了
本帖最后由 qn1586314774 于 2020-6-4 20:44 编辑
使用mpp/sample/audio中提供的demo
修改地方
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_STEREO;//AUDIO_SOUND_MODE_MONO
stAioAttr.u32ChnCnt = 2;//1
音频芯片:TLV320AIC3104
测试:制作的音频区分左右声道,使用这个例子播放音频,不知为什么,左右声道不区分?
源代码如下:
/[code]******************************************************************************
* function : file -> Adec -> Ao
******************************************************************************/
HI_S32 SAMPLE_AUDIO_AdecAo(HI_VOID)
{
HI_S32 s32Ret;
AUDIO_DEV AoDev = SAMPLE_AUDIO_AO_DEV;
AO_CHN AoChn = 0;
ADEC_CHN AdChn = 0;
FILE *pfd = NULL;
HI_U32 AoChnCnt = 0;
AIO_ATTR_S stAioAttr;
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_48000;//AUDIO_SAMPLE_RATE_44100
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_STEREO;// AUDIO_SOUND_MODE_STEREO
stAioAttr.u32EXFlag = 1;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 2;//1
stAioAttr.u32ClkChnCnt = 2;
stAioAttr.u32ClkSel = 0;
if(PT_AAC == gs_enPayloadType)
{
//stAioAttr.u32PtNumPerFrm = AACLC_SAMPLES_PER_FRAME;
}
#ifdef HI_ACODEC_TYPE_TLV320AIC31
stAioAttr.u32ClkSel = 1;
#endif
gs_pstAiReSmpAttr = NULL;
gs_pstAoReSmpAttr = NULL;
s32Ret = SAMPLE_COMM_AUDIO_CfgAcodec(&stAioAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
AoChnCnt = stAioAttr.u32ChnCnt >> stAioAttr.enSoundmode;
g_u32AoCnt = AoChnCnt;
g_u32AoDev = AoDev;
enInSampleRate = AUDIO_SAMPLE_RATE_BUTT;
enOutSampleRate = AUDIO_SAMPLE_RATE_BUTT;
//s32Ret = SAMPLE_COMM_AUDIO_StartAo(AoDev, AoChnCnt, &stAioAttr, AUDIO_SAMPLE_RATE_BUTT, HI_FALSE, HI_NULL, 0);
s32Ret = SAMPLE_COMM_AUDIO_StartAo(AoDev, AoChnCnt, &stAioAttr, enInSampleRate, enOutSampleRate, HI_NULL, 0);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
//打开音频原始文件,读取写入
g_u32Adec = AdChn;
s32Ret = SAMPLE_COMM_AUDIO_StartAdec(AdChn, gs_enPayloadType);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_AoBindAdec(AoDev, AoChn, AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
pfd = SAMPLE_AUDIO_OpenAdecFile(AdChn, gs_enPayloadType);
if (!pfd)
{
SAMPLE_DBG(HI_FAILURE);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdFileAdec(AdChn, pfd);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
printf("bind adec:%d to ao(%d,%d) ok \n", AdChn, AoDev, AoChn);
printf("\nplease press twice ENTER to exit this sample\n");
getchar();
getchar();
s32Ret = SAMPLE_COMM_AUDIO_DestoryTrdFileAdec(AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_StopAdec(AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_StopAo(AoDev, AoChnCnt, gs_bAioReSample, HI_FALSE);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_AoUnbindAdec(AoDev, AoChn, AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
return HI_SUCCESS;
}
[/code]
使用mpp/sample/audio中提供的demo
修改地方
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_STEREO;//AUDIO_SOUND_MODE_MONO
stAioAttr.u32ChnCnt = 2;//1
音频芯片:TLV320AIC3104
测试:制作的音频区分左右声道,使用这个例子播放音频,不知为什么,左右声道不区分?
源代码如下:
/[code]******************************************************************************
* function : file -> Adec -> Ao
******************************************************************************/
HI_S32 SAMPLE_AUDIO_AdecAo(HI_VOID)
{
HI_S32 s32Ret;
AUDIO_DEV AoDev = SAMPLE_AUDIO_AO_DEV;
AO_CHN AoChn = 0;
ADEC_CHN AdChn = 0;
FILE *pfd = NULL;
HI_U32 AoChnCnt = 0;
AIO_ATTR_S stAioAttr;
stAioAttr.enSamplerate = AUDIO_SAMPLE_RATE_48000;//AUDIO_SAMPLE_RATE_44100
stAioAttr.enBitwidth = AUDIO_BIT_WIDTH_16;
stAioAttr.enWorkmode = AIO_MODE_I2S_MASTER;
stAioAttr.enSoundmode = AUDIO_SOUND_MODE_STEREO;// AUDIO_SOUND_MODE_STEREO
stAioAttr.u32EXFlag = 1;
stAioAttr.u32FrmNum = 30;
stAioAttr.u32PtNumPerFrm = SAMPLE_AUDIO_PTNUMPERFRM;
stAioAttr.u32ChnCnt = 2;//1
stAioAttr.u32ClkChnCnt = 2;
stAioAttr.u32ClkSel = 0;
if(PT_AAC == gs_enPayloadType)
{
//stAioAttr.u32PtNumPerFrm = AACLC_SAMPLES_PER_FRAME;
}
#ifdef HI_ACODEC_TYPE_TLV320AIC31
stAioAttr.u32ClkSel = 1;
#endif
gs_pstAiReSmpAttr = NULL;
gs_pstAoReSmpAttr = NULL;
s32Ret = SAMPLE_COMM_AUDIO_CfgAcodec(&stAioAttr);
if (HI_SUCCESS != s32Ret)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
AoChnCnt = stAioAttr.u32ChnCnt >> stAioAttr.enSoundmode;
g_u32AoCnt = AoChnCnt;
g_u32AoDev = AoDev;
enInSampleRate = AUDIO_SAMPLE_RATE_BUTT;
enOutSampleRate = AUDIO_SAMPLE_RATE_BUTT;
//s32Ret = SAMPLE_COMM_AUDIO_StartAo(AoDev, AoChnCnt, &stAioAttr, AUDIO_SAMPLE_RATE_BUTT, HI_FALSE, HI_NULL, 0);
s32Ret = SAMPLE_COMM_AUDIO_StartAo(AoDev, AoChnCnt, &stAioAttr, enInSampleRate, enOutSampleRate, HI_NULL, 0);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
//打开音频原始文件,读取写入
g_u32Adec = AdChn;
s32Ret = SAMPLE_COMM_AUDIO_StartAdec(AdChn, gs_enPayloadType);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_AoBindAdec(AoDev, AoChn, AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
pfd = SAMPLE_AUDIO_OpenAdecFile(AdChn, gs_enPayloadType);
if (!pfd)
{
SAMPLE_DBG(HI_FAILURE);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_CreatTrdFileAdec(AdChn, pfd);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
printf("bind adec:%d to ao(%d,%d) ok \n", AdChn, AoDev, AoChn);
printf("\nplease press twice ENTER to exit this sample\n");
getchar();
getchar();
s32Ret = SAMPLE_COMM_AUDIO_DestoryTrdFileAdec(AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_StopAdec(AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_StopAo(AoDev, AoChnCnt, gs_bAioReSample, HI_FALSE);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
s32Ret = SAMPLE_COMM_AUDIO_AoUnbindAdec(AoDev, AoChn, AdChn);
if (s32Ret != HI_SUCCESS)
{
SAMPLE_DBG(s32Ret);
return HI_FAILURE;
}
return HI_SUCCESS;
}
[/code]
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2020-07-01 17:18:17
-
2016-03-28 22:53:35
-
2018-12-26 13:50:50
-
2018-07-06 11:19:20
-
2017-03-13 08:57:46
-
2023-07-17 14:09:51
-
2018-12-31 12:38:09
-
2015-03-31 11:31:52
-
2019-01-28 09:32:19
-
2016-06-12 09:36:19
-
2013-12-24 11:15:05
-
2017-03-10 16:27:38
-
2018-12-20 17:39:44
-
2019-11-25 09:18:53
-
2018-10-26 15:00:15
-
2016-05-17 16:22:50
-
2020-06-19 09:50:26
-
32014-09-25 16:18:31
-
2023-02-20 17:54:12
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
-
50SS928 运行PQtools 拼接 推到设备里有一半画面会异常
-
53536AV100的sample_vdec输出到CVBS显示
-
10海思板子mpp怎么在vi阶段改变视频数据尺寸
-
10HI3559AV100 多摄像头同步模式
-
9海思ss928单路摄像头vio中加入opencv处理并显示
-
10EB-RV1126-BC-191板子运行自己编码的程序
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认