File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,18 @@ pub enum Primaries {
23
23
EBU3213 ,
24
24
}
25
25
26
+ impl Primaries {
27
+ pub fn name ( & self ) -> Option < & ' static str > {
28
+ if * self == Primaries :: Unspecified {
29
+ return None ;
30
+ }
31
+ unsafe {
32
+ let ptr = av_color_primaries_name ( ( * self ) . into ( ) ) ;
33
+ ptr. as_ref ( ) . map ( |ptr| from_utf8_unchecked ( CStr :: from_ptr ( ptr) . to_bytes ( ) ) )
34
+ }
35
+ }
36
+ }
37
+
26
38
impl From < AVColorPrimaries > for Primaries {
27
39
fn from ( value : AVColorPrimaries ) -> Primaries {
28
40
match value {
Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ pub enum Range {
9
9
JPEG ,
10
10
}
11
11
12
+ impl Range {
13
+ pub fn name ( & self ) -> Option < & ' static str > {
14
+ if * self == Range :: Unspecified {
15
+ return None ;
16
+ }
17
+ unsafe {
18
+ let ptr = av_color_range_name ( ( * self ) . into ( ) ) ;
19
+ ptr. as_ref ( ) . map ( |ptr| from_utf8_unchecked ( CStr :: from_ptr ( ptr) . to_bytes ( ) ) )
20
+ }
21
+ }
22
+ }
23
+
12
24
impl From < AVColorRange > for Range {
13
25
fn from ( value : AVColorRange ) -> Self {
14
26
match value {
Original file line number Diff line number Diff line change @@ -25,6 +25,18 @@ pub enum TransferCharacteristic {
25
25
ARIB_STD_B67 ,
26
26
}
27
27
28
+ impl TransferCharacteristic {
29
+ pub fn name ( & self ) -> Option < & ' static str > {
30
+ if * self == TransferCharacteristic :: Unspecified {
31
+ return None ;
32
+ }
33
+ unsafe {
34
+ let ptr = av_color_transfer_name ( ( * self ) . into ( ) ) ;
35
+ ptr. as_ref ( ) . map ( |ptr| from_utf8_unchecked ( CStr :: from_ptr ( ptr) . to_bytes ( ) ) )
36
+ }
37
+ }
38
+ }
39
+
28
40
impl From < AVColorTransferCharacteristic > for TransferCharacteristic {
29
41
fn from ( value : AVColorTransferCharacteristic ) -> TransferCharacteristic {
30
42
match value {
You can’t perform that action at this time.
0 commit comments