S1: AudioDecoder decodes DTS through ec-dts (was an unsupported arm; capability gap)
Browse files at this commit50f88ea1ad4fe9801b41ce8e1b513dbec18c9b33Parent: d2e45f52 changed files +6 -0
crates/ec-probe/Cargo.tomlmodified+1 -0
| @@ -12,6 +12,7 @@ ec-ac3 = { workspace = true } | |||
| 12 | ec-alac = { workspace = true } | 12 | ec-alac = { workspace = true } |
| 13 | ec-amr = { workspace = true } | 13 | ec-amr = { workspace = true } |
| 14 | ec-core = { workspace = true } | 14 | ec-core = { workspace = true } |
| 15 | +ec-dts = { workspace = true } | ||
| 15 | ec-flac = { workspace = true } | 16 | ec-flac = { workspace = true } |
| 16 | ec-pcm-ext = { workspace = true } | 17 | ec-pcm-ext = { workspace = true } |
| 17 | ec-matroska = { workspace = true } | 18 | ec-matroska = { workspace = true } |
crates/ec-probe/src/decoder.rsmodified+5 -0
| @@ -25,6 +25,7 @@ enum Inner { | |||
| 25 | AmrNb(Box<ec_amr::nb::decoder::AmrNbDecoder>), | 25 | AmrNb(Box<ec_amr::nb::decoder::AmrNbDecoder>), |
| 26 | AmrWb(Box<ec_amr::wb::AmrWbDecoder>), | 26 | AmrWb(Box<ec_amr::wb::AmrWbDecoder>), |
| 27 | Opus(Box<ec_opus::MultistreamDecoder>), | 27 | Opus(Box<ec_opus::MultistreamDecoder>), |
| 28 | + Dts(Box<ec_dts::DtsDecoder>), | ||
| 28 | /// PCM needs no decoder, only a reading of the bytes. | 29 | /// PCM needs no decoder, only a reading of the bytes. |
| 29 | Pcm(PcmFormat), | 30 | Pcm(PcmFormat), |
| 30 | } | 31 | } |
| @@ -158,6 +159,7 @@ impl AudioDecoder { | |||
| 158 | 48_000, streams, coupled, &mapping, | 159 | 48_000, streams, coupled, &mapping, |
| 159 | )?)) | 160 | )?)) |
| 160 | } | 161 | } |
| 162 | + CodecId::Dts => Inner::Dts(Box::new(ec_dts::DtsDecoder::new())), | ||
| 161 | codec => match PcmFormat::of(codec) { | 163 | codec => match PcmFormat::of(codec) { |
| 162 | Some(format) => Inner::Pcm(format), | 164 | Some(format) => Inner::Pcm(format), |
| 163 | None => { | 165 | None => { |
| @@ -216,6 +218,7 @@ impl AudioDecoder { | |||
| 216 | Inner::Vorbis(d) => drain(d.as_mut(), packet, out)?, | 218 | Inner::Vorbis(d) => drain(d.as_mut(), packet, out)?, |
| 217 | Inner::Ac3(d) => drain(d.as_mut(), packet, out)?, | 219 | Inner::Ac3(d) => drain(d.as_mut(), packet, out)?, |
| 218 | Inner::TrueHd(d) => drain(d.as_mut(), packet, out)?, | 220 | Inner::TrueHd(d) => drain(d.as_mut(), packet, out)?, |
| 221 | + Inner::Dts(d) => drain(d.as_mut(), packet, out)?, | ||
| 219 | Inner::Aac(d) => { | 222 | Inner::Aac(d) => { |
| 220 | let audio = d.decode(&packet.data, packet.pts)?; | 223 | let audio = d.decode(&packet.data, packet.pts)?; |
| 221 | self.channels = usize::from(audio.channels).max(1); | 224 | self.channels = usize::from(audio.channels).max(1); |
| @@ -309,6 +312,7 @@ impl AudioDecoder { | |||
| 309 | Inner::Vorbis(d) => flush_drain(d.as_mut(), out)?, | 312 | Inner::Vorbis(d) => flush_drain(d.as_mut(), out)?, |
| 310 | Inner::Ac3(d) => flush_drain(d.as_mut(), out)?, | 313 | Inner::Ac3(d) => flush_drain(d.as_mut(), out)?, |
| 311 | Inner::TrueHd(d) => flush_drain(d.as_mut(), out)?, | 314 | Inner::TrueHd(d) => flush_drain(d.as_mut(), out)?, |
| 315 | + Inner::Dts(d) => flush_drain(d.as_mut(), out)?, | ||
| 312 | // AAC, ALAC, Opus and PCM decode a packet at a time with nothing | 316 | // AAC, ALAC, Opus and PCM decode a packet at a time with nothing |
| 313 | // held back across the end of the file. | 317 | // held back across the end of the file. |
| 314 | Inner::Aac(_) | Inner::Alac(_) | Inner::PcmExt(_) | Inner::AmrNb(_) | Inner::AmrWb(_) | Inner::Opus(_) | Inner::Pcm(_) => {} | 318 | Inner::Aac(_) | Inner::Alac(_) | Inner::PcmExt(_) | Inner::AmrNb(_) | Inner::AmrWb(_) | Inner::Opus(_) | Inner::Pcm(_) => {} |
| @@ -352,6 +356,7 @@ impl AudioDecoder { | |||
| 352 | Inner::Vorbis(d) => d.reset(), | 356 | Inner::Vorbis(d) => d.reset(), |
| 353 | Inner::Ac3(d) => d.reset(), | 357 | Inner::Ac3(d) => d.reset(), |
| 354 | Inner::TrueHd(d) => d.reset(), | 358 | Inner::TrueHd(d) => d.reset(), |
| 359 | + Inner::Dts(d) => ec_core::Decoder::reset(d.as_mut()), | ||
| 355 | Inner::Aac(d) => { | 360 | Inner::Aac(d) => { |
| 356 | **d = match d.config().cloned() { | 361 | **d = match d.config().cloned() { |
| 357 | Some(cfg) => ec_aac::AacDecoder::with_config(cfg), | 362 | Some(cfg) => ec_aac::AacDecoder::with_config(cfg), |