Skip to content

Commit

Permalink
(Continued)
Browse files Browse the repository at this point in the history
  • Loading branch information
wberube committed Aug 30, 2024
1 parent 1688e9e commit 3875aee
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
41 changes: 41 additions & 0 deletions src/hal/plus/ak_hal.c
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions src/hal/plus/ak_hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/hal/plus/ak_venc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/hal/plus/ak_vi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3875aee

Please sign in to comment.