Skip to content

Commit e98efd9

Browse files
committed
Unifying *_video_create presentation and correcting the MP4 shutdown
routine
1 parent dce6789 commit e98efd9

9 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/hal/hisi/v4_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ int v4_video_create(char index, hal_vidconfig *config)
602602
int ret;
603603
v4_venc_chn channel;
604604
memset(&channel, 0, sizeof(channel));
605+
605606
channel.gop.mode = V4_VENC_GOPMODE_NORMALP;
606607
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
607608
channel.attrib.codec = V4_VENC_CODEC_MJPG;

src/hal/plus/ak_hal.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ void ak_pipeline_destroy(void)
119119
int ak_video_create(char index, hal_vidconfig *config)
120120
{
121121
int ret;
122-
123122
ak_venc_codec codec;
124123
char ratemode;
125124
ak_venc_prof profile;
@@ -151,10 +150,10 @@ int ak_video_create(char index, hal_vidconfig *config)
151150

152151
{
153152
ak_venc_cnf channel = {.codec = codec, .width = config->width, .height = config->height,
154-
.minQual = MIN(MAX(config->minQual, 20), 50),
155-
.maxQual = MIN(MAX(config->maxQual ? config->maxQual : 50, 20), 50),
156-
.dstFps = config->framerate, .gop = config->gop, .maxBitrate = config->maxBitrate,
157-
.profile = profile, .subChnOn = index,
153+
.minQual = MIN(MAX(config->minQual, 20), 50),
154+
.maxQual = MIN(MAX(config->maxQual ? config->maxQual : 50, 20), 50),
155+
.dstFps = config->framerate, .gop = config->gop, .maxBitrate = config->maxBitrate,
156+
.profile = profile, .subChnOn = index,
158157
.output = index ? AK_VENC_OUT_SUBSTRM : AK_VENC_OUT_MAINSTRM, .vbrModeOn = ratemode};
159158

160159
if (!(_ak_venc_dev[index] = ak_venc.fnEnableChannel(&channel)))
@@ -247,7 +246,7 @@ int ak_system_init(char *snrConfig)
247246

248247
// Disable the watchdog timer if it isn't already
249248
hal_registry(0x080080E8, &val, OP_WRITE);
250-
249+
251250
if (ak_vi.fnLoadSensorConfig(snrConfig))
252251
HAL_DANGER("ak_vi", "Loading the sensor config failed"
253252
" with %#x!\n%s\n", ret = ak_sys.fnGetErrorNum(),
@@ -256,4 +255,4 @@ int ak_system_init(char *snrConfig)
256255
return ret;
257256
}
258257

259-
#endif
258+
#endif

src/hal/plus/cvi_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ int cvi_video_create(char index, hal_vidconfig *config)
518518
int ret;
519519
cvi_venc_chn channel;
520520
memset(&channel, 0, sizeof(channel));
521+
521522
channel.gop.mode = CVI_VENC_GOPMODE_NORMALP;
522523
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
523524
channel.attrib.codec = CVI_VENC_CODEC_MJPG;

src/hal/plus/rk_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ int rk_video_create(char index, hal_vidconfig *config)
440440
int ret;
441441
rk_venc_chn channel;
442442
memset(&channel, 0, sizeof(channel));
443+
443444
channel.gop.mode = RK_VENC_GOPMODE_NORMALP;
444445
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
445446
channel.attrib.codec = RK_VENC_CODEC_MJPG;

src/hal/star/i3_hal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ int i3_video_create(char index, hal_vidconfig *config)
395395
int ret;
396396
i3_venc_chn channel;
397397
i3_venc_attr_h26x *attrib;
398+
memset(&channel, 0, sizeof(channel));
398399
399400
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
400401
channel.attrib.codec = I3_VENC_CODEC_MJPG;
@@ -410,7 +411,7 @@ int i3_video_create(char index, hal_vidconfig *config)
410411
channel.rate.mode = series == 0xEF ? I3OG_VENC_RATEMODE_MJPGQP : I3_VENC_RATEMODE_MJPGQP;
411412
channel.rate.mjpgQp.fpsNum =
412413
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
413-
channel.rate.mjpgCbr.fpsDen = 1;
414+
channel.rate.mjpgQp.fpsDen = 1;
414415
channel.rate.mjpgQp.quality = MAX(config->minQual, config->maxQual);
415416
break;
416417
default:

src/hal/star/i6_hal.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ int i6_video_create(char index, hal_vidconfig *config)
499499
int ret;
500500
i6_venc_chn channel;
501501
i6_venc_attr_h26x *attrib;
502+
memset(&channel, 0, sizeof(channel));
502503

503504
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
504505
channel.attrib.codec = I6_VENC_CODEC_MJPG;
@@ -514,7 +515,7 @@ int i6_video_create(char index, hal_vidconfig *config)
514515
channel.rate.mode = series == 0xEF ? I6OG_VENC_RATEMODE_MJPGQP : I6_VENC_RATEMODE_MJPGQP;
515516
channel.rate.mjpgQp.fpsNum =
516517
config->codec == HAL_VIDCODEC_JPG ? 1 : config->framerate;
517-
channel.rate.mjpgCbr.fpsDen = 1;
518+
channel.rate.mjpgQp.fpsDen = 1;
518519
channel.rate.mjpgQp.quality = MAX(config->minQual, config->maxQual);
519520
break;
520521
default:

src/hal/star/i6c_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ int i6c_video_create(char index, hal_vidconfig *config)
547547
int ret;
548548
i6c_venc_chn channel;
549549
i6c_venc_attr_h26x *attrib;
550+
memset(&channel, 0, sizeof(channel));
550551

551552
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
552553
_i6c_venc_dev[index] = I6C_VENC_DEV_MJPG_0;

src/hal/star/m6_hal.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ int m6_video_create(char index, hal_vidconfig *config)
524524
int ret;
525525
m6_venc_chn channel;
526526
m6_venc_attr_h26x *attrib;
527+
memset(&channel, 0, sizeof(channel));
527528

528529
if (config->codec == HAL_VIDCODEC_JPG || config->codec == HAL_VIDCODEC_MJPG) {
529530
_m6_venc_dev[index] = M6_VENC_DEV_MJPG_0;

src/media.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ int media_mp4_disable(void) {
566566

567567
for (char i = 0; i < chnCount; i++) {
568568
if (!chnState[i].enable) continue;
569-
if (chnState[i].payload != HAL_VIDCODEC_H264 ||
569+
if (chnState[i].payload != HAL_VIDCODEC_H264 &&
570570
chnState[i].payload != HAL_VIDCODEC_H265) continue;
571571

572572
if (ret = unbind_channel(i, 1))

0 commit comments

Comments
 (0)