@libmedia/avutil 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -183,4 +183,44 @@ typedef struct AVChannelLayout {
183
183
  void *opaque;
184
184
  } AVChannelLayout;
185
185
 
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
+
186
226
  #endif
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include <stdint.h>
6
6
  #include "wasmatomic.h"
7
+ #include "audiosample.h"
7
8
 
8
9
  typedef struct AVPCMBuffer {
9
10
  /**
@@ -31,6 +32,10 @@ typedef struct AVPCMBuffer {
31
32
  * 采样率
32
33
  */
33
34
  int32_t sampleRate;
35
+ /**
36
+ * pcm 格式
37
+ */
38
+ enum AVSampleFormat format;
34
39
  /**
35
40
  * pts
36
41
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libmedia/avutil",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "libmedia 工具模块",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,8 +16,8 @@
16
16
  "author": "Gaoxing Zhao",
17
17
  "license": "LGPL-3.0-or-later",
18
18
  "dependencies": {
19
- "@libmedia/common": "1.0.2",
20
- "@libmedia/cheap": "0.3.0"
19
+ "@libmedia/common": "1.2.0",
20
+ "@libmedia/cheap": "0.4.1"
21
21
  },
22
22
  "exports": {
23
23
  "./AVStream": {