Implement other driver options too
This commit is contained in:
parent
195e0f2aa2
commit
ec2242db02
173
driver.c
173
driver.c
|
@ -101,6 +101,34 @@ static const audio_driver_t *audio_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_audio_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; audio_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = audio_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
static const video_driver_t *video_drivers[] = {
|
static const video_driver_t *video_drivers[] = {
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
&video_gl,
|
&video_gl,
|
||||||
|
@ -142,6 +170,34 @@ static const video_driver_t *video_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_video_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; video_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = video_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
static const input_driver_t *input_drivers[] = {
|
static const input_driver_t *input_drivers[] = {
|
||||||
#ifdef __CELLOS_LV2__
|
#ifdef __CELLOS_LV2__
|
||||||
&input_ps3,
|
&input_ps3,
|
||||||
|
@ -190,11 +246,6 @@ static const input_driver_t *input_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* JM: This is a very painful function to write,
|
|
||||||
* especially because we'll have to do it to all
|
|
||||||
* the drivers.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char* config_get_input_driver_options(void)
|
const char* config_get_input_driver_options(void)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
|
@ -231,6 +282,34 @@ static const input_osk_driver_t *osk_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_osk_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; osk_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = osk_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
static const camera_driver_t *camera_drivers[] = {
|
static const camera_driver_t *camera_drivers[] = {
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
&camera_v4l2,
|
&camera_v4l2,
|
||||||
|
@ -248,6 +327,34 @@ static const camera_driver_t *camera_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_camera_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; camera_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = camera_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
static const location_driver_t *location_drivers[] = {
|
static const location_driver_t *location_drivers[] = {
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
&location_android,
|
&location_android,
|
||||||
|
@ -261,6 +368,34 @@ static const location_driver_t *location_drivers[] = {
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_location_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; location_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = location_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||||
#ifdef IOS
|
#ifdef IOS
|
||||||
|
@ -286,6 +421,34 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char* config_get_menu_driver_options(void)
|
||||||
|
{
|
||||||
|
union string_list_elem_attr attr;
|
||||||
|
char *options = NULL;
|
||||||
|
int option_k = 0;
|
||||||
|
int options_len = 0;
|
||||||
|
struct string_list *options_l = NULL;
|
||||||
|
|
||||||
|
attr.i = 0;
|
||||||
|
options_l = (struct string_list*)string_list_new();
|
||||||
|
|
||||||
|
for (option_k = 0; menu_ctx_drivers[option_k]; option_k++)
|
||||||
|
{
|
||||||
|
const char *opt = menu_ctx_drivers[option_k]->ident;
|
||||||
|
options_len += strlen(opt) + 1;
|
||||||
|
string_list_append(options_l, opt, attr);
|
||||||
|
}
|
||||||
|
|
||||||
|
options = (char*)calloc(options_len, sizeof(char));
|
||||||
|
|
||||||
|
string_list_join_concat(options, options_len, options_l, "|");
|
||||||
|
|
||||||
|
string_list_free(options_l);
|
||||||
|
options_l = NULL;
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const void *find_driver_nonempty(const char *label, int i,
|
static const void *find_driver_nonempty(const char *label, int i,
|
||||||
|
|
8
driver.h
8
driver.h
|
@ -676,6 +676,14 @@ extern input_driver_t input_rwebinput;
|
||||||
extern input_driver_t input_null;
|
extern input_driver_t input_null;
|
||||||
|
|
||||||
const char* config_get_input_driver_options(void);
|
const char* config_get_input_driver_options(void);
|
||||||
|
const char* config_get_camera_driver_options(void);
|
||||||
|
const char* config_get_video_driver_options(void);
|
||||||
|
const char* config_get_audio_driver_options(void);
|
||||||
|
const char* config_get_osk_driver_options(void);
|
||||||
|
const char* config_get_location_driver_options(void);
|
||||||
|
#ifdef HAVE_MENU
|
||||||
|
const char* config_get_menu_driver_options(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
extern camera_driver_t camera_v4l2;
|
extern camera_driver_t camera_v4l2;
|
||||||
extern camera_driver_t camera_android;
|
extern camera_driver_t camera_android;
|
||||||
|
|
|
@ -2991,11 +2991,12 @@ static bool setting_data_append_list_driver_options(
|
||||||
NULL);
|
NULL);
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||||
|
|
||||||
CONFIG_STRING(
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.video.driver,
|
g_settings.video.driver,
|
||||||
"video_driver",
|
"video_driver",
|
||||||
"Video Driver",
|
"Video Driver",
|
||||||
config_get_default_video(),
|
config_get_default_video(),
|
||||||
|
config_get_video_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -3012,11 +3013,13 @@ static bool setting_data_append_list_driver_options(
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||||
CONFIG_STRING(
|
|
||||||
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.audio.driver,
|
g_settings.audio.driver,
|
||||||
"audio_driver",
|
"audio_driver",
|
||||||
"Audio Driver",
|
"Audio Driver",
|
||||||
config_get_default_audio(),
|
config_get_default_audio(),
|
||||||
|
config_get_audio_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -3034,22 +3037,24 @@ static bool setting_data_append_list_driver_options(
|
||||||
NULL);
|
NULL);
|
||||||
(*list)[list_info->index - 1].action_toggle = &setting_data_string_action_toggle_audio_resampler;
|
(*list)[list_info->index - 1].action_toggle = &setting_data_string_action_toggle_audio_resampler;
|
||||||
|
|
||||||
CONFIG_STRING(
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.camera.driver,
|
g_settings.camera.driver,
|
||||||
"camera_driver",
|
"camera_driver",
|
||||||
"Camera Driver",
|
"Camera Driver",
|
||||||
config_get_default_camera(),
|
config_get_default_camera(),
|
||||||
|
config_get_camera_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||||
|
|
||||||
CONFIG_STRING(
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.location.driver,
|
g_settings.location.driver,
|
||||||
"location_driver",
|
"location_driver",
|
||||||
"Location Driver",
|
"Location Driver",
|
||||||
config_get_default_location(),
|
config_get_default_location(),
|
||||||
|
config_get_location_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -3057,11 +3062,12 @@ static bool setting_data_append_list_driver_options(
|
||||||
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
settings_data_list_current_add_flags(list, list_info, SD_FLAG_IS_DRIVER);
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
CONFIG_STRING(
|
CONFIG_STRING_OPTIONS(
|
||||||
g_settings.menu.driver,
|
g_settings.menu.driver,
|
||||||
"menu_driver",
|
"menu_driver",
|
||||||
"Menu Driver",
|
"Menu Driver",
|
||||||
config_get_default_menu(),
|
config_get_default_menu(),
|
||||||
|
config_get_menu_driver_options(),
|
||||||
group_info.name,
|
group_info.name,
|
||||||
subgroup_info.name,
|
subgroup_info.name,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
Loading…
Reference in New Issue