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) {
|
if (source->parser && source->parser->req_type == httpp_req_put) {
|
||||||
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
|
ICECAST_LOG_ERROR("Got legacy SOURCE-style metadata update command on "
|
||||||
"source connected with PUT at mountpoint %H", source->mount);
|
"source connected with PUT at mountpoint %H", source->mount);
|
||||||
|
source_set_flags(source, SOURCE_FLAG_LEGACY_METADATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_REQUIRE(client, "mode", action);
|
COMMAND_REQUIRE(client, "mode", action);
|
||||||
@ -1270,6 +1271,7 @@ static void command_metadata(client_t *client,
|
|||||||
} else {
|
} else {
|
||||||
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
|
ICECAST_LOG_ERROR("Got legacy shoutcast-style metadata update command "
|
||||||
"on source that does not accept it at mountpoint %H", source->mount);
|
"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);
|
admin_send_response_simple(client, source, response, "Mountpoint will not accept URL updates", 1);
|
||||||
return;
|
return;
|
||||||
|
@ -952,6 +952,9 @@ int connection_complete_source(source_t *source, int response)
|
|||||||
format_type = FORMAT_TYPE_GENERIC;
|
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) {
|
if (format_get_plugin (format_type, source) < 0) {
|
||||||
global_unlock();
|
global_unlock();
|
||||||
config_release_config();
|
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 _parse_audio_info (source_t *source, const char *s);
|
||||||
static void source_shutdown (source_t *source);
|
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
|
/* Allocate a new source with the stated mountpoint, if one already
|
||||||
* exists with that mountpoint in the global source tree then return
|
* exists with that mountpoint in the global source tree then return
|
||||||
* NULL.
|
* NULL.
|
||||||
@ -1541,5 +1530,22 @@ health_t source_get_health(source_t *source)
|
|||||||
if (!(flags & SOURCE_FLAG_GOT_DATA))
|
if (!(flags & SOURCE_FLAG_GOT_DATA))
|
||||||
health = health_atbest(health, HEALTH_ERROR);
|
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;
|
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;
|
typedef uint_least32_t source_flags_t;
|
||||||
|
|
||||||
#define SOURCE_FLAG_GOT_DATA ((source_flags_t)0x00000001U)
|
#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 {
|
struct source_tag {
|
||||||
mutex_t lock;
|
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);
|
bool source_write_dumpfile(source_t *source, const void *buffer, size_t len);
|
||||||
void source_kill_dumpfile(source_t *source);
|
void source_kill_dumpfile(source_t *source);
|
||||||
health_t source_get_health(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;
|
extern mutex_t move_clients_mutex;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user