mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-30 15:08:31 +00:00
Renamed CameraDevice to Camera
This is consistent with the rest of the SDL API
This commit is contained in:
@@ -88,7 +88,7 @@ static int xioctl(int fh, int request, void *arg)
|
||||
return r;
|
||||
}
|
||||
|
||||
static int V4L2_WaitDevice(SDL_CameraDevice *device)
|
||||
static int V4L2_WaitDevice(SDL_Camera *device)
|
||||
{
|
||||
const int fd = device->hidden->fd;
|
||||
|
||||
@@ -118,7 +118,7 @@ static int V4L2_WaitDevice(SDL_CameraDevice *device)
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int V4L2_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *frame, Uint64 *timestampNS)
|
||||
static int V4L2_AcquireFrame(SDL_Camera *device, SDL_Surface *frame, Uint64 *timestampNS)
|
||||
{
|
||||
const int fd = device->hidden->fd;
|
||||
const io_method io = device->hidden->io;
|
||||
@@ -232,7 +232,7 @@ static int V4L2_AcquireFrame(SDL_CameraDevice *device, SDL_Surface *frame, Uint6
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void V4L2_ReleaseFrame(SDL_CameraDevice *device, SDL_Surface *frame)
|
||||
static void V4L2_ReleaseFrame(SDL_Camera *device, SDL_Surface *frame)
|
||||
{
|
||||
struct v4l2_buffer buf;
|
||||
const int fd = device->hidden->fd;
|
||||
@@ -289,7 +289,7 @@ static void V4L2_ReleaseFrame(SDL_CameraDevice *device, SDL_Surface *frame)
|
||||
}
|
||||
}
|
||||
|
||||
static int EnqueueBuffers(SDL_CameraDevice *device)
|
||||
static int EnqueueBuffers(SDL_Camera *device)
|
||||
{
|
||||
const int fd = device->hidden->fd;
|
||||
const io_method io = device->hidden->io;
|
||||
@@ -338,14 +338,14 @@ static int EnqueueBuffers(SDL_CameraDevice *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int AllocBufferRead(SDL_CameraDevice *device, size_t buffer_size)
|
||||
static int AllocBufferRead(SDL_Camera *device, size_t buffer_size)
|
||||
{
|
||||
device->hidden->buffers[0].length = buffer_size;
|
||||
device->hidden->buffers[0].start = SDL_calloc(1, buffer_size);
|
||||
return device->hidden->buffers[0].start ? 0 : -1;
|
||||
}
|
||||
|
||||
static int AllocBufferMmap(SDL_CameraDevice *device)
|
||||
static int AllocBufferMmap(SDL_Camera *device)
|
||||
{
|
||||
const int fd = device->hidden->fd;
|
||||
int i;
|
||||
@@ -377,7 +377,7 @@ static int AllocBufferMmap(SDL_CameraDevice *device)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int AllocBufferUserPtr(SDL_CameraDevice *device, size_t buffer_size)
|
||||
static int AllocBufferUserPtr(SDL_Camera *device, size_t buffer_size)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < device->hidden->nb_buffers; ++i) {
|
||||
@@ -419,7 +419,7 @@ static Uint32 format_sdl_to_v4l2(SDL_PixelFormat fmt)
|
||||
}
|
||||
}
|
||||
|
||||
static void V4L2_CloseDevice(SDL_CameraDevice *device)
|
||||
static void V4L2_CloseDevice(SDL_Camera *device)
|
||||
{
|
||||
if (!device) {
|
||||
return;
|
||||
@@ -470,7 +470,7 @@ static void V4L2_CloseDevice(SDL_CameraDevice *device)
|
||||
}
|
||||
}
|
||||
|
||||
static int V4L2_OpenDevice(SDL_CameraDevice *device, const SDL_CameraSpec *spec)
|
||||
static int V4L2_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec)
|
||||
{
|
||||
const V4L2DeviceHandle *handle = (const V4L2DeviceHandle *) device->handle;
|
||||
struct stat st;
|
||||
@@ -634,12 +634,12 @@ static int V4L2_OpenDevice(SDL_CameraDevice *device, const SDL_CameraSpec *spec)
|
||||
}
|
||||
|
||||
// Currently there is no user permission prompt for camera access, but maybe there will be a D-Bus portal interface at some point.
|
||||
SDL_CameraDevicePermissionOutcome(device, SDL_TRUE);
|
||||
SDL_CameraPermissionOutcome(device, SDL_TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SDL_bool FindV4L2CameraDeviceByBusInfoCallback(SDL_CameraDevice *device, void *userdata)
|
||||
static SDL_bool FindV4L2CameraByBusInfoCallback(SDL_Camera *device, void *userdata)
|
||||
{
|
||||
const V4L2DeviceHandle *handle = (const V4L2DeviceHandle *) device->handle;
|
||||
return (SDL_strcmp(handle->bus_info, (const char *) userdata) == 0);
|
||||
@@ -713,7 +713,7 @@ static void MaybeAddDevice(const char *path)
|
||||
} else if ((vcap.device_caps & V4L2_CAP_VIDEO_CAPTURE) == 0) {
|
||||
close(fd);
|
||||
return; // not a video capture device.
|
||||
} else if (SDL_FindPhysicalCameraDeviceByCallback(FindV4L2CameraDeviceByBusInfoCallback, vcap.bus_info)) {
|
||||
} else if (SDL_FindPhysicalCameraByCallback(FindV4L2CameraByBusInfoCallback, vcap.bus_info)) {
|
||||
close(fd);
|
||||
return; // already have it.
|
||||
}
|
||||
@@ -795,7 +795,7 @@ static void MaybeAddDevice(const char *path)
|
||||
if (handle->path) {
|
||||
handle->bus_info = SDL_strdup((char *)vcap.bus_info);
|
||||
if (handle->bus_info) {
|
||||
if (SDL_AddCameraDevice((const char *) vcap.card, SDL_CAMERA_POSITION_UNKNOWN, add_data.num_specs, add_data.specs, handle)) {
|
||||
if (SDL_AddCamera((const char *) vcap.card, SDL_CAMERA_POSITION_UNKNOWN, add_data.num_specs, add_data.specs, handle)) {
|
||||
SDL_free(add_data.specs);
|
||||
return; // good to go.
|
||||
}
|
||||
@@ -809,7 +809,7 @@ static void MaybeAddDevice(const char *path)
|
||||
SDL_free(add_data.specs);
|
||||
}
|
||||
|
||||
static void V4L2_FreeDeviceHandle(SDL_CameraDevice *device)
|
||||
static void V4L2_FreeDeviceHandle(SDL_Camera *device)
|
||||
{
|
||||
if (device) {
|
||||
V4L2DeviceHandle *handle = (V4L2DeviceHandle *) device->handle;
|
||||
@@ -820,7 +820,7 @@ static void V4L2_FreeDeviceHandle(SDL_CameraDevice *device)
|
||||
}
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
static SDL_bool FindV4L2CameraDeviceByPathCallback(SDL_CameraDevice *device, void *userdata)
|
||||
static SDL_bool FindV4L2CameraByPathCallback(SDL_Camera *device, void *userdata)
|
||||
{
|
||||
const V4L2DeviceHandle *handle = (const V4L2DeviceHandle *) device->handle;
|
||||
return (SDL_strcmp(handle->path, (const char *) userdata) == 0);
|
||||
@@ -829,7 +829,7 @@ static SDL_bool FindV4L2CameraDeviceByPathCallback(SDL_CameraDevice *device, voi
|
||||
static void MaybeRemoveDevice(const char *path)
|
||||
{
|
||||
if (path) {
|
||||
SDL_CameraDeviceDisconnected(SDL_FindPhysicalCameraDeviceByCallback(FindV4L2CameraDeviceByPathCallback, (void *) path));
|
||||
SDL_CameraDisconnected(SDL_FindPhysicalCameraByCallback(FindV4L2CameraByPathCallback, (void *) path));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user