Commit 12ed9e51 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

win32: convert clock sources to list

No needs for a callback.
parent e9b64c1d
......@@ -1147,6 +1147,25 @@ static const char *const ppsz_prefres[] = {
"all the processor time and render the whole system unresponsive which " \
"might require a reboot of your machine.")
#define CLOCK_SOURCE_TEXT N_("Clock source")
#ifdef _WIN32
static const char *const clock_sources[] = {
"", "interrupt", "tick",
#if !VLC_WINSTORE_APP
"multimedia",
#endif
"perf", "wall",
};
static const char *const clock_sources_text[] = {
N_("Auto"), "Interrupt time", "Windows time",
#if !VLC_WINSTORE_APP
"Multimedia timers",
#endif
"Performance counters", "System time (DANGEROUS!)",
};
#endif
#define PLAYLISTENQUEUE_TEXT N_( \
"Enqueue items into playlist in one instance mode")
#define PLAYLISTENQUEUE_LONGTEXT N_( \
......@@ -2139,10 +2158,9 @@ vlc_module_begin ()
HPRIORITY_LONGTEXT, false )
#endif
#define CLOCK_SOURCE_TEXT N_("Clock source")
#ifdef _WIN32
add_string( "clock-source", NULL, CLOCK_SOURCE_TEXT, CLOCK_SOURCE_TEXT, true )
change_string_cb( EnumClockSource )
change_string_list( clock_sources, clock_sources_text )
#endif
/* Playlist options */
......
......@@ -37,9 +37,6 @@ void system_Init ( void );
void system_Configure ( libvlc_int_t *, int, const char *const [] );
#if defined(_WIN32) || defined(__OS2__)
void system_End(void);
#ifndef __OS2__
int EnumClockSource( const char *, char ***, char *** );
#endif
#endif
void vlc_CPU_dump(vlc_object_t *);
......
......@@ -884,72 +884,6 @@ static BOOL SelectClockSource(void *data)
return TRUE;
}
int EnumClockSource(const char *var, char ***vp, char ***np)
{
const size_t max = 6;
char **values = malloc (sizeof (*values) * max);
char **names = malloc (sizeof (*names) * max);
if (!values || !names)
{
free(values);
free(names);
*vp = NULL;
*np = NULL;
return -1;
}
int n = 0;
values[n] = strdup ("");
names[n] = strdup (_("Auto"));
if (!values[n] || !names[n])
goto error;
n++;
values[n] = strdup ("interrupt");
names[n] = strdup ("Interrupt time");
if (!values[n] || !names[n])
goto error;
n++;
values[n] = strdup ("tick");
names[n] = strdup ("Windows time");
if (!values[n] || !names[n])
goto error;
n++;
#if !VLC_WINSTORE_APP
values[n] = strdup ("multimedia");
names[n] = strdup ("Multimedia timers");
if (!values[n] || !names[n])
goto error;
n++;
#endif
values[n] = strdup ("perf");
names[n] = strdup ("Performance counters");
if (!values[n] || !names[n])
goto error;
n++;
values[n] = strdup ("wall");
names[n] = strdup ("System time (DANGEROUS!)");
if (!values[n] || !names[n])
goto error;
n++;
*vp = values;
*np = names;
(void) var;
return n;
error:
for (int i = 0; i <= n; ++i)
{
free (values[i]);
free (names[i]);
}
free( values );
free( names);
*vp = NULL;
*np = NULL;
return -1;
}
/*** CPU ***/
unsigned vlc_GetCPUCount (void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment