libretro.api.camera¶
Interface and types for providing video input to a Core.
See also
CameraDriverThe protocol that uses these types to implement camera support in libretro.py.
libretro.drivers.cameralibretro.py’s included
CameraDriverimplementations.
Module Attributes
Start the camera. |
|
Stop the running camera. |
|
Notify the core that the camera driver has been initialized or deinitialized. |
|
Deliver a new camera frame as a raw pixel buffer. |
|
Deliver a new camera frame as an OpenGL texture. |
Classes
Denotes camera features requested by the |
|
Bitmask of supported camera driver features. |
|
Interface between the core and the |
- retro_camera_start_t¶
Start the camera.
Called by the core to begin receiving camera frames from the frontend. Cameras are disabled by default and must be explicitly started.
- Returns:
Trueif the camera was successfully started,Falseif no camera is available or the frontend lacks permission to access it.
Corresponds to
retro_camera_start_tinlibretro.h.
- retro_camera_stop_t¶
Stop the running camera.
Called by the core to halt the delivery of camera frames.
Corresponds to
retro_camera_stop_tinlibretro.h.
- retro_camera_lifetime_status_t¶
Notify the core that the camera driver has been initialized or deinitialized.
Registered by the core and called by the frontend right after the camera driver is initialized, or right before it is deinitialized.
Corresponds to
retro_camera_lifetime_status_tinlibretro.h.
- retro_camera_frame_raw_framebuffer_t¶
Deliver a new camera frame as a raw pixel buffer.
Registered by the core and called by the frontend when a new camera frame is available in system memory, with the top-left corner of the image as the first pixel.
- Parameters:
buffer – Pointer to the camera’s most recent video frame, with one
XRGB8888pixel peruint32_t.width – Width of the frame, in pixels.
height – Height of the frame, in pixels.
pitch – Length of one row in
buffer, in bytes.
Warning
buffermay be invalidated when this function returns, so the core should make its own copy if it needs to retain the data.Corresponds to
retro_camera_frame_raw_framebuffer_tinlibretro.h.
- retro_camera_frame_opengl_texture_t¶
Deliver a new camera frame as an OpenGL texture.
Registered by the core and called by the frontend when a new camera frame is available as a frontend-owned OpenGL texture.
- Parameters:
texture_id – ID of the OpenGL texture that holds the frame. Owned by the frontend; the core must not modify it.
texture_target – OpenGL texture target type (e.g.
GL_TEXTURE_2DorGL_TEXTURE_RECTANGLE).affine – Pointer to a 3x3 column-major affine matrix that maps pixel coordinates to texture coordinates.
Warning
texture_idandaffinemay be invalidated when this function returns, so the core should make its own copy if it needs to retain them.Corresponds to
retro_camera_frame_opengl_texture_tinlibretro.h.
- class retro_camera_callback[source]¶
Bases:
StructureInterface between the core and the
CameraDriver.Corresponds to
retro_camera_callbackinlibretro.h.- caps¶
Bitmask of requested
CameraCapabilities.Assigned values will be bitwise-masked to fit into a
uint64_t.See also
- width¶
The core’s requested width of the camera frame in pixels.
0means that theCameraDrivershould choose the width.Assigned values will be bitwise-masked to fit into an unsigned int.
See also
- height¶
The core’s requested height of the camera frame in pixels.
0means that theCameraDrivershould choose the height.Assigned values will be bitwise-masked to fit into an unsigned int.
See also
- __init__(*args, **kwargs)¶
- classmethod __new__(*args, **kwargs)¶
- frame_raw_framebuffer¶
Called by the
CameraDriverwhen it produces a frame backed by a raw framebuffer. Set by theCore.See also
- frame_opengl_texture¶
Called by the
CameraDriverwhen it produces a frame backed by an OpenGL texture. Set by theCore.See also
- initialized¶
Called by the
CameraDriverafter it’s initialized. Set by theCore. Optional.See also
- deinitialized¶
Called by the
CameraDriverbefore it’s deinitialized. Set by theCore. Optional.See also
- __deepcopy__(_)[source]¶
Return a deep copy of this object. Intended for use with
copy.deepcopy().>>> import copy >>> from libretro.api import retro_camera_callback >>> cb = retro_camera_callback(caps=1, width=640, height=480) >>> cb2 = copy.deepcopy(cb) >>> cb == cb2 True >>> cb is cb2 False
- class CameraCapabilities[source]¶
Bases:
IntEnumDenotes camera features requested by the
Coreand/or supported by theCameraDriver.Corresponds to
retro_camera_buffer.- OPENGL_TEXTURE = 0¶
- RAW_FRAMEBUFFER = 1¶
- flag()[source]¶
Return this capability as a bitmask flag.
Equivalent to
1 << self.value.- Return type:
>>> from libretro.api import CameraCapabilities >>> CameraCapabilities.OPENGL_TEXTURE.flag() 1
- __new__(value)¶
- classmethod value in self¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members. 3) value is a pseudo-member (flags)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶
- classmethod iter(self)¶
Return members in definition order.
- classmethod len(self)¶
Return the number of members (no aliases)
- class CameraCapabilityFlags[source]¶
Bases:
IntFlagBitmask of supported camera driver features.
>>> from libretro.api import CameraCapabilityFlags >>> CameraCapabilityFlags.RAW_FRAMEBUFFER | CameraCapabilityFlags.OPENGL_TEXTURE <CameraCapabilityFlags.RAW_FRAMEBUFFER|OPENGL_TEXTURE: 3>
- OPENGL_TEXTURE = 1¶
- RAW_FRAMEBUFFER = 2¶
- __new__(value)¶
- other in self¶
Returns True if self has at least the same flags set as other.
- iter(self)¶
Returns flags in definition order.
- len(self)¶
Return the number of members (no aliases)
- classmethod self[name]¶
Return the member matching name.
- __init__()¶