Cleanup Frame.parse_sample_rate/1
This commit is contained in:
parent
491b7462ca
commit
797a87ded8
|
@ -184,16 +184,18 @@ defmodule MPEGAudioFrameParser.Frame do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp parse_sample_rate(<<@sync_word::size(11), version_bits::size(2), _::size(7), sample_rate_bits::size(2), _::bits>>) do
|
defp parse_sample_rate(<<@sync_word::size(11), version_bits::size(2), _::size(7), sample_rate_bits::size(2), _::bits>>) do
|
||||||
case {version_bits, sample_rate_bits} do
|
version_atom = version_atom(version_bits)
|
||||||
{0b11, 0b00} -> 44100
|
|
||||||
{0b11, 0b01} -> 48000
|
case {version_atom, sample_rate_bits} do
|
||||||
{0b11, 0b10} -> 32000
|
{:version1, 0b00} -> 44100
|
||||||
{0b10, 0b00} -> 22050
|
{:version1, 0b01} -> 48000
|
||||||
{0b10, 0b01} -> 24000
|
{:version1, 0b10} -> 32000
|
||||||
{0b10, 0b10} -> 16000
|
{:version2, 0b00} -> 22050
|
||||||
{0b00, 0b00} -> 11025
|
{:version2, 0b01} -> 24000
|
||||||
{0b00, 0b01} -> 12000
|
{:version2, 0b10} -> 16000
|
||||||
{0b00, 0b10} -> 8000
|
{:"version2.5", 0b00} -> 11025
|
||||||
|
{:"version2.5", 0b01} -> 12000
|
||||||
|
{:"version2.5", 0b10} -> 8000
|
||||||
_ -> :bad
|
_ -> :bad
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue