@moodbar/native 0.4.0 → 0.5.0

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.
@@ -23,6 +23,9 @@ typedef struct MoodbarNativeAnalysisSummary {
23
23
  uint64_t handle;
24
24
  uint32_t frame_count;
25
25
  uint32_t channel_count;
26
+ uint32_t decode_errors;
27
+ uint32_t zero_channel_packets;
28
+ uint32_t truncated_frames;
26
29
  } MoodbarNativeAnalysisSummary;
27
30
 
28
31
  typedef struct MoodbarNativeBuffer {
@@ -41,6 +44,12 @@ MoodbarNativeStatus moodbar_native_analysis_from_bytes(const uint8_t *bytes,
41
44
  const char *options_json,
42
45
  struct MoodbarNativeAnalysisSummary *out_summary);
43
46
 
47
+ MoodbarNativeStatus moodbar_native_analysis_from_pcm(uint32_t sample_rate,
48
+ const float *samples,
49
+ size_t samples_len,
50
+ const char *options_json,
51
+ struct MoodbarNativeAnalysisSummary *out_summary);
52
+
44
53
  MoodbarNativeStatus moodbar_native_analysis_dispose(uint64_t handle);
45
54
 
46
55
  MoodbarNativeStatus moodbar_native_render_svg(uint64_t handle,
@@ -51,6 +60,12 @@ MoodbarNativeStatus moodbar_native_render_png(uint64_t handle,
51
60
  const char *options_json,
52
61
  struct MoodbarNativeBuffer *out_png);
53
62
 
63
+ MoodbarNativeStatus moodbar_native_get_colors(uint64_t handle,
64
+ struct MoodbarNativeBuffer *out_colors);
65
+
66
+ MoodbarNativeStatus moodbar_native_get_frames(uint64_t handle,
67
+ struct MoodbarNativeBuffer *out_frames);
68
+
54
69
  MoodbarNativeStatus moodbar_native_last_error(struct MoodbarNativeBuffer *out_message_utf8);
55
70
 
56
71
  /**
@@ -4,6 +4,23 @@
4
4
  <dict>
5
5
  <key>AvailableLibraries</key>
6
6
  <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>libmoodbar_native_ffi_macos.a</string>
10
+ <key>HeadersPath</key>
11
+ <string>Headers</string>
12
+ <key>LibraryIdentifier</key>
13
+ <string>macos-arm64_x86_64</string>
14
+ <key>LibraryPath</key>
15
+ <string>libmoodbar_native_ffi_macos.a</string>
16
+ <key>SupportedArchitectures</key>
17
+ <array>
18
+ <string>arm64</string>
19
+ <string>x86_64</string>
20
+ </array>
21
+ <key>SupportedPlatform</key>
22
+ <string>macos</string>
23
+ </dict>
7
24
  <dict>
8
25
  <key>BinaryPath</key>
9
26
  <string>libmoodbar_native_ffi.a</string>
@@ -23,6 +23,9 @@ typedef struct MoodbarNativeAnalysisSummary {
23
23
  uint64_t handle;
24
24
  uint32_t frame_count;
25
25
  uint32_t channel_count;
26
+ uint32_t decode_errors;
27
+ uint32_t zero_channel_packets;
28
+ uint32_t truncated_frames;
26
29
  } MoodbarNativeAnalysisSummary;
27
30
 
28
31
  typedef struct MoodbarNativeBuffer {
@@ -41,6 +44,12 @@ MoodbarNativeStatus moodbar_native_analysis_from_bytes(const uint8_t *bytes,
41
44
  const char *options_json,
42
45
  struct MoodbarNativeAnalysisSummary *out_summary);
43
46
 
47
+ MoodbarNativeStatus moodbar_native_analysis_from_pcm(uint32_t sample_rate,
48
+ const float *samples,
49
+ size_t samples_len,
50
+ const char *options_json,
51
+ struct MoodbarNativeAnalysisSummary *out_summary);
52
+
44
53
  MoodbarNativeStatus moodbar_native_analysis_dispose(uint64_t handle);
45
54
 
46
55
  MoodbarNativeStatus moodbar_native_render_svg(uint64_t handle,
@@ -51,6 +60,12 @@ MoodbarNativeStatus moodbar_native_render_png(uint64_t handle,
51
60
  const char *options_json,
52
61
  struct MoodbarNativeBuffer *out_png);
53
62
 
63
+ MoodbarNativeStatus moodbar_native_get_colors(uint64_t handle,
64
+ struct MoodbarNativeBuffer *out_colors);
65
+
66
+ MoodbarNativeStatus moodbar_native_get_frames(uint64_t handle,
67
+ struct MoodbarNativeBuffer *out_frames);
68
+
54
69
  MoodbarNativeStatus moodbar_native_last_error(struct MoodbarNativeBuffer *out_message_utf8);
55
70
 
56
71
  /**
@@ -23,6 +23,9 @@ typedef struct MoodbarNativeAnalysisSummary {
23
23
  uint64_t handle;
24
24
  uint32_t frame_count;
25
25
  uint32_t channel_count;
26
+ uint32_t decode_errors;
27
+ uint32_t zero_channel_packets;
28
+ uint32_t truncated_frames;
26
29
  } MoodbarNativeAnalysisSummary;
27
30
 
28
31
  typedef struct MoodbarNativeBuffer {
@@ -41,6 +44,12 @@ MoodbarNativeStatus moodbar_native_analysis_from_bytes(const uint8_t *bytes,
41
44
  const char *options_json,
42
45
  struct MoodbarNativeAnalysisSummary *out_summary);
43
46
 
47
+ MoodbarNativeStatus moodbar_native_analysis_from_pcm(uint32_t sample_rate,
48
+ const float *samples,
49
+ size_t samples_len,
50
+ const char *options_json,
51
+ struct MoodbarNativeAnalysisSummary *out_summary);
52
+
44
53
  MoodbarNativeStatus moodbar_native_analysis_dispose(uint64_t handle);
45
54
 
46
55
  MoodbarNativeStatus moodbar_native_render_svg(uint64_t handle,
@@ -51,6 +60,12 @@ MoodbarNativeStatus moodbar_native_render_png(uint64_t handle,
51
60
  const char *options_json,
52
61
  struct MoodbarNativeBuffer *out_png);
53
62
 
63
+ MoodbarNativeStatus moodbar_native_get_colors(uint64_t handle,
64
+ struct MoodbarNativeBuffer *out_colors);
65
+
66
+ MoodbarNativeStatus moodbar_native_get_frames(uint64_t handle,
67
+ struct MoodbarNativeBuffer *out_frames);
68
+
54
69
  MoodbarNativeStatus moodbar_native_last_error(struct MoodbarNativeBuffer *out_message_utf8);
55
70
 
56
71
  /**
@@ -0,0 +1 @@
1
+ #include "moodbar_native_ffi.h"
@@ -0,0 +1,81 @@
1
+ #ifndef MOODBAR_NATIVE_FFI_H
2
+ #define MOODBAR_NATIVE_FFI_H
3
+
4
+ #pragma once
5
+
6
+ /* This file is generated by cbindgen. */
7
+
8
+ #include <stdarg.h>
9
+ #include <stdbool.h>
10
+ #include <stddef.h>
11
+ #include <stdint.h>
12
+ #include <stdlib.h>
13
+
14
+ enum MoodbarNativeStatus {
15
+ Ok = 0,
16
+ InvalidArgument = 1,
17
+ NotFound = 2,
18
+ Internal = 3,
19
+ };
20
+ typedef int32_t MoodbarNativeStatus;
21
+
22
+ typedef struct MoodbarNativeAnalysisSummary {
23
+ uint64_t handle;
24
+ uint32_t frame_count;
25
+ uint32_t channel_count;
26
+ uint32_t decode_errors;
27
+ uint32_t zero_channel_packets;
28
+ uint32_t truncated_frames;
29
+ } MoodbarNativeAnalysisSummary;
30
+
31
+ typedef struct MoodbarNativeBuffer {
32
+ uint8_t *ptr;
33
+ size_t len;
34
+ size_t cap;
35
+ } MoodbarNativeBuffer;
36
+
37
+ MoodbarNativeStatus moodbar_native_analysis_from_path(const char *path,
38
+ const char *options_json,
39
+ struct MoodbarNativeAnalysisSummary *out_summary);
40
+
41
+ MoodbarNativeStatus moodbar_native_analysis_from_bytes(const uint8_t *bytes,
42
+ size_t bytes_len,
43
+ const char *extension,
44
+ const char *options_json,
45
+ struct MoodbarNativeAnalysisSummary *out_summary);
46
+
47
+ MoodbarNativeStatus moodbar_native_analysis_from_pcm(uint32_t sample_rate,
48
+ const float *samples,
49
+ size_t samples_len,
50
+ const char *options_json,
51
+ struct MoodbarNativeAnalysisSummary *out_summary);
52
+
53
+ MoodbarNativeStatus moodbar_native_analysis_dispose(uint64_t handle);
54
+
55
+ MoodbarNativeStatus moodbar_native_render_svg(uint64_t handle,
56
+ const char *options_json,
57
+ struct MoodbarNativeBuffer *out_svg_utf8);
58
+
59
+ MoodbarNativeStatus moodbar_native_render_png(uint64_t handle,
60
+ const char *options_json,
61
+ struct MoodbarNativeBuffer *out_png);
62
+
63
+ MoodbarNativeStatus moodbar_native_get_colors(uint64_t handle,
64
+ struct MoodbarNativeBuffer *out_colors);
65
+
66
+ MoodbarNativeStatus moodbar_native_get_frames(uint64_t handle,
67
+ struct MoodbarNativeBuffer *out_frames);
68
+
69
+ MoodbarNativeStatus moodbar_native_last_error(struct MoodbarNativeBuffer *out_message_utf8);
70
+
71
+ /**
72
+ * Frees a heap buffer previously returned by this library.
73
+ *
74
+ * # Safety
75
+ *
76
+ * `buffer` must be a valid, writable pointer obtained from this library, and must not be
77
+ * freed more than once.
78
+ */
79
+ void moodbar_native_buffer_free(struct MoodbarNativeBuffer *buffer);
80
+
81
+ #endif /* MOODBAR_NATIVE_FFI_H */
@@ -23,6 +23,9 @@ typedef struct MoodbarNativeAnalysisSummary {
23
23
  uint64_t handle;
24
24
  uint32_t frame_count;
25
25
  uint32_t channel_count;
26
+ uint32_t decode_errors;
27
+ uint32_t zero_channel_packets;
28
+ uint32_t truncated_frames;
26
29
  } MoodbarNativeAnalysisSummary;
27
30
 
28
31
  typedef struct MoodbarNativeBuffer {
@@ -41,6 +44,12 @@ MoodbarNativeStatus moodbar_native_analysis_from_bytes(const uint8_t *bytes,
41
44
  const char *options_json,
42
45
  struct MoodbarNativeAnalysisSummary *out_summary);
43
46
 
47
+ MoodbarNativeStatus moodbar_native_analysis_from_pcm(uint32_t sample_rate,
48
+ const float *samples,
49
+ size_t samples_len,
50
+ const char *options_json,
51
+ struct MoodbarNativeAnalysisSummary *out_summary);
52
+
44
53
  MoodbarNativeStatus moodbar_native_analysis_dispose(uint64_t handle);
45
54
 
46
55
  MoodbarNativeStatus moodbar_native_render_svg(uint64_t handle,
@@ -51,6 +60,12 @@ MoodbarNativeStatus moodbar_native_render_png(uint64_t handle,
51
60
  const char *options_json,
52
61
  struct MoodbarNativeBuffer *out_png);
53
62
 
63
+ MoodbarNativeStatus moodbar_native_get_colors(uint64_t handle,
64
+ struct MoodbarNativeBuffer *out_colors);
65
+
66
+ MoodbarNativeStatus moodbar_native_get_frames(uint64_t handle,
67
+ struct MoodbarNativeBuffer *out_frames);
68
+
54
69
  MoodbarNativeStatus moodbar_native_last_error(struct MoodbarNativeBuffer *out_message_utf8);
55
70
 
56
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moodbar/native",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "React Native bindings for moodbar audio visualization",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "repository": {