@@ -43,6 +43,9 @@ const GUID_IGNORE: Guid = Guid(0x9c43_51a6, 0x3535, 0x42ae, 0x91, 0x0c, 0xcd, 0x
43
43
#[ rustfmt:: skip]
44
44
#[ cfg( feature="qoi" ) ]
45
45
const GUID_QOI : Guid = Guid ( 0x4dae_9af8 , 0xb399 , 0x4df6 , 0xb4 , 0x3a , 0x66 , 0x2f , 0xd9 , 0xc0 , 0xf5 , 0xd6 ) ;
46
+ #[ rustfmt:: skip]
47
+ #[ cfg( feature="qoiz" ) ]
48
+ const GUID_QOIZ : Guid = Guid ( 0x229c_c6dc , 0xa860 , 0x4b52 , 0xb4 , 0xd8 , 0x05 , 0x3a , 0x22 , 0xb3 , 0x89 , 0x2b ) ;
46
49
47
50
#[ derive( Debug , PartialEq , Eq ) ]
48
51
pub struct Guid ( u32 , u16 , u16 , u8 , u8 , u8 , u8 , u8 , u8 , u8 , u8 ) ;
@@ -172,6 +175,8 @@ impl Encode for Codec {
172
175
CodecProperty :: Ignore => GUID_IGNORE ,
173
176
#[ cfg( feature = "qoi" ) ]
174
177
CodecProperty :: Qoi => GUID_QOI ,
178
+ #[ cfg( feature = "qoiz" ) ]
179
+ CodecProperty :: QoiZ => GUID_QOIZ ,
175
180
_ => return Err ( other_err ! ( "invalid codec" ) ) ,
176
181
} ;
177
182
guid. encode ( dst) ?;
@@ -211,6 +216,8 @@ impl Encode for Codec {
211
216
}
212
217
#[ cfg( feature = "qoi" ) ]
213
218
CodecProperty :: Qoi => dst. write_u16 ( 0 ) ,
219
+ #[ cfg( feature = "qoiz" ) ]
220
+ CodecProperty :: QoiZ => dst. write_u16 ( 0 ) ,
214
221
CodecProperty :: Ignore => dst. write_u16 ( 0 ) ,
215
222
CodecProperty :: None => dst. write_u16 ( 0 ) ,
216
223
} ;
@@ -236,6 +243,8 @@ impl Encode for Codec {
236
243
} ,
237
244
#[ cfg( feature = "qoi" ) ]
238
245
CodecProperty :: Qoi => 0 ,
246
+ #[ cfg( feature = "qoiz" ) ]
247
+ CodecProperty :: QoiZ => 0 ,
239
248
CodecProperty :: Ignore => 0 ,
240
249
CodecProperty :: None => 0 ,
241
250
}
@@ -280,6 +289,13 @@ impl<'de> Decode<'de> for Codec {
280
289
}
281
290
CodecProperty :: Qoi
282
291
}
292
+ #[ cfg( feature = "qoiz" ) ]
293
+ GUID_QOIZ => {
294
+ if !property_buffer. is_empty ( ) {
295
+ return Err ( invalid_field_err ! ( "qoi property" , "must be empty" ) ) ;
296
+ }
297
+ CodecProperty :: QoiZ
298
+ }
283
299
_ => CodecProperty :: None ,
284
300
} ;
285
301
@@ -301,6 +317,8 @@ pub enum CodecProperty {
301
317
Ignore ,
302
318
#[ cfg( feature = "qoi" ) ]
303
319
Qoi ,
320
+ #[ cfg( feature = "qoiz" ) ]
321
+ QoiZ ,
304
322
None ,
305
323
}
306
324
@@ -639,13 +657,15 @@ pub struct CodecId(u8);
639
657
pub const CODEC_ID_NONE : CodecId = CodecId ( 0 ) ;
640
658
pub const CODEC_ID_REMOTEFX : CodecId = CodecId ( 3 ) ;
641
659
pub const CODEC_ID_QOI : CodecId = CodecId ( 0x0A ) ;
660
+ pub const CODEC_ID_QOIZ : CodecId = CodecId ( 0x0B ) ;
642
661
643
662
impl Debug for CodecId {
644
663
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
645
664
let name = match self . 0 {
646
665
0 => "None" ,
647
666
3 => "RemoteFx" ,
648
667
0x0A => "QOI" ,
668
+ 0x0B => "QOIZ" ,
649
669
_ => "unknown" ,
650
670
} ;
651
671
write ! ( f, "CodecId({})" , name)
@@ -658,6 +678,7 @@ impl CodecId {
658
678
0 => Some ( CODEC_ID_NONE ) ,
659
679
3 => Some ( CODEC_ID_REMOTEFX ) ,
660
680
0x0A => Some ( CODEC_ID_QOI ) ,
681
+ 0x0B => Some ( CODEC_ID_QOIZ ) ,
661
682
_ => None ,
662
683
}
663
684
}
@@ -700,6 +721,7 @@ fn parse_codecs_config<'a>(codecs: &'a [&'a str]) -> Result<HashMap<&'a str, boo
700
721
///
701
722
/// * `remotefx` (on by default)
702
723
/// * `qoi` (on by default, when feature "qoi")
724
+ /// * `qoiz` (on by default, when feature "qoiz")
703
725
///
704
726
/// # Returns
705
727
///
@@ -711,6 +733,7 @@ pub fn client_codecs_capabilities(config: &[&str]) -> Result<BitmapCodecs, Strin
711
733
List of codecs:
712
734
- `remotefx` (on by default)
713
735
- `qoi` (on by default, when feature "qoi")
736
+ - `qoiz` (on by default, when feature "qoiz")
714
737
"#
715
738
. to_owned ( ) ) ;
716
739
}
@@ -739,6 +762,14 @@ List of codecs:
739
762
} ) ;
740
763
}
741
764
765
+ #[ cfg( feature = "qoiz" ) ]
766
+ if config. remove ( "qoiz" ) . unwrap_or ( true ) {
767
+ codecs. push ( Codec {
768
+ id : CODEC_ID_QOIZ . 0 ,
769
+ property : CodecProperty :: QoiZ ,
770
+ } ) ;
771
+ }
772
+
742
773
let codec_names = config. keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
743
774
if !codec_names. is_empty ( ) {
744
775
return Err ( format ! ( "Unknown codecs: {}" , codec_names) ) ;
@@ -761,6 +792,7 @@ List of codecs:
761
792
///
762
793
/// * `remotefx` (on by default)
763
794
/// * `qoi` (on by default, when feature "qoi")
795
+ /// * `qoiz` (on by default, when feature "qoiz")
764
796
///
765
797
/// # Returns
766
798
///
@@ -771,6 +803,7 @@ pub fn server_codecs_capabilities(config: &[&str]) -> Result<BitmapCodecs, Strin
771
803
List of codecs:
772
804
- `remotefx` (on by default)
773
805
- `qoi` (on by default, when feature "qoi")
806
+ - `qoiz` (on by default, when feature "qoiz")
774
807
"#
775
808
. to_owned ( ) ) ;
776
809
}
@@ -797,6 +830,14 @@ List of codecs:
797
830
} ) ;
798
831
}
799
832
833
+ #[ cfg( feature = "qoiz" ) ]
834
+ if config. remove ( "qoiz" ) . unwrap_or ( true ) {
835
+ codecs. push ( Codec {
836
+ id : 0 ,
837
+ property : CodecProperty :: QoiZ ,
838
+ } ) ;
839
+ }
840
+
800
841
let codec_names = config. keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
801
842
if !codec_names. is_empty ( ) {
802
843
return Err ( format ! ( "Unknown codecs: {}" , codec_names) ) ;
0 commit comments