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