fusion/mw/media/mw_video.c

68 lines
1.8 KiB
C
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*************************************************
File name : mw_video.c
Module :
Author : amir
Version : 0.1
Created on : 2024-09-07
Description :
Modify History:
1. Date: Author: Modification:
*************************************************/
#include "mw_video.h"
/**
* 函数Video_OpenStream
* 声明uint32_t video_openstream(STREAM_CHANNEL Stream, int32_t Channel)
* 功能:打开视频流
* 入参STREAM_CHANNEL Stream, 视频流通道
VIDEO_FORMAT Format, 视频格式
int32_t Channel, 设备通道号
* 出参:无
* 返回:函数执行指示, uint32_t代码值
* 0 成功
* 非0 失败, 错误码
*/
uint32_t video_openstream(HAL_SENSOR_IDX idx, hal_video_frame_callback cb, HAL_STREAM_CHANNEL stream_chn, const video_attr_st attr)
{
uint32_t ret = hal_video_init(idx);
return ret|hal_video_openstream(idx, cb, stream_chn, attr);
}
/**
* 函数Video_CloseStream
* 声明uint32_t video_close(STREAM_CHANNEL Stream, int32_t Channel)
* 功能:关闭视频流
* 入参STREAM_CHANNEL Stream, 视频流通道
VIDEO_FORMAT Format, 视频格式
int32_t Channel, 设备通道号
* 出参:无
* 返回:函数执行指示, uint32_t代码值
* 0 成功
* 非0 失败, 错误码
*/
uint32_t video_close(hal_video_frame_callback cb)
{
return hal_video_closestream(cb);
}
static uint32_t video_frame_cb(video_frame * frame){
hlogi("%s frame:%p", __func__, frame);
hv_msleep(2000);
return OK;
}
void mw_video_test(){
video_attr_st attr;
video_openstream(0, video_frame_cb, 0, attr);
hv_sleep(2);
video_close(video_frame_cb);
}