海思SS928平台H265编码例程解析4---函数功能分析

1、函数 sample_comm_fd_isset

在线程函数sample_comm_venc_get_venc_stream_proc中调用了函数 sample_comm_fd_isset,其内容如下:

static hi_void sample_comm_fd_isset(sample_comm_venc_stream_proc_info *stream_proc_info, fd_set *read_fds,
    hi_venc_stream_buf_info *stream_buf_info, hi_payload_type *payload_type, sample_venc_getstream_para *para)
{
    hi_s32 i, ret;

    for (i = 0; (i < stream_proc_info->chn_total) && (i < HI_VENC_MAX_CHN_NUM); i++) {
        if (FD_ISSET(stream_proc_info->venc_fd[i], read_fds)) {
            stream_proc_info->venc_chn = para->venc_chn[i];
            ret = sample_comm_get_stream_from_one_channl(stream_proc_info, i, stream_buf_info, payload_type);
            if (ret == SAMPLE_RETURN_CONTINUE) {
                continue;
            } else if (ret == SAMPLE_RETURN_BREAK) {
                break;
            }
        }
    }
}

功能:在一个通信过程中处理来自VENC(Video Encoder)的输入数据。

相关函数:fd_set *read_fds: 用于保存需要读取的文件描述符集合。

2、函数sample_comm_get_stream_from_one_channl

static hi_s32 sample_comm_get_stream_from_one_channl(sample_comm_venc_stream_proc_info *stream_proc_info,
    hi_s32 index, hi_venc_stream_buf_info *stream_buf_info, hi_payload_type *payload_type)
{
    hi_s32 ret;
    hi_venc_stream stream;
    hi_venc_chn_status stat;

    /* step 2.1 : query how many packs in one-frame stream. */
    if (memset_s(&stream, sizeof(stream), 0, sizeof(stream)) != EOK) {
        printf("call memset_s error\n");
    }

    ret = hi_mpi_venc_query_status(index, &stat);
    if (ret != HI_SUCCESS) {
        sample_print("hi_mpi_venc_query_status chn[%d] failed with %#x!\n", index, ret);
        return SAMPLE_RETURN_BREAK;
    }

    if (stat.cur_packs == 0) {
        sample_print("NOTE: current  frame is HI_NULL!\n");
        return SAMPLE_RETURN_CONTINUE;
    }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菩提树下的凡夫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值