int codec_load_file(const char *plugin, struct codec_api *api) { char msgbuf[80]; int fd; int rc; /* zero out codec buffer to ensure a properly zeroed bss area */ memset(codecbuf, 0, CODEC_SIZE); fd = open(plugin, O_RDONLY); if (fd < 0) { snprintf(msgbuf, sizeof(msgbuf)-1, "Couldn't load codec: %s", plugin); logf("Codec load error:%d", fd); splash(HZ*2, true, msgbuf); return fd; } rc = read(fd, &codecbuf[0], CODEC_SIZE); close(fd); if (rc <= 0) { logf("Codec read error"); return CODEC_ERROR; } return codec_load_ram(codecbuf, (size_t)rc, NULL, 0, api); }
int codec_load_file(const char *plugin, struct codec_api *api) { char path[MAX_PATH]; codec_get_full_path(path, plugin); curr_handle = lc_open(path, codecbuf, CODEC_SIZE); if (curr_handle == NULL) { logf("Codec: cannot read file"); return CODEC_ERROR; } return codec_load_ram(api); }
int codec_load_file(const char *plugin, struct codec_api *api) { char path[MAX_PATH]; void *handle; codec_get_full_path(path, plugin); handle = lc_open(path, codecbuf, CODEC_SIZE); if (handle == NULL) { logf("Codec load error"); splashf(HZ*2, "Couldn't load codec: %s", path); return CODEC_ERROR; } return codec_load_ram(handle, api); }
int codec_load_buf(int hid, struct codec_api *api) { int rc = bufread(hid, CODEC_SIZE, codecbuf); if (rc < 0) { logf("Codec: cannot read buf handle"); return CODEC_ERROR; } curr_handle = lc_open_from_mem(codecbuf, rc); if (curr_handle == NULL) { logf("Codec: load error"); return CODEC_ERROR; } return codec_load_ram(api); }
int codec_load_buf(unsigned int hid, struct codec_api *api) { int rc; void *handle; rc = bufread(hid, CODEC_SIZE, codecbuf); if (rc < 0) { logf("error loading codec"); return CODEC_ERROR; } handle = lc_open_from_mem(codecbuf, rc); if (handle == NULL) { logf("error loading codec"); return CODEC_ERROR; } api->discard_codec(); return codec_load_ram(handle, api); }