Skip to content

Commit

Permalink
Making the RTSP parameter optional, updates on hisi-gen1 (streaming b…
Browse files Browse the repository at this point in the history
…y frame still fails at this point)
  • Loading branch information
wberube committed Aug 20, 2024
1 parent 0e83dff commit 2404bec
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
4 changes: 1 addition & 3 deletions src/app_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 10 additions & 0 deletions src/hal/hisi/v1_aud.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
18 changes: 9 additions & 9 deletions src/hal/hisi/v1_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 8 additions & 15 deletions src/hal/hisi/v1_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 2404bec

Please sign in to comment.