Finish encoding and return compressed bytes. Prepends a 4-byte LE sample count header.
(self)
| 137 | /// |
| 138 | /// Prepends a 4-byte LE sample count header. |
| 139 | pub fn finish(self) -> Vec<u8> { |
| 140 | let count_bytes = (self.count as u32).to_le_bytes(); |
| 141 | let bitstream = self.buf.as_bytes(); |
| 142 | let mut out = Vec::with_capacity(4 + bitstream.len()); |
| 143 | out.extend_from_slice(&count_bytes); |
| 144 | out.extend_from_slice(bitstream); |
| 145 | out |
| 146 | } |
| 147 | |
| 148 | pub fn count(&self) -> u64 { |
| 149 | self.count |