mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 22:23:17 -05:00
[outputs] Fix gcc 10 complaining about multiple definitions
outputs_master_volume, output_device_list and output_buffer were defined in outputs.h, but should only have been declared with extern. Solve it by making output_buffer static/non-global (wasn't used anyway), and the two others are now returned by functions.
This commit is contained in:
parent
69fbd7b32a
commit
a2ec7ee28f
@ -105,6 +105,12 @@ struct output_quality_subscription
|
||||
struct encode_ctx *encode_ctx;
|
||||
};
|
||||
|
||||
// Buffer used to pass data to the backends
|
||||
static struct output_buffer output_buffer;
|
||||
|
||||
static struct output_device *outputs_device_list;
|
||||
static int outputs_master_volume;
|
||||
|
||||
static struct outputs_callback_register outputs_cb_register[OUTPUTS_MAX_CALLBACKS];
|
||||
static struct event *outputs_deferredev;
|
||||
static struct timeval outputs_stop_timeout = { OUTPUTS_STOP_TIMEOUT, 0 };
|
||||
@ -392,14 +398,14 @@ device_list_sort(void)
|
||||
{
|
||||
swaps = 0;
|
||||
prev = NULL;
|
||||
for (device = output_device_list; device && device->next; device = device->next)
|
||||
for (device = outputs_device_list; device && device->next; device = device->next)
|
||||
{
|
||||
next = device->next;
|
||||
if ( (outputs_priority(device) > outputs_priority(next)) ||
|
||||
(outputs_priority(device) == outputs_priority(next) && strcasecmp(device->name, next->name) > 0) )
|
||||
{
|
||||
if (device == output_device_list)
|
||||
output_device_list = next;
|
||||
if (device == outputs_device_list)
|
||||
outputs_device_list = next;
|
||||
if (prev)
|
||||
prev->next = next;
|
||||
|
||||
@ -513,7 +519,7 @@ vol_adjust(void)
|
||||
int selected_highest = -1;
|
||||
int all_highest = -1;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (OUTPUTS_DEVICE_DISPLAY_SELECTED(device) && (device->volume > selected_highest))
|
||||
selected_highest = device->volume;
|
||||
@ -524,7 +530,7 @@ vol_adjust(void)
|
||||
|
||||
outputs_master_volume = (selected_highest >= 0) ? selected_highest : all_highest;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (!OUTPUTS_DEVICE_DISPLAY_SELECTED(device) && (device->volume > outputs_master_volume))
|
||||
device->volume = outputs_master_volume;
|
||||
@ -535,7 +541,7 @@ vol_adjust(void)
|
||||
#ifdef DEBUG_VOLUME
|
||||
DPRINTF(E_DBG, L_PLAYER, "*** Master: %d\n", outputs_master_volume);
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
DPRINTF(E_DBG, L_PLAYER, "*** %s: abs %d rel %d selected %d\n", device->name, device->volume, device->relvol, OUTPUTS_DEVICE_DISPLAY_SELECTED(device));
|
||||
}
|
||||
@ -549,7 +555,7 @@ outputs_device_get(uint64_t device_id)
|
||||
{
|
||||
struct output_device *device;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (device_id == device->id)
|
||||
return device;
|
||||
@ -692,7 +698,7 @@ outputs_device_add(struct output_device *add, bool new_deselect)
|
||||
char *keep_name;
|
||||
int ret;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (device->id == add->id)
|
||||
break;
|
||||
@ -719,8 +725,8 @@ outputs_device_add(struct output_device *add, bool new_deselect)
|
||||
if (new_deselect)
|
||||
device->selected = 0;
|
||||
|
||||
device->next = output_device_list;
|
||||
output_device_list = device;
|
||||
device->next = outputs_device_list;
|
||||
outputs_device_list = device;
|
||||
}
|
||||
// Update to a device already in the list
|
||||
else
|
||||
@ -780,7 +786,7 @@ outputs_device_remove(struct output_device *remove)
|
||||
outputs_device_stop(remove, device_stop_cb);
|
||||
|
||||
prev = NULL;
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (device == remove)
|
||||
break;
|
||||
@ -799,7 +805,7 @@ outputs_device_remove(struct output_device *remove)
|
||||
DPRINTF(E_INFO, L_PLAYER, "Removing %s device '%s'; stopped advertising\n", remove->type_name, remove->name);
|
||||
|
||||
if (!prev)
|
||||
output_device_list = remove->next;
|
||||
outputs_device_list = remove->next;
|
||||
else
|
||||
prev->next = remove->next;
|
||||
|
||||
@ -1006,7 +1012,7 @@ outputs_start(output_status_cb started_cb, output_status_cb stopped_cb, bool onl
|
||||
int pending = 0;
|
||||
int ret = -1;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (device->selected)
|
||||
ret = outputs_device_start(device, started_cb, only_probe);
|
||||
@ -1029,7 +1035,7 @@ outputs_stop(output_status_cb cb)
|
||||
int pending = 0;
|
||||
int ret;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (!device->session)
|
||||
continue;
|
||||
@ -1049,7 +1055,7 @@ outputs_stop_delayed_cancel(void)
|
||||
{
|
||||
struct output_device *device;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
event_del(device->stop_timer);
|
||||
|
||||
return 0;
|
||||
@ -1062,7 +1068,7 @@ outputs_flush(output_status_cb cb)
|
||||
int pending = 0;
|
||||
int ret;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
ret = outputs_device_flush(device, cb);
|
||||
if (ret < 0)
|
||||
@ -1074,6 +1080,12 @@ outputs_flush(output_status_cb cb)
|
||||
return pending;
|
||||
}
|
||||
|
||||
int
|
||||
outputs_volume_get(void)
|
||||
{
|
||||
return outputs_master_volume;
|
||||
}
|
||||
|
||||
int
|
||||
outputs_volume_set(int volume, output_status_cb cb)
|
||||
{
|
||||
@ -1086,7 +1098,7 @@ outputs_volume_set(int volume, output_status_cb cb)
|
||||
|
||||
outputs_master_volume = volume;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
{
|
||||
if (!device->selected)
|
||||
continue;
|
||||
@ -1109,7 +1121,7 @@ outputs_sessions_count(void)
|
||||
struct output_device *device;
|
||||
int count = 0;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_device_list; device; device = device->next)
|
||||
if (device->session)
|
||||
count++;
|
||||
|
||||
@ -1175,6 +1187,12 @@ outputs_name(enum output_types type)
|
||||
return outputs[type]->name;
|
||||
}
|
||||
|
||||
struct output_device *
|
||||
outputs_list(void)
|
||||
{
|
||||
return outputs_device_list;
|
||||
}
|
||||
|
||||
int
|
||||
outputs_init(void)
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ struct output_buffer
|
||||
// holds the original, untranscoded, data (which might not have any
|
||||
// subscribers, and the last element is a zero terminator.
|
||||
struct output_data data[OUTPUTS_MAX_QUALITY_SUBSCRIPTIONS + 2];
|
||||
} output_buffer;
|
||||
};
|
||||
|
||||
struct output_definition
|
||||
{
|
||||
@ -256,9 +256,6 @@ struct output_definition
|
||||
void (*metadata_purge)(void);
|
||||
};
|
||||
|
||||
// Our main list of devices, not for use by backend modules
|
||||
struct output_device *output_device_list;
|
||||
|
||||
/* ------------------------------- General use ------------------------------ */
|
||||
|
||||
struct output_device *
|
||||
@ -283,9 +280,6 @@ outputs_cb(int callback_id, uint64_t device_id, enum output_device_state);
|
||||
|
||||
/* ---------------------------- Called by player ---------------------------- */
|
||||
|
||||
int
|
||||
outputs_master_volume;
|
||||
|
||||
// Ownership of *add is transferred, so don't address after calling. Instead you
|
||||
// can address the return value (which is not the same if the device was already
|
||||
// in the list.
|
||||
@ -343,6 +337,9 @@ outputs_stop(output_status_cb cb);
|
||||
int
|
||||
outputs_flush(output_status_cb cb);
|
||||
|
||||
int
|
||||
outputs_volume_get(void);
|
||||
|
||||
int
|
||||
outputs_volume_set(int volume, output_status_cb cb);
|
||||
|
||||
@ -367,6 +364,9 @@ outputs_priority(struct output_device *device);
|
||||
const char *
|
||||
outputs_name(enum output_types type);
|
||||
|
||||
struct output_device *
|
||||
outputs_list(void);
|
||||
|
||||
int
|
||||
outputs_init(void);
|
||||
|
||||
|
16
src/player.c
16
src/player.c
@ -1437,7 +1437,7 @@ device_auth_kickoff(void *arg, int *retval)
|
||||
struct output_device *device;
|
||||
|
||||
// First find the device requiring verification
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
if (device->type == cmdarg->auth.type && device->state == OUTPUT_STATE_PASSWORD)
|
||||
break;
|
||||
@ -1858,7 +1858,7 @@ get_status(void *arg, int *retval)
|
||||
status->consume = consume;
|
||||
status->repeat = repeat;
|
||||
|
||||
status->volume = outputs_master_volume;
|
||||
status->volume = outputs_volume_get();
|
||||
|
||||
status->plid = cur_plid;
|
||||
|
||||
@ -2055,7 +2055,7 @@ playback_start_item(void *arg, int *retval)
|
||||
DPRINTF(E_LOG, L_PLAYER, "All selected speakers failed to start\n");
|
||||
|
||||
// All selected devices failed, autoselect an unselected (if enabled)
|
||||
for (device = output_device_list; (*retval < 0) && speaker_autoselect && device; device = device->next)
|
||||
for (device = outputs_list(); (*retval < 0) && speaker_autoselect && device; device = device->next)
|
||||
{
|
||||
if (!device->selected && outputs_priority(device) != 0 && !device->session)
|
||||
*retval = outputs_device_start(device, device_activate_cb, false);
|
||||
@ -2474,7 +2474,7 @@ speaker_enumerate(void *arg, int *retval)
|
||||
struct output_device *device;
|
||||
struct player_speaker_info spk;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
device_to_speaker_info(&spk, device);
|
||||
spk_enum->cb(&spk, spk_enum->arg);
|
||||
@ -2490,7 +2490,7 @@ speaker_get_byid(void *arg, int *retval)
|
||||
struct speaker_get_param *spk_param = arg;
|
||||
struct output_device *device;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
if ((device->advertised || device->selected)
|
||||
&& device->id == spk_param->spk_id)
|
||||
@ -2512,7 +2512,7 @@ speaker_get_byactiveremote(void *arg, int *retval)
|
||||
struct speaker_get_param *spk_param = arg;
|
||||
struct output_device *device;
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
if ((uint32_t)device->id == spk_param->active_remote)
|
||||
{
|
||||
@ -2547,7 +2547,7 @@ speaker_set(void *arg, int *retval)
|
||||
|
||||
DPRINTF(E_DBG, L_PLAYER, "Speaker set: %d speakers\n", nspk);
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
for (i = 1; i <= nspk; i++)
|
||||
{
|
||||
@ -3495,7 +3495,7 @@ player(void *arg)
|
||||
|
||||
db_speaker_clear_all();
|
||||
|
||||
for (device = output_device_list; device; device = device->next)
|
||||
for (device = outputs_list(); device; device = device->next)
|
||||
{
|
||||
ret = db_speaker_save(device);
|
||||
if (ret < 0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user