]> git.nihav.org Git - nihav-encoder.git/commitdiff
do not allow packets with palette changes for muxers that don't support it
authorKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 31 Mar 2026 19:08:28 +0000 (21:08 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Tue, 31 Mar 2026 19:08:28 +0000 (21:08 +0200)
src/main.rs

index 61c5b2c4ee854ff71a502bcfc9b4784aa9d76309..015cbe3eb69de736a917e774c2f5ac82cc7df1a6 100644 (file)
@@ -750,6 +750,11 @@ fn main() {
                 transcoder.debug_log(DebugLog::ENCODE, &format!(" Packet from stream {src_id} dropped"));
             },
             OutputMode::Copy(dst_id) => {
+                if mux_quirks.is_global_pal() && pkt.ts.pts != Some(0) &&
+                        pkt.side_data.iter().any(|sd| matches!(sd, NASideData::Palette(true, _))) {
+                    println!("Palette change encountered while muxer does not support that!");
+                    break 'main_loop;
+                }
                 let dstr = mux.get_stream(dst_id as usize).unwrap();
                 pkt.reassign(dstr, pkt.get_time_information());
                 transcoder.debug_log(DebugLog::ENCODE, &format!(" Packet from stream {src_id} copied to {dst_id}"));
@@ -763,6 +768,11 @@ fn main() {
                 transcoder.queue.queue_packet(pkt, &mut transcoder.debug);
             },
             OutputMode::Encode(dst_id, ref mut encoder) => {
+                if mux_quirks.is_global_pal() && pkt.ts.pts != Some(0) &&
+                        pkt.side_data.iter().any(|sd| matches!(sd, NASideData::Palette(true, _))) {
+                    println!("Palette change encountered while muxer does not support that!");
+                    break 'main_loop;
+                }
                 if let Some(ref mut dec_ctx) = transcoder.decoders[src_id] {
                     let ret = dec_ctx.decoder.decode(&mut dec_ctx.dsupp, &pkt);
                     if let Some(ref mut dbg) = transcoder.debug {