mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-01-03 14:56:34 -05:00
Feature: Added SOURCE_FLAG_FORMAT_GENERIC, and SOURCE_FLAG_LEGACY_METADATA
This commit is contained in:
parent
eed81f5bec
commit
871d296ab1
@ -1226,6 +1226,7 @@ static void command_metadata(client_t *client,
|
||||
if (source->parser && source->parser->req_type == httpp_req_put) {
|
||||
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
|
||||
"source connected with PUT at mountpoint %H", source->mount);
|
||||
source_set_flags(source, SOURCE_FLAG_LEGACY_METADATA);
|
||||
}
|
||||
|
||||
COMMAND_REQUIRE(client, "mode", action);
|
||||
@ -1270,6 +1271,7 @@ static void command_metadata(client_t *client,
|
||||
} else {
|
||||
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
|
||||
"on source that does not accept it at mountpoint %H", source->mount);
|
||||
source_set_flags(source, SOURCE_FLAG_LEGACY_METADATA);
|
||||
|
||||
admin_send_response_simple(client, source, response, "Mountpoint will not accept URL updates", 1);
|
||||
return;
|
||||
|
@ -952,6 +952,9 @@ int connection_complete_source(source_t *source, int response)
|
||||
format_type = FORMAT_TYPE_GENERIC;
|
||||
}
|
||||
|
||||
if (format_type == FORMAT_TYPE_GENERIC)
|
||||
source_set_flags(source, SOURCE_FLAG_FORMAT_GENERIC);
|
||||
|
||||
if (format_get_plugin (format_type, source) < 0) {
|
||||
global_unlock();
|
||||
config_release_config();
|
||||
|
28
src/source.c
28
src/source.c
@ -74,17 +74,6 @@ static int _free_client(void *key);
|
||||
static void _parse_audio_info (source_t *source, const char *s);
|
||||
static void source_shutdown (source_t *source);
|
||||
|
||||
static void source_set_flags(source_t *source, source_flags_t flags)
|
||||
{
|
||||
/* check if we need to do anything at all */
|
||||
if ((source->flags & flags) == flags)
|
||||
return;
|
||||
|
||||
thread_mutex_lock(&source->lock);
|
||||
source->flags |= flags;
|
||||
thread_mutex_unlock(&source->lock);
|
||||
}
|
||||
|
||||
/* Allocate a new source with the stated mountpoint, if one already
|
||||
* exists with that mountpoint in the global source tree then return
|
||||
* NULL.
|
||||
@ -1541,5 +1530,22 @@ health_t source_get_health(source_t *source)
|
||||
if (!(flags & SOURCE_FLAG_GOT_DATA))
|
||||
health = health_atbest(health, HEALTH_ERROR);
|
||||
|
||||
if (flags & SOURCE_FLAG_FORMAT_GENERIC)
|
||||
health = health_atbest(health, HEALTH_WARNING);
|
||||
|
||||
if (flags & SOURCE_FLAG_LEGACY_METADATA)
|
||||
health = health_atbest(health, HEALTH_ERROR);
|
||||
|
||||
return health;
|
||||
}
|
||||
|
||||
void source_set_flags(source_t *source, source_flags_t flags)
|
||||
{
|
||||
/* check if we need to do anything at all */
|
||||
if ((source->flags & flags) == flags)
|
||||
return;
|
||||
|
||||
thread_mutex_lock(&source->lock);
|
||||
source->flags |= flags;
|
||||
thread_mutex_unlock(&source->lock);
|
||||
}
|
||||
|
@ -31,8 +31,10 @@
|
||||
typedef uint_least32_t source_flags_t;
|
||||
|
||||
#define SOURCE_FLAG_GOT_DATA ((source_flags_t)0x00000001U)
|
||||
#define SOURCE_FLAG_FORMAT_GENERIC ((source_flags_t)0x00000002U)
|
||||
#define SOURCE_FLAG_LEGACY_METADATA ((source_flags_t)0x00000004U)
|
||||
|
||||
#define SOURCE_FLAGS_CLEARABLE ((source_flags_t)0)
|
||||
#define SOURCE_FLAGS_CLEARABLE (SOURCE_FLAG_LEGACY_METADATA)
|
||||
|
||||
struct source_tag {
|
||||
mutex_t lock;
|
||||
@ -123,6 +125,7 @@ void source_recheck_mounts (int update_all);
|
||||
bool source_write_dumpfile(source_t *source, const void *buffer, size_t len);
|
||||
void source_kill_dumpfile(source_t *source);
|
||||
health_t source_get_health(source_t *source);
|
||||
void source_set_flags(source_t *source, source_flags_t flags);
|
||||
|
||||
extern mutex_t move_clients_mutex;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user