diff --git a/src/hal/plus/ak_hal.c b/src/hal/plus/ak_hal.c index e3633fd..f747602 100644 --- a/src/hal/plus/ak_hal.c +++ b/src/hal/plus/ak_hal.c @@ -1,8 +1,9 @@ -#if 0 +#ifdef __arm__ #include "ak_hal.h" ak_aud_impl ak_aud; +ak_sys_impl ak_sys; ak_venc_impl ak_venc; ak_vi_impl ak_vi; @@ -10,19 +11,26 @@ hal_chnstate ak_state[AK_VENC_CHN_NUM] = {0}; int (*ak_aud_cb)(hal_audframe*); int (*ak_vid_cb)(char, hal_vidstream*); +ak_vi_cnf _ak_vi_cnf; + void *_ak_vi_dev; +void *_ak_venc_dev[AK_VENC_CHN_NUM]; +void *_ak_venc_strm[AK_VENC_CHN_NUM]; void ak_hal_deinit(void) { ak_vi_unload(&ak_vi); ak_venc_unload(&ak_venc); ak_aud_unload(&ak_aud); + ak_sys_unload(&ak_sys); } int ak_hal_init(void) { int ret; + if (ret = ak_sys_load(&ak_sys)) + return ret; if (ret = ak_aud_load(&ak_aud)) return ret; if (ret = ak_venc_load(&ak_venc)) @@ -33,9 +41,193 @@ int ak_hal_init(void) return EXIT_SUCCESS; } +int ak_channel_bind(char index) +{ + if (!(_ak_venc_strm[index] = + ak_venc.fnBindChannel(_ak_vi_dev, _ak_venc_dev[index]))) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + int ak_channel_grayscale(char enable) { return ak_vi.fnSetDeviceMode(_ak_vi_dev, enable & 1); } +int ak_channel_unbind(char index) +{ + int ret = ak_venc.fnUnbindChannel(_ak_venc_strm[index]); + + _ak_venc_strm[index] = NULL; + + return ret; +} + +int ak_pipeline_create(char mirror, char flip) +{ + int ret; + + if (!(_ak_vi_dev = ak_vi.fnEnableDevice(0))) + return EXIT_FAILURE; + + if (ret = ak_vi.fnGetSensorResolution(_ak_vi_dev, _ak_vi_cnf.dest)) + return ret; + + _ak_vi_cnf.capt.x = 0; + _ak_vi_cnf.capt.y = 0; + _ak_vi_cnf.capt.width = _ak_vi_cnf.dest[0].width; + _ak_vi_cnf.capt.height = _ak_vi_cnf.dest[0].height; + if (ret = ak_vi.fnSetDeviceConfig(_ak_vi_dev, &_ak_vi_cnf)) + return ret; + + if (ret = ak_vi.fnStartDevice(_ak_vi_dev)) + return ret; + + if (ret = ak_vi.fnSetDeviceFlipMirror(_ak_vi_dev, flip & 1, mirror & 1)) + return ret; + + return EXIT_SUCCESS; +} + +void ak_pipeline_destroy(void) +{ + ak_vi.fnStopDevice(_ak_vi_dev); + ak_vi.fnDisableDevice(_ak_vi_dev); +} + +int ak_video_create(char index, hal_vidconfig *config) +{ + int ret; + + ak_venc_codec codec; + char ratemode; + ak_venc_prof profile; + + switch (config->mode) { + case HAL_VIDMODE_CBR: ratemode = 0; break; + case HAL_VIDMODE_VBR: ratemode = 1; break; + default: HAL_ERROR("ak_venc", "Video encoder does not support this mode!"); + } + switch (config->codec) { + case HAL_VIDCODEC_JPG: + case HAL_VIDCODEC_MJPG: + codec = AK_VENC_CODEC_MJPG; + profile = AK_VENC_PROF_HEVC_MAINSTILL; + break; + case HAL_VIDCODEC_H265: + codec = AK_VENC_CODEC_H265; + profile = AK_VENC_PROF_HEVC_MAIN; + break; + case HAL_VIDCODEC_H264: + codec = AK_VENC_CODEC_H264; + switch (config->profile) { + case HAL_VIDPROFILE_BASELINE: profile = AK_VENC_PROF_BASE; break; + case HAL_VIDPROFILE_MAIN: profile = AK_VENC_PROF_MAIN; break; + default: profile = AK_VENC_PROF_HIGH; break; + } break; + default: HAL_ERROR("ak_venc", "This codec is not supported by the hardware!"); + } + + { + ak_venc_cnf channel = {.codec = codec, .width = config->width, .height = config->height, + .minQual = config->minQual, .maxQual = config->maxQual, .dstFps = config->framerate, + .gop = config->gop, .maxBitrate = config->maxBitrate, .profile = profile, .subChnOn = index, + .output = index ? AK_VENC_OUT_SUBSTRM : AK_VENC_OUT_MAINSTRM, .vbrModeOn = ratemode}; + + if (!(_ak_venc_dev[index] = ak_venc.fnEnableChannel(&channel))) + HAL_ERROR("ak_venc", "Creating channel %d failed with %#x!\n%s\n", + index, ret = ak_sys.fnGetErrorNum(), ak_sys.fnGetErrorStr(ret)); + } + + ak_state[index].payload = config->codec; + + return EXIT_SUCCESS; +} + +int ak_video_destroy(char index) +{ + if (ak_venc.fnDisableChannel(_ak_venc_dev[index])) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + +int ak_video_destroy_all(void) +{ + int ret; + + for (char i = 0; i < AK_VENC_CHN_NUM; i++) + if (ak_state[i].enable) + if (ret = ak_video_destroy(i)) + return ret; + + return EXIT_SUCCESS; +} + +void ak_video_request_idr(char index) +{ + ak_venc.fnRequestIdr(_ak_venc_dev[index]); +} + +void *ak_video_thread(void) +{ + int ret; + + while (keepRunning) { + for (int i = 0; i < AK_VENC_CHN_NUM; i++) { + if (!ak_state[i].enable) continue; + if (!ak_state[i].mainLoop) continue; + + ak_venc_strm stream; + if (ak_venc.fnGetStream(_ak_venc_strm[i], &stream)) { + ret = ak_sys.fnGetErrorNum(); + HAL_DANGER("ak_venc", "Getting the stream on " + "channel %d failed with %#x!\n%s\n", i, ret, + ak_sys.fnGetErrorStr(ret)); + }; + if (!stream.length) continue; + + if (ak_vid_cb) { + hal_vidstream outStrm; + hal_vidpack outPack[1]; + memset(outPack, 0, sizeof(outPack)); + outStrm.count = 1; + outStrm.seq = stream.sequence; + outPack[0].data = stream.data; + outPack[0].length = stream.length; + outPack[0].naluCnt = 1; + outPack[0].nalu[0].length = outPack[0].length; + outPack[0].nalu[0].offset = 0; + outPack[0].nalu[0].type = stream.naluType; + outPack[0].offset = 0; + outPack[0].timestamp = stream.timestamp; + outStrm.pack = outPack; + (*ak_vid_cb)(i, &outStrm); + + if (ak_venc.fnFreeStream(_ak_venc_strm[i], &stream)) { + HAL_DANGER("ak_venc", "Releasing the stream on " + "channel %d failed!\n", i); + } + } + } + } + HAL_INFO("ak_venc", "Shutting down encoding thread...\n"); +} + +void ak_system_deinit(void) +{ + +} + +int ak_system_init(char *snrConfig) +{ + int ret; + + if (ret = ak_vi.fnLoadSensorConfig(snrConfig)) + return ret; + + return EXIT_SUCCESS; +} + #endif \ No newline at end of file diff --git a/src/hal/plus/ak_hal.h b/src/hal/plus/ak_hal.h index 5658a19..dbefc4e 100644 --- a/src/hal/plus/ak_hal.h +++ b/src/hal/plus/ak_hal.h @@ -2,6 +2,7 @@ #include "ak_common.h" #include "ak_aud.h" +#include "ak_sys.h" #include "ak_venc.h" #include "ak_vi.h" @@ -35,4 +36,4 @@ int ak_video_snapshot_grab(char index, hal_jpegdata *jpeg); void *ak_video_thread(void); void ak_system_deinit(void); -int ak_system_init(void); \ No newline at end of file +int ak_system_init(char *snrConfig); \ No newline at end of file diff --git a/src/hal/plus/ak_sys.h b/src/hal/plus/ak_sys.h new file mode 100644 index 0000000..e3877bf --- /dev/null +++ b/src/hal/plus/ak_sys.h @@ -0,0 +1,41 @@ +#pragma once + +#include "ak_common.h" + +typedef struct { + void *handle, *handleAkuio, *handleThread; + + int (*fnGetErrorNum)(void); + char* (*fnGetErrorStr)(int error); +} ak_sys_impl; + +static int ak_sys_load(ak_sys_impl *sys_lib) { + if (!(sys_lib->handleThread = dlopen("libplat_thread.so", RTLD_LAZY | RTLD_GLOBAL))) + HAL_ERROR("ak_sys", "Failed to load library!\nError: %s\n", dlerror()); + + if (!(sys_lib->handleAkuio = dlopen("libakuio.so", RTLD_LAZY | RTLD_GLOBAL))) + HAL_ERROR("ak_sys", "Failed to load library!\nError: %s\n", dlerror()); + + if (!(sys_lib->handle = dlopen("libplat_common.so", RTLD_LAZY | RTLD_GLOBAL))) + HAL_ERROR("ak_sys", "Failed to load library!\nError: %s\n", dlerror()); + + if (!(sys_lib->fnGetErrorNum = (int(*)(void)) + hal_symbol_load("ak_sys", sys_lib->handle, "ak_get_error_no"))) + return EXIT_FAILURE; + + if (!(sys_lib->fnGetErrorStr = (char*(*)(int error)) + hal_symbol_load("ak_sys", sys_lib->handle, "ak_get_error_str"))) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} + +static void ak_sys_unload(ak_sys_impl *sys_lib) { + if (sys_lib->handle) dlclose(sys_lib->handle); + sys_lib->handle = NULL; + if (sys_lib->handleAkuio) dlclose(sys_lib->handleAkuio); + sys_lib->handleAkuio = NULL; + if (sys_lib->handleThread) dlclose(sys_lib->handleThread); + sys_lib->handleThread = NULL; + memset(sys_lib, 0, sizeof(*sys_lib)); +} \ No newline at end of file diff --git a/src/hal/plus/ak_venc.h b/src/hal/plus/ak_venc.h index 2c30de8..d901110 100644 --- a/src/hal/plus/ak_venc.h +++ b/src/hal/plus/ak_venc.h @@ -26,7 +26,7 @@ typedef enum { typedef enum { AK_VENC_PROF_MAIN, AK_VENC_PROF_HIGH, - AK_VENC_PROF_BASELINE, + AK_VENC_PROF_BASE, AK_VENC_PROF_HEVC_MAIN, AK_VENC_PROF_HEVC_MAINSTILL, AK_VENC_PROF_END diff --git a/src/hal/plus/ak_vi.h b/src/hal/plus/ak_vi.h index 8e6494d..431eb0d 100644 --- a/src/hal/plus/ak_vi.h +++ b/src/hal/plus/ak_vi.h @@ -70,7 +70,7 @@ static int ak_vi_load(ak_vi_impl *vi_lib) { return EXIT_FAILURE; if (!(vi_lib->fnSetDeviceFlipMirror = (int(*)(void *device, int flipOn, int mirrorOn)) - hal_symbol_load("ak_vi", vi_lib->handle, "ak_vi_switch_mode"))) + hal_symbol_load("ak_vi", vi_lib->handle, "ak_vi_set_flip_mirror"))) return EXIT_FAILURE; if (!(vi_lib->fnSetDeviceMode = (int(*)(void *device, int nightOn)) diff --git a/src/hal/plus/gm_hal.c b/src/hal/plus/gm_hal.c index 01108bc..0db201a 100644 --- a/src/hal/plus/gm_hal.c +++ b/src/hal/plus/gm_hal.c @@ -260,7 +260,7 @@ int gm_video_create(char index, hal_vidconfig *config) switch (config->codec) { case HAL_VIDCODEC_JPG: - case HAL_VIDCODEC_MJPG: + case HAL_VIDCODEC_MJPG: { GM_DECLARE(gm_lib, mjpgchn, gm_venc_mjpg_cnf, "gm_mjpege_attr_t"); mjpgchn.dest.width = config->width; mjpgchn.dest.height = config->height; @@ -271,7 +271,7 @@ int gm_video_create(char index, hal_vidconfig *config) mjpgchn.maxBitrate = MAX(config->bitrate, config->maxBitrate); gm_lib.fnSetDeviceConfig(_gm_venc_dev[index], &mjpgchn); break; - case HAL_VIDCODEC_H264: + } case HAL_VIDCODEC_H264: { GM_DECLARE(gm_lib, h264chn, gm_venc_h264_cnf, "gm_h264e_attr_t"); h264chn.dest.width = config->width; h264chn.dest.height = config->height; @@ -298,7 +298,7 @@ int gm_video_create(char index, hal_vidconfig *config) h264chn.level = 41; gm_lib.fnSetDeviceConfig(_gm_venc_dev[index], &h264chn); break; - default: HAL_ERROR("gm_venc", "This codec is not supported by the hardware!"); + } default: HAL_ERROR("gm_venc", "This codec is not supported by the hardware!"); } gm_state[index].payload = config->codec; diff --git a/src/hal/star/i3_hal.h b/src/hal/star/i3_hal.h index 7c23389..6a0dfc8 100644 --- a/src/hal/star/i3_hal.h +++ b/src/hal/star/i3_hal.h @@ -14,6 +14,7 @@ extern char keepRunning; +extern hal_chnstate i3_state[I3_VENC_CHN_NUM]; extern int (*i3_aud_cb)(hal_audframe*); extern int (*i3_vid_cb)(char, hal_vidstream*); diff --git a/src/hal/star/i6_hal.h b/src/hal/star/i6_hal.h index 841ea59..9a30c23 100644 --- a/src/hal/star/i6_hal.h +++ b/src/hal/star/i6_hal.h @@ -16,6 +16,7 @@ extern char keepRunning; +extern hal_chnstate i6_state[I6_VENC_CHN_NUM]; extern int (*i6_aud_cb)(hal_audframe*); extern int (*i6_vid_cb)(char, hal_vidstream*); diff --git a/src/hal/star/i6c_hal.h b/src/hal/star/i6c_hal.h index 76e73e9..385c043 100644 --- a/src/hal/star/i6c_hal.h +++ b/src/hal/star/i6c_hal.h @@ -14,6 +14,7 @@ extern char keepRunning; +extern hal_chnstate i6c_state[I6C_VENC_CHN_NUM]; extern int (*i6c_aud_cb)(hal_audframe*); extern int (*i6c_vid_cb)(char, hal_vidstream*); diff --git a/src/hal/star/i6f_hal.h b/src/hal/star/i6f_hal.h index bc804ad..d77b651 100644 --- a/src/hal/star/i6f_hal.h +++ b/src/hal/star/i6f_hal.h @@ -12,6 +12,7 @@ extern char keepRunning; +extern hal_chnstate i6f_state[I6F_VENC_CHN_NUM]; extern int (*i6f_aud_cb)(hal_audframe*); extern int (*i6f_vid_cb)(char, hal_vidstream*); diff --git a/src/hal/support.c b/src/hal/support.c index b88689e..b5ccf48 100644 --- a/src/hal/support.c +++ b/src/hal/support.c @@ -183,6 +183,17 @@ void hal_identify(void) { vid_thread = gm_video_thread; return; } + + if (!access("/sys/devices/platform/ak39-uart.0", F_OK)) { + plat = HAL_PLATFORM_AK; + strcpy(chip, "AK3918"); + strcpy(family, "anyka"); + chnCount = AK_VENC_CHN_NUM; + chnState = (hal_chnstate*)ak_state; + //aud_thread = ak_audio_thread; + vid_thread = ak_video_thread; + return; + } #endif #ifdef __mips__ diff --git a/src/hal/support.h b/src/hal/support.h index 0d2d470..76c6df1 100644 --- a/src/hal/support.h +++ b/src/hal/support.h @@ -1,5 +1,6 @@ #include "types.h" #if defined(__arm__) +#include "plus/ak_hal.h" #include "plus/gm_hal.h" #include "hisi/v1_hal.h" #include "hisi/v2_hal.h" @@ -52,19 +53,5 @@ extern char family[32]; extern hal_platform plat; extern int series; -#if defined(__arm__) -extern hal_chnstate gm_state[GM_VENC_CHN_NUM]; -extern hal_chnstate v1_state[V1_VENC_CHN_NUM]; -extern hal_chnstate v2_state[V2_VENC_CHN_NUM]; -extern hal_chnstate v3_state[V3_VENC_CHN_NUM]; -extern hal_chnstate v4_state[V4_VENC_CHN_NUM]; -extern hal_chnstate i3_state[I3_VENC_CHN_NUM]; -extern hal_chnstate i6_state[I6_VENC_CHN_NUM]; -extern hal_chnstate i6c_state[I6C_VENC_CHN_NUM]; -extern hal_chnstate i6f_state[I6F_VENC_CHN_NUM]; -#elif defined(__mips__) -extern hal_chnstate t31_state[T31_VENC_CHN_NUM]; -#endif - bool hal_registry(unsigned int addr, unsigned int *data, hal_register_op op); void hal_identify(void); \ No newline at end of file diff --git a/src/hal/types.h b/src/hal/types.h index 105e5a9..6b35579 100644 --- a/src/hal/types.h +++ b/src/hal/types.h @@ -20,6 +20,7 @@ typedef enum { HAL_PLATFORM_UNK, + HAL_PLATFORM_AK, HAL_PLATFORM_CVI, HAL_PLATFORM_GM, HAL_PLATFORM_I3, diff --git a/src/lib/schrift.c b/src/lib/schrift.c index ec62da9..55fd179 100644 --- a/src/lib/schrift.c +++ b/src/lib/schrift.c @@ -638,7 +638,7 @@ grow_points(Outline *outl) if (outl->capPoints > UINT16_MAX / 2) return -1; cap = (uint_fast16_t) (2U * outl->capPoints); - if (!(mem = reallocarray(outl->points, cap, sizeof *outl->points))) + if (!(mem = xreallocarray(outl->points, cap, sizeof *outl->points))) return -1; outl->capPoints = (uint_least16_t) cap; outl->points = mem; @@ -654,7 +654,7 @@ grow_curves(Outline *outl) if (outl->capCurves > UINT16_MAX / 2) return -1; cap = (uint_fast16_t) (2U * outl->capCurves); - if (!(mem = reallocarray(outl->curves, cap, sizeof *outl->curves))) + if (!(mem = xreallocarray(outl->curves, cap, sizeof *outl->curves))) return -1; outl->capCurves = (uint_least16_t) cap; outl->curves = mem; @@ -670,7 +670,7 @@ grow_lines(Outline *outl) if (outl->capLines > UINT16_MAX / 2) return -1; cap = (uint_fast16_t) (2U * outl->capLines); - if (!(mem = reallocarray(outl->lines, cap, sizeof *outl->lines))) + if (!(mem = xreallocarray(outl->lines, cap, sizeof *outl->lines))) return -1; outl->capLines = (uint_least16_t) cap; outl->lines = mem; diff --git a/src/lib/schrift.h b/src/lib/schrift.h index 989bf2f..d23fdda 100644 --- a/src/lib/schrift.h +++ b/src/lib/schrift.h @@ -20,10 +20,8 @@ #include /* size_t */ #include /* uint_fast32_t, uint_least32_t */ -#ifdef __UCLIBC__ -#define reallocarray(ptr, nmemb, size) \ +#define xreallocarray(ptr, nmemb, size) \ realloc(ptr, (nmemb) * size) -#endif #ifdef __cplusplus extern "C" { diff --git a/src/media.c b/src/media.c index fd7b907..33594bb 100644 --- a/src/media.c +++ b/src/media.c @@ -151,6 +151,7 @@ void request_idr(void) { } if (index != -1) switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_video_request_idr(index); break; case HAL_PLATFORM_GM: gm_video_request_idr(index); break; case HAL_PLATFORM_I6: i6_video_request_idr(index); break; case HAL_PLATFORM_I6C: i6c_video_request_idr(index); break; @@ -172,6 +173,7 @@ void set_grayscale(bool active) { pthread_mutex_lock(&chnMtx); switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_channel_grayscale(active); break; case HAL_PLATFORM_I6: i6_channel_grayscale(active); break; case HAL_PLATFORM_I6C: i6c_channel_grayscale(active); break; case HAL_PLATFORM_I6F: i6f_channel_grayscale(active); break; @@ -205,6 +207,7 @@ int take_next_free_channel(bool mainLoop) { int create_channel(char index, short width, short height, char framerate, char jpeg) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: return EXIT_SUCCESS; case HAL_PLATFORM_GM: return EXIT_SUCCESS; case HAL_PLATFORM_I6: return i6_channel_create(index, width, height, app_config.mirror, app_config.flip, jpeg); @@ -233,6 +236,7 @@ int create_channel(char index, short width, short height, char framerate, char j int bind_channel(char index, char framerate, char jpeg) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: return ak_channel_bind(index); case HAL_PLATFORM_GM: return gm_channel_bind(index); case HAL_PLATFORM_I6: return i6_channel_bind(index, framerate); case HAL_PLATFORM_I6C: return i6c_channel_bind(index, framerate); @@ -252,6 +256,7 @@ int bind_channel(char index, char framerate, char jpeg) { int unbind_channel(char index, char jpeg) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: return ak_channel_unbind(index); case HAL_PLATFORM_GM: return gm_channel_unbind(index); case HAL_PLATFORM_I6: return i6_channel_unbind(index); case HAL_PLATFORM_I6C: return i6c_channel_unbind(index); @@ -271,6 +276,7 @@ int unbind_channel(char index, char jpeg) { int disable_video(char index, char jpeg) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: return ak_video_destroy(index); case HAL_PLATFORM_GM: return gm_video_destroy(index); case HAL_PLATFORM_I6: return i6_video_destroy(index); case HAL_PLATFORM_I6C: return i6c_video_destroy(index); @@ -420,6 +426,7 @@ int enable_mjpeg(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ret = ak_video_create(index, &config); break; case HAL_PLATFORM_GM: ret = gm_video_create(index, &config); break; case HAL_PLATFORM_I6: ret = i6_video_create(index, &config); break; case HAL_PLATFORM_I6C: ret = i6c_video_create(index, &config); break; @@ -492,6 +499,7 @@ int enable_mp4(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ret = ak_video_create(index, &config); break; case HAL_PLATFORM_GM: ret = gm_video_create(index, &config); break; case HAL_PLATFORM_I6: ret = i6_video_create(index, &config); break; case HAL_PLATFORM_I6C: ret = i6c_video_create(index, &config); break; @@ -528,6 +536,7 @@ int start_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ret = ak_hal_init(); break; case HAL_PLATFORM_GM: ret = gm_hal_init(); break; case HAL_PLATFORM_I3: ret = i3_hal_init(); break; case HAL_PLATFORM_I6: ret = i6_hal_init(); break; @@ -596,6 +605,7 @@ int start_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ret = ak_system_init(app_config.sensor_config); break; case HAL_PLATFORM_GM: ret = gm_system_init(); break; case HAL_PLATFORM_I3: ret = i3_system_init(); break; case HAL_PLATFORM_I6: ret = i6_system_init(); break; @@ -628,6 +638,8 @@ int start_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ret = ak_pipeline_create(app_config.mirror, + app_config.flip); break; case HAL_PLATFORM_GM: ret = gm_pipeline_create(app_config.mirror, app_config.flip); break; case HAL_PLATFORM_I6: ret = i6_pipeline_create(0, width, @@ -727,6 +739,7 @@ int stop_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_video_destroy_all(); break; case HAL_PLATFORM_GM: gm_video_destroy_all(); break; case HAL_PLATFORM_I6: i6_video_destroy_all(); break; case HAL_PLATFORM_I6C: i6c_video_destroy_all(); break; @@ -744,6 +757,7 @@ int stop_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_pipeline_destroy(); break; case HAL_PLATFORM_GM: gm_pipeline_destroy(); break; case HAL_PLATFORM_I6: i6_pipeline_destroy(); break; case HAL_PLATFORM_I6C: i6c_pipeline_destroy(); break; @@ -767,6 +781,7 @@ int stop_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_system_deinit(); break; case HAL_PLATFORM_GM: gm_system_deinit(); break; case HAL_PLATFORM_I3: i3_system_deinit(); break; case HAL_PLATFORM_I6: i6_system_deinit(); break; @@ -794,6 +809,7 @@ int stop_sdk(void) { switch (plat) { #if defined(__arm__) + case HAL_PLATFORM_AK: ak_hal_deinit(); break; case HAL_PLATFORM_GM: gm_hal_deinit(); break; case HAL_PLATFORM_I3: i3_hal_deinit(); break; case HAL_PLATFORM_I6: i6_hal_deinit(); break; diff --git a/src/server.c b/src/server.c index 3939df8..962bfa7 100644 --- a/src/server.c +++ b/src/server.c @@ -983,7 +983,7 @@ void *server_thread(void *vargp) { char *remain; int respLen; short id = strtol(uri + 9, &remain, 10); - if (remain != uri + 9 || id < 0 || id >= MAX_OSD) { + if (remain == uri + 9 || id < 0 || id >= MAX_OSD) { respLen = sprintf(response, "HTTP/1.1 404 Not Found\r\n" \ "Content-Type: text/plain\r\n" \