2004-01-29 01:02:12 +00:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
2018-05-25 12:38:01 +00:00
|
|
|
* Copyright 2012-2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
|
2004-01-29 01:02:12 +00:00
|
|
|
*/
|
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
#ifndef __SOURCE_H__
|
|
|
|
#define __SOURCE_H__
|
|
|
|
|
2018-06-17 12:28:38 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include "common/thread/thread.h"
|
|
|
|
#include "common/httpp/httpp.h"
|
|
|
|
|
2018-06-17 10:12:15 +00:00
|
|
|
#include "icecasttypes.h"
|
2020-09-30 17:25:49 +00:00
|
|
|
#include "connection.h"
|
2003-02-02 14:33:17 +00:00
|
|
|
#include "yp.h"
|
2003-02-26 23:52:23 +00:00
|
|
|
#include "util.h"
|
2002-12-30 07:55:56 +00:00
|
|
|
#include "format.h"
|
2015-03-28 16:15:49 +00:00
|
|
|
#include "playlist.h"
|
2003-03-02 10:13:59 +00:00
|
|
|
|
2018-05-25 11:42:08 +00:00
|
|
|
struct source_tag {
|
2012-07-17 14:03:37 +00:00
|
|
|
mutex_t lock;
|
2002-08-16 14:26:48 +00:00
|
|
|
client_t *client;
|
2003-03-15 02:10:19 +00:00
|
|
|
connection_t *con;
|
|
|
|
http_parser_t *parser;
|
2005-05-08 13:51:05 +00:00
|
|
|
time_t client_stats_update;
|
2003-03-15 02:10:19 +00:00
|
|
|
|
|
|
|
char *mount;
|
2002-12-30 15:19:46 +00:00
|
|
|
|
|
|
|
/* If this source drops, try to move all clients to this fallback */
|
|
|
|
char *fallback_mount;
|
|
|
|
|
2003-02-06 13:10:48 +00:00
|
|
|
/* set to zero to request the source to shutdown without causing a global
|
|
|
|
* shutdown */
|
|
|
|
int running;
|
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
struct _format_plugin_tag *format;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
avl_tree *client_tree;
|
|
|
|
avl_tree *pending_tree;
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2003-03-15 02:10:19 +00:00
|
|
|
rwlock_t *shutdown_rwlock;
|
2003-02-26 23:52:23 +00:00
|
|
|
util_dict *audio_info;
|
2003-03-02 10:13:59 +00:00
|
|
|
|
2005-06-03 15:35:52 +00:00
|
|
|
FILE *intro_file;
|
|
|
|
|
2003-03-02 10:13:59 +00:00
|
|
|
char *dumpfilename; /* Name of a file to dump incoming stream to */
|
|
|
|
FILE *dumpfile;
|
|
|
|
|
2005-06-11 01:24:58 +00:00
|
|
|
unsigned long peak_listeners;
|
2005-05-26 03:04:48 +00:00
|
|
|
unsigned long listeners;
|
2007-08-09 15:43:00 +00:00
|
|
|
unsigned long prev_listeners;
|
2003-02-11 14:23:34 +00:00
|
|
|
long max_listeners;
|
2003-06-26 13:32:04 +00:00
|
|
|
int yp_public;
|
2004-01-15 01:01:09 +00:00
|
|
|
int fallback_override;
|
2005-08-23 18:40:20 +00:00
|
|
|
int fallback_when_full;
|
2004-11-11 15:47:33 +00:00
|
|
|
int shoutcast_compat;
|
2004-08-20 15:13:59 +00:00
|
|
|
|
|
|
|
/* per source burst handling for connecting clients */
|
|
|
|
unsigned int burst_size; /* trigger level for burst on connect */
|
|
|
|
unsigned int burst_offset;
|
|
|
|
refbuf_t *burst_point;
|
|
|
|
|
|
|
|
unsigned int queue_size;
|
|
|
|
unsigned int queue_size_limit;
|
|
|
|
|
2004-02-26 11:56:48 +00:00
|
|
|
unsigned timeout; /* source timeout in seconds */
|
2005-06-09 01:51:47 +00:00
|
|
|
int on_demand;
|
|
|
|
int on_demand_req;
|
2004-11-22 18:21:48 +00:00
|
|
|
int hidden;
|
2004-08-20 15:13:59 +00:00
|
|
|
time_t last_read;
|
|
|
|
int short_delay;
|
|
|
|
|
|
|
|
refbuf_t *stream_data;
|
|
|
|
refbuf_t *stream_data_tail;
|
|
|
|
|
2015-03-28 16:15:49 +00:00
|
|
|
playlist_t *history;
|
2018-06-09 09:54:38 +00:00
|
|
|
};
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2004-02-19 16:32:26 +00:00
|
|
|
source_t *source_reserve (const char *mount);
|
|
|
|
void *source_client_thread (void *arg);
|
2005-08-12 15:27:32 +00:00
|
|
|
void source_client_callback (client_t *client, void *source);
|
2005-05-30 14:50:57 +00:00
|
|
|
void source_update_settings (ice_config_t *config, source_t *source, mount_proxy *mountinfo);
|
2004-02-19 16:32:26 +00:00
|
|
|
void source_clear_source (source_t *source);
|
2001-09-10 02:21:46 +00:00
|
|
|
source_t *source_find_mount(const char *mount);
|
2004-01-15 01:01:09 +00:00
|
|
|
source_t *source_find_mount_raw(const char *mount);
|
2020-09-30 17:25:49 +00:00
|
|
|
client_t *source_find_client(source_t *source, connection_id_t id);
|
2001-09-10 02:21:46 +00:00
|
|
|
int source_compare_sources(void *arg, void *a, void *b);
|
2004-02-27 15:15:40 +00:00
|
|
|
void source_free_source(source_t *source);
|
2020-09-30 17:50:26 +00:00
|
|
|
void source_move_clients(source_t *source, source_t *dest, connection_id_t *id);
|
2003-03-14 07:59:58 +00:00
|
|
|
int source_remove_client(void *key);
|
2004-02-26 16:51:43 +00:00
|
|
|
void source_main(source_t *source);
|
2007-08-11 17:44:45 +00:00
|
|
|
void source_recheck_mounts (int update_all);
|
2001-09-10 02:21:46 +00:00
|
|
|
|
2004-01-29 16:46:54 +00:00
|
|
|
extern mutex_t move_clients_mutex;
|
|
|
|
|
2001-09-10 02:21:46 +00:00
|
|
|
#endif
|