Fix bug Alaw is Codec_id 6 and Ulaw is Codec_id 7
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
d6ac1eb3bb
commit
86fc1d14e9
|
@ -15,8 +15,8 @@ fn parse_sound_data(input: &[u8]) -> IResult<&[u8], BlockType> {
|
|||
2 => Codec::Adpcm3to8,
|
||||
3 => Codec::Adpcm2to8,
|
||||
4 => Codec::Pcm16BitSigned,
|
||||
5 => Codec::Alaw,
|
||||
6 => Codec::Ulaw,
|
||||
6 => Codec::Alaw,
|
||||
7 => Codec::Ulaw,
|
||||
_ => return Err(Err::Error(Error::new(input, ErrorKind::Alt))),
|
||||
};
|
||||
let (input, data) = take(block_size - 2)(input)?;
|
||||
|
@ -89,8 +89,8 @@ fn parse_extra_information(input: &[u8]) -> IResult<&[u8], BlockType> {
|
|||
2 => Codec::Adpcm3to8,
|
||||
3 => Codec::Adpcm2to8,
|
||||
4 => Codec::Pcm16BitSigned,
|
||||
5 => Codec::Alaw,
|
||||
6 => Codec::Ulaw,
|
||||
6 => Codec::Alaw,
|
||||
7 => Codec::Ulaw,
|
||||
_ => return Err(Err::Error(Error::new(input, ErrorKind::Alt))),
|
||||
};
|
||||
let sample_rate: u32 =
|
||||
|
@ -119,8 +119,8 @@ fn parse_sound_data_new(input: &[u8]) -> IResult<&[u8], BlockType> {
|
|||
2 => Codec::Adpcm3to8,
|
||||
3 => Codec::Adpcm2to8,
|
||||
4 => Codec::Pcm16BitSigned,
|
||||
5 => Codec::Alaw,
|
||||
6 => Codec::Ulaw,
|
||||
6 => Codec::Alaw,
|
||||
7 => Codec::Ulaw,
|
||||
0x0200 => Codec::Adpcm4to16,
|
||||
_ => return Err(Err::Error(Error::new(input, ErrorKind::Alt))),
|
||||
};
|
||||
|
|
|
@ -32,8 +32,8 @@ fn write_sound_data(block: &BlockType) -> Result<Vec<u8>, Error> {
|
|||
Codec::Adpcm3to8 => 2,
|
||||
Codec::Adpcm2to8 => 3,
|
||||
Codec::Pcm16BitSigned => 4,
|
||||
Codec::Alaw => 5,
|
||||
Codec::Ulaw => 6,
|
||||
Codec::Alaw => 6,
|
||||
Codec::Ulaw => 7,
|
||||
_ => return Err(Error::new(ErrorKind::Other, "Invalid codec")),
|
||||
};
|
||||
bytes.extend_from_slice(&[codec_id]);
|
||||
|
@ -142,8 +142,8 @@ fn write_extra_information(block: &BlockType) -> Result<Vec<u8>, Error> {
|
|||
Codec::Adpcm3to8 => 2,
|
||||
Codec::Adpcm2to8 => 3,
|
||||
Codec::Pcm16BitSigned => 4,
|
||||
Codec::Alaw => 5,
|
||||
Codec::Ulaw => 6,
|
||||
Codec::Alaw => 6,
|
||||
Codec::Ulaw => 7,
|
||||
_ => return Err(Error::new(ErrorKind::Other, "Invalid codec")),
|
||||
};
|
||||
bytes.extend_from_slice(&[codec_id]);
|
||||
|
@ -179,8 +179,8 @@ fn write_sound_data_new(block: &BlockType) -> Result<Vec<u8>, Error> {
|
|||
Codec::Adpcm3to8 => 2,
|
||||
Codec::Adpcm2to8 => 3,
|
||||
Codec::Pcm16BitSigned => 4,
|
||||
Codec::Alaw => 5,
|
||||
Codec::Ulaw => 6,
|
||||
Codec::Alaw => 6,
|
||||
Codec::Ulaw => 7,
|
||||
Codec::Adpcm4to16 => 0x0200,
|
||||
};
|
||||
bytes.extend_from_slice(&codec_id.to_le_bytes());
|
||||
|
|
Loading…
Reference in New Issue