mirror of
https://github.com/l1npengtul/nokhwa.git
synced 2026-07-04 10:37:26 +00:00
add GRAY8 to AVFourCC, bump macos to 0.1.2
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[package]
|
||||
name = "nokhwa-bindings-macos"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
edition = "2018"
|
||||
authors = ["l1npengtul"]
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/l1npengtul/nokhwa"
|
||||
|
||||
@@ -242,9 +242,9 @@ pub mod avfoundation {
|
||||
use block::ConcreteBlock;
|
||||
use cocoa_foundation::foundation::{NSArray, NSInteger, NSString, NSUInteger};
|
||||
use core_media_sys::{
|
||||
kCMPixelFormat_422YpCbCr8_yuvs, kCMVideoCodecType_422YpCbCr8, kCMVideoCodecType_JPEG,
|
||||
kCMVideoCodecType_JPEG_OpenDML, CMFormatDescriptionGetMediaSubType, CMSampleBufferRef,
|
||||
CMVideoDimensions,
|
||||
kCMPixelFormat_422YpCbCr8_yuvs, kCMPixelFormat_8IndexedGray_WhiteIsZero,
|
||||
kCMVideoCodecType_422YpCbCr8, kCMVideoCodecType_JPEG, kCMVideoCodecType_JPEG_OpenDML,
|
||||
CMFormatDescriptionGetMediaSubType, CMSampleBufferRef, CMVideoDimensions,
|
||||
};
|
||||
use dashmap::DashMap;
|
||||
use flume::{Receiver, Sender};
|
||||
@@ -681,6 +681,7 @@ pub mod avfoundation {
|
||||
pub enum AVFourCC {
|
||||
YUV2,
|
||||
MJPEG,
|
||||
GRAY8,
|
||||
}
|
||||
|
||||
// Localized Name
|
||||
@@ -874,6 +875,7 @@ pub mod avfoundation {
|
||||
let fourcc = match fcc_raw {
|
||||
kCMVideoCodecType_422YpCbCr8 | kCMPixelFormat_422YpCbCr8_yuvs => AVFourCC::YUV2,
|
||||
kCMVideoCodecType_JPEG | kCMVideoCodecType_JPEG_OpenDML => AVFourCC::MJPEG,
|
||||
kCMPixelFormat_8IndexedGray_WhiteIsZero => AVFourCC::GRAY8,
|
||||
_ => {
|
||||
return Err(AVFError::InvalidValue {
|
||||
found: fcc_raw.to_string(),
|
||||
@@ -1109,7 +1111,7 @@ pub mod avfoundation {
|
||||
Ok(avf) => avf.into_raw(),
|
||||
Err(_) => {
|
||||
// should not happen
|
||||
return Err(AVFError::StreamOpen("String contains null? This is a bug, please report it https://github.com/l1npengtul/nokhwa".to_string()));
|
||||
return Err(AVFError::StreamOpen("String contains null? This is a bug, please report it: https://github.com/l1npengtul/nokhwa".to_string()));
|
||||
}
|
||||
};
|
||||
let queue = dispatch_queue_create(avf_queue_str, NSObject(std::ptr::null_mut()));
|
||||
|
||||
Reference in New Issue
Block a user