use NAPacketiser::attach_stream() where appropriate master
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 27 Apr 2024 11:45:28 +0000 (13:45 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 27 Apr 2024 11:45:28 +0000 (13:45 +0200)
hwdec-vaapi/src/lib.rs
sndplay/src/demux.rs

index 40e14f445fc17e24793419ae76b82cc1d2b2eba0..cdc8b080a52f3df32df7fc5a920c80cda04f42a0 100644 (file)
@@ -283,8 +283,7 @@ pub struct VaapiH264Decoder {
     tb_den:         u32,
 }
 
-#[cfg(not(target_arch="x86_64"))]
-fn copy_luma(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, w: usize, h: usize) {
+fn copy_luma_default(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, w: usize, h: usize) {
     for (dline, sline) in dst.chunks_mut(dstride)
             .zip(src.chunks(sstride))
             .take(h) {
@@ -292,6 +291,10 @@ fn copy_luma(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, w: usiz
     }
 }
 #[cfg(not(target_arch="x86_64"))]
+fn copy_luma(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, w: usize, h: usize) {
+    copy_luma_default(dst, dstride, src, sstride, w, h);
+}
+#[cfg(not(target_arch="x86_64"))]
 fn deint_chroma(frm: NASimpleVideoFrame<u8>, src: &[u8], sstride: usize) {
     let mut uoff = frm.offset[1];
     let mut voff = frm.offset[2];
@@ -309,6 +312,10 @@ fn deint_chroma(frm: NASimpleVideoFrame<u8>, src: &[u8], sstride: usize) {
 use std::arch::asm;
 #[cfg(target_arch="x86_64")]
 fn copy_luma(dst: &mut [u8], dstride: usize, src: &[u8], sstride: usize, w: usize, h: usize) {
+    if !is_x86_feature_detected!("avx") {
+        copy_luma_default(dst, dstride, src, sstride, w, h);
+        return;
+    }
     if dst.as_ptr().align_offset(32) == 0 && src.as_ptr().align_offset(32) == 0 &&
             (w % 64) == 0 && ((dstride | sstride) % 32) == 0 {
         unsafe {
index c35167c97ae7bbae7803fe054b833f3b5974a2cc..d050bceb2ff592695575d1220927328547ddaea3 100644 (file)
@@ -97,7 +97,8 @@ impl<'a> DemuxerObject<'a> {
                     let mut pkts = Vec::new();
                     for stream in dmx.get_streams() {
                         if let Some(pcreate) = reg.pkt_reg.find_packetiser(stream.get_info().get_name()) {
-                            let packetiser = (pcreate)();
+                            let mut packetiser = (pcreate)();
+                            packetiser.attach_stream(stream);
                             pkts.push(Some(packetiser));
                         } else {
                             pkts.push(None);