]> git.nihav.org Git - nihav.git/commitdiff
nihav-core/muxers: introduce quirk for muxers that support global palette only
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 31 Mar 2026 18:56:50 +0000 (20:56 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 31 Mar 2026 18:56:50 +0000 (20:56 +0200)
nihav-core/src/muxers/mod.rs

index 1364574a3f313b41c1ab4c041a8fd35e3783b3e8..42068b4c675da366b0e2d7c54a9619499c709d18 100644 (file)
@@ -63,7 +63,9 @@ pub const MUX_QUIRK_FIXED_RATE: u32         = 1 <<  0;
 /// Muxer expects to know full duration in advance.
 pub const MUX_QUIRK_FIXED_DURATION: u32     = 1 <<  1;
 /// Muxer does not care about synchronisation of the stream.
-pub const MUX_QUIRK_UNSYNC: u32            = 1 <<  2;
+pub const MUX_QUIRK_UNSYNC: u32             = 1 <<  2;
+/// Muxer does not support palette changes.
+pub const MUX_QUIRK_GLOBAL_PAL: u32         = 1 <<  3;
 
 impl MuxerQuirks {
     /// Creates a new instance of `MuxerQuirks`
@@ -83,13 +85,19 @@ impl MuxerQuirks {
     /// Tells that muxer does not expect to know full duration in advance.
     pub fn clear_fixed_duration(&mut self) { self.0 &= !MUX_QUIRK_FIXED_DURATION; }
 
-
     /// Queries if the muxer does not care about stream synchronisation.
     pub fn is_unsync(self) -> bool { (self.0 & MUX_QUIRK_UNSYNC) != 0 }
     /// Tells that muxer does not care about stream synchronisation.
     pub fn set_unsync(&mut self) { self.0 |= MUX_QUIRK_UNSYNC; }
     /// Tells that muxer actually cares about streams being synchronised.
     pub fn clear_unsync(&mut self) { self.0 &= !MUX_QUIRK_UNSYNC; }
+
+    /// Queries if the muxer does not support palette changes.
+    pub fn is_global_pal(self) -> bool { (self.0 & MUX_QUIRK_GLOBAL_PAL) != 0 }
+    /// Tells that muxer does not support palette changes.
+    pub fn set_global_pal(&mut self) { self.0 |= MUX_QUIRK_GLOBAL_PAL; }
+    /// Tells that muxer does not require global palette (and palette changes are fine).
+    pub fn clear_global_pal(&mut self) { self.0 &= !MUX_QUIRK_GLOBAL_PAL; }
 }