diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-06-30 18:22:40 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2023-06-30 18:22:40 +0200 |
commit | 7b7b426d726457b8cd48baefb6242cbda0fd7f01 (patch) | |
tree | 51f57dd0a3f898d9d5760df528a0637bdb719801 /sndplay/src/main.rs | |
parent | e2ca0dbe4e8c92c3c95cda0cf1dc57da164b1c8a (diff) | |
download | nihav-player-7b7b426d726457b8cd48baefb6242cbda0fd7f01.tar.gz |
sndplay: support playing AAC with SBR
Diffstat (limited to 'sndplay/src/main.rs')
-rw-r--r-- | sndplay/src/main.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sndplay/src/main.rs b/sndplay/src/main.rs index c368651..4741853 100644 --- a/sndplay/src/main.rs +++ b/sndplay/src/main.rs @@ -303,8 +303,16 @@ impl Player { } let (dsupp, decoder) = dec.unwrap(); - let ainfo = ainfo.unwrap().get_properties().get_audio_info().unwrap(); - let arate = if ainfo.sample_rate > 0 { ainfo.sample_rate } else { 44100 }; + let info = ainfo.unwrap(); + let ainfo = info.get_properties().get_audio_info().unwrap(); + let sbr_hack = info.get_name() == "aac" && ainfo.sample_rate < 32000; + let arate = if ainfo.sample_rate > 0 { + if !sbr_hack { + ainfo.sample_rate + } else { + ainfo.sample_rate * 2 + } + } else { 44100 }; let ch = ainfo.channels; println!("Playing {} [{}Hz {}ch]", name, arate, ch); |