Merge remote-tracking branch 'origin/senpai' into senpai

This commit is contained in:
l1npengtul
2023-02-09 23:02:41 +09:00
5 changed files with 13 additions and 14 deletions
+1 -5
View File
@@ -14,11 +14,7 @@
* limitations under the License.
*/
use crate::{
error::NokhwaError,
frame_format::FrameFormat,
types::{FrameFormat, Resolution},
};
use crate::{error::NokhwaError, frame_format::FrameFormat, types::Resolution};
use bytes::Bytes;
use image::ImageBuffer;
+2 -1
View File
@@ -14,7 +14,8 @@
* limitations under the License.
*/
use crate::types::{ApiBackend, FrameFormat};
use crate::frame_format::FrameFormat;
use crate::types::ApiBackend;
use thiserror::Error;
/// All errors in `nokhwa`.
+4 -2
View File
@@ -1,5 +1,5 @@
use crate::frame_format::FrameFormat;
use crate::{error::NokhwaError, pixel_format::FormatDecoder};
use crate::{error::NokhwaError, pixel_format::FormatDecoders};
#[cfg(feature = "serialize")]
use serde::{Deserialize, Serialize};
use std::{
@@ -32,7 +32,9 @@ impl RequestedFormat<'_> {
/// Creates a new [`RequestedFormat`] by using the [`RequestedFormatType`] and getting the [`FrameFormat`]
/// constraints from a generic type.
#[must_use]
pub fn new<Decoder: FormatDecoder>(requested: RequestedFormatType) -> RequestedFormat<'static> {
pub fn new<Decoder: FormatDecoders>(
requested: RequestedFormatType,
) -> RequestedFormat<'static> {
RequestedFormat {
requested_format: requested,
wanted_decoder: Decoder::FORMATS,
+2 -2
View File
@@ -168,7 +168,7 @@ impl Camera {
/// This will return the new [`CameraFormat`]
/// # Errors
/// If nothing fits the requested criteria, this will return an error.
pub fn set_camera_requset(
pub fn set_camera_request(
&mut self,
request: RequestedFormat,
) -> Result<CameraFormat, NokhwaError> {
@@ -182,7 +182,7 @@ impl Camera {
Ok(new_format)
}
#[deprecated(since = "0.10.0", note = "please use `set_camera_requset` instead.")]
#[deprecated(since = "0.10.0", note = "please use `set_camera_request` instead.")]
/// Will set the current [`CameraFormat`]
/// This will reset the current stream if used while stream is opened.
///
+4 -4
View File
@@ -177,7 +177,7 @@ impl CallbackCamera {
/// This will reset the current stream if used while stream is opened.
/// # Errors
/// If you started the stream and the camera rejects the new camera format, this will return an error.
#[deprecated(since = "0.10.0", note = "please use `set_camera_requset` instead.")]
#[deprecated(since = "0.10.0", note = "please use `set_camera_request` instead.")]
pub fn set_camera_format(&mut self, new_fmt: CameraFormat) -> Result<(), NokhwaError> {
*self
.last_frame_captured
@@ -193,7 +193,7 @@ impl CallbackCamera {
.camera
.lock()
.map_err(|why| NokhwaError::GeneralError(why.to_string()))?
.set_camera_requset(request)?;
.set_camera_request(request)?;
if new_fmt != set_fmt {
return Err(NokhwaError::SetPropertyError {
property: "CameraFormat".to_string(),
@@ -212,14 +212,14 @@ impl CallbackCamera {
/// This will return the new [`CameraFormat`]
/// # Errors
/// If nothing fits the requested criteria, this will return an error.
pub fn set_camera_requset(
pub fn set_camera_request(
&mut self,
request: RequestedFormat,
) -> Result<CameraFormat, NokhwaError> {
self.camera
.lock()
.map_err(|why| NokhwaError::GeneralError(why.to_string()))?
.set_camera_requset(request)
.set_camera_request(request)
}
/// A hashmap of [`Resolution`]s mapped to framerates
/// # Errors