mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
First crack at making YP/curl optional.
svn path=/trunk/icecast/; revision=4552
This commit is contained in:
parent
8c866378d8
commit
8651aabcbb
@ -164,7 +164,9 @@ fi
|
|||||||
|
|
||||||
AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!(Perhaps you need --with-ogg-prefix=/usr/local)))
|
AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!(Perhaps you need --with-ogg-prefix=/usr/local)))
|
||||||
AM_PATH_VORBIS(, AC_MSG_ERROR(must have Vorbis installed!(Perhaps you need --with-vorbis-prefix=/usr/local)))
|
AM_PATH_VORBIS(, AC_MSG_ERROR(must have Vorbis installed!(Perhaps you need --with-vorbis-prefix=/usr/local)))
|
||||||
AM_PATH_CURL(, AC_MSG_ERROR(must have libcurl installed!))
|
AM_PATH_CURL(
|
||||||
|
[ICECAST_OBJECTS="$ICECAST_OBJECTS geturl.o yp.o"],
|
||||||
|
[AC_MSG_NOTICE([libcurl not found, YP disabled])])
|
||||||
ACX_PTHREAD(, AC_MSG_ERROR(POSIX threads missing))
|
ACX_PTHREAD(, AC_MSG_ERROR(POSIX threads missing))
|
||||||
|
|
||||||
dnl Make substitutions
|
dnl Make substitutions
|
||||||
@ -185,5 +187,6 @@ AC_SUBST(DEBUG)
|
|||||||
AC_SUBST(CFLAGS)
|
AC_SUBST(CFLAGS)
|
||||||
AC_SUBST(PROFILE)
|
AC_SUBST(PROFILE)
|
||||||
AC_SUBST(XIPH_CFLAGS)
|
AC_SUBST(XIPH_CFLAGS)
|
||||||
|
AC_SUBST(ICECAST_OBJECTS)
|
||||||
|
|
||||||
AC_OUTPUT(Makefile conf/Makefile src/Makefile src/avl/Makefile src/httpp/Makefile src/thread/Makefile src/log/Makefile src/net/Makefile src/timing/Makefile doc/Makefile web/Makefile win32/Makefile win32/res/Makefile)
|
AC_OUTPUT(Makefile conf/Makefile src/Makefile src/avl/Makefile src/httpp/Makefile src/thread/Makefile src/log/Makefile src/net/Makefile src/timing/Makefile doc/Makefile web/Makefile win32/Makefile win32/res/Makefile)
|
||||||
|
@ -11,10 +11,12 @@ noinst_HEADERS = config.h os.h logging.h sighandler.h connection.h global.h\
|
|||||||
compat.h format_mp3.h fserve.h xslt.h geturl.h yp.h event.h
|
compat.h format_mp3.h fserve.h xslt.h geturl.h yp.h event.h
|
||||||
icecast_SOURCES = config.c main.c logging.c sighandler.c connection.c global.c\
|
icecast_SOURCES = config.c main.c logging.c sighandler.c connection.c global.c\
|
||||||
util.c slave.c source.c stats.c refbuf.c client.c format.c format_vorbis.c\
|
util.c slave.c source.c stats.c refbuf.c client.c format.c format_vorbis.c\
|
||||||
format_mp3.c xslt.c fserve.c geturl.c yp.c event.c admin.c
|
format_mp3.c xslt.c fserve.c event.c admin.c
|
||||||
|
EXTRA_icecast_SOURCES = geturl.c yp.c
|
||||||
|
|
||||||
icecast_LDADD = net/libicenet.la thread/libicethread.la httpp/libicehttpp.la\
|
icecast_LDADD = $(ICECAST_OBJECTS) net/libicenet.la thread/libicethread.la httpp/libicehttpp.la\
|
||||||
log/libicelog.la avl/libiceavl.la timing/libicetiming.la
|
log/libicelog.la avl/libiceavl.la timing/libicetiming.la
|
||||||
|
icecast_DEPENDENCIES = $(icecast_LDADD)
|
||||||
|
|
||||||
LIBS = @LIBS@ @XSLT_LIBS@ @SOCKET_LIBS@ @XML_LIBS@ @OGG_LIBS@ @VORBIS_LIBS@ @CURL_LIBS@ @PTHREAD_LIBS@
|
LIBS = @LIBS@ @XSLT_LIBS@ @SOCKET_LIBS@ @XML_LIBS@ @OGG_LIBS@ @VORBIS_LIBS@ @CURL_LIBS@ @PTHREAD_LIBS@
|
||||||
CFLAGS = -g @CFLAGS@ @XML_CFLAGS@ @XSLT_CFLAGS@ @OGG_CFLAGS@ @VORBIS_CFLAGS@ @CURL_CFLAGS@ @PTHREAD_CFLAGS@
|
CFLAGS = -g @CFLAGS@ @XML_CFLAGS@ @XSLT_CFLAGS@ @OGG_CFLAGS@ @VORBIS_CFLAGS@ @CURL_CFLAGS@ @PTHREAD_CFLAGS@
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -40,7 +41,6 @@
|
|||||||
|
|
||||||
#include "yp.h"
|
#include "yp.h"
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "geturl.h"
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
#include "format_mp3.h"
|
#include "format_mp3.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -175,4 +176,3 @@ struct curl_memory_struct2 *curl_get_header_result(int which)
|
|||||||
{
|
{
|
||||||
return &(curl_connections[which].header_result);
|
return &(curl_connections[which].header_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#ifndef __GETURL_H__
|
#ifndef __GETURL_H__
|
||||||
#define __GETURL_H__
|
#define __GETURL_H__
|
||||||
|
|
||||||
@ -43,4 +44,3 @@ int curl_get_connection();
|
|||||||
int curl_release_connection(int which);
|
int curl_release_connection(int which);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
@ -7,7 +8,6 @@
|
|||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "refbuf.h"
|
#include "refbuf.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "geturl.h"
|
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -28,7 +29,9 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "xslt.h"
|
#include "xslt.h"
|
||||||
#include "fserve.h"
|
#include "fserve.h"
|
||||||
|
#ifdef HAVE_CURL
|
||||||
#include "geturl.h"
|
#include "geturl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <libxml/xmlmemory.h>
|
#include <libxml/xmlmemory.h>
|
||||||
|
|
||||||
@ -63,12 +66,16 @@ static void _initialize_subsystems(void)
|
|||||||
global_initialize();
|
global_initialize();
|
||||||
refbuf_initialize();
|
refbuf_initialize();
|
||||||
xslt_initialize();
|
xslt_initialize();
|
||||||
|
#ifdef HAVE_CURL
|
||||||
curl_initialize();
|
curl_initialize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _shutdown_subsystems(void)
|
static void _shutdown_subsystems(void)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_CURL
|
||||||
curl_shutdown();
|
curl_shutdown();
|
||||||
|
#endif
|
||||||
fserve_shutdown();
|
fserve_shutdown();
|
||||||
xslt_shutdown();
|
xslt_shutdown();
|
||||||
refbuf_shutdown();
|
refbuf_shutdown();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
/* slave.c
|
/* slave.c
|
||||||
* by Ciaran Anscomb <ciaran.anscomb@6809.org.uk>
|
* by Ciaran Anscomb <ciaran.anscomb@6809.org.uk>
|
||||||
*
|
*
|
||||||
@ -38,7 +39,6 @@
|
|||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "geturl.h"
|
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
27
src/source.c
27
src/source.c
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -28,7 +29,9 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#ifdef HAVE_CURL
|
||||||
#include "geturl.h"
|
#include "geturl.h"
|
||||||
|
#endif
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
@ -51,8 +54,10 @@
|
|||||||
static int _compare_clients(void *compare_arg, void *a, void *b);
|
static int _compare_clients(void *compare_arg, void *a, void *b);
|
||||||
static int _free_client(void *key);
|
static int _free_client(void *key);
|
||||||
static int _parse_audio_info(source_t *source, char *s);
|
static int _parse_audio_info(source_t *source, char *s);
|
||||||
|
#ifdef HAVE_CURL
|
||||||
static void _add_yp_info(source_t *source, char *stat_name,
|
static void _add_yp_info(source_t *source, char *stat_name,
|
||||||
void *info, int type);
|
void *info, int type);
|
||||||
|
#endif
|
||||||
|
|
||||||
source_t *source_create(client_t *client, connection_t *con,
|
source_t *source_create(client_t *client, connection_t *con,
|
||||||
http_parser_t *parser, const char *mount, format_type_t type,
|
http_parser_t *parser, const char *mount, format_type_t type,
|
||||||
@ -149,9 +154,11 @@ int source_free_source(void *key)
|
|||||||
avl_tree_free(source->pending_tree, _free_client);
|
avl_tree_free(source->pending_tree, _free_client);
|
||||||
avl_tree_free(source->client_tree, _free_client);
|
avl_tree_free(source->client_tree, _free_client);
|
||||||
source->format->free_plugin(source->format);
|
source->format->free_plugin(source->format);
|
||||||
|
#ifdef HAVE_CURL
|
||||||
for (i=0; i<source->num_yp_directories; i++) {
|
for (i=0; i<source->num_yp_directories; i++) {
|
||||||
yp_destroy_ypdata(source->ypdata[i]);
|
yp_destroy_ypdata(source->ypdata[i]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
util_dict_free(source->audio_info);
|
util_dict_free(source->audio_info);
|
||||||
free(source);
|
free(source);
|
||||||
|
|
||||||
@ -192,6 +199,7 @@ void *source_main(void *arg)
|
|||||||
hostname = config->hostname;
|
hostname = config->hostname;
|
||||||
port = config->port;
|
port = config->port;
|
||||||
|
|
||||||
|
#ifdef HAVE_CURL
|
||||||
for (i=0;i<config->num_yp_directories;i++) {
|
for (i=0;i<config->num_yp_directories;i++) {
|
||||||
if (config->yp_url[i]) {
|
if (config->yp_url[i]) {
|
||||||
source->ypdata[source->num_yp_directories] = yp_create_ypdata();
|
source->ypdata[source->num_yp_directories] = yp_create_ypdata();
|
||||||
@ -203,7 +211,8 @@ void *source_main(void *arg)
|
|||||||
source->num_yp_directories++;
|
source->num_yp_directories++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
config_release_config();
|
config_release_config();
|
||||||
|
|
||||||
/* grab a read lock, to make sure we get a chance to cleanup */
|
/* grab a read lock, to make sure we get a chance to cleanup */
|
||||||
@ -237,8 +246,10 @@ void *source_main(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* start off the statistics */
|
/* start off the statistics */
|
||||||
stats_event(source->mount, "listeners", "0");
|
|
||||||
source->listeners = 0;
|
source->listeners = 0;
|
||||||
|
stats_event(source->mount, "listeners", "0");
|
||||||
|
stats_event(source->mount, "type", source->format->format_description);
|
||||||
|
#ifdef HAVE_CURL
|
||||||
if ((s = httpp_getvar(source->parser, "ice-name"))) {
|
if ((s = httpp_getvar(source->parser, "ice-name"))) {
|
||||||
_add_yp_info(source, "server_name", s, YP_SERVER_NAME);
|
_add_yp_info(source, "server_name", s, YP_SERVER_NAME);
|
||||||
}
|
}
|
||||||
@ -275,7 +286,6 @@ void *source_main(void *arg)
|
|||||||
strcpy(source->ypdata[i]->server_type,
|
strcpy(source->ypdata[i]->server_type,
|
||||||
source->format->format_description);
|
source->format->format_description);
|
||||||
}
|
}
|
||||||
stats_event(source->mount, "type", source->format->format_description);
|
|
||||||
|
|
||||||
for (i=0;i<source->num_yp_directories;i++) {
|
for (i=0;i<source->num_yp_directories;i++) {
|
||||||
int listen_url_size;
|
int listen_url_size;
|
||||||
@ -310,10 +320,12 @@ void *source_main(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DEBUG0("Source creation complete");
|
DEBUG0("Source creation complete");
|
||||||
|
|
||||||
while (global.running == ICE_RUNNING && source->running) {
|
while (global.running == ICE_RUNNING && source->running) {
|
||||||
|
#ifdef HAVE_CURL
|
||||||
if(!suppress_yp) {
|
if(!suppress_yp) {
|
||||||
current_time = time(NULL);
|
current_time = time(NULL);
|
||||||
for (i=0;i<source->num_yp_directories;i++) {
|
for (i=0;i<source->num_yp_directories;i++) {
|
||||||
@ -354,7 +366,7 @@ void *source_main(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
ret = source->format->get_buffer(source->format, NULL, 0, &refbuf);
|
ret = source->format->get_buffer(source->format, NULL, 0, &refbuf);
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
WARN0("Bad data from source");
|
WARN0("Bad data from source");
|
||||||
@ -566,10 +578,13 @@ void *source_main(void *arg)
|
|||||||
done:
|
done:
|
||||||
|
|
||||||
DEBUG0("Source exiting");
|
DEBUG0("Source exiting");
|
||||||
|
|
||||||
|
#ifdef HAVE_CURL
|
||||||
if(!suppress_yp) {
|
if(!suppress_yp) {
|
||||||
yp_remove(source);
|
yp_remove(source);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
avl_tree_rlock(global.source_tree);
|
avl_tree_rlock(global.source_tree);
|
||||||
fallback_source = source_find_mount(source->fallback_mount);
|
fallback_source = source_find_mount(source->fallback_mount);
|
||||||
avl_tree_unlock(global.source_tree);
|
avl_tree_unlock(global.source_tree);
|
||||||
@ -701,6 +716,7 @@ static int _parse_audio_info(source_t *source, char *s)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_CURL
|
||||||
static void _add_yp_info(source_t *source, char *stat_name,
|
static void _add_yp_info(source_t *source, char *stat_name,
|
||||||
void *info, int type)
|
void *info, int type)
|
||||||
{
|
{
|
||||||
@ -792,3 +808,4 @@ static void _add_yp_info(source_t *source, char *stat_name,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
3
src/yp.c
3
src/yp.c
@ -1,3 +1,4 @@
|
|||||||
|
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -15,7 +16,7 @@
|
|||||||
|
|
||||||
#define CATMODULE "yp"
|
#define CATMODULE "yp"
|
||||||
|
|
||||||
int yp_submit_url(int curl_con, char *yp_url, char *url, char *type, int i)
|
static int yp_submit_url(int curl_con, char *yp_url, char *url, char *type, int i)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int *timeout;
|
int *timeout;
|
||||||
|
Loading…
Reference in New Issue
Block a user