mirror of
https://github.com/libretro/RetroArch
synced 2024-07-05 09:48:42 +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.h>
|
||||||
#include <string/string_list.h>
|
|
||||||
|
|
||||||
#include "camera_driver.h"
|
#include "camera_driver.h"
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
#include "../string_list_special.h"
|
||||||
|
|
||||||
static const camera_driver_t *camera_drivers[] = {
|
static const camera_driver_t *camera_drivers[] = {
|
||||||
#ifdef HAVE_V4L2
|
#ifdef HAVE_V4L2
|
||||||
|
@ -80,39 +80,7 @@ const char *camera_driver_find_ident(int idx)
|
||||||
**/
|
**/
|
||||||
const char* config_get_camera_driver_options(void)
|
const char* config_get_camera_driver_options(void)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
return string_list_special_new(STRING_LIST_CAMERA_DRIVERS);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void find_camera_driver(void)
|
void find_camera_driver(void)
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#include "menu/menu_driver.h"
|
#include "menu/menu_driver.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_CAMERA
|
||||||
|
#include "camera/camera_driver.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *string_list_special_new(enum string_list_type type)
|
const char *string_list_special_new(enum string_list_type type)
|
||||||
{
|
{
|
||||||
union string_list_elem_attr attr;
|
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);
|
string_list_append(s, opt, attr);
|
||||||
}
|
}
|
||||||
break;
|
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
|
#endif
|
||||||
case STRING_LIST_NONE:
|
case STRING_LIST_NONE:
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -19,7 +19,8 @@
|
||||||
enum string_list_type
|
enum string_list_type
|
||||||
{
|
{
|
||||||
STRING_LIST_NONE = 0,
|
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);
|
const char *string_list_special_new(enum string_list_type type);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user