From 3875aeef859218db4a51168526af92ba8fb1b2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?William=20B=C3=A9rub=C3=A9?= Date: Fri, 30 Aug 2024 07:59:37 -0400 Subject: [PATCH] (Continued) --- src/hal/plus/ak_hal.c | 41 +++++++++++++++++++++++++++++++++++++++++ src/hal/plus/ak_hal.h | 4 ---- src/hal/plus/ak_venc.h | 6 ++++++ src/hal/plus/ak_vi.h | 2 +- 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100644 src/hal/plus/ak_hal.c diff --git a/src/hal/plus/ak_hal.c b/src/hal/plus/ak_hal.c new file mode 100644 index 0000000..e3633fd --- /dev/null +++ b/src/hal/plus/ak_hal.c @@ -0,0 +1,41 @@ +#if 0 + +#include "ak_hal.h" + +ak_aud_impl ak_aud; +ak_venc_impl ak_venc; +ak_vi_impl ak_vi; + +hal_chnstate ak_state[AK_VENC_CHN_NUM] = {0}; +int (*ak_aud_cb)(hal_audframe*); +int (*ak_vid_cb)(char, hal_vidstream*); + +void *_ak_vi_dev; + +void ak_hal_deinit(void) +{ + ak_vi_unload(&ak_vi); + ak_venc_unload(&ak_venc); + ak_aud_unload(&ak_aud); +} + +int ak_hal_init(void) +{ + int ret; + + if (ret = ak_aud_load(&ak_aud)) + return ret; + if (ret = ak_venc_load(&ak_venc)) + return ret; + if (ret = ak_vi_load(&ak_vi)) + return ret; + + return EXIT_SUCCESS; +} + +int ak_channel_grayscale(char enable) +{ + return ak_vi.fnSetDeviceMode(_ak_vi_dev, enable & 1); +} + +#endif \ No newline at end of file diff --git a/src/hal/plus/ak_hal.h b/src/hal/plus/ak_hal.h index f006eb4..5658a19 100644 --- a/src/hal/plus/ak_hal.h +++ b/src/hal/plus/ak_hal.h @@ -27,10 +27,6 @@ int ak_config_load(char *path); int ak_pipeline_create(char mirror, char flip); void ak_pipeline_destroy(void); -int ak_region_create(int *handle, hal_rect rect, short opacity); -void ak_region_destroy(int *handle); -int ak_region_setbitmap(int *handle, hal_bitmap *bitmap); - int ak_video_create(char index, hal_vidconfig *config); int ak_video_destroy(char index); int ak_video_destroy_all(void); diff --git a/src/hal/plus/ak_venc.h b/src/hal/plus/ak_venc.h index 0cb5f1d..2c30de8 100644 --- a/src/hal/plus/ak_venc.h +++ b/src/hal/plus/ak_venc.h @@ -65,6 +65,8 @@ typedef struct { int (*fnFreeStream)(void *bind, ak_venc_strm *stream); int (*fnGetStream)(void *bind, ak_venc_strm *stream); + + int (*fnRequestIdr)(void *channel); } ak_venc_impl; static int ak_venc_load(ak_venc_impl *venc_lib) { @@ -95,6 +97,10 @@ static int ak_venc_load(ak_venc_impl *venc_lib) { hal_symbol_load("ak_venc", venc_lib->handle, "ak_venc_get_stream"))) return EXIT_FAILURE; + if (!(venc_lib->fnRequestIdr = (int(*)(void *channel)) + hal_symbol_load("ak_venc", venc_lib->handle, "ak_venc_set_iframe"))) + return EXIT_FAILURE; + return EXIT_SUCCESS; } diff --git a/src/hal/plus/ak_vi.h b/src/hal/plus/ak_vi.h index 23e9a2c..8e6494d 100644 --- a/src/hal/plus/ak_vi.h +++ b/src/hal/plus/ak_vi.h @@ -18,7 +18,7 @@ typedef struct { typedef struct { ak_vi_crop capt; - ak_vi_res dest[CVI_VI_CHN_NUM]; + ak_vi_res dest[AK_VI_CHN_NUM]; } ak_vi_cnf; typedef struct {