示例#1
0
HI_S32 HI_MPI_Ao_UnBindAi(AUDIO_DEV AoDev, AUDIO_DEV AiDev, AI_CHN AiChn)
{
	MPP_CHN_S stSrcChn, stDesChn;

	stSrcChn.enModId  = HI_ID_AI;
	stSrcChn.s32DevId = AiDev;
	stSrcChn.s32ChnId = AiChn;

	stDesChn.enModId  = HI_ID_AO;
	stDesChn.s32DevId = AoDev;
	stDesChn.s32ChnId = 0;

	return HI_MPI_SYS_UnBind(&stSrcChn, &stDesChn);
}
示例#2
0
HI_S32 HI_MPI_Sys_UnBindByForce(
	HI_S32 DesTyp, HI_S32 DesGrp, HI_S32 DesChn)
{
	MPP_CHN_S stSrcChn,stDesChn;

	stDesChn.enModId  = DesTyp;
	stDesChn.s32DevId = DesGrp;
	stDesChn.s32ChnId = DesChn;	

	if(HI_SUCCESS == HI_MPI_SYS_GetBindbyDest(&stDesChn, &stSrcChn)) {
		return HI_MPI_SYS_UnBind(&stSrcChn, &stDesChn);
	}

	return HI_SUCCESS;
}
示例#3
0
文件: sal_audio.c 项目: thatking/util
static int ao_unbind_adec(AUDIO_DEV AoDev, AO_CHN AoChn, ADEC_CHN AdChn)
{
    MPP_CHN_S stSrcChn;
    memset(&stSrcChn, 0, sizeof(stSrcChn));
    MPP_CHN_S stDestChn;
    memset(&stDestChn, 0, sizeof(stDestChn));

    stSrcChn.enModId = HI_ID_AI;
    stSrcChn.s32DevId = AoDev;
    stSrcChn.s32ChnId = AdChn;
    stDestChn.enModId = HI_ID_AENC;
    stDestChn.s32DevId = 0;
    stDestChn.s32ChnId = AoChn;

    return HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
}
示例#4
0
文件: sal_audio.c 项目: thatking/util
static int aenc_unbind_ai(AUDIO_DEV AiDev, AI_CHN AiChn, AENC_CHN AeChn)
{
    MPP_CHN_S stSrcChn;
    memset(&stSrcChn, 0, sizeof(stSrcChn));
    MPP_CHN_S stDestChn;
    memset(&stDestChn, 0, sizeof(stDestChn));

    stSrcChn.enModId = HI_ID_AI;
    stSrcChn.s32DevId = AiDev;
    stSrcChn.s32ChnId = AiChn;
    stDestChn.enModId = HI_ID_AENC;
    stDestChn.s32DevId = 0;
    stDestChn.s32ChnId = AeChn;

    return HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
}
/*****************************************************************************
* function : Vi chn unbind vpss group
*****************************************************************************/
HI_S32 SAMPLE_COMM_VI_UnBindVpss(SAMPLE_VI_MODE_E enViMode)
{
    HI_S32 i, j, s32Ret;
    VPSS_GRP VpssGrp;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;
    SAMPLE_VI_PARAM_S stViParam;
    VI_DEV ViDev;
    VI_CHN ViChn;

    s32Ret = SAMPLE_COMM_VI_Mode2Param(enViMode, &stViParam);
    if (HI_SUCCESS !=s32Ret)
    {
        SAMPLE_PRT("SAMPLE_COMM_VI_Mode2Param failed!\n");
        return HI_FAILURE;
    }
    
    VpssGrp = 0;    
    for (i=0; i<stViParam.s32ViDevCnt; i++)
    {
        ViDev = i * stViParam.s32ViDevInterval;

        for (j=0; j<stViParam.s32ViChnCnt; j++)
        {
            ViChn = j * stViParam.s32ViChnInterval;
            
            stSrcChn.enModId = HI_ID_VIU;
            stSrcChn.s32DevId = ViDev;
            stSrcChn.s32ChnId = ViChn;
        
            stDestChn.enModId = HI_ID_VPSS;
            stDestChn.s32DevId = VpssGrp;
            stDestChn.s32ChnId = 0;
        
            s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
            if (s32Ret != HI_SUCCESS)
            {
                SAMPLE_PRT("failed with %#x!\n", s32Ret);
                return HI_FAILURE;
            }
            
            VpssGrp ++;
        }
    }
    return HI_SUCCESS;
}
示例#6
0
/******************************************************************************
* funciton : stop vda, and stop vda thread -- MD
******************************************************************************/
HI_VOID SAMPLE_COMM_VDA_MdStop(VDA_CHN VdaChn, VI_CHN ViChn)
{
    HI_S32 s32Ret = HI_SUCCESS;
    
    MPP_CHN_S stSrcChn, stDestChn;

    /* join thread */
    if (HI_TRUE == gs_stMdParam.bThreadStart)
    {
        gs_stMdParam.bThreadStart = HI_FALSE;
        pthread_join(gs_VdaPid[SAMPLE_VDA_MD_CHN], 0);
    }
    
    /* vda stop recv picture */
    s32Ret = HI_MPI_VDA_StopRecvPic(VdaChn);
    if(s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("err(0x%x)!!!!\n",s32Ret);
    }

    /* unbind vda chn & vi chn */

    stSrcChn.enModId = HI_ID_VIU;
    stSrcChn.s32ChnId = ViChn;
    stSrcChn.s32DevId = 0;
    stDestChn.enModId = HI_ID_VDA;
    stDestChn.s32ChnId = VdaChn;
    stDestChn.s32DevId = 0;
    
    s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
    if(s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("err(0x%x)!!!!\n", s32Ret);
    }
	
    /* destroy vda chn */
    s32Ret = HI_MPI_VDA_DestroyChn(VdaChn);
    if(s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("err(0x%x)!!!!\n", s32Ret);
    }
    
    return;
}
示例#7
0
bool HimppVencChan::disableObject()
{
    HI_S32 s32Ret;
    GROUP_CROP_CFG_S dis_crop = { .bEnable = HI_FALSE };

    MPP_CHN_S dst_chn = {
        .enModId = HI_ID_GROUP,
        .s32DevId = _grpid,
        .s32ChnId = 0
    };
    if ((s32Ret = HI_MPI_SYS_UnBind(*source(), &dst_chn)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_SYS_UnBind %d failed [%#x]\n",
                    _chnid, s32Ret);
    }

    if ((s32Ret = HI_MPI_VENC_StopRecvPic(_chnid)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_VENC_StopRecvPic %d failed [%#x]\n",
                    _chnid, s32Ret);
    }

    if ((s32Ret = HI_MPI_VENC_SetGrpCrop(_grpid, &dis_crop)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_VENC_SetGrpCrop [%d] failed [%#x]!\n",
                    _grpid, s32Ret);
    }

    if ((s32Ret = HI_MPI_VENC_UnRegisterChn(_chnid)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_VENC_UnRegisterChn %d failed [%#x]\n",
                    _chnid, s32Ret);
    }

    if ((s32Ret = HI_MPI_VENC_DestroyChn(_chnid)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_VENC_DestroyChn %d failed [%#x]\n",
                    _chnid, s32Ret);
    }

    if ((s32Ret = HI_MPI_VENC_DestroyGroup(_grpid)) != HI_SUCCESS) {
        HIMPP_PRINT("HI_MPI_VENC_DestroyGroup %d failed [%#x]\n",
                    _grpid, s32Ret);
    }

    return true;
}
示例#8
0
HI_S32 HI_MPI_Ao_BindAiByForce(AUDIO_DEV AoDev, AUDIO_DEV AiDev, AI_CHN AiChn)
{
	MPP_CHN_S stSrcChn, stDesChn;

	memset(&stSrcChn, 0, sizeof(stSrcChn));

	stDesChn.enModId  = HI_ID_AO;
	stDesChn.s32DevId = AoDev;
	stDesChn.s32ChnId = 0;

	if(!HI_MPI_SYS_GetBindbyDest(&stDesChn, &stSrcChn)) {
		HI_MPI_SYS_UnBind(&stSrcChn, &stDesChn);
	}

	stSrcChn.enModId  = HI_ID_AI;
	stSrcChn.s32DevId = AiDev;
	stSrcChn.s32ChnId = AiChn;

	return HI_MPI_SYS_Bind(&stSrcChn, &stDesChn);
}
示例#9
0
bool HimppAencChan::disableObject()
{
    HI_S32 s32Ret;

    MPP_CHN_S dst_chn;
    dst_chn.enModId = HI_ID_AENC;
    dst_chn.s32DevId = 0;
    dst_chn.s32ChnId = _chnid;
    s32Ret = HI_MPI_SYS_UnBind(*source(), &dst_chn);
    if (s32Ret != HI_SUCCESS) {
        fprintf(stderr, "HI_MPI_SYS_UnBind AENC chn%d failed [%#x]\n",
                _chnid, s32Ret);
    }

    s32Ret = HI_MPI_AENC_DestroyChn(_chnid);
    if (s32Ret != HI_SUCCESS) {
        fprintf(stderr, "failed to destroy VENC chn%d\n", _chnid);
    }

    return true;
}
示例#10
0
HI_S32 SAMPLE_COMM_VO_UnBindVpss(VO_LAYER VoLayer,VO_CHN VoChn,VPSS_GRP VpssGrp,VPSS_CHN VpssChn)
{
    HI_S32 s32Ret = HI_SUCCESS;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;

    stSrcChn.enModId = HI_ID_VPSS;
    stSrcChn.s32DevId = VpssGrp;
    stSrcChn.s32ChnId = VpssChn;

    stDestChn.enModId = HI_ID_VOU;
    stDestChn.s32DevId = VoLayer;
    stDestChn.s32ChnId = VoChn;

    s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }
    return s32Ret;
}
示例#11
0
/******************************************************************************
* function : venc unbind vo           
******************************************************************************/
HI_S32 SAMPLE_COMM_VENC_UnBindVo(VENC_CHN GrpChn,VO_DEV VoDev,VO_CHN VoChn)
{
    HI_S32 s32Ret = HI_SUCCESS;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;

    stSrcChn.enModId = HI_ID_VOU;
    stSrcChn.s32DevId = VoDev;
    stSrcChn.s32ChnId = VoChn;

    stDestChn.enModId = HI_ID_VENC;
    stDestChn.s32DevId = 0;
    stDestChn.s32ChnId = GrpChn;

    s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }

    return s32Ret;
}
/******************************************************************************
* function : vdec group unbind vpss chn
******************************************************************************/
HI_S32 SAMLE_COMM_VDEC_UnBindVpss(VDEC_CHN VdChn, VPSS_GRP VpssGrp)
{
    HI_S32 s32Ret = HI_SUCCESS;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;

    stSrcChn.enModId = HI_ID_VDEC;
    stSrcChn.s32DevId = 0;
    stSrcChn.s32ChnId = VdChn;

    stDestChn.enModId = HI_ID_VPSS;
    stDestChn.s32DevId = VpssGrp;
    stDestChn.s32ChnId = 0;

    s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("HI_MPI_SYS_UnBind failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }

    return HI_SUCCESS;
}
示例#13
0
/******************************************************************************
* function : venc unbind vo           
******************************************************************************/
HI_S32 SAMPLE_COMM_VDEC_UnBindVenc(VDEC_CHN VdChn,VENC_CHN VeChn)
{
    HI_S32 s32Ret = HI_SUCCESS;
    MPP_CHN_S stSrcChn;
    MPP_CHN_S stDestChn;

    stSrcChn.enModId = HI_ID_VDEC;
    stSrcChn.s32DevId = 0;
    stSrcChn.s32ChnId = VdChn;

    stDestChn.enModId = HI_ID_VENC;
    stDestChn.s32DevId = 0;
    stDestChn.s32ChnId = VeChn;


    s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
    if (s32Ret != HI_SUCCESS)
    {
        SAMPLE_PRT("failed with %#x!\n", s32Ret);
        return HI_FAILURE;
    }

    return s32Ret;
}
示例#14
0
static int enc_release_h264_stream(int vin, int stream)
{
	SDK_ENC_H264_STREAM_ATTR_t* stream_attr = &_sdk_enc.attr.video_stream_attr[vin][stream];
	if(stream_attr && vin < HI_VENC_CH_BACKLOG_REF && stream < HI_VENC_STREAM_BACKLOG_REF){
		if(ENC_H264_STREAM_ATTR_MAGIC == stream_attr->magic){
			int const venc_ch = __HI_VENC_CH(vin, stream);
			int const venc_group = venc_ch;
			int const vpss_group = vin;
			int const vpss_ch = (venc_ch % HI_VENC_STREAM_BACKLOG_REF); 
			
			MPP_CHN_S mpp_chn_vpss;
			MPP_CHN_S mpp_chn_venc;

			memset(&mpp_chn_vpss, 0, sizeof(mpp_chn_vpss));
			memset(&mpp_chn_venc, 0, sizeof(mpp_chn_venc));
			// unbind venc to vpss
			mpp_chn_vpss.enModId = HI_ID_VPSS;
			mpp_chn_vpss.s32DevId = vpss_group;
			mpp_chn_vpss.s32ChnId = vpss_ch;
			mpp_chn_venc.enModId = HI_ID_GROUP;
			mpp_chn_venc.s32DevId = venc_group;
			mpp_chn_venc.s32ChnId = venc_ch;
			SOC_TRACE("Stoping recv venc %d", venc_ch);
			SOC_CHECK(HI_MPI_VENC_StopRecvPic(venc_ch));
			SOC_CHECK(HI_MPI_SYS_UnBind(&mpp_chn_vpss, &mpp_chn_venc));
			SOC_CHECK(HI_MPI_VENC_UnRegisterChn(venc_ch));
			SOC_CHECK(HI_MPI_VENC_DestroyChn(venc_ch));
			SOC_CHECK(HI_MPI_VENC_DestroyGroup(venc_group));

			// clear the magic
			stream_attr->magic = 0;
			return SDK_SUCCESS;
		}
	}
	return SDK_FAILURE;
}
示例#15
0
文件: HiSnap.c 项目: MindShow/hi3535
/******************************************************************************
* funciton : bind venc and vpss. 
******************************************************************************/
HI_S32 venc_bind_vpss(VENC_CHN VencChn, SIZE_S *stSize, HI_BOOL Bind)
{
	HI_S32 s32Ret;
	MPP_CHN_S stSrcChn;
	MPP_CHN_S stDestChn;
	VPSS_CHN_MODE_S stVpssChnMode;
	// VENC_GRP VencGrp = VencChn;
	VPSS_GRP VpssGrp = VencChn;
	VPSS_CHN VpssChn = 1;

	stSrcChn.enModId = HI_ID_VPSS;
	stSrcChn.s32DevId = VpssGrp;
	stSrcChn.s32ChnId = VpssChn;
	stDestChn.enModId = HI_ID_VENC;
	stDestChn.s32DevId = 0;
	stDestChn.s32ChnId = VencChn;

	if(Bind == HI_TRUE)
	{
		s32Ret = HI_MPI_SYS_Bind(&stSrcChn, &stDestChn);
		if (s32Ret != HI_SUCCESS)
		{
			Printf("failed with %#x!\n", s32Ret);
			return HI_FAILURE;
		}
		
		stVpssChnMode.bDouble		 = HI_FALSE;
		stVpssChnMode.enChnMode 	 = VPSS_CHN_MODE_USER;
		stVpssChnMode.enPixelFormat  = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stVpssChnMode.u32Width		 = stSize->u32Width;
		stVpssChnMode.u32Height 	 = stSize->u32Height;
		stVpssChnMode.enCompressMode = COMPRESS_MODE_NONE;
		s32Ret = HI_MPI_VPSS_SetChnMode(VpssGrp, VpssChn, &stVpssChnMode);
		if (HI_SUCCESS != s32Ret)
		{
			Printf("set vpss grp%d chn%d mode fail, s32Ret: 0x%x.\n", VpssGrp, VpssChn, s32Ret);
			return s32Ret;
		}
	}
	else
	{
		s32Ret = HI_MPI_SYS_UnBind(&stSrcChn, &stDestChn);
		if (s32Ret != HI_SUCCESS)
		{
			Printf("failed with %#x!\n", s32Ret);
			return HI_FAILURE;
		}
		
		stVpssChnMode.bDouble		 = HI_FALSE;
		stVpssChnMode.enChnMode 	 = VPSS_CHN_MODE_AUTO;
		stVpssChnMode.enPixelFormat  = PIXEL_FORMAT_YUV_SEMIPLANAR_420;
		stVpssChnMode.u32Width		 = stSize->u32Width;
		stVpssChnMode.u32Height 	 = stSize->u32Height;
		stVpssChnMode.enCompressMode = COMPRESS_MODE_NONE;
		s32Ret = HI_MPI_VPSS_SetChnMode(VpssGrp, VpssChn, &stVpssChnMode);
		if (HI_SUCCESS != s32Ret)
		{
			Printf("set vpss grp%d chn%d mode fail, s32Ret: 0x%x.\n", VpssGrp, VpssChn, s32Ret);
			return s32Ret;
		}
	}

	return HI_SUCCESS;
}