diff --git a/src/app_config.c b/src/app_config.c index a366f90..42e00ef 100644 --- a/src/app_config.c +++ b/src/app_config.c @@ -253,9 +253,7 @@ enum ConfigError parse_app_config(void) { goto RET_ERR; parse_int(&ini, "isp", "antiflicker", -1, 60, &app_config.antiflicker); - err = parse_bool(&ini, "rtsp", "enable", &app_config.rtsp_enable); - if (err != CONFIG_OK) - goto RET_ERR; + parse_bool(&ini, "rtsp", "enable", &app_config.rtsp_enable); parse_bool(&ini, "mdns", "enable", &app_config.mdns_enable); diff --git a/src/hal/hisi/v1_aud.h b/src/hal/hisi/v1_aud.h index 6feb63f..cb6add1 100644 --- a/src/hal/hisi/v1_aud.h +++ b/src/hal/hisi/v1_aud.h @@ -52,6 +52,11 @@ typedef struct { char isSysBound; } v1_aud_efrm; +typedef struct { + unsigned int userFrmDepth; + int rev; +} v1_aud_para; + typedef struct { void *handle; @@ -61,6 +66,7 @@ typedef struct { int (*fnDisableChannel)(int device, int channel); int (*fnEnableChannel)(int device, int channel); + int (*fnSetChannelParam)(int device, int channel, v1_aud_para *param); int (*fnFreeFrame)(int device, int channel, v1_aud_frm *frame, v1_aud_efrm *encFrame); int (*fnGetFrame)(int device, int channel, v1_aud_frm *frame, v1_aud_efrm *encFrame, int millis); @@ -90,6 +96,10 @@ static int v1_aud_load(v1_aud_impl *aud_lib) { hal_symbol_load("v1_aud", aud_lib->handle, "HI_MPI_AI_EnableChn"))) return EXIT_FAILURE; + if (!(aud_lib->fnSetChannelParam = (int(*)(int device, int channel, v1_aud_para *param)) + hal_symbol_load("v2_aud", aud_lib->handle, "HI_MPI_AI_SetChnParam"))) + return EXIT_FAILURE; + if (!(aud_lib->fnFreeFrame = (int(*)(int device, int channel, v1_aud_frm *frame, v1_aud_efrm *encFrame)) hal_symbol_load("v1_aud", aud_lib->handle, "HI_MPI_AI_ReleaseFrame"))) return EXIT_FAILURE; diff --git a/src/hal/hisi/v1_hal.c b/src/hal/hisi/v1_hal.c index 47e0044..734436b 100644 --- a/src/hal/hisi/v1_hal.c +++ b/src/hal/hisi/v1_hal.c @@ -92,7 +92,7 @@ int v1_audio_init(int samplerate) } if (ret = v1_aud.fnEnableDevice(_v1_aud_dev)) return ret; - + if (ret = v1_aud.fnEnableChannel(_v1_aud_dev, _v1_aud_chn)) return ret; @@ -513,8 +513,8 @@ int v1_video_create(char index, hal_vidconfig *config) attrib->maxPic.width = config->width; attrib->maxPic.height = config->height; attrib->bufSize = config->height * config->width * 2; - attrib->profile = config->profile; - attrib->byFrame = 1; + attrib->profile = MIN(config->profile, 1); + attrib->byFrame = 0; attrib->fieldOn = 0; attrib->mainStrmOn = index ? 0 : 1; attrib->priority = 0; @@ -656,8 +656,8 @@ int v1_video_snapshot_grab(char index, hal_jpegdata *jpeg) jpeg->jpegSize = 0; for (unsigned int i = 0; i < strm.count; i++) { v1_venc_pack *pack = &strm.packet[i]; - unsigned int packLen = pack->length - pack->offset; - unsigned char *packData = pack->data + pack->offset; + unsigned int packLen = pack->length[0] + pack->length[1] - pack->offset; + unsigned char *packData = pack->data[0] + pack->offset; unsigned int newLen = jpeg->jpegSize + packLen; if (newLen > jpeg->length) { @@ -761,10 +761,10 @@ void *v1_video_thread(void) outStrm.seq = stream.sequence; for (int j = 0; j < stream.count; j++) { v1_venc_pack *pack = &stream.packet[j]; - outPack[j].data = pack->data; - outPack[j].length = pack->length; + outPack[j].data = pack->data[0]; + outPack[j].length = pack->length[0] + pack->length[1]; outPack[j].naluCnt = 1; - outPack[j].nalu[0].length = pack->length; + outPack[j].nalu[0].length = pack->length[0] + pack->length[1]; outPack[j].nalu[0].offset = pack->offset; switch (v1_state[i].payload) { case HAL_VIDCODEC_H264: @@ -829,7 +829,7 @@ int v1_system_init(char *snrConfig) v1_config.vichn.capt.height ? v1_config.vichn.capt.height : v1_config.videv.rect.height, V1_PIXFMT_YUV420SP, alignWidth); - pool.comm[0].blockCnt = 4; + pool.comm[0].blockCnt = 5; if (ret = v1_vb.fnConfigPool(&pool)) return ret; diff --git a/src/hal/hisi/v1_venc.h b/src/hal/hisi/v1_venc.h index 50d1b77..713a137 100644 --- a/src/hal/hisi/v1_venc.h +++ b/src/hal/hisi/v1_venc.h @@ -39,6 +39,8 @@ typedef enum { V1_VENC_RATEMODE_MJPGVBR, V1_VENC_RATEMODE_MJPGABR, V1_VENC_RATEMODE_MJPGQP, + V1_VENC_RATEMODE_H264CBRv2 = 13, + V1_VENC_RATEMODE_H264VBRv2, V1_VENC_RATEMODE_END } v1_venc_ratemode; @@ -174,21 +176,14 @@ typedef union { } v1_venc_nalu; typedef struct { - v1_venc_nalu packType; - unsigned int offset; - unsigned int length; -} v1_venc_packinfo; - -typedef struct { - unsigned int addr; - unsigned char *data; - unsigned int length; + unsigned int addr[2]; + unsigned char *data[2]; + unsigned int length[2]; unsigned long long timestamp; + int endField; int endFrame; v1_venc_nalu naluType; unsigned int offset; - unsigned int packNum; - v1_venc_packinfo packetInfo[8]; } v1_venc_pack; typedef struct { @@ -214,8 +209,6 @@ typedef struct { unsigned int refSliceType; unsigned int refType; unsigned int updAttrCnt; - unsigned int startQual; - int pSkipOn; } v1_venc_strminfo_h264; typedef struct { @@ -254,7 +247,7 @@ typedef struct { int (*fnSetJpegParam)(int channel, v1_venc_jpg *param); int (*fnFreeStream)(int channel, v1_venc_strm *stream); - int (*fnGetStream)(int channel, v1_venc_strm *stream, unsigned int timeout); + int (*fnGetStream)(int channel, v1_venc_strm *stream, int blockingOn); int (*fnQuery)(int channel, v1_venc_stat* stats); @@ -320,7 +313,7 @@ static int v1_venc_load(v1_venc_impl *venc_lib) { hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_ReleaseStream"))) return EXIT_FAILURE; - if (!(venc_lib->fnGetStream = (int(*)(int channel, v1_venc_strm *stream, unsigned int timeout)) + if (!(venc_lib->fnGetStream = (int(*)(int channel, v1_venc_strm *stream, int blockingOn)) hal_symbol_load("v1_venc", venc_lib->handle, "HI_MPI_VENC_GetStream"))) return EXIT_FAILURE;