mirror of
https://github.com/libretro/RetroArch
synced 2025-02-05 15:40:04 +00:00
Add RETRO_ENVIRONMENT_SET_CAMERA_RETRIEVE
This commit is contained in:
parent
d662357999
commit
c107b06a76
@ -749,6 +749,21 @@ static bool v4l_ready(void *data, unsigned *width, unsigned *height)
|
|||||||
return v4l->ready;
|
return v4l->ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static uint64_t v4l_set_capabilities(void *data, uint64_t state)
|
||||||
|
{
|
||||||
|
(void)data;
|
||||||
|
uint64_t ret = 0;
|
||||||
|
|
||||||
|
//FIXME - set when driver supports this
|
||||||
|
//if (state & (1 << RETRO_CAMERA_RECV_GL_TEXTURE))
|
||||||
|
//ret |= (1 << RETRO_CAMERA_RECV_GL_TEXTURE);
|
||||||
|
|
||||||
|
if (state & (1 << RETRO_CAMERA_RECV_RAW_FRAMEBUFFER))
|
||||||
|
ret |= (1 << RETRO_CAMERA_RECV_RAW_FRAMEBUFFER);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
const camera_driver_t camera_v4l2 = {
|
const camera_driver_t camera_v4l2 = {
|
||||||
v4l_init,
|
v4l_init,
|
||||||
v4l_free,
|
v4l_free,
|
||||||
@ -757,5 +772,6 @@ const camera_driver_t camera_v4l2 = {
|
|||||||
v4l_ready,
|
v4l_ready,
|
||||||
v4l_texture_image_2d,
|
v4l_texture_image_2d,
|
||||||
v4l_texture_subimage_2d,
|
v4l_texture_subimage_2d,
|
||||||
|
v4l_set_capabilities,
|
||||||
"video4linux2",
|
"video4linux2",
|
||||||
};
|
};
|
||||||
|
1
driver.h
1
driver.h
@ -342,6 +342,7 @@ typedef struct camera_driver
|
|||||||
bool (*ready)(void *data, unsigned *width, unsigned *height);
|
bool (*ready)(void *data, unsigned *width, unsigned *height);
|
||||||
void (*texture_image_2d)(void *data);
|
void (*texture_image_2d)(void *data);
|
||||||
void (*texture_subimage_2d)(void *data);
|
void (*texture_subimage_2d)(void *data);
|
||||||
|
uint64_t (*set_capabilities)(void *data, uint64_t mask);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
} camera_driver_t;
|
} camera_driver_t;
|
||||||
|
|
||||||
|
14
dynamic.c
14
dynamic.c
@ -783,6 +783,20 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case RETRO_ENVIRONMENT_SET_CAMERA_RETRIEVE:
|
||||||
|
{
|
||||||
|
#ifdef HAVE_CAMERA
|
||||||
|
RARCH_LOG("Environ SET_CAMERA_RETRIEVE.\n");
|
||||||
|
uint64_t *mask_ptr = (uint64_t*)data;
|
||||||
|
uint64_t mask = *mask_ptr;
|
||||||
|
if (driver.camera)
|
||||||
|
*mask_ptr = driver.camera->set_capabilities(driver.camera_data, mask);
|
||||||
|
else
|
||||||
|
*mask_ptr = 0;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Private extensions for internal use, not part of libretro API.
|
// Private extensions for internal use, not part of libretro API.
|
||||||
case RETRO_ENVIRONMENT_SET_LIBRETRO_PATH:
|
case RETRO_ENVIRONMENT_SET_LIBRETRO_PATH:
|
||||||
RARCH_LOG("Environ (Private) SET_LIBRETRO_PATH.\n");
|
RARCH_LOG("Environ (Private) SET_LIBRETRO_PATH.\n");
|
||||||
|
14
libretro.h
14
libretro.h
@ -541,6 +541,12 @@ enum retro_mod
|
|||||||
// The purpose of this interface is to allow
|
// The purpose of this interface is to allow
|
||||||
// setting state related to sensors such as polling rate, enabling/disable it entirely, etc.
|
// setting state related to sensors such as polling rate, enabling/disable it entirely, etc.
|
||||||
// Reading sensor state is done via the normal input_state_callback API.
|
// Reading sensor state is done via the normal input_state_callback API.
|
||||||
|
#define RETRO_ENVIRONMENT_SET_CAMERA_RETRIEVE (26 | RETRO_ENVIRONMENT_EXPERIMENTAL)
|
||||||
|
// uint64_t * --
|
||||||
|
// Sends a bitmask value to the camera driver, telling it which receive modes are expected to be handled by the
|
||||||
|
// camera interface._
|
||||||
|
// Example bitmask: caps = (1 << RETRO_CAMERA_RECV_GL_TEXTURE) | (1 << RETRO_CAMERA_RECV_RAW_FRAMEBUFFER).
|
||||||
|
// Returns a bitmask value that tells which camera retrieval modes have been set by the driver.
|
||||||
|
|
||||||
// FIXME: Document the sensor API and work out behavior.
|
// FIXME: Document the sensor API and work out behavior.
|
||||||
// It will be marked as experimental until then.
|
// It will be marked as experimental until then.
|
||||||
@ -552,6 +558,14 @@ enum retro_sensor_action
|
|||||||
RETRO_SENSOR_DUMMY = INT_MAX
|
RETRO_SENSOR_DUMMY = INT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum retro_camera_mode
|
||||||
|
{
|
||||||
|
RETRO_CAMERA_RECV_GL_TEXTURE = 0,
|
||||||
|
RETRO_CAMERA_RECV_RAW_FRAMEBUFFER,
|
||||||
|
|
||||||
|
RETRO_CAMERA_DUMMY = INT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
typedef bool (*retro_set_sensor_state_t)(unsigned port, enum retro_sensor_action action, unsigned rate);
|
typedef bool (*retro_set_sensor_state_t)(unsigned port, enum retro_sensor_action action, unsigned rate);
|
||||||
struct retro_sensor_interface
|
struct retro_sensor_interface
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user