Use little endian and some bug fixes
This commit is contained in:
2 files changed
+8
-8
No files matched your search
+2
-2
@@ -58,7 +58,7 @@ impl VideoIFrame {
|
||||
}
|
||||
|
||||
pub fn data_size(&self) -> usize {
|
||||
u32::from_be_bytes(self.raw[8..12].try_into().expect("slice with incorrect length")).try_into().expect("u32 won't fit into usize")
|
||||
u32::from_le_bytes(self.raw[8..12].try_into().expect("slice with incorrect length")).try_into().expect("u32 won't fit into usize")
|
||||
}
|
||||
|
||||
pub fn unknowna(&self) -> &[u8] {
|
||||
@@ -115,7 +115,7 @@ impl VideoPFrame {
|
||||
}
|
||||
|
||||
pub fn data_size(&self) -> usize {
|
||||
u32::from_be_bytes(self.raw[8..12].try_into().expect("slice with incorrect length")).try_into().expect("u32 won't fit into usize")
|
||||
u32::from_le_bytes(self.raw[8..12].try_into().expect("slice with incorrect length")).try_into().expect("u32 won't fit into usize")
|
||||
}
|
||||
|
||||
pub fn unknowna(&self) -> &[u8] {
|
||||
|
||||
+6
-6
@@ -294,7 +294,7 @@ impl BcCamera {
|
||||
trace!("Expected {} bytes in video package", expected_bytes);
|
||||
trace!("Actual {} bytes in video package", actual_size);
|
||||
trace!("Remaining bytes {}", (expected_bytes - actual_size));
|
||||
data_out.write_all(frame.as_slice())?
|
||||
data_out.write_all(frame.as_slice())?;
|
||||
},
|
||||
VideoFrame::PFrame(frame) => {
|
||||
let expected_bytes = frame.data_size();
|
||||
@@ -305,7 +305,7 @@ impl BcCamera {
|
||||
trace!("Expected {} bytes in video package", expected_bytes);
|
||||
trace!("Actual {} bytes in video package", actual_size);
|
||||
trace!("Remaining bytes {}", (expected_bytes - actual_size));
|
||||
data_out.write_all(frame.as_slice())?
|
||||
data_out.write_all(frame.as_slice())?;
|
||||
}
|
||||
};
|
||||
},
|
||||
@@ -324,22 +324,22 @@ impl BcCamera {
|
||||
BinaryData::VideoData(binary) => {
|
||||
trace!("Video magic detected but expected video data for chunked frame {}", self.byte_debt);
|
||||
self.byte_debt -= binary.len();
|
||||
data_out.write_all(binary.as_slice())?
|
||||
data_out.write_all(binary.as_slice())?;
|
||||
},
|
||||
BinaryData::AudioData(binary) => {
|
||||
trace!("Audio magic detected but expected video data for chunked frame {}", self.byte_debt);
|
||||
self.byte_debt -= binary.len();
|
||||
data_out.write_all(binary.as_slice())?
|
||||
data_out.write_all(binary.as_slice())?;
|
||||
},
|
||||
BinaryData::InfoData(binary) => {
|
||||
trace!("Info magic detected but expected video data for chunked frame {}", self.byte_debt);
|
||||
self.byte_debt -= binary.len();
|
||||
data_out.write_all(binary.as_slice())?
|
||||
data_out.write_all(binary.as_slice())?;
|
||||
},
|
||||
BinaryData::Unknown(binary) => {
|
||||
trace!("Fulfilling expected video data for chunked frame {}", self.byte_debt);
|
||||
self.byte_debt -= binary.len();
|
||||
data_out.write_all(binary.as_slice())?
|
||||
data_out.write_all(binary.as_slice())?;
|
||||
},
|
||||
};
|
||||
trace!("Remaning data expected for chunked frame {}", self.byte_debt);
|
||||
|
||||
Reference in new issue
Block a user