@@ -43,6 +43,9 @@ const GUID_IGNORE: Guid = Guid(0x9c43_51a6, 0x3535, 0x42ae, 0x91, 0x0c, 0xcd, 0x
4343#[ rustfmt:: skip]
4444#[ cfg( feature="qoi" ) ]
4545const 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 ) ;
4649
4750#[ derive( Debug , PartialEq , Eq ) ]
4851pub struct Guid ( u32 , u16 , u16 , u8 , u8 , u8 , u8 , u8 , u8 , u8 , u8 ) ;
@@ -172,6 +175,8 @@ impl Encode for Codec {
172175 CodecProperty :: Ignore => GUID_IGNORE ,
173176 #[ cfg( feature = "qoi" ) ]
174177 CodecProperty :: Qoi => GUID_QOI ,
178+ #[ cfg( feature = "qoiz" ) ]
179+ CodecProperty :: QoiZ => GUID_QOIZ ,
175180 _ => return Err ( other_err ! ( "invalid codec" ) ) ,
176181 } ;
177182 guid. encode ( dst) ?;
@@ -211,6 +216,8 @@ impl Encode for Codec {
211216 }
212217 #[ cfg( feature = "qoi" ) ]
213218 CodecProperty :: Qoi => dst. write_u16 ( 0 ) ,
219+ #[ cfg( feature = "qoiz" ) ]
220+ CodecProperty :: QoiZ => dst. write_u16 ( 0 ) ,
214221 CodecProperty :: Ignore => dst. write_u16 ( 0 ) ,
215222 CodecProperty :: None => dst. write_u16 ( 0 ) ,
216223 } ;
@@ -236,6 +243,8 @@ impl Encode for Codec {
236243 } ,
237244 #[ cfg( feature = "qoi" ) ]
238245 CodecProperty :: Qoi => 0 ,
246+ #[ cfg( feature = "qoiz" ) ]
247+ CodecProperty :: QoiZ => 0 ,
239248 CodecProperty :: Ignore => 0 ,
240249 CodecProperty :: None => 0 ,
241250 }
@@ -280,6 +289,13 @@ impl<'de> Decode<'de> for Codec {
280289 }
281290 CodecProperty :: Qoi
282291 }
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+ }
283299 _ => CodecProperty :: None ,
284300 } ;
285301
@@ -301,6 +317,8 @@ pub enum CodecProperty {
301317 Ignore ,
302318 #[ cfg( feature = "qoi" ) ]
303319 Qoi ,
320+ #[ cfg( feature = "qoiz" ) ]
321+ QoiZ ,
304322 None ,
305323}
306324
@@ -639,13 +657,15 @@ pub struct CodecId(u8);
639657pub const CODEC_ID_NONE : CodecId = CodecId ( 0 ) ;
640658pub const CODEC_ID_REMOTEFX : CodecId = CodecId ( 3 ) ;
641659pub const CODEC_ID_QOI : CodecId = CodecId ( 0x0A ) ;
660+ pub const CODEC_ID_QOIZ : CodecId = CodecId ( 0x0B ) ;
642661
643662impl Debug for CodecId {
644663 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
645664 let name = match self . 0 {
646665 0 => "None" ,
647666 3 => "RemoteFx" ,
648667 0x0A => "QOI" ,
668+ 0x0B => "QOIZ" ,
649669 _ => "unknown" ,
650670 } ;
651671 write ! ( f, "CodecId({})" , name)
@@ -658,6 +678,7 @@ impl CodecId {
658678 0 => Some ( CODEC_ID_NONE ) ,
659679 3 => Some ( CODEC_ID_REMOTEFX ) ,
660680 0x0A => Some ( CODEC_ID_QOI ) ,
681+ 0x0B => Some ( CODEC_ID_QOIZ ) ,
661682 _ => None ,
662683 }
663684 }
@@ -700,6 +721,7 @@ fn parse_codecs_config<'a>(codecs: &'a [&'a str]) -> Result<HashMap<&'a str, boo
700721///
701722/// * `remotefx` (on by default)
702723/// * `qoi` (on by default, when feature "qoi")
724+ /// * `qoiz` (on by default, when feature "qoiz")
703725///
704726/// # Returns
705727///
@@ -711,6 +733,7 @@ pub fn client_codecs_capabilities(config: &[&str]) -> Result<BitmapCodecs, Strin
711733List of codecs:
712734- `remotefx` (on by default)
713735- `qoi` (on by default, when feature "qoi")
736+ - `qoiz` (on by default, when feature "qoiz")
714737"#
715738 . to_owned ( ) ) ;
716739 }
@@ -739,6 +762,14 @@ List of codecs:
739762 } ) ;
740763 }
741764
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+
742773 let codec_names = config. keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
743774 if !codec_names. is_empty ( ) {
744775 return Err ( format ! ( "Unknown codecs: {}" , codec_names) ) ;
@@ -761,6 +792,7 @@ List of codecs:
761792///
762793/// * `remotefx` (on by default)
763794/// * `qoi` (on by default, when feature "qoi")
795+ /// * `qoiz` (on by default, when feature "qoiz")
764796///
765797/// # Returns
766798///
@@ -771,6 +803,7 @@ pub fn server_codecs_capabilities(config: &[&str]) -> Result<BitmapCodecs, Strin
771803List of codecs:
772804- `remotefx` (on by default)
773805- `qoi` (on by default, when feature "qoi")
806+ - `qoiz` (on by default, when feature "qoiz")
774807"#
775808 . to_owned ( ) ) ;
776809 }
@@ -797,6 +830,14 @@ List of codecs:
797830 } ) ;
798831 }
799832
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+
800841 let codec_names = config. keys ( ) . copied ( ) . collect :: < Vec < _ > > ( ) . join ( ", " ) ;
801842 if !codec_names. is_empty ( ) {
802843 return Err ( format ! ( "Unknown codecs: {}" , codec_names) ) ;
0 commit comments