react-native-tiny-wavpack-decoder 0.1.0 → 1.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-tiny-wavpack-decoder",
3
- "version": "0.1.0",
3
+ "version": "1.0.2",
4
4
  "description": "Tiny WavPack Decoder for React Native",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -47,8 +47,20 @@
47
47
  },
48
48
  "keywords": [
49
49
  "react-native",
50
+ "wavpack",
51
+ "audio-decoder",
52
+ "turbo-module",
53
+ "new-architecture",
50
54
  "ios",
51
- "android"
55
+ "android",
56
+ "audio-processing",
57
+ "wav",
58
+ "file-conversion",
59
+ "native-module",
60
+ "audio",
61
+ "decoder",
62
+ "cross-platform",
63
+ "progress-events"
52
64
  ],
53
65
  "repository": {
54
66
  "type": "git",
@@ -97,7 +109,7 @@
97
109
  },
98
110
  "peerDependencies": {
99
111
  "react": "*",
100
- "react-native": "*"
112
+ "react-native": ">=0.77.0"
101
113
  },
102
114
  "workspaces": [
103
115
  "example"
@@ -1,140 +1,140 @@
1
- ////////////////////////////////////////////////////////////////////////////
2
- // **** WAVPACK **** //
3
- // Hybrid Lossless Wavefile Compressor //
4
- // Copyright (c) 1998 - 2006 Conifer Software. //
5
- // All Rights Reserved. //
6
- // Distributed under the BSD Software License (see license.txt) //
7
- ////////////////////////////////////////////////////////////////////////////
8
-
9
- // bits.c
10
-
11
- // This module provides utilities to support the BitStream structure which is
12
- // used to read and write all WavPack audio data streams. It also contains a
13
- // wrapper for the stream I/O functions and a set of functions dealing with
14
- // endian-ness, both for enhancing portability. Finally, a debug wrapper for
15
- // the malloc() system is provided.
16
-
17
- #include "wavpack.h"
18
-
19
- #include <string.h>
20
- #include <ctype.h>
21
-
22
- ////////////////////////// Bitstream functions ////////////////////////////////
23
-
24
- // Open the specified BitStream and associate with the specified buffer.
25
-
26
- static void bs_read (Bitstream *bs);
27
-
28
- void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes)
29
- {
30
- CLEAR (*bs);
31
- bs->buf = buffer_start;
32
- bs->end = buffer_end;
33
-
34
- if (file) {
35
- bs->ptr = bs->end - 1;
36
- bs->file_bytes = file_bytes;
37
- bs->file = file;
38
- }
39
- else
40
- bs->ptr = bs->buf - 1;
41
-
42
- bs->wrap = bs_read;
43
- }
44
-
45
- // This function is only called from the getbit() and getbits() macros when
46
- // the BitStream has been exhausted and more data is required. Sinve these
47
- // bistreams no longer access files, this function simple sets an error and
48
- // resets the buffer.
49
-
50
- static void bs_read (Bitstream *bs)
51
- {
52
- if (bs->file && bs->file_bytes) {
53
- uint32_t bytes_read, bytes_to_read = bs->end - bs->buf;
54
-
55
- if (bytes_to_read > bs->file_bytes)
56
- bytes_to_read = bs->file_bytes;
57
-
58
- bytes_read = bs->file (bs->buf, bytes_to_read);
59
-
60
- if (bytes_read) {
61
- bs->end = bs->buf + bytes_read;
62
- bs->file_bytes -= bytes_read;
63
- }
64
- else {
65
- memset (bs->buf, -1, bs->end - bs->buf);
66
- bs->error = 1;
67
- }
68
- }
69
- else
70
- bs->error = 1;
71
-
72
- if (bs->error)
73
- memset (bs->buf, -1, bs->end - bs->buf);
74
-
75
- bs->ptr = bs->buf;
76
- }
77
-
78
- /////////////////////// Endian Correction Routines ////////////////////////////
79
-
80
- void little_endian_to_native (void *data, char *format)
81
- {
82
- uchar *cp = (uchar *) data;
83
- int32_t temp;
84
-
85
- while (*format) {
86
- switch (*format) {
87
- case 'L':
88
- temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24);
89
- * (int32_t *) cp = temp;
90
- cp += 4;
91
- break;
92
-
93
- case 'S':
94
- temp = cp [0] + (cp [1] << 8);
95
- * (short *) cp = (short) temp;
96
- cp += 2;
97
- break;
98
-
99
- default:
100
- if (isdigit (*format))
101
- cp += *format - '0';
102
-
103
- break;
104
- }
105
-
106
- format++;
107
- }
108
- }
109
-
110
- void native_to_little_endian (void *data, char *format)
111
- {
112
- uchar *cp = (uchar *) data;
113
- int32_t temp;
114
-
115
- while (*format) {
116
- switch (*format) {
117
- case 'L':
118
- temp = * (int32_t *) cp;
119
- *cp++ = (uchar) temp;
120
- *cp++ = (uchar) (temp >> 8);
121
- *cp++ = (uchar) (temp >> 16);
122
- *cp++ = (uchar) (temp >> 24);
123
- break;
124
-
125
- case 'S':
126
- temp = * (short *) cp;
127
- *cp++ = (uchar) temp;
128
- *cp++ = (uchar) (temp >> 8);
129
- break;
130
-
131
- default:
132
- if (isdigit (*format))
133
- cp += *format - '0';
134
-
135
- break;
136
- }
137
-
138
- format++;
139
- }
140
- }
1
+ ////////////////////////////////////////////////////////////////////////////
2
+ // **** WAVPACK **** //
3
+ // Hybrid Lossless Wavefile Compressor //
4
+ // Copyright (c) 1998 - 2006 Conifer Software. //
5
+ // All Rights Reserved. //
6
+ // Distributed under the BSD Software License (see license.txt) //
7
+ ////////////////////////////////////////////////////////////////////////////
8
+
9
+ // bits.c
10
+
11
+ // This module provides utilities to support the BitStream structure which is
12
+ // used to read and write all WavPack audio data streams. It also contains a
13
+ // wrapper for the stream I/O functions and a set of functions dealing with
14
+ // endian-ness, both for enhancing portability. Finally, a debug wrapper for
15
+ // the malloc() system is provided.
16
+
17
+ #include "wavpack.h"
18
+
19
+ #include <string.h>
20
+ #include <ctype.h>
21
+
22
+ ////////////////////////// Bitstream functions ////////////////////////////////
23
+
24
+ // Open the specified BitStream and associate with the specified buffer.
25
+
26
+ static void bs_read (Bitstream *bs);
27
+
28
+ void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes)
29
+ {
30
+ CLEAR (*bs);
31
+ bs->buf = buffer_start;
32
+ bs->end = buffer_end;
33
+
34
+ if (file) {
35
+ bs->ptr = bs->end - 1;
36
+ bs->file_bytes = file_bytes;
37
+ bs->file = file;
38
+ }
39
+ else
40
+ bs->ptr = bs->buf - 1;
41
+
42
+ bs->wrap = bs_read;
43
+ }
44
+
45
+ // This function is only called from the getbit() and getbits() macros when
46
+ // the BitStream has been exhausted and more data is required. Sinve these
47
+ // bistreams no longer access files, this function simple sets an error and
48
+ // resets the buffer.
49
+
50
+ static void bs_read (Bitstream *bs)
51
+ {
52
+ if (bs->file && bs->file_bytes) {
53
+ uint32_t bytes_read, bytes_to_read = bs->end - bs->buf;
54
+
55
+ if (bytes_to_read > bs->file_bytes)
56
+ bytes_to_read = bs->file_bytes;
57
+
58
+ bytes_read = bs->file (bs->buf, bytes_to_read);
59
+
60
+ if (bytes_read) {
61
+ bs->end = bs->buf + bytes_read;
62
+ bs->file_bytes -= bytes_read;
63
+ }
64
+ else {
65
+ memset (bs->buf, -1, bs->end - bs->buf);
66
+ bs->error = 1;
67
+ }
68
+ }
69
+ else
70
+ bs->error = 1;
71
+
72
+ if (bs->error)
73
+ memset (bs->buf, -1, bs->end - bs->buf);
74
+
75
+ bs->ptr = bs->buf;
76
+ }
77
+
78
+ /////////////////////// Endian Correction Routines ////////////////////////////
79
+
80
+ void little_endian_to_native (void *data, char *format)
81
+ {
82
+ uchar *cp = (uchar *) data;
83
+ int32_t temp;
84
+
85
+ while (*format) {
86
+ switch (*format) {
87
+ case 'L':
88
+ temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24);
89
+ * (int32_t *) cp = temp;
90
+ cp += 4;
91
+ break;
92
+
93
+ case 'S':
94
+ temp = cp [0] + (cp [1] << 8);
95
+ * (short *) cp = (short) temp;
96
+ cp += 2;
97
+ break;
98
+
99
+ default:
100
+ if (isdigit (*format))
101
+ cp += *format - '0';
102
+
103
+ break;
104
+ }
105
+
106
+ format++;
107
+ }
108
+ }
109
+
110
+ void native_to_little_endian (void *data, char *format)
111
+ {
112
+ uchar *cp = (uchar *) data;
113
+ int32_t temp;
114
+
115
+ while (*format) {
116
+ switch (*format) {
117
+ case 'L':
118
+ temp = * (int32_t *) cp;
119
+ *cp++ = (uchar) temp;
120
+ *cp++ = (uchar) (temp >> 8);
121
+ *cp++ = (uchar) (temp >> 16);
122
+ *cp++ = (uchar) (temp >> 24);
123
+ break;
124
+
125
+ case 'S':
126
+ temp = * (short *) cp;
127
+ *cp++ = (uchar) temp;
128
+ *cp++ = (uchar) (temp >> 8);
129
+ break;
130
+
131
+ default:
132
+ if (isdigit (*format))
133
+ cp += *format - '0';
134
+
135
+ break;
136
+ }
137
+
138
+ format++;
139
+ }
140
+ }
@@ -1,50 +1,50 @@
1
- ////////////////////////////////////////////////////////////////////////////
2
- // **** WAVPACK **** //
3
- // Hybrid Lossless Wavefile Compressor //
4
- // Copyright (c) 1998 - 2006 Conifer Software. //
5
- // All Rights Reserved. //
6
- // Distributed under the BSD Software License (see license.txt) //
7
- ////////////////////////////////////////////////////////////////////////////
8
-
9
- // float.c
10
-
11
- #include "wavpack.h"
12
-
13
- int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd)
14
- {
15
- int bytecnt = wpmd->byte_length;
16
- char *byteptr = wpmd->data;
17
-
18
- if (bytecnt != 4)
19
- return FALSE;
20
-
21
- wps->float_flags = *byteptr++;
22
- wps->float_shift = *byteptr++;
23
- wps->float_max_exp = *byteptr++;
24
- wps->float_norm_exp = *byteptr;
25
- return TRUE;
26
- }
27
-
28
- void float_values (WavpackStream *wps, int32_t *values, int32_t num_values)
29
- {
30
- int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift;
31
-
32
- if (shift > 32)
33
- shift = 32;
34
- else if (shift < -32)
35
- shift = -32;
36
-
37
- while (num_values--) {
38
- if (shift > 0)
39
- *values <<= shift;
40
- else if (shift < 0)
41
- *values >>= -shift;
42
-
43
- if (*values > 8388607L)
44
- *values = 8388607L;
45
- else if (*values < -8388608L)
46
- *values = -8388608L;
47
-
48
- values++;
49
- }
50
- }
1
+ ////////////////////////////////////////////////////////////////////////////
2
+ // **** WAVPACK **** //
3
+ // Hybrid Lossless Wavefile Compressor //
4
+ // Copyright (c) 1998 - 2006 Conifer Software. //
5
+ // All Rights Reserved. //
6
+ // Distributed under the BSD Software License (see license.txt) //
7
+ ////////////////////////////////////////////////////////////////////////////
8
+
9
+ // float.c
10
+
11
+ #include "wavpack.h"
12
+
13
+ int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd)
14
+ {
15
+ int bytecnt = wpmd->byte_length;
16
+ char *byteptr = wpmd->data;
17
+
18
+ if (bytecnt != 4)
19
+ return FALSE;
20
+
21
+ wps->float_flags = *byteptr++;
22
+ wps->float_shift = *byteptr++;
23
+ wps->float_max_exp = *byteptr++;
24
+ wps->float_norm_exp = *byteptr;
25
+ return TRUE;
26
+ }
27
+
28
+ void float_values (WavpackStream *wps, int32_t *values, int32_t num_values)
29
+ {
30
+ int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift;
31
+
32
+ if (shift > 32)
33
+ shift = 32;
34
+ else if (shift < -32)
35
+ shift = -32;
36
+
37
+ while (num_values--) {
38
+ if (shift > 0)
39
+ *values <<= shift;
40
+ else if (shift < 0)
41
+ *values >>= -shift;
42
+
43
+ if (*values > 8388607L)
44
+ *values = 8388607L;
45
+ else if (*values < -8388608L)
46
+ *values = -8388608L;
47
+
48
+ values++;
49
+ }
50
+ }
@@ -1,25 +1,25 @@
1
- Copyright (c) 1998 - 2006 Conifer Software
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without
5
- modification, are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice,
8
- this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright notice,
10
- this list of conditions and the following disclaimer in the
11
- documentation and/or other materials provided with the distribution.
12
- * Neither the name of Conifer Software nor the names of its contributors
13
- may be used to endorse or promote products derived from this software
14
- without specific prior written permission.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
20
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ Copyright (c) 1998 - 2006 Conifer Software
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the
11
+ documentation and/or other materials provided with the distribution.
12
+ * Neither the name of Conifer Software nor the names of its contributors
13
+ may be used to endorse or promote products derived from this software
14
+ without specific prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
20
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.