1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-12-04 14:46:31 -05:00

Switch to non-obsolete shout_set_content_format()

Error checking is now more strict; work around unreliability in tests
as failure/success depends on libshout configuration
This commit is contained in:
Moritz Grimm 2021-02-09 12:03:06 +01:00
parent 1517b7b521
commit 8d882cacff
2 changed files with 13 additions and 6 deletions

View File

@ -216,7 +216,7 @@ _stream_cfg_stream(struct stream *s, cfg_stream_t cfg_stream)
switch (cfg_stream_get_format(cfg_stream)) {
case CFG_STREAM_OGG:
if (SHOUTERR_SUCCESS !=
shout_set_format(s->shout, SHOUT_FORMAT_OGG)) {
shout_set_content_format(s->shout, SHOUT_FORMAT_OGG, 0, NULL)) {
log_error("stream: %s: format: %s: %s",
s->name, cfg_stream_get_format_str(cfg_stream),
shout_get_error(s->shout));
@ -225,7 +225,7 @@ _stream_cfg_stream(struct stream *s, cfg_stream_t cfg_stream)
break;
case CFG_STREAM_MP3:
if (SHOUTERR_SUCCESS !=
shout_set_format(s->shout, SHOUT_FORMAT_MP3)) {
shout_set_content_format(s->shout, SHOUT_FORMAT_MP3, 0, NULL)) {
log_error("stream: %s: format: %s: %s",
s->name, cfg_stream_get_format_str(cfg_stream),
shout_get_error(s->shout));
@ -234,7 +234,7 @@ _stream_cfg_stream(struct stream *s, cfg_stream_t cfg_stream)
break;
case CFG_STREAM_WEBM:
if (SHOUTERR_SUCCESS !=
shout_set_format(s->shout, SHOUT_FORMAT_WEBM)) {
shout_set_content_format(s->shout, SHOUT_FORMAT_WEBM, 0, NULL)) {
log_error("stream: %s: format: %s: %s",
s->name, cfg_stream_get_format_str(cfg_stream),
shout_get_error(s->shout));
@ -244,7 +244,7 @@ _stream_cfg_stream(struct stream *s, cfg_stream_t cfg_stream)
#ifdef SHOUT_FORMAT_MATROSKA
case CFG_STREAM_MATROSKA:
if (SHOUTERR_SUCCESS !=
shout_set_format(s->shout, SHOUT_FORMAT_MATROSKA)) {
shout_set_content_format(s->shout, SHOUT_FORMAT_MATROSKA, 0, NULL)) {
log_error("stream: %s: format: %s: %s",
s->name, cfg_stream_get_format_str(cfg_stream),
shout_get_error(s->shout));

View File

@ -52,11 +52,18 @@ START_TEST(test_stream)
ck_assert_int_eq(cfg_stream_set_mountpoint(str_cfg, streams, "/test.ogg", NULL), 0);
ck_assert_int_ne(stream_configure(s), 0);
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "mp3", NULL), 0);
log_error("MP3 stream configuration result: %d (may be due to libshout config)",
stream_configure(s));
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "webm", NULL), 0);
log_error("WebM stream configuration result: %d (may be due to libshout config)",
stream_configure(s));
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "matroska", NULL), 0);
log_error("Matroska stream configuration result: %d (may be due to libshout config)",
stream_configure(s));
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "ogg", NULL), 0);
ck_assert_int_ne(stream_configure(s), 0);
cfg_intake_set_filename(int_cfg, intakes, "stream_test", NULL);
ck_assert_int_eq(stream_configure(s), 0);
ck_assert_int_eq(cfg_stream_set_format(str_cfg, streams, "ogg", NULL), 0);
ck_assert_int_eq(stream_configure(s), 0);
ck_assert_int_eq(cfg_stream_set_stream_name(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_stream_url(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_stream_genre(str_cfg, streams, "test", NULL), 0);