mirror of
https://github.com/libretro/RetroArch
synced 2024-07-03 00:38:44 +00:00
Rfactor camera_driver.c to use string_list_special
This commit is contained in:
parent
08a97a4ca3
commit
415176e360
|
@ -15,10 +15,10 @@
|
|||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <string/string_list.h>
|
||||
|
||||
#include "camera_driver.h"
|
||||
#include "../general.h"
|
||||
#include "../string_list_special.h"
|
||||
|
||||
static const camera_driver_t *camera_drivers[] = {
|
||||
#ifdef HAVE_V4L2
|
||||
|
@ -80,39 +80,7 @@ const char *camera_driver_find_ident(int idx)
|
|||
**/
|
||||
const char* config_get_camera_driver_options(void)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
unsigned i;
|
||||
char *options = NULL;
|
||||
int options_len = 0;
|
||||
struct string_list *options_l = string_list_new();
|
||||
|
||||
attr.i = 0;
|
||||
|
||||
if (!options_l)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; camera_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = camera_driver_find_ident(i);
|
||||
options_len += strlen(opt) + 1;
|
||||
string_list_append(options_l, opt, attr);
|
||||
}
|
||||
|
||||
options = (char*)calloc(options_len, sizeof(char));
|
||||
|
||||
if (!options)
|
||||
{
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
string_list_join_concat(options, options_len, options_l, "|");
|
||||
|
||||
string_list_free(options_l);
|
||||
options_l = NULL;
|
||||
|
||||
return options;
|
||||
return string_list_special_new(STRING_LIST_CAMERA_DRIVERS);
|
||||
}
|
||||
|
||||
void find_camera_driver(void)
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "menu/menu_driver.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAMERA
|
||||
#include "camera/camera_driver.h"
|
||||
#endif
|
||||
|
||||
const char *string_list_special_new(enum string_list_type type)
|
||||
{
|
||||
union string_list_elem_attr attr;
|
||||
|
@ -47,6 +51,17 @@ const char *string_list_special_new(enum string_list_type type)
|
|||
string_list_append(s, opt, attr);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case STRING_LIST_CAMERA_DRIVERS:
|
||||
#ifdef HAVE_CAMERA
|
||||
for (i = 0; camera_driver_find_handle(i); i++)
|
||||
{
|
||||
const char *opt = camera_driver_find_ident(i);
|
||||
len += strlen(opt) + 1;
|
||||
|
||||
string_list_append(s, opt, attr);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case STRING_LIST_NONE:
|
||||
default:
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
enum string_list_type
|
||||
{
|
||||
STRING_LIST_NONE = 0,
|
||||
STRING_LIST_MENU_DRIVERS
|
||||
STRING_LIST_MENU_DRIVERS,
|
||||
STRING_LIST_CAMERA_DRIVERS
|
||||
};
|
||||
|
||||
const char *string_list_special_new(enum string_list_type type);
|
||||
|
|
Loading…
Reference in New Issue
Block a user