Commit 8651aabc authored by brendan's avatar brendan

First crack at making YP/curl optional.

svn path=/trunk/icecast/; revision=4552
parent 8c866378
......@@ -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_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))
dnl Make substitutions
......@@ -185,5 +187,6 @@ AC_SUBST(DEBUG)
AC_SUBST(CFLAGS)
AC_SUBST(PROFILE)
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)
......@@ -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
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\
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
icecast_DEPENDENCIES = $(icecast_LDADD)
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@
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -40,7 +41,6 @@
#include "yp.h"
#include "source.h"
#include "geturl.h"
#include "format.h"
#include "format_mp3.h"
#include "event.h"
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -175,4 +176,3 @@ struct curl_memory_struct2 *curl_get_header_result(int which)
{
return &(curl_connections[which].header_result);
}
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#ifndef __GETURL_H__
#define __GETURL_H__
......@@ -43,4 +44,3 @@ int curl_get_connection();
int curl_release_connection(int which);
#endif
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <string.h>
#include "thread.h"
......@@ -7,7 +8,6 @@
#include "connection.h"
#include "refbuf.h"
#include "client.h"
#include "geturl.h"
#include "source.h"
#include "format.h"
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <stdio.h>
#include <string.h>
......@@ -28,7 +29,9 @@
#include "logging.h"
#include "xslt.h"
#include "fserve.h"
#ifdef HAVE_CURL
#include "geturl.h"
#endif
#include <libxml/xmlmemory.h>
......@@ -63,12 +66,16 @@ static void _initialize_subsystems(void)
global_initialize();
refbuf_initialize();
xslt_initialize();
#ifdef HAVE_CURL
curl_initialize();
#endif
}
static void _shutdown_subsystems(void)
{
#ifdef HAVE_CURL
curl_shutdown();
#endif
fserve_shutdown();
xslt_shutdown();
refbuf_shutdown();
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* slave.c
* by Ciaran Anscomb <ciaran.anscomb@6809.org.uk>
*
......@@ -38,7 +39,6 @@
#include "client.h"
#include "stats.h"
#include "logging.h"
#include "geturl.h"
#include "source.h"
#include "format.h"
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -28,7 +29,9 @@
#include "logging.h"
#include "config.h"
#include "util.h"
#ifdef HAVE_CURL
#include "geturl.h"
#endif
#include "source.h"
#include "format.h"
......@@ -51,8 +54,10 @@
static int _compare_clients(void *compare_arg, void *a, void *b);
static int _free_client(void *key);
static int _parse_audio_info(source_t *source, char *s);
#ifdef HAVE_CURL
static void _add_yp_info(source_t *source, char *stat_name,
void *info, int type);
#endif
source_t *source_create(client_t *client, connection_t *con,
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->client_tree, _free_client);
source->format->free_plugin(source->format);
#ifdef HAVE_CURL
for (i=0; i<source->num_yp_directories; i++) {
yp_destroy_ypdata(source->ypdata[i]);
}
#endif
util_dict_free(source->audio_info);
free(source);
......@@ -192,6 +199,7 @@ void *source_main(void *arg)
hostname = config->hostname;
port = config->port;
#ifdef HAVE_CURL
for (i=0;i<config->num_yp_directories;i++) {
if (config->yp_url[i]) {
source->ypdata[source->num_yp_directories] = yp_create_ypdata();
......@@ -203,7 +211,8 @@ void *source_main(void *arg)
source->num_yp_directories++;
}
}
#endif
config_release_config();
/* 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 */
stats_event(source->mount, "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"))) {
_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,
source->format->format_description);
}
stats_event(source->mount, "type", source->format->format_description);
for (i=0;i<source->num_yp_directories;i++) {
int listen_url_size;
......@@ -310,10 +320,12 @@ void *source_main(void *arg)
}
}
}
#endif
DEBUG0("Source creation complete");
while (global.running == ICE_RUNNING && source->running) {
#ifdef HAVE_CURL
if(!suppress_yp) {
current_time = time(NULL);
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);
if(ret < 0) {
WARN0("Bad data from source");
......@@ -566,10 +578,13 @@ void *source_main(void *arg)
done:
DEBUG0("Source exiting");
#ifdef HAVE_CURL
if(!suppress_yp) {
yp_remove(source);
}
#endif
avl_tree_rlock(global.source_tree);
fallback_source = source_find_mount(source->fallback_mount);
avl_tree_unlock(global.source_tree);
......@@ -701,6 +716,7 @@ static int _parse_audio_info(source_t *source, char *s)
return 1;
}
#ifdef HAVE_CURL
static void _add_yp_info(source_t *source, char *stat_name,
void *info, int type)
{
......@@ -792,3 +808,4 @@ static void _add_yp_info(source_t *source, char *stat_name,
}
}
}
#endif
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
......@@ -15,7 +16,7 @@
#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 *timeout;
......
/* -*- c-basic-offset: 4; indent-tabs-mode: nil; -*- */
#ifndef __YP_H__
#define __YP_H__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment