aboutsummaryrefslogtreecommitdiffstats
path: root/nihav-rad/src
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2019-04-29 13:02:12 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2019-04-29 13:02:12 +0200
commit2422d9699cd56cbb86ac32b3e8dd026e20a89db5 (patch)
treece89fa9df27f1fb2ee52574f9b7b7d90a7739f23 /nihav-rad/src
parentcd830591a8770b4a56ce9b938574adcee3ed33f5 (diff)
downloadnihav-2422d9699cd56cbb86ac32b3e8dd026e20a89db5.tar.gz
switch NACodecInfo to Arc
Diffstat (limited to 'nihav-rad/src')
-rw-r--r--nihav-rad/src/codecs/bink2.rs6
-rw-r--r--nihav-rad/src/codecs/binkaud.rs2
-rw-r--r--nihav-rad/src/codecs/binkvid.rs6
-rw-r--r--nihav-rad/src/codecs/smacker.rs12
4 files changed, 12 insertions, 14 deletions
diff --git a/nihav-rad/src/codecs/bink2.rs b/nihav-rad/src/codecs/bink2.rs
index 719608d..60d42a4 100644
--- a/nihav-rad/src/codecs/bink2.rs
+++ b/nihav-rad/src/codecs/bink2.rs
@@ -996,7 +996,7 @@ impl Default for Bink2Codes {
#[derive(Default)]
struct Bink2Decoder {
- info: Rc<NACodecInfo>,
+ info: NACodecInfoRef,
ips: IPShuffler,
version: u32,
@@ -1858,7 +1858,7 @@ fn decode_acs_4blocks_old(br: &mut BitReader, codes: &Bink2Codes, dst: &mut [[f3
const KB2H_NUM_SLICES: [usize; 4] = [ 2, 3, 4, 8 ];
impl NADecoder for Bink2Decoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
let w = vinfo.get_width();
let h = vinfo.get_height();
@@ -1907,7 +1907,7 @@ impl NADecoder for Bink2Decoder {
if self.has_alpha { FORMATON_FLAG_ALPHA } else { 0 },
if self.has_alpha { 4 } else { 3 });
let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, false, fmt));
- self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()));
+ self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
Ok(())
} else {
diff --git a/nihav-rad/src/codecs/binkaud.rs b/nihav-rad/src/codecs/binkaud.rs
index c38f6d4..182c6c9 100644
--- a/nihav-rad/src/codecs/binkaud.rs
+++ b/nihav-rad/src/codecs/binkaud.rs
@@ -178,7 +178,7 @@ const CRITICAL_FREQS: [usize; MAX_BANDS] = [
const RUN_TAB: [usize; 16] = [ 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 32, 64 ];
impl NADecoder for BinkAudioDecoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() {
let srate = ainfo.get_sample_rate();
let channels = ainfo.get_channels();
diff --git a/nihav-rad/src/codecs/binkvid.rs b/nihav-rad/src/codecs/binkvid.rs
index dc9a469..2f95ed6 100644
--- a/nihav-rad/src/codecs/binkvid.rs
+++ b/nihav-rad/src/codecs/binkvid.rs
@@ -474,7 +474,7 @@ impl Default for QuantMats {
#[derive(Default)]
struct BinkDecoder {
- info: Rc<NACodecInfo>,
+ info: NACodecInfoRef,
ips: IPShuffler,
hams: HAMShuffler,
@@ -1157,7 +1157,7 @@ const BINK_FLAG_ALPHA: u32 = 0x00100000;
const BINK_FLAG_GRAY: u32 = 0x00020000;
impl NADecoder for BinkDecoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
let w = vinfo.get_width();
let h = vinfo.get_height();
@@ -1192,7 +1192,7 @@ impl NADecoder for BinkDecoder {
None, None, None, None, 0, 1);
}
let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, h, false, fmt));
- self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()));
+ self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
//self.init_bundle_lengths(w.max(8), (w + 7) >> 3);
self.init_bundle_bufs((w + 7) >> 3, (h + 7) >> 3);
diff --git a/nihav-rad/src/codecs/smacker.rs b/nihav-rad/src/codecs/smacker.rs
index bbf4846..bc27ab0 100644
--- a/nihav-rad/src/codecs/smacker.rs
+++ b/nihav-rad/src/codecs/smacker.rs
@@ -210,7 +210,7 @@ const SMK_BLOCK_RUNS: [usize; 64] = [
];
struct SmackerVideoDecoder {
- info: Rc<NACodecInfo>,
+ info: NACodecInfoRef,
mmap_tree: SmackerTree16,
mclr_tree: SmackerTree16,
full_tree: SmackerTree16,
@@ -227,9 +227,8 @@ struct SmackerVideoDecoder {
impl SmackerVideoDecoder {
fn new() -> Self {
- let dummy_info = Rc::new(DUMMY_CODEC_INFO);
Self {
- info: dummy_info,
+ info: NACodecInfoRef::default(),
mmap_tree: SmackerTree16::new(),
mclr_tree: SmackerTree16::new(),
full_tree: SmackerTree16::new(),
@@ -388,7 +387,7 @@ impl SmackerVideoDecoder {
}
impl NADecoder for SmackerVideoDecoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Video(vinfo) = info.get_properties() {
let w = vinfo.get_width();
let h = vinfo.get_height();
@@ -428,8 +427,7 @@ impl NADecoder for SmackerVideoDecoder {
out_h <<= 1;
}
let myinfo = NACodecTypeInfo::Video(NAVideoInfo::new(w, out_h, false, fmt));
- self.info = Rc::new(NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()));
-
+ self.info = NACodecInfo::new_ref(info.get_name(), myinfo, info.get_extradata()).into_ref();
Ok(())
} else {
@@ -494,7 +492,7 @@ impl SmackerAudioDecoder {
}
impl NADecoder for SmackerAudioDecoder {
- fn init(&mut self, info: Rc<NACodecInfo>) -> DecoderResult<()> {
+ fn init(&mut self, info: NACodecInfoRef) -> DecoderResult<()> {
if let NACodecTypeInfo::Audio(ainfo) = info.get_properties() {
self.bits = ainfo.get_format().get_bits();
let fmt = if self.bits == 8 { SND_U8_FORMAT } else { SND_S16P_FORMAT };