mirror of
https://gitlab.xiph.org/xiph/ezstream.git
synced 2024-11-03 04:17:18 -05:00
Add plumbing for future encapsulation of libshout usage
This commit is contained in:
parent
b34b78aeba
commit
4b087df3ab
@ -13,6 +13,7 @@ noinst_HEADERS = \
|
|||||||
log.h \
|
log.h \
|
||||||
metadata.h \
|
metadata.h \
|
||||||
playlist.h \
|
playlist.h \
|
||||||
|
stream.h \
|
||||||
util.h \
|
util.h \
|
||||||
xalloc.h
|
xalloc.h
|
||||||
libezstream_la_SOURCES = \
|
libezstream_la_SOURCES = \
|
||||||
@ -24,6 +25,7 @@ libezstream_la_SOURCES = \
|
|||||||
log.c \
|
log.c \
|
||||||
metadata.c \
|
metadata.c \
|
||||||
playlist.c \
|
playlist.c \
|
||||||
|
stream.c \
|
||||||
util.c \
|
util.c \
|
||||||
xalloc.c
|
xalloc.c
|
||||||
libezstream_la_DEPENDENCIES = \
|
libezstream_la_DEPENDENCIES = \
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
#include "playlist.h"
|
#include "playlist.h"
|
||||||
|
#include "stream.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "xalloc.h"
|
#include "xalloc.h"
|
||||||
|
|
||||||
@ -994,8 +995,7 @@ streamPlaylist(shout_t *shout)
|
|||||||
int
|
int
|
||||||
ez_shutdown(int exitval)
|
ez_shutdown(int exitval)
|
||||||
{
|
{
|
||||||
shout_shutdown();
|
stream_exit();
|
||||||
|
|
||||||
playlist_exit();
|
playlist_exit();
|
||||||
cfg_encoder_exit();
|
cfg_encoder_exit();
|
||||||
cfg_decoder_exit();
|
cfg_decoder_exit();
|
||||||
@ -1017,6 +1017,7 @@ main(int argc, char *argv[])
|
|||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
if (0 > cfg_init() ||
|
if (0 > cfg_init() ||
|
||||||
0 > cmdline_parse(argc, argv, &ret) ||
|
0 > cmdline_parse(argc, argv, &ret) ||
|
||||||
@ -1024,9 +1025,9 @@ main(int argc, char *argv[])
|
|||||||
0 > cfg_decoder_init() ||
|
0 > cfg_decoder_init() ||
|
||||||
0 > cfg_encoder_init() ||
|
0 > cfg_encoder_init() ||
|
||||||
0 > playlist_init() ||
|
0 > playlist_init() ||
|
||||||
0 > cfg_reload())
|
0 > cfg_reload() ||
|
||||||
|
0 > stream_init())
|
||||||
return (ez_shutdown(ret));
|
return (ez_shutdown(ret));
|
||||||
shout_init();
|
|
||||||
|
|
||||||
if (0 > cfg_check(&errstr)) {
|
if (0 > cfg_check(&errstr)) {
|
||||||
log_error("%s: %s", cfg_get_program_config_file(), errstr);
|
log_error("%s: %s", cfg_get_program_config_file(), errstr);
|
||||||
|
37
src/stream.c
Normal file
37
src/stream.c
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Moritz Grimm <mgrimm@mrsserver.net>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
#include <shout/shout.h>
|
||||||
|
|
||||||
|
#include "cfg.h"
|
||||||
|
#include "stream.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
stream_init(void)
|
||||||
|
{
|
||||||
|
shout_init();
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
stream_exit(void)
|
||||||
|
{
|
||||||
|
shout_shutdown();
|
||||||
|
}
|
23
src/stream.h
Normal file
23
src/stream.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 Moritz Grimm <mgrimm@mrsserver.net>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __STREAM_H__
|
||||||
|
#define __STREAM_H__
|
||||||
|
|
||||||
|
int stream_init(void);
|
||||||
|
void stream_exit(void);
|
||||||
|
|
||||||
|
#endif /* __STREAM_H__ */
|
@ -6,6 +6,7 @@ TESTS = \
|
|||||||
check_cmdline \
|
check_cmdline \
|
||||||
check_log \
|
check_log \
|
||||||
check_playlist \
|
check_playlist \
|
||||||
|
check_stream \
|
||||||
check_xalloc
|
check_xalloc
|
||||||
check_PROGRAMS = $(TESTS)
|
check_PROGRAMS = $(TESTS)
|
||||||
|
|
||||||
@ -34,6 +35,11 @@ check_playlist_SOURCES = \
|
|||||||
check_playlist_DEPENDENCIES = $(top_builddir)/src/libezstream.la
|
check_playlist_DEPENDENCIES = $(top_builddir)/src/libezstream.la
|
||||||
check_playlist_LDADD = $(check_playlist_DEPENDENCIES) @CHECK_LIBS@
|
check_playlist_LDADD = $(check_playlist_DEPENDENCIES) @CHECK_LIBS@
|
||||||
|
|
||||||
|
check_stream_SOURCES = \
|
||||||
|
check_stream.c
|
||||||
|
check_stream_DEPENDENCIES = $(top_builddir)/src/libezstream.la
|
||||||
|
check_stream_LDADD = $(check_stream_DEPENDENCIES) @CHECK_LIBS@
|
||||||
|
|
||||||
check_xalloc_SOURCES = \
|
check_xalloc_SOURCES = \
|
||||||
check_xalloc.c
|
check_xalloc.c
|
||||||
check_xalloc_DEPENDENCIES = $(top_builddir)/src/libezstream.la
|
check_xalloc_DEPENDENCIES = $(top_builddir)/src/libezstream.la
|
||||||
|
60
tests/check_stream.c
Normal file
60
tests/check_stream.c
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
#include <check.h>
|
||||||
|
|
||||||
|
#include "stream.h"
|
||||||
|
|
||||||
|
Suite * stream_suite(void);
|
||||||
|
void setup_checked(void);
|
||||||
|
void teardown_checked(void);
|
||||||
|
|
||||||
|
START_TEST(test_stream)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
Suite *
|
||||||
|
stream_suite(void)
|
||||||
|
{
|
||||||
|
Suite *s;
|
||||||
|
TCase *tc_stream;
|
||||||
|
|
||||||
|
s = suite_create("Stream");
|
||||||
|
|
||||||
|
tc_stream = tcase_create("Stream");
|
||||||
|
tcase_add_checked_fixture(tc_stream, setup_checked, teardown_checked);
|
||||||
|
tcase_add_test(tc_stream, test_stream);
|
||||||
|
suite_add_tcase(s, tc_stream);
|
||||||
|
|
||||||
|
return (s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setup_checked(void)
|
||||||
|
{
|
||||||
|
if (0 < stream_init())
|
||||||
|
ck_abort_msg("setup_checked failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
teardown_checked(void)
|
||||||
|
{
|
||||||
|
stream_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
unsigned int num_failed;
|
||||||
|
Suite *s;
|
||||||
|
SRunner *sr;
|
||||||
|
|
||||||
|
s = stream_suite();
|
||||||
|
sr = srunner_create(s);
|
||||||
|
|
||||||
|
srunner_run_all(sr, CK_NORMAL);
|
||||||
|
num_failed = srunner_ntests_failed(sr);
|
||||||
|
srunner_free(sr);
|
||||||
|
|
||||||
|
if (num_failed)
|
||||||
|
return (1);
|
||||||
|
return (0);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user