generated from Justintime50/python-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial drafts of camera and disk drivers
- Loading branch information
Showing
8 changed files
with
204 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from .driver import * | ||
from .generator import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,88 @@ | ||
from abc import abstractmethod | ||
from typing import Protocol, runtime_checkable | ||
from libretro.api.camera import * | ||
|
||
from libretro.api.camera import ( | ||
retro_camera_callback, | ||
retro_camera_start_t, | ||
retro_camera_stop_t, | ||
retro_camera_lifetime_status_t, | ||
retro_camera_frame_raw_framebuffer_t, | ||
retro_camera_frame_opengl_texture_t, CameraCapabilityFlags, | ||
) | ||
|
||
|
||
@runtime_checkable | ||
class CameraDriver(Protocol): | ||
pass | ||
@abstractmethod | ||
def __init__(self): | ||
self._as_parameter_: retro_camera_callback = retro_camera_callback() | ||
self._as_parameter_.start = retro_camera_start_t(self.start) | ||
self._as_parameter_.stop = retro_camera_stop_t(self.stop) | ||
|
||
@property | ||
@abstractmethod | ||
def caps(self) -> CameraCapabilityFlags: ... | ||
|
||
@caps.setter | ||
@abstractmethod | ||
def caps(self, value: CameraCapabilityFlags) -> None: ... | ||
|
||
@abstractmethod | ||
def start(self) -> bool: ... | ||
|
||
@abstractmethod | ||
def stop(self) -> None: ... | ||
|
||
@abstractmethod | ||
def poll(self) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def width(self) -> int: ... | ||
|
||
@width.setter | ||
@abstractmethod | ||
def width(self, value: int) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def height(self) -> int: ... | ||
|
||
@height.setter | ||
@abstractmethod | ||
def height(self, value: int) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def frame_raw_framebuffer(self) -> retro_camera_frame_raw_framebuffer_t | None: ... | ||
|
||
@frame_raw_framebuffer.setter | ||
@abstractmethod | ||
def frame_raw_framebuffer(self, value: retro_camera_frame_raw_framebuffer_t) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def frame_opengl_texture(self) -> retro_camera_frame_opengl_texture_t | None: ... | ||
|
||
@frame_opengl_texture.setter | ||
@abstractmethod | ||
def frame_opengl_texture(self, value: retro_camera_frame_opengl_texture_t) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def initialized(self) -> retro_camera_lifetime_status_t | None: ... | ||
|
||
@initialized.setter | ||
@abstractmethod | ||
def initialized(self, value: retro_camera_lifetime_status_t) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def deinitialized(self) -> retro_camera_lifetime_status_t | None: ... | ||
|
||
@deinitialized.setter | ||
@abstractmethod | ||
def deinitialized(self, value: retro_camera_lifetime_status_t) -> None: ... | ||
|
||
|
||
__all__ = ["CameraDriver"] | ||
__all__ = ["CameraDriver"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from typing import override | ||
|
||
from .driver import CameraDriver | ||
from ... import retro_camera_lifetime_status_t, retro_camera_frame_raw_framebuffer_t, \ | ||
CameraCapabilityFlags, retro_camera_frame_opengl_texture_t | ||
|
||
class CameraFrame: | ||
pass | ||
# TODO: Add a buffer | ||
# TODO: Add dimensions | ||
|
||
|
||
class GeneratorCameraDriver(CameraDriver): | ||
@override | ||
def __init__(self): | ||
super().__init__() | ||
|
||
# TODO: Accept a generator for camera frames | ||
|
||
@property | ||
def caps(self) -> CameraCapabilityFlags: | ||
pass | ||
|
||
def start(self) -> bool: | ||
pass | ||
|
||
def stop(self) -> None: | ||
pass | ||
|
||
def poll(self) -> None: | ||
pass | ||
|
||
@property | ||
def width(self) -> int: | ||
pass | ||
|
||
@property | ||
def height(self) -> int: | ||
pass | ||
|
||
@property | ||
def frame_raw_framebuffer(self) -> retro_camera_frame_raw_framebuffer_t | None: | ||
pass | ||
|
||
@property | ||
def frame_opengl_texture(self) -> retro_camera_frame_opengl_texture_t | None: | ||
pass | ||
|
||
@property | ||
def initialized(self) -> retro_camera_lifetime_status_t | None: | ||
pass | ||
|
||
@property | ||
def deinitialized(self) -> retro_camera_lifetime_status_t | None: | ||
pass | ||
|
||
|
||
__all__ = [ | ||
"GeneratorCameraDriver", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .driver import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from abc import abstractmethod | ||
from typing import Protocol, runtime_checkable | ||
|
||
from libretro.api.disk import ( | ||
retro_disk_control_ext_callback, | ||
retro_disk_control_callback, | ||
) | ||
|
||
|
||
@runtime_checkable | ||
class DiskDriver(Protocol): | ||
@property | ||
@abstractmethod | ||
def version(self) -> int: ... | ||
|
||
@property | ||
@abstractmethod | ||
def callback(self) -> retro_disk_control_callback | retro_disk_control_ext_callback | None: ... | ||
|
||
@callback.setter | ||
@abstractmethod | ||
def callback(self, value: retro_disk_control_callback | retro_disk_control_ext_callback) -> None: ... | ||
|
||
@callback.deleter | ||
@abstractmethod | ||
def callback(self) -> None: ... | ||
|
||
@property | ||
@abstractmethod | ||
def eject_state(self) -> bool: ... | ||
|
||
@eject_state.setter | ||
@abstractmethod | ||
def eject_state(self, value: bool) -> None: ... | ||
|
||
|
||
__all__ = [ | ||
"DiskDriver", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters