diff --git a/src/util/color/primaries.rs b/src/util/color/primaries.rs index b827125..d3a1967 100644 --- a/src/util/color/primaries.rs +++ b/src/util/color/primaries.rs @@ -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() { diff --git a/src/util/color/range.rs b/src/util/color/range.rs index a440844..689a410 100644 --- a/src/util/color/range.rs +++ b/src/util/color/range.rs @@ -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() { diff --git a/src/util/color/space.rs b/src/util/color/space.rs index 4e15551..ddcdd93 100644 --- a/src/util/color/space.rs +++ b/src/util/color/space.rs @@ -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() { diff --git a/src/util/color/transfer_characteristic.rs b/src/util/color/transfer_characteristic.rs index b6c3fa9..df3b053 100644 --- a/src/util/color/transfer_characteristic.rs +++ b/src/util/color/transfer_characteristic.rs @@ -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() {