diff --git a/examples/ezstream-video.xml b/examples/ezstream-video.xml index e35ce52..0ff1f4c 100644 --- a/examples/ezstream-video.xml +++ b/examples/ezstream-video.xml @@ -17,7 +17,7 @@ /video.ogg Theora - PassThrough + @@ -30,19 +30,14 @@ Theora-192x128 - + ffmpeg2theora -x 192 -y 128 -a 0 -v 4 --title @M@ -o - @T@ .avi .mpg - - - PassThrough - Theora - - - - diff --git a/src/cfg_encoder.c b/src/cfg_encoder.c index 068595b..5a3ad65 100644 --- a/src/cfg_encoder.c +++ b/src/cfg_encoder.c @@ -210,17 +210,18 @@ cfg_encoder_set_format_str(struct cfg_encoder *e, int cfg_encoder_set_program(struct cfg_encoder *e, struct cfg_encoder_list *not_used, const char *program, - const char **not_used2) + const char **errstrp) { (void)not_used; - (void)not_used2; + + if (!program || !program[0]) { + if (errstrp) + *errstrp = "empty"; + return (-1); + } xfree(e->program); - - if (!program || !program[0]) - e->program = NULL; - else - e->program = xstrdup(program); + e->program = xstrdup(program); return (0); } @@ -234,8 +235,11 @@ cfg_encoder_validate(struct cfg_encoder *e, const char **errstrp) return (-1); } - if (!e->program) - return (0); + if (!e->program) { + if (errstrp) + *errstrp = "program not set"; + return (-1); + } CHECKPH_PROHIBITED(e->program, PLACEHOLDER_TRACK); CHECKPH_PROHIBITED(e->program, PLACEHOLDER_STRING); diff --git a/src/ezstream-cfgmigrate.c b/src/ezstream-cfgmigrate.c index b7e8063..b460f09 100644 --- a/src/ezstream-cfgmigrate.c +++ b/src/ezstream-cfgmigrate.c @@ -309,27 +309,6 @@ _parse_ezconfig0(EZCONFIG *ez) cfg_encoder_list_remove(enc_list, &enc); warnings++; } - } else { - if (ed->format && - 0 == strcasecmp(ed->format, "THEORA")) { - cfg_encoder_t enc; - - enc = cfg_encoder_list_find(enc_list, - ed->format); - if (NULL == enc) - enc = cfg_encoder_list_get(enc_list, - CFG_DEFAULT); - ENTITY_SET(enc, enc_list, cfg_encoder_set_name, - " (encoder)", ed->format); - ENTITY_SET(enc, enc_list, cfg_encoder_set_format_str, - " (encoder)", ed->format); - if (0 > cfg_encoder_validate(enc, &err_str)) { - log_warning("%s: %s: %s", v0_cfgfile, - " (encoder)", err_str); - cfg_encoder_list_remove(enc_list, &enc); - warnings++; - } - } } if (ed->decoder) { cfg_decoder_t dec = NULL; diff --git a/tests/check_cfg_encoder.c b/tests/check_cfg_encoder.c index 5ea1abe..692d9e6 100644 --- a/tests/check_cfg_encoder.c +++ b/tests/check_cfg_encoder.c @@ -52,13 +52,8 @@ END_TEST START_TEST(test_encoder_set_program) { - cfg_encoder_t enc = cfg_encoder_list_get(encoders, "test_encoder_set_program"); - - ck_assert_int_eq(cfg_encoder_set_program(enc, encoders, NULL, NULL), 0); - ck_assert_ptr_eq(cfg_encoder_get_program(enc), NULL); - - ck_assert_int_eq(cfg_encoder_set_program(enc, encoders, "test", NULL), 0); - ck_assert_str_eq(cfg_encoder_get_program(enc), "test"); + TEST_XSTRDUP_T(cfg_encoder_t, cfg_encoder_list_get, encoders, + cfg_encoder_set_program, cfg_encoder_get_program); } END_TEST @@ -94,14 +89,25 @@ END_TEST START_TEST(test_encoder_validate) { cfg_encoder_t enc = cfg_encoder_list_get(encoders, "test_encoder_validate"); + cfg_encoder_t enc2 = cfg_encoder_list_get(encoders, "test_encoder_validate_2");; const char *errstr; + errstr = NULL; + ck_assert_int_ne(cfg_encoder_set_name(enc2, encoders, + "test_encoder_validate", &errstr), 0); + ck_assert_str_eq(errstr, "already exists"); + ck_assert_int_ne(cfg_encoder_validate(enc, NULL), 0); ck_assert_int_ne(cfg_encoder_validate(enc, &errstr), 0); ck_assert_str_eq(errstr, "format not set"); ck_assert_int_eq(cfg_encoder_set_format(enc, CFG_STREAM_VORBIS), 0); + ck_assert_int_ne(cfg_encoder_validate(enc, &errstr), 0); + ck_assert_str_eq(errstr, "program not set"); + + ck_assert_int_eq(cfg_encoder_set_program(enc, encoders, "test", NULL), + 0); ck_assert_int_eq(cfg_encoder_validate(enc, NULL), 0); ck_assert_int_eq(cfg_encoder_set_program(enc, encoders,