1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-11-03 04:17:18 -05:00

Add <language_tag />

This commit is contained in:
Moritz Grimm 2021-02-09 15:07:32 +01:00
parent 8d882cacff
commit 9bb5b8d252
9 changed files with 53 additions and 0 deletions

2
NEWS
View File

@ -1,5 +1,7 @@
Changes in 1.0.2, released on XXXX-XX-XX: Changes in 1.0.2, released on XXXX-XX-XX:
* Add support for setting an RFC 5646 language tag on streams via the
<language_tag/> option
* Fix a crash, if metadata placeholders are configured for input files * Fix a crash, if metadata placeholders are configured for input files
that do not contain the respective values. From gui-lux on Github (#16). that do not contain the respective values. From gui-lux on Github (#16).
* Fix a crash in one instance of querying the metadata program. From taku0220 * Fix a crash in one instance of querying the metadata program. From taku0220

View File

@ -359,6 +359,15 @@ stream input media files as-is.
The configured encoder's output stream format must match what is configured The configured encoder's output stream format must match what is configured
in in
.Sy \&<format\ /\&> . .Sy \&<format\ /\&> .
.It Sy \&<language_tag\ /\&>
RFC 5646 language tag, such as
.Em en-US ,
describing the target audience
.Pq not necessarily the actual content
language(s) of the stream.
.Pp
Default:
.Em none
.It Sy \&<stream_name\ /\&> .It Sy \&<stream_name\ /\&>
Informational name of the broadcast. Informational name of the broadcast.
.Pp .Pp

View File

@ -114,6 +114,9 @@
<!-- Encoder name (defined below) to use for (re)encoding --> <!-- Encoder name (defined below) to use for (re)encoding -->
<encoder>OggEnc-Q1.5</encoder> <encoder>OggEnc-Q1.5</encoder>
<!-- RFC 5646 language tag describing target audience language(s) -->
<language_tag>en-US, i-klingon</language_tag>
<!-- Various other informational settings --> <!-- Various other informational settings -->
<stream_name>Test Stream</stream_name> <stream_name>Test Stream</stream_name>
<stream_url>http://localhost:8000/</stream_url> <stream_url>http://localhost:8000/</stream_url>

View File

@ -43,6 +43,7 @@ struct cfg_stream {
char *stream_bitrate; char *stream_bitrate;
char *stream_samplerate; char *stream_samplerate;
char *stream_channels; char *stream_channels;
char *language_tag;
}; };
TAILQ_HEAD(cfg_stream_list, cfg_stream); TAILQ_HEAD(cfg_stream_list, cfg_stream);
@ -162,6 +163,7 @@ cfg_stream_destroy(struct cfg_stream **s_p)
xfree(s->stream_bitrate); xfree(s->stream_bitrate);
xfree(s->stream_samplerate); xfree(s->stream_samplerate);
xfree(s->stream_channels); xfree(s->stream_channels);
xfree(s->language_tag);
xfree(s); xfree(s);
*s_p = NULL; *s_p = NULL;
} }
@ -383,6 +385,16 @@ cfg_stream_set_stream_channels(struct cfg_stream *s,
return (0); return (0);
} }
int
cfg_stream_set_language_tag(struct cfg_stream *s,
struct cfg_stream_list *not_used, const char *language_tag,
const char **errstrp)
{
(void)not_used;
SET_XSTRDUP(s->language_tag, language_tag, errstrp);
return (0);
}
int int
cfg_stream_validate(struct cfg_stream *s, const char **errstrp) cfg_stream_validate(struct cfg_stream *s, const char **errstrp)
{ {
@ -490,3 +502,9 @@ cfg_stream_get_stream_channels(struct cfg_stream *s)
{ {
return (s->stream_channels); return (s->stream_channels);
} }
const char *
cfg_stream_get_language_tag(struct cfg_stream *s)
{
return (s->language_tag);
}

View File

@ -86,6 +86,8 @@ int cfg_stream_set_stream_samplerate(cfg_stream_t, cfg_stream_list_t,
const char *, const char **); const char *, const char **);
int cfg_stream_set_stream_channels(cfg_stream_t, cfg_stream_list_t, int cfg_stream_set_stream_channels(cfg_stream_t, cfg_stream_list_t,
const char *, const char **); const char *, const char **);
int cfg_stream_set_language_tag(cfg_stream_t, cfg_stream_list_t,
const char *, const char **);
int cfg_stream_validate(cfg_stream_t, const char **); int cfg_stream_validate(cfg_stream_t, const char **);
@ -120,5 +122,7 @@ const char *
cfg_stream_get_stream_samplerate(cfg_stream_t); cfg_stream_get_stream_samplerate(cfg_stream_t);
const char * const char *
cfg_stream_get_stream_channels(cfg_stream_t); cfg_stream_get_stream_channels(cfg_stream_t);
const char *
cfg_stream_get_language_tag(cfg_stream_t);
#endif /* __CFG_STREAM_H__ */ #endif /* __CFG_STREAM_H__ */

View File

@ -163,6 +163,7 @@ _cfgfile_xml_parse_stream(xmlDocPtr doc, xmlNodePtr cur)
XML_STREAM_SET(s, sl, cfg_stream_set_stream_bitrate, "stream_bitrate"); XML_STREAM_SET(s, sl, cfg_stream_set_stream_bitrate, "stream_bitrate");
XML_STREAM_SET(s, sl, cfg_stream_set_stream_samplerate, "stream_samplerate"); XML_STREAM_SET(s, sl, cfg_stream_set_stream_samplerate, "stream_samplerate");
XML_STREAM_SET(s, sl, cfg_stream_set_stream_channels, "stream_channels"); XML_STREAM_SET(s, sl, cfg_stream_set_stream_channels, "stream_channels");
XML_STREAM_SET(s, sl, cfg_stream_set_language_tag, "language_tag");
} }
if (0 > cfg_stream_validate(s, &errstr)) { if (0 > cfg_stream_validate(s, &errstr)) {

View File

@ -257,6 +257,13 @@ _stream_cfg_stream(struct stream *s, cfg_stream_t cfg_stream)
s->name, cfg_stream_get_format_str(cfg_stream)); s->name, cfg_stream_get_format_str(cfg_stream));
return (-1); return (-1);
} }
if (cfg_stream_get_language_tag(cfg_stream) &&
SHOUTERR_SUCCESS !=
shout_set_content_language(s->shout, cfg_stream_get_language_tag(cfg_stream))) {
log_error("stream: %s: language: %s",
s->name, shout_get_error(s->shout));
return (-1);
}
if (SHOUTERR_SUCCESS != if (SHOUTERR_SUCCESS !=
shout_set_public(s->shout, (unsigned int)cfg_stream_get_public(cfg_stream))) { shout_set_public(s->shout, (unsigned int)cfg_stream_get_public(cfg_stream))) {
log_error("stream: %s: public: %s", log_error("stream: %s: public: %s",

View File

@ -200,6 +200,13 @@ START_TEST(test_stream_stream_channels)
} }
END_TEST END_TEST
START_TEST(test_stream_language_tag)
{
TEST_XSTRDUP_T(cfg_stream_t, cfg_stream_list_get, streams,
cfg_stream_set_language_tag, cfg_stream_get_language_tag);
}
END_TEST
START_TEST(test_stream_validate) START_TEST(test_stream_validate)
{ {
cfg_stream_t str = cfg_stream_list_get(streams, "test_stream_validate"); cfg_stream_t str = cfg_stream_list_get(streams, "test_stream_validate");
@ -244,6 +251,7 @@ cfg_suite(void)
tcase_add_test(tc_stream, test_stream_stream_bitrate); tcase_add_test(tc_stream, test_stream_stream_bitrate);
tcase_add_test(tc_stream, test_stream_stream_samplerate); tcase_add_test(tc_stream, test_stream_stream_samplerate);
tcase_add_test(tc_stream, test_stream_stream_channels); tcase_add_test(tc_stream, test_stream_stream_channels);
tcase_add_test(tc_stream, test_stream_language_tag);
tcase_add_test(tc_stream, test_stream_validate); tcase_add_test(tc_stream, test_stream_validate);
suite_add_tcase(s, tc_stream); suite_add_tcase(s, tc_stream);

View File

@ -72,6 +72,7 @@ START_TEST(test_stream)
ck_assert_int_eq(cfg_stream_set_stream_bitrate(str_cfg, streams, "test", NULL), 0); ck_assert_int_eq(cfg_stream_set_stream_bitrate(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_stream_samplerate(str_cfg, streams, "test", NULL), 0); ck_assert_int_eq(cfg_stream_set_stream_samplerate(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_stream_channels(str_cfg, streams, "test", NULL), 0); ck_assert_int_eq(cfg_stream_set_stream_channels(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_language_tag(str_cfg, streams, "test", NULL), 0);
ck_assert_int_eq(cfg_stream_set_public(str_cfg, streams, "true", NULL), 0); ck_assert_int_eq(cfg_stream_set_public(str_cfg, streams, "true", NULL), 0);
ck_assert_int_eq(stream_configure(s), 0); ck_assert_int_eq(stream_configure(s), 0);