topology: fix compilation for older alsa-lib

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2021-12-06 11:00:02 +01:00
parent 66693b1a77
commit 15a5a16eb7
2 changed files with 18 additions and 2 deletions

View file

@ -175,7 +175,7 @@ void free_pre_preprocessor(struct tplg_pre_processor *tplg_pp)
free(tplg_pp);
}
int init_pre_precessor(struct tplg_pre_processor **tplg_pp, snd_output_type_t type,
int init_pre_processor(struct tplg_pre_processor **tplg_pp, snd_output_type_t type,
const char *output_file)
{
struct tplg_pre_processor *_tplg_pp;
@ -224,6 +224,7 @@ err:
return ret;
}
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
static int pre_process_defines(struct tplg_pre_processor *tplg_pp, const char *pre_processor_defs,
snd_config_t *top)
{
@ -513,6 +514,7 @@ static int pre_process_includes_all(struct tplg_pre_processor *tplg_pp, snd_conf
return 0;
}
#endif /* version < 1.2.6 */
int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_size,
const char *pre_processor_defs, const char *inc_path)
@ -542,6 +544,7 @@ int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_
tplg_pp->input_cfg = top;
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
/* parse command line definitions */
err = pre_process_defines(tplg_pp, pre_processor_defs, tplg_pp->input_cfg);
if (err < 0) {
@ -563,6 +566,7 @@ int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_
fprintf(stderr, "Failed to expand pre-processor definitions in input config\n");
goto err;
}
#endif
err = pre_process_config(tplg_pp, tplg_pp->input_cfg);
if (err < 0) {

View file

@ -56,6 +56,9 @@ _("Usage: %s [OPTIONS]...\n"
"-u, --dump=FILE dump (reparse) configuration file\n"
"-v, --verbose=LEVEL set verbosity level (0...1)\n"
"-o, --output=FILE set output file\n"
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
"-D, --define=ARGS define variables (VAR1=VAL1[,VAR2=VAL2] ...)\n"
#endif
"-s, --sort sort the identifiers in the normalized output\n"
"-g, --group save configuration by group indexes\n"
"-x, --nocheck save configuration without additional integrity checks\n"
@ -368,7 +371,11 @@ static int decode(const char *source_file, const char *output_file,
int main(int argc, char *argv[])
{
static const char short_options[] = "hc:d:n:u:v:o:pP:sgxzVD:";
static const char short_options[] = "hc:d:n:u:v:o:pP:sgxzV"
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
"D:"
#endif
;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"verbose", 1, NULL, 'v'},
@ -378,6 +385,9 @@ int main(int argc, char *argv[])
{"normalize", 1, NULL, 'n'},
{"dump", 1, NULL, 'u'},
{"output", 1, NULL, 'o'},
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
{"define", 1, NULL, 'D'},
#endif
{"sort", 0, NULL, 's'},
{"group", 0, NULL, 'g'},
{"nocheck", 0, NULL, 'x'},
@ -439,9 +449,11 @@ int main(int argc, char *argv[])
case 'x':
sflags |= SND_TPLG_SAVE_NOCHECK;
break;
#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
case 'D':
pre_processor_defs = optarg;
break;
#endif
case 'V':
version(argv[0]);
return 0;