uril::color::*: .name() returns None if unspecified
pixdesc "helpfully" returns "unknown", which renders our Option pointless.
This commit is contained in:
parent
10d3b75342
commit
2d3a34f74d
@ -26,6 +26,9 @@ pub enum Primaries {
|
|||||||
|
|
||||||
impl Primaries {
|
impl Primaries {
|
||||||
pub fn name(&self) -> Option<&'static str> {
|
pub fn name(&self) -> Option<&'static str> {
|
||||||
|
if *self == Primaries::Unspecified {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_color_primaries_name((*self).into());
|
let ptr = av_color_primaries_name((*self).into());
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
|
@ -13,6 +13,9 @@ pub enum Range {
|
|||||||
|
|
||||||
impl Range {
|
impl Range {
|
||||||
pub fn name(&self) -> Option<&'static str> {
|
pub fn name(&self) -> Option<&'static str> {
|
||||||
|
if *self == Range::Unspecified {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_color_range_name((*self).into());
|
let ptr = av_color_range_name((*self).into());
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
|
@ -27,6 +27,9 @@ pub enum Space {
|
|||||||
|
|
||||||
impl Space {
|
impl Space {
|
||||||
pub fn name(&self) -> Option<&'static str> {
|
pub fn name(&self) -> Option<&'static str> {
|
||||||
|
if *self == Space::Unspecified {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_color_space_name((*self).into());
|
let ptr = av_color_space_name((*self).into());
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
|
@ -29,6 +29,9 @@ pub enum TransferCharacteristic {
|
|||||||
|
|
||||||
impl TransferCharacteristic {
|
impl TransferCharacteristic {
|
||||||
pub fn name(&self) -> Option<&'static str> {
|
pub fn name(&self) -> Option<&'static str> {
|
||||||
|
if *self == TransferCharacteristic::Unspecified {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = av_color_transfer_name((*self).into());
|
let ptr = av_color_transfer_name((*self).into());
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user