mp4, fmp4: fix byte order for opus extension

The "Encapsulation of Opus in ISO Base Media File Format" [1] specifications,
§ 4.3.2 Opus Specific Box, indicates that data must be stored as big-endian.

In `write_dops`, `to_le_bytes` variants were used.

Related to [2].

[1] https://opus-codec.org/docs/opus_in_isobmff.html#4.3.2
[2] https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4875

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1247>
This commit is contained in:
François Laignel 2023-06-19 16:26:57 +02:00
parent 84a33ca7b9
commit f85106b86a
2 changed files with 6 additions and 6 deletions

View file

@ -1502,9 +1502,9 @@ fn write_dops(v: &mut Vec<u8>, caps: &gst::Caps) -> Result<(), Error> {
// Version number
v.push(0);
v.push(channels);
v.extend(pre_skip.to_le_bytes());
v.extend(rate.to_le_bytes());
v.extend(output_gain.to_le_bytes());
v.extend(pre_skip.to_be_bytes());
v.extend(rate.to_be_bytes());
v.extend(output_gain.to_be_bytes());
v.push(channel_mapping_family);
if channel_mapping_family > 0 {
v.push(stream_count);

View file

@ -1319,9 +1319,9 @@ fn write_dops(v: &mut Vec<u8>, caps: &gst::Caps) -> Result<(), Error> {
// Version number
v.push(0);
v.push(channels);
v.extend(pre_skip.to_le_bytes());
v.extend(rate.to_le_bytes());
v.extend(output_gain.to_le_bytes());
v.extend(pre_skip.to_be_bytes());
v.extend(rate.to_be_bytes());
v.extend(output_gain.to_be_bytes());
v.push(channel_mapping_family);
if channel_mapping_family > 0 {
v.push(stream_count);