Fail encoder init when CQM file cannot be opened

This commit is contained in:
Arttu Ylä-Outinen 2016-10-31 11:33:14 +09:00
parent db5e750c7f
commit 97863cdaa2

View file

@ -203,12 +203,14 @@ encoder_control_t* kvz_encoder_control_init(kvz_config *const cfg) {
kvz_scalinglist_init(&encoder->scaling_list);
// CQM
{
FILE* cqmfile;
cqmfile = cfg->cqmfile ? fopen(cfg->cqmfile, "rb") : NULL;
if (cfg->cqmfile) {
FILE* cqmfile = fopen(cfg->cqmfile, "rb");
if (cqmfile) {
kvz_scalinglist_parse(&encoder->scaling_list, cqmfile);
fclose(cqmfile);
} else {
fprintf(stderr, "Could not open CQM file.\n");
goto init_failed;
}
}
kvz_scalinglist_process(&encoder->scaling_list, encoder->bitdepth);