format/pixel: add Descriptor::{name, log2_chroma_w}()
This commit is contained in:
parent
1095c8842e
commit
403407bf2c
@ -1,3 +1,6 @@
|
|||||||
|
use std::ffi::CStr;
|
||||||
|
use std::str::from_utf8_unchecked;
|
||||||
|
|
||||||
use ffi::*;
|
use ffi::*;
|
||||||
|
|
||||||
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
||||||
@ -312,12 +315,24 @@ impl Descriptor {
|
|||||||
self.ptr
|
self.ptr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn name(self) -> &'static str {
|
||||||
|
unsafe {
|
||||||
|
from_utf8_unchecked(CStr::from_ptr((*self.as_ptr()).name).to_bytes())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn nb_components(self) -> u8 {
|
pub fn nb_components(self) -> u8 {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_ptr()).nb_components
|
(*self.as_ptr()).nb_components
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn log2_chroma_w(self) -> u8 {
|
||||||
|
unsafe {
|
||||||
|
(*self.as_ptr()).log2_chroma_w
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn log2_chroma_h(self) -> u8 {
|
pub fn log2_chroma_h(self) -> u8 {
|
||||||
unsafe {
|
unsafe {
|
||||||
(*self.as_ptr()).log2_chroma_h
|
(*self.as_ptr()).log2_chroma_h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user