static void get_song(void)
{
- char **sl = dblist[mmd->dbt_num].get_audio_file_list(10);
+ char **sl = dblist[mmd->selector_num].get_audio_file_list(10);
int i;
if (!sl)
continue;
}
mmd->num_played++;
- if (dblist[mmd->dbt_num].update_audio_file)
- dblist[mmd->dbt_num].update_audio_file(sl[i]);
+ if (dblist[mmd->selector_num].update_audio_file)
+ dblist[mmd->selector_num].update_audio_file(sl[i]);
PARA_DEBUG_LOG("%s", "success\n");
mmd->new_afs_status_flags &= (~AFS_NEXT);
gettimeofday(&now, NULL);
status_item_list[SI_STATUS_BAR], bar ? bar : "(none)",
status_item_list[SI_STATUS], status,
status_item_list[SI_STATUS_FLAGS], flags,
- status_item_list[SI_SELECTOR], dblist[nmmd->dbt_num].name,
+ status_item_list[SI_SELECTOR], dblist[nmmd->selector_num].name,
status_item_list[SI_OFFSET], offset,
status_item_list[SI_FORMAT], audio_format_name(nmmd->audio_format),
/* not found, look for commands supported by the current selector */
mmd_lock();
if (handler)
- *handler = make_message("the %s selector", dblist[mmd->dbt_num].name);
- cmd = dblist[mmd->dbt_num].cmd_list;
+ *handler = make_message("the %s selector",
+ dblist[mmd->selector_num].name);
+ cmd = dblist[mmd->selector_num].cmd_list;
mmd_unlock();
for (; cmd->name; cmd++)
if (!strcmp(cmd->name, name))
if ((ret = send_description(fd, cmd_struct, "server", 0)) < 0)
return ret;
mmd_lock();
- handler = para_strdup(dblist[mmd->dbt_num].name);
- cmd = dblist[mmd->dbt_num].cmd_list;
+ handler = para_strdup(dblist[mmd->selector_num].name);
+ cmd = dblist[mmd->selector_num].cmd_list;
mmd_unlock();
ret = send_description(fd, cmd, handler, 0);
free(handler);
if (!argc) {
char *selector;
mmd_lock();
- selector = para_strdup(dblist[mmd->dbt_num].name);
+ selector = para_strdup(dblist[mmd->selector_num].name);
mmd_unlock();
ret = send_va_buffer(fd, "%s\n", selector);
free(selector);
goto err_out;
mmd_mutex = ret;
- mmd->dbt_num = 0;
+ mmd->selector_num = 0;
mmd->num_played = 0;
mmd->num_commands = 0;
mmd->events = 0;
PARA_WARNING_LOG("%s", PARA_STRERROR(-ret));
break;
}
- mmd->dbt_num = i;
+ mmd->selector_num = i;
return;
}
PARA_WARNING_LOG("%s", "falling back to the random selector\n");
random:
- mmd->dbt_num = 0;
+ mmd->selector_num = 0;
dblist[0].init(&dblist[0]); /* always successful */
}
static void handle_dbt_change(void)
{
- int ret, old = mmd->dbt_num, new = mmd->dbt_change;
+ int ret, old = mmd->selector_num, new = mmd->dbt_change;
dblist[old].shutdown();
ret = dblist[new].init(&dblist[new]);
mmd->dbt_change = -1; /* reset */
if (ret >= 0) {
- mmd->dbt_num = new;
+ mmd->selector_num = new;
return;
}
/* init failed */
PARA_ERROR_LOG("%s -- switching to the random selector\n", PARA_STRERROR(-ret));
dblist[0].init(&dblist[0]);
- mmd->dbt_num = 0;
+ mmd->selector_num = 0;
}
/*
close_log(logfile); /* gets reopened if necessary by parse_config */
logfile = NULL;
parse_config(1); /* reopens log */
- mmd->dbt_change = mmd->dbt_num; /* do not change selector */
+ mmd->dbt_change = mmd->selector_num; /* do not change selector */
handle_dbt_change(); /* reload selector */
}
&max_fileno,
&rfds, &wfds);
}
- if (dblist[mmd->dbt_num].pre_select) {
- ret = dblist[mmd->dbt_num].pre_select(&rfds, &wfds);
+ if (dblist[mmd->selector_num].pre_select) {
+ ret = dblist[mmd->selector_num].pre_select(&rfds, &wfds);
max_fileno = MAX(max_fileno, ret);
}
mmd_unlock();
mmd_lock();
if (mmd->dbt_change >= 0)
handle_dbt_change();
- if (dblist[mmd->dbt_num].post_select)
- dblist[mmd->dbt_num].post_select(&rfds, &wfds);
+ if (dblist[mmd->selector_num].post_select)
+ dblist[mmd->selector_num].post_select(&rfds, &wfds);
if (ret < 0 && err == EINTR)
goto repeat;
if (ret < 0) {
case SIGTERM:
PARA_EMERG_LOG("terminating on signal %d\n", sig);
kill(0, SIGTERM);
- dblist[mmd->dbt_num].shutdown();
+ dblist[mmd->selector_num].shutdown();
mutex_destroy(mmd_mutex);
shm_detach(mmd);
shm_destroy(mmd_shm_id);
/** a string that gets filled in by the current audio file selector */
char selector_info[MMD_INFO_SIZE];
/** the number if the current database tool */
- int dbt_num;
+ int selector_num;
/** commands set this to non-zero to request a database tool change */
int dbt_change;
/** used by the sender command */