Skip to content

Commit 5ab1788

Browse files
committed
fix(avutil): 修正 avpcmbuffer.h 头文件
1 parent 20631ad commit 5ab1788

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/avutil/include/audiosample.h

+40
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,44 @@ typedef struct AVChannelLayout {
183183
void *opaque;
184184
} AVChannelLayout;
185185

186+
/**
187+
* Audio sample formats
188+
*
189+
* - The data described by the sample format is always in native-endian order.
190+
* Sample values can be expressed by native C types, hence the lack of a signed
191+
* 24-bit sample format even though it is a common raw audio data format.
192+
*
193+
* - The floating-point formats are based on full volume being in the range
194+
* [-1.0, 1.0]. Any values outside this range are beyond full volume level.
195+
*
196+
* - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
197+
* (such as AVFrame in libavcodec) is as follows:
198+
*
199+
* @par
200+
* For planar sample formats, each audio channel is in a separate data plane,
201+
* and linesize is the buffer size, in bytes, for a single plane. All data
202+
* planes must be the same size. For packed sample formats, only the first data
203+
* plane is used, and samples for each channel are interleaved. In this case,
204+
* linesize is the buffer size, in bytes, for the 1 plane.
205+
*
206+
*/
207+
enum AVSampleFormat {
208+
AV_SAMPLE_FMT_NONE = -1,
209+
AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
210+
AV_SAMPLE_FMT_S16, ///< signed 16 bits
211+
AV_SAMPLE_FMT_S32, ///< signed 32 bits
212+
AV_SAMPLE_FMT_FLT, ///< float
213+
AV_SAMPLE_FMT_DBL, ///< double
214+
215+
AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
216+
AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
217+
AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
218+
AV_SAMPLE_FMT_FLTP, ///< float, planar
219+
AV_SAMPLE_FMT_DBLP, ///< double, planar
220+
AV_SAMPLE_FMT_S64, ///< signed 64 bits
221+
AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
222+
223+
AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
224+
};
225+
186226
#endif

src/avutil/include/avpcmbuffer.h

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <stdint.h>
66
#include "wasmatomic.h"
7+
#include "audiosample.h"
78

89
typedef struct AVPCMBuffer {
910
/**
@@ -31,6 +32,10 @@ typedef struct AVPCMBuffer {
3132
* 采样率
3233
*/
3334
int32_t sampleRate;
35+
/**
36+
* pcm 格式
37+
*/
38+
enum AVSampleFormat format;
3439
/**
3540
* pts
3641
*/

0 commit comments

Comments
 (0)