diff options
| author | Kostya Shishkov <[email protected]> | 2019-11-09 18:57:34 +0100 |
|---|---|---|
| committer | Kostya Shishkov <[email protected]> | 2019-11-09 18:57:34 +0100 |
| commit | f9be4e750dccff762b9a3d894faec50ffdb59233 (patch) | |
| tree | 183d7d505c1785f850a3c652c62cd012cd4c5aa2 /nihav-commonfmt/src/codecs | |
| parent | 80aaa7ef4cf5ce03978f64d07c344e4b18718b1b (diff) | |
add flush() to decoder interface
Diffstat (limited to 'nihav-commonfmt/src/codecs')
| -rw-r--r-- | nihav-commonfmt/src/codecs/aac.rs | 6 | ||||
| -rw-r--r-- | nihav-commonfmt/src/codecs/atrac3.rs | 6 | ||||
| -rw-r--r-- | nihav-commonfmt/src/codecs/clearvideo.rs | 3 | ||||
| -rw-r--r-- | nihav-commonfmt/src/codecs/pcm.rs | 2 | ||||
| -rw-r--r-- | nihav-commonfmt/src/codecs/sipro.rs | 2 | ||||
| -rw-r--r-- | nihav-commonfmt/src/codecs/ts102366.rs | 3 |
6 files changed, 22 insertions, 0 deletions
diff --git a/nihav-commonfmt/src/codecs/aac.rs b/nihav-commonfmt/src/codecs/aac.rs index 04fff33..aeb2d06 100644 --- a/nihav-commonfmt/src/codecs/aac.rs +++ b/nihav-commonfmt/src/codecs/aac.rs @@ -1250,6 +1250,12 @@ impl NADecoder for AACDecoder { frm.set_keyframe(true); Ok(frm.into_ref()) } + fn flush(&mut self) { + for pair in self.pairs.iter_mut() { + pair.ics[0].delay = [0.0; 1024]; + pair.ics[1].delay = [0.0; 1024]; + } + } } pub fn get_decoder() -> Box<dyn NADecoder> { diff --git a/nihav-commonfmt/src/codecs/atrac3.rs b/nihav-commonfmt/src/codecs/atrac3.rs index c80bd36..441da89 100644 --- a/nihav-commonfmt/src/codecs/atrac3.rs +++ b/nihav-commonfmt/src/codecs/atrac3.rs @@ -687,6 +687,12 @@ impl NADecoder for Atrac3Decoder { frm.set_keyframe(true); Ok(frm.into_ref()) } + fn flush(&mut self) { + for ch_data in self.ch_data.iter_mut() { + ch_data.delay = [0.0; 1024]; + ch_data.qmf_delay = [0.0; 64 * 3]; + } + } } pub fn get_decoder() -> Box<dyn NADecoder> { diff --git a/nihav-commonfmt/src/codecs/clearvideo.rs b/nihav-commonfmt/src/codecs/clearvideo.rs index 3e913a9..790ea3e 100644 --- a/nihav-commonfmt/src/codecs/clearvideo.rs +++ b/nihav-commonfmt/src/codecs/clearvideo.rs @@ -698,6 +698,9 @@ impl NADecoder for ClearVideoDecoder { } Ok(frm.into_ref()) } + fn flush(&mut self) { + self.frmmgr.clear(); + } } pub fn get_decoder() -> Box<dyn NADecoder> { diff --git a/nihav-commonfmt/src/codecs/pcm.rs b/nihav-commonfmt/src/codecs/pcm.rs index 49e9dad..32c8de0 100644 --- a/nihav-commonfmt/src/codecs/pcm.rs +++ b/nihav-commonfmt/src/codecs/pcm.rs @@ -56,6 +56,8 @@ impl NADecoder for PCMDecoder { Err(DecoderError::InvalidData) } } + fn flush(&mut self) { + } } pub fn get_decoder() -> Box<dyn NADecoder> { diff --git a/nihav-commonfmt/src/codecs/sipro.rs b/nihav-commonfmt/src/codecs/sipro.rs index fd035c6..745feaf 100644 --- a/nihav-commonfmt/src/codecs/sipro.rs +++ b/nihav-commonfmt/src/codecs/sipro.rs @@ -732,6 +732,8 @@ impl NADecoder for SiproDecoder { frm.set_keyframe(true); Ok(frm.into_ref()) } + fn flush(&mut self) { + } } pub fn get_decoder() -> Box<dyn NADecoder> { diff --git a/nihav-commonfmt/src/codecs/ts102366.rs b/nihav-commonfmt/src/codecs/ts102366.rs index 65b1b9e..62acaeb 100644 --- a/nihav-commonfmt/src/codecs/ts102366.rs +++ b/nihav-commonfmt/src/codecs/ts102366.rs @@ -1235,6 +1235,9 @@ impl NADecoder for AudioDecoder { frm.set_keyframe(true); Ok(frm.into_ref()) } + fn flush(&mut self) { + self.delay = [[0.0; BLOCK_LEN]; MAX_CHANNELS + 1]; + } } pub fn get_decoder() -> Box<dyn NADecoder> { |
