uril::color::*: .name() returns None if unspecified

pixdesc "helpfully" returns "unknown", which renders our Option pointless.
This commit is contained in:
Zhiming Wang 2018-09-14 21:30:50 -04:00
parent 10d3b75342
commit 2d3a34f74d
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
4 changed files with 12 additions and 0 deletions

View File

@ -26,6 +26,9 @@ pub enum Primaries {
impl Primaries {
pub fn name(&self) -> Option<&'static str> {
if *self == Primaries::Unspecified {
return None;
}
unsafe {
let ptr = av_color_primaries_name((*self).into());
if ptr.is_null() {

View File

@ -13,6 +13,9 @@ pub enum Range {
impl Range {
pub fn name(&self) -> Option<&'static str> {
if *self == Range::Unspecified {
return None;
}
unsafe {
let ptr = av_color_range_name((*self).into());
if ptr.is_null() {

View File

@ -27,6 +27,9 @@ pub enum Space {
impl Space {
pub fn name(&self) -> Option<&'static str> {
if *self == Space::Unspecified {
return None;
}
unsafe {
let ptr = av_color_space_name((*self).into());
if ptr.is_null() {

View File

@ -29,6 +29,9 @@ pub enum TransferCharacteristic {
impl TransferCharacteristic {
pub fn name(&self) -> Option<&'static str> {
if *self == TransferCharacteristic::Unspecified {
return None;
}
unsafe {
let ptr = av_color_transfer_name((*self).into());
if ptr.is_null() {