RIFF WAV 文件中是否保证格式参数的字节序? [英] Is the endianness of format params guaranteed in RIFF WAV files?

查看:35
本文介绍了RIFF WAV 文件中是否保证格式参数的字节序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 RIFF WAV 文件中是否保证格式参数的字节序?我听到了相互矛盾的答案,包括对RIFX 文件格式.

Is the endianness of format params guaranteed in RIFF WAV files? I have heard conflicting answers to this including references to a RIFX file format.

推荐答案

是.

如果文件以 RIFF 开头,则它是小端.如果它以 FFIR 或 RIFX 开头,则可能不是.一般来说,支持 WAV 格式就意味着支持 RIFF 文件,尽管添加 RIFX 支持应该不难.

If the file starts with RIFF, then it's little endian. If it starts with FFIR or RIFX, then it's probably not. Generally, supporting the WAV format means supporting RIFF files, although adding RIFX support should not prove difficult.

BWF(广播波格式)的 AES31 规范引用了这个 RIFF 规范:http://www.tactilemedia.com/info/MCI_Control_Info.html

The AES31 specification for BWF (Broadcast Wave Format) references this specification for RIFF: http://www.tactilemedia.com/info/MCI_Control_Info.html

从这里:

RIFF 有一个对应的 RIFX,即用于定义 RIFF 文件格式使用 Motorola 整数字节排序格式而不是 Intel 格式.一个RIFX 文件与 RIFF 文件相同,除了前四个字节是'RIFX' 而不是 'RIFF' 和整数字节顺序表示为摩托罗拉格式.

RIFF has a counterpart, RIFX, that is used to define RIFF file formats that use the Motorola integer byte-ordering format rather than the Intel format. A RIFX file is the same as a RIFF file, except that the first four bytes are 'RIFX' instead of 'RIFF', and integer byte ordering is represented in Motorola format.

您引用的 KVR 文章指的是作者在 big-endian 系统 (Motorola PPC) 上错误使用 int*,这将检索字节交换值.在编写跨端代码时,始终需要注意正确处理字节交换.

The KVR article you reference refers to the author's incorrect usage of int* on big-endian systems (Motorola PPC), which will retrieve byte-swapped values. Care is always necessary to handle byte-swapping correctly when writing cross-endian code.

如果磁盘上文件的第 0 个字节是R",第 3 个字节是F",则可以确定其余内容将按小端存储.

If the zeroth byte of the file on disk is 'R', and the 3rd is 'F', you can be certain that the rest of the contents will be stored little endian.

RIFX 没有被广泛使用.大多数大端 RIFF 实现会将字节交换到磁盘,并生成正确的 RIFF 文件.

RIFX is not widely used. Most big-endian RIFF implementations swap bytes to disk, and generate correct RIFF files.

这篇关于RIFF WAV 文件中是否保证格式参数的字节序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆