Changes of Revision 22

pipewire-aptx.changes Changed
x
 
1
@@ -1,4 +1,9 @@
2
 -------------------------------------------------------------------
3
+Thu Jan 26 20:45:06 UTC 2023 - Bjørn Lie <zaitor@opensuse.org>
4
+
5
+- Update to version 0.3.65
6
+
7
+-------------------------------------------------------------------
8
 Mon Jan 16 08:13:26 UTC 2023 - Bjørn Lie <zaitor@opensuse.org>
9
 
10
 - Update to version 0.3.64
11
pipewire-aptx.spec Changed
10
 
1
@@ -7,7 +7,7 @@
2
 %define soversion 0_2
3
 
4
 Name:           pipewire-aptx
5
-Version:        0.3.64
6
+Version:        0.3.65
7
 Release:        0
8
 Summary:        PipeWire Bluetooth aptX codec plugin
9
 License:        MIT
10
pipewire-0.3.64.tar.gz/NEWS -> pipewire-0.3.65.tar.gz/NEWS Changed
129
 
1
@@ -1,3 +1,117 @@
2
+# PipeWire 0.3.65 (2023-01-26)
3
+
4
+This is a bugfix release that is API and ABI compatible with previous
5
+0.3.x releases.
6
+
7
+## Highlights
8
+  - Add back the deprecated symbols but make sure a deprecated warning is
9
+    emitted for them. This fixes compilation issues in bindings.
10
+  - Fix an error in the AVX code that could cause crackling in filter-chain
11
+    when using the mixer.
12
+  - The convolver in filter-chain can now select an IR from a list of IRs
13
+    that best matches the current samplerate. Also resampling of the IR
14
+    has been improved.
15
+  - A new native module-combine-stream was added. You can use this to create
16
+    a 5.1 device from 3 stereo soundcards, for example, or direct the output
17
+    to multiple sinks at once.
18
+  - Support for Bluetooth MIDI was added. This requires a wireplumber
19
+    addition as well.
20
+  - An ALSA plugin rule was added to tweak the buffer settings in Davinci
21
+    Resolve so that it now runs with acceptable latency. (#1697)
22
+  - Support for compress offload was added using tinycompress. This allows
23
+    compressed formats to be decoded in hardware using ALSA on some devices.
24
+  - Many more buffixes and improvements.
25
+
26
+
27
+## PipeWire
28
+  - Add back the deprecated symbols but make sure a deprecated warning is
29
+    emitted for them. (#2952)
30
+  - Fix a regression when running older servers and newer clients (such as
31
+    flatpaks on older server) where the server would run clients too soon,
32
+    causing crashes. (#2964)
33
+  - Ensure that environment variables override any config values.
34
+
35
+## Tools
36
+  - pw-cli has received some improvements in the output.
37
+  - pw-cat can now use ffmpeg to demux streams for compress offload.
38
+
39
+## modules
40
+  - The convolver IR volume is now preserved after resampling.
41
+  - Adapter ports can now have a custom prefix.
42
+  - module-rt now clamps the realtime priority to the user allowed one if
43
+    it is within an acceptable range. Before it would fall back to RTKit
44
+    immediately.
45
+  - The module-echo-cancel can now have per stream channel layouts which
46
+    makes it possible to link to specific audio ports on a device. (#2939)
47
+  - Fix an error in the AVX code that could cause crackling in filter-chain
48
+    when using the mixer. (#2965)
49
+  - The convolver in filter-chain can now select an IR from a list of IRs
50
+    that best matches the current sample-rate.
51
+  - module-pipe-* now better matches the pulseaudio properties. (#2973)
52
+  - A new combine-stream module was added to combine multiple sinks into
53
+    one sink. It is also possible to merge multiple sources into one.
54
+  - module-rtp-source now has match rules to select what SAP sessions
55
+    to stream from. There were also improvements to the buffering and
56
+    latency handling.
57
+  - module-rtp-sink now handles multicast loopback correctly.
58
+  - module-rtp-sink implements min-ptime and max-ptime to control the
59
+    send packet latency.
60
+
61
+## SPA
62
+  - A new modifier flag was added to the video format parser helper to
63
+    allow 0 (linear) as a valid modifier. (#2943)
64
+  - Params includes were reorganized to make it more scalable. Many compressed
65
+    audio formats were added.
66
+  - The alsa pcm plugin now handles invalid values from the driver
67
+    gracefully. (#2953)
68
+  - Fix some potential stuttering cause by wrong scaling and overflow
69
+    of the output buffers in audioconvert. (#2680)
70
+  - Debug output is now also sent to the log instead of stdout. (#2923)
71
+  - A debug context was added to debug macros to implement custom debug
72
+    handling. This is used to redirect the debug of pods to the debug log
73
+    instead of using some custom duplicated code.
74
+  - Fix some warnings for potentially undefined shifts in format
75
+    conversion.
76
+  - Support for compress offload was added using tinycompress. This is mostly
77
+    used on some embedded hardware where decoding of audio formats can be
78
+    done in hardware.
79
+
80
+## Bluetooth
81
+  - Some fixes for LE audio were added.
82
+  - Support for Bluetooth MIDI was added. This requires a wireplumber
83
+    addition as well.
84
+  - Reply OK to empty commands.
85
+  - Improve compatibility with some devices that send stray \n such as
86
+    the Sennheiser HD 350BT. (#2991)
87
+
88
+## pulse-server
89
+  - Devices with unsupported formats (by the pulseaudio API) are now also
90
+    listed in the pulseaudio API (with invalid formats).
91
+  - The native module-combine-stream is used for module-combine-sink.
92
+
93
+## JACK
94
+  - Make jack.merge-monitor default to true to better match the jack1/2
95
+    behaviour. Add an exception for mixxx, which is more usable with
96
+    unmerged monitors. (#1760)
97
+
98
+## ALSA
99
+  - The property handling in the ALSA plugin was improved. alsa.properties
100
+    and alsa.rules can now be added to the config file.
101
+  - A rule was added to tweak the buffer settings in Davinci Resolve so that
102
+    it can run with acceptable latency. (#1697)
103
+  - ALSA volume will now also use cubic volumes, like pulseaudio.
104
+  - The ALSA ctl plugin now also uses the client-rt.conf file.
105
+  - A new alsa.volume-method was added to configure cubic or linear volume.
106
+    This can be set per application using the rules.
107
+
108
+## GStreamer
109
+  - pipewiresrc will now advertize DMABUF support if the pipeline suports
110
+    this.
111
+  - pipewiresrc will now always be a live source unless told otherwise.
112
+
113
+Older versions:
114
+
115
+
116
 # PipeWire 0.3.64 (2023-01-12)
117
 
118
 This is a bugfix release that is API and ABI compatible with previous
119
@@ -85,9 +199,6 @@
120
     to PipeWire sessions from the portal.
121
   - DMABuf support was re-enabled in gstpipewiresrc.
122
 
123
-
124
-Older versions:
125
-
126
 # PipeWire 0.3.63 (2022-12-15)
127
 
128
 This is a quick bugfix release that is API and ABI compatible with previous
129
pipewire-0.3.64.tar.gz/doc/Doxyfile.in -> pipewire-0.3.65.tar.gz/doc/Doxyfile.in Changed
16
 
1
@@ -1,13 +1,12 @@
2
 PROJECT_NAME           = PipeWire
3
 PROJECT_NUMBER         = @PACKAGE_VERSION@
4
-OUTPUT_DIRECTORY       = doc
5
+OUTPUT_DIRECTORY       = "@output_directory@"
6
 FULL_PATH_NAMES        = NO
7
 JAVADOC_AUTOBRIEF      = YES
8
 TAB_SIZE               = 8
9
 OPTIMIZE_OUTPUT_FOR_C  = YES
10
 EXTRACT_ALL            = YES
11
 EXTRACT_STATIC         = YES
12
-FULL_PATH_NAMES        = YES
13
 STRIP_FROM_PATH        = @path_prefixes@
14
 STRIP_FROM_INC_PATH    = @path_prefixes@
15
 SHOW_FILES             = NO
16
pipewire-0.3.64.tar.gz/doc/meson.build -> pipewire-0.3.65.tar.gz/doc/meson.build Changed
9
 
1
@@ -3,6 +3,7 @@
2
 doxyfile_conf.set('PACKAGE_VERSION', meson.project_version())
3
 doxyfile_conf.set('top_srcdir', meson.project_source_root())
4
 doxyfile_conf.set('top_builddir', meson.project_build_root())
5
+doxyfile_conf.set('output_directory', meson.current_build_dir())
6
 
7
 dot_found = find_program('dot', required: false).found()
8
 summary({'dot (used with doxygen)': dot_found}, bool_yn: true, section: 'Optional programs')
9
pipewire-0.3.64.tar.gz/doc/pipewire-modules.dox -> pipewire-0.3.65.tar.gz/doc/pipewire-modules.dox Changed
9
 
1
@@ -54,6 +54,7 @@
2
 - \subpage page_module_avb
3
 - \subpage page_module_client_device
4
 - \subpage page_module_client_node
5
+- \subpage page_module_combine_stream
6
 - \subpage page_module_echo_cancel
7
 - \subpage page_module_example_sink
8
 - \subpage page_module_example_source
9
pipewire-0.3.64.tar.gz/man/pw-cat.1.rst.in -> pipewire-0.3.65.tar.gz/man/pw-cat.1.rst.in Changed
10
 
1
@@ -160,7 +160,7 @@
2
 --volume=VALUE
3
   The stream volume, default 1.000.
4
   Depending on the locale you have configured, "," or "." may be
5
-  used as a decimal seperator. Check with **locale** command.
6
+  used as a decimal separator. Check with **locale** command.
7
 
8
 AUTHORS
9
 =======
10
pipewire-0.3.64.tar.gz/man/pw-link.1.rst.in -> pipewire-0.3.65.tar.gz/man/pw-link.1.rst.in Changed
10
 
1
@@ -65,7 +65,7 @@
2
 CONNECTING PORTS
3
 ================
4
 
5
-Whithout any list option (-i, -o or -l), the given ports will be linked.
6
+Without any list option (-i, -o or -l), the given ports will be linked.
7
 Valid port specifications are:
8
 
9
 *port-id*
10
pipewire-0.3.64.tar.gz/meson.build -> pipewire-0.3.65.tar.gz/meson.build Changed
28
 
1
@@ -1,5 +1,5 @@
2
 project('pipewire', 'c' ,
3
-  version : '0.3.64',
4
+  version : '0.3.65',
5
   license :  'MIT', 'LGPL-2.1-or-later', 'GPL-2.0-only' ,
6
   meson_version : '>= 0.59.0',
7
   default_options :  'warning_level=3',
8
@@ -266,6 +266,19 @@
9
   readline_dep = cc.find_library('readline', required : get_option('readline'))
10
 endif
11
 
12
+# Both the FFmpeg SPA plugin and the pw-cat FFmpeg integration use libavcodec.
13
+# But only the latter also needs libavformat.
14
+# Search for these libraries here, globally, so both of these subprojects can reuse the results.
15
+pw_cat_ffmpeg = get_option('pw-cat-ffmpeg')
16
+ffmpeg = get_option('ffmpeg')
17
+if pw_cat_ffmpeg.allowed() or ffmpeg.allowed()
18
+  avcodec_dep = dependency('libavcodec', required: pw_cat_ffmpeg.enabled() or ffmpeg.enabled())
19
+  avformat_dep = dependency('libavformat', required: pw_cat_ffmpeg.enabled())
20
+else
21
+  avcodec_dep = dependency('', required: false)
22
+endif
23
+cdata.set('HAVE_PW_CAT_FFMPEG_INTEGRATION', pw_cat_ffmpeg.allowed())
24
+
25
 summary({'readline (for pw-cli)': readline_dep.found()}, bool_yn: true, section: 'Misc dependencies')
26
 cdata.set('HAVE_READLINE', readline_dep.found())
27
 ncurses_dep = dependency('ncursesw', required : false)
28
pipewire-0.3.64.tar.gz/meson_options.txt -> pipewire-0.3.65.tar.gz/meson_options.txt Changed
20
 
1
@@ -188,6 +188,10 @@
2
        description: 'Build pw-cat/pw-play/pw-record',
3
        type: 'feature',
4
        value: 'auto')
5
+option('pw-cat-ffmpeg',
6
+       description: 'Enable FFmpeg integration in pw-cat/pw-play/pw-record',
7
+       type: 'feature',
8
+       value: 'disabled')
9
 option('udev',
10
        description: 'Enable Udev integration',
11
        type: 'feature',
12
@@ -273,3 +277,7 @@
13
        description: 'Enable code that depends on gsettings',
14
        type: 'feature',
15
        value: 'auto')
16
+option('compress-offload',
17
+       description: 'Enable ALSA Compress-Offload support',
18
+       type: 'feature',
19
+       value: 'disabled')
20
pipewire-0.3.64.tar.gz/pipewire-alsa/alsa-plugins/ctl_pipewire.c -> pipewire-0.3.65.tar.gz/pipewire-alsa/alsa-plugins/ctl_pipewire.c Changed
201
 
1
@@ -37,7 +37,10 @@
2
 PW_LOG_TOPIC_STATIC(alsa_log_topic, "alsa.ctl");
3
 #define PW_LOG_TOPIC_DEFAULT alsa_log_topic
4
 
5
-#define VOLUME_MAX 65536
6
+#define DEFAULT_VOLUME_METHOD  "cubic"
7
+
8
+#define VOLUME_MIN ((uint32_t) 0U)
9
+#define VOLUME_MAX ((uint32_t) 0x10000U)
10
 
11
 struct volume {
12
    uint32_t channels;
13
@@ -47,6 +50,8 @@
14
 typedef struct {
15
    snd_ctl_ext_t ext;
16
 
17
+   struct pw_properties *props;
18
+
19
    struct spa_system *system;
20
    struct pw_thread_loop *mainloop;
21
 
22
@@ -74,6 +79,9 @@
23
    struct volume source_volume;
24
 
25
    int subscribed;
26
+#define VOLUME_METHOD_LINEAR   (0)
27
+#define VOLUME_METHOD_CUBIC    (1)
28
+   int volume_method;
29
 
30
 #define UPDATE_SINK_VOL     (1<<0)
31
 #define UPDATE_SINK_MUTE    (1<<1)
32
@@ -84,6 +92,32 @@
33
    struct spa_list globals;
34
 } snd_ctl_pipewire_t;
35
 
36
+static inline uint32_t volume_from_linear(float vol, int method)
37
+{
38
+   if (vol <= 0.0f)
39
+       vol = 0.0f;
40
+
41
+   switch (method) {
42
+   case VOLUME_METHOD_CUBIC:
43
+       vol = cbrtf(vol);
44
+       break;
45
+   }
46
+   return SPA_CLAMP((uint64_t)lroundf(vol * VOLUME_MAX),
47
+           VOLUME_MIN, VOLUME_MAX);
48
+}
49
+
50
+static inline float volume_to_linear(uint32_t vol, int method)
51
+{
52
+   float v = ((float)vol) / VOLUME_MAX;
53
+
54
+   switch (method) {
55
+   case VOLUME_METHOD_CUBIC:
56
+       v = v * v * v;
57
+       break;
58
+   }
59
+   return v;
60
+}
61
+
62
 struct global;
63
 
64
 struct global_info {
65
@@ -416,7 +450,7 @@
66
                  long *imax, long *istep)
67
 {
68
    *istep = 1;
69
-   *imin = 0;
70
+   *imin = VOLUME_MIN;
71
    *imax = VOLUME_MAX;
72
 
73
    return 0;
74
@@ -476,7 +510,8 @@
75
    return err;
76
 }
77
 
78
-static struct spa_pod *build_volume_mute(struct spa_pod_builder *b, struct volume *volume, int *mute)
79
+static struct spa_pod *build_volume_mute(struct spa_pod_builder *b, struct volume *volume,
80
+       int *mute, int volume_method)
81
 {
82
    struct spa_pod_frame f1;
83
 
84
@@ -488,7 +523,7 @@
85
 
86
        n_volumes = volume->channels;
87
        for (i = 0; i < n_volumes; i++)
88
-           volumesi = volume->valuesi / (float) VOLUME_MAX;
89
+           volumesi = volume_to_linear(volume->valuesi, volume_method);
90
 
91
        spa_pod_builder_prop(b, SPA_PROP_channelVolumes, 0);
92
        spa_pod_builder_array(b, sizeof(float),
93
@@ -536,7 +571,7 @@
94
            0);
95
 
96
        spa_pod_builder_prop(&b, SPA_PARAM_ROUTE_props, 0);
97
-       build_volume_mute(&b, volume, mute);
98
+       build_volume_mute(&b, volume, mute, ctl->volume_method);
99
        param = spa_pod_builder_pop(&b, &f0);
100
 
101
        pw_log_debug("set device %d mute/volume for node %d", dg->id, g->id);
102
@@ -546,7 +581,7 @@
103
        if (!SPA_FLAG_IS_SET(g->permissions, PW_PERM_W | PW_PERM_X))
104
            return -EPERM;
105
 
106
-       param = build_volume_mute(&b, volume, mute);
107
+       param = build_volume_mute(&b, volume, mute, ctl->volume_method);
108
 
109
        pw_log_debug("set node %d mute/volume", g->id);
110
        pw_node_set_param((struct pw_node*)g->proxy,
111
@@ -761,6 +796,7 @@
112
        spa_system_close(ctl->system, ctl->fd);
113
    if (ctl->mainloop)
114
        pw_thread_loop_destroy(ctl->mainloop);
115
+   pw_properties_free(ctl->props);
116
    free(ctl);
117
 }
118
 
119
@@ -816,6 +852,7 @@
120
 {
121
    struct spa_pod_prop *prop;
122
    struct spa_pod_object *obj = (struct spa_pod_object *) param;
123
+   snd_ctl_pipewire_t *ctl = g->ctl;
124
 
125
    SPA_POD_OBJECT_FOREACH(obj, prop) {
126
        switch (prop->key) {
127
@@ -841,7 +878,8 @@
128
 
129
            g->node.channel_volume.channels = n_volumes;
130
            for (i = 0; i < n_volumes; i++)
131
-               g->node.channel_volume.valuesi = volumesi * VOLUME_MAX;
132
+               g->node.channel_volume.valuesi =
133
+                   volume_from_linear(volumesi, ctl->volume_method);
134
 
135
            SPA_FLAG_UPDATE(g->node.flags, NODE_FLAG_DEVICE_VOLUME, device);
136
            pw_log_debug("update node %d channelVolumes", g->id);
137
@@ -1230,6 +1268,14 @@
138
         .done = on_core_done,
139
 };
140
 
141
+static int execute_match(void *data, const char *location, const char *action,
142
+                const char *val, size_t len)
143
+{
144
+   snd_ctl_pipewire_t *ctl = data;
145
+   if (spa_streq(action, "update-props"))
146
+       pw_properties_update_string(ctl->props, val, len);
147
+   return 1;
148
+}
149
 
150
 SPA_EXPORT
151
 SND_CTL_PLUGIN_DEFINE_FUNC(pipewire)
152
@@ -1242,7 +1288,6 @@
153
    const char *fallback_name = NULL;
154
    int err;
155
    const char *str;
156
-   struct pw_properties *props = NULL;
157
    snd_ctl_pipewire_t *ctl;
158
    struct pw_loop *loop;
159
 
160
@@ -1305,10 +1350,6 @@
161
        return -EINVAL;
162
    }
163
 
164
-   str = getenv("PIPEWIRE_REMOTE");
165
-   if (str != NULL && str0 != '\0')
166
-       server = str;
167
-
168
    if (fallback_name && name && spa_streq(name, fallback_name))
169
        fallback_name = NULL; /* no fallback for the same name */
170
 
171
@@ -1343,30 +1384,57 @@
172
        goto error;
173
    }
174
 
175
-   ctl->context = pw_context_new(loop, NULL, 0);
176
+   ctl->context = pw_context_new(loop,
177
+                   pw_properties_new(
178
+                       PW_KEY_CLIENT_API, "alsa",
179
+                       PW_KEY_CONFIG_NAME, "client-rt.conf",
180
+                       NULL),
181
+                   0);
182
    if (ctl->context == NULL) {
183
        err = -errno;
184
        goto error;
185
    }
186
 
187
-   props = pw_properties_new(NULL, NULL);
188
-   if (props == NULL) {
189
+   ctl->props = pw_properties_new(NULL, NULL);
190
+   if (ctl->props == NULL) {
191
        err = -errno;
192
        goto error;
193
    }
194
 
195
-   pw_properties_setf(props, PW_KEY_APP_NAME, "PipeWire ALSA %s",
196
-           pw_get_prgname());
197
-
198
    if (server)
199
-       pw_properties_set(props, PW_KEY_REMOTE_NAME, server);
200
+       pw_properties_set(ctl->props, PW_KEY_REMOTE_NAME, server);
201
pipewire-0.3.64.tar.gz/pipewire-alsa/alsa-plugins/meson.build -> pipewire-0.3.65.tar.gz/pipewire-alsa/alsa-plugins/meson.build Changed
10
 
1
@@ -21,7 +21,7 @@
2
     pipewire_alsa_plugin_ctl_sources,
3
     c_args : pipewire_alsa_plugin_c_args,
4
     include_directories : configinc,
5
-    dependencies : pipewire_dep, alsa_dep,
6
+    dependencies : pipewire_dep, alsa_dep, mathlib,
7
     install : true,
8
     install_dir : pipewire_libdir / 'alsa-lib',
9
 )
10
pipewire-0.3.64.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c -> pipewire-0.3.65.tar.gz/pipewire-alsa/alsa-plugins/pcm_pipewire.c Changed
201
 
1
@@ -70,30 +70,12 @@
2
 #define MIN_BUFFER_BYTES   (2*MIN_PERIOD_BYTES)
3
 #define MAX_BUFFER_BYTES   (2*MAX_PERIOD_BYTES)
4
 
5
-struct params {
6
-   const char *node_name;
7
-   const char *server_name;
8
-   const char *playback_node;
9
-   const char *capture_node;
10
-   const char *role;
11
-   snd_pcm_format_t format;
12
-   int rate;
13
-   int channels;
14
-   int period_bytes;
15
-   int buffer_bytes;
16
-   uint32_t flags;
17
-};
18
-
19
 typedef struct {
20
    snd_pcm_ioplug_t io;
21
 
22
    snd_output_t *output;
23
    FILE *log_file;
24
 
25
-   char *node_name;
26
-   char *target;
27
-   char *role;
28
-
29
    int fd;
30
    int error;
31
    unsigned int activated:1;   /* PipeWire is activated? */
32
@@ -113,12 +95,12 @@
33
    struct spa_system *system;
34
    struct pw_thread_loop *main_loop;
35
 
36
+   struct pw_properties *props;
37
    struct pw_context *context;
38
 
39
    struct pw_core *core;
40
    struct spa_hook core_listener;
41
 
42
-   uint32_t flags;
43
    struct pw_stream *stream;
44
    struct spa_hook stream_listener;
45
 
46
@@ -192,9 +174,7 @@
47
        spa_system_close(pw->system, pw->fd);
48
    if (pw->main_loop)
49
        pw_thread_loop_destroy(pw->main_loop);
50
-   free(pw->node_name);
51
-   free(pw->target);
52
-   free(pw->role);
53
+   pw_properties_free(pw->props);
54
    snd_output_close(pw->output);
55
    fclose(pw->log_file);
56
    free(pw);
57
@@ -541,7 +521,6 @@
58
    const struct spa_pod *params1;
59
    uint8_t buffer1024;
60
    struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
61
-   struct pw_properties *props;
62
    uint32_t min_period;
63
 
64
    pw_thread_loop_lock(pw->main_loop);
65
@@ -568,40 +547,18 @@
66
        goto done;
67
    pw->hw_params_changed = false;
68
 
69
-   props = pw_properties_new(NULL, NULL);
70
-   if (props == NULL)
71
-       goto error;
72
-
73
-   pw_properties_set(props, PW_KEY_CLIENT_API, "alsa");
74
-   pw_properties_setf(props, PW_KEY_APP_NAME, "%s", pw_get_prgname());
75
-
76
-   if (pw_properties_get(props, PW_KEY_NODE_LATENCY) == NULL)
77
-       pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%lu/%u", pw->min_avail, io->rate);
78
-   if (pw_properties_get(props, PW_KEY_NODE_RATE) == NULL)
79
-       pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u", io->rate);
80
-   if (pw->target != NULL && !spa_streq(pw->target, "-1") &&
81
-       pw_properties_get(props, PW_KEY_TARGET_OBJECT) == NULL)
82
-       pw_properties_setf(props, PW_KEY_TARGET_OBJECT, "%s", pw->target);
83
-
84
-   if (pw_properties_get(props, PW_KEY_MEDIA_TYPE) == NULL)
85
-       pw_properties_set(props, PW_KEY_MEDIA_TYPE, "Audio");
86
-   if (pw_properties_get(props, PW_KEY_MEDIA_CATEGORY) == NULL)
87
-       pw_properties_set(props, PW_KEY_MEDIA_CATEGORY,
88
-               io->stream == SND_PCM_STREAM_PLAYBACK ?
89
-               "Playback" : "Capture");
90
-   if (pw->role != NULL &&
91
-       pw_properties_get(props, PW_KEY_MEDIA_ROLE) == NULL)
92
-       pw_properties_setf(props, PW_KEY_MEDIA_ROLE, "%s", pw->role);
93
+   pw_properties_setf(pw->props, PW_KEY_NODE_LATENCY, "%lu/%u", pw->min_avail, io->rate);
94
+   pw_properties_setf(pw->props, PW_KEY_NODE_RATE, "1/%u", io->rate);
95
 
96
    params0 = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &pw->format);
97
 
98
    if (pw->stream != NULL) {
99
-       pw_stream_update_properties(pw->stream, &props->dict);
100
+       pw_stream_update_properties(pw->stream, &pw->props->dict);
101
        pw_stream_update_params(pw->stream, params, 1);
102
        goto done;
103
    }
104
 
105
-   pw->stream = pw_stream_new(pw->core, pw->node_name, props);
106
+   pw->stream = pw_stream_new(pw->core, NULL, pw_properties_copy(pw->props));
107
    if (pw->stream == NULL)
108
        goto error;
109
 
110
@@ -614,7 +571,6 @@
111
                PW_DIRECTION_OUTPUT :
112
                PW_DIRECTION_INPUT,
113
                PW_ID_ANY,
114
-               pw->flags |
115
                PW_STREAM_FLAG_AUTOCONNECT |
116
                PW_STREAM_FLAG_MAP_BUFFERS |
117
                PW_STREAM_FLAG_RT_PROCESS,
118
@@ -969,7 +925,7 @@
119
    .query_chmaps = snd_pcm_pipewire_query_chmaps,
120
 };
121
 
122
-static int pipewire_set_hw_constraint(snd_pcm_pipewire_t *pw, struct params *p)
123
+static int pipewire_set_hw_constraint(snd_pcm_pipewire_t *pw)
124
 {
125
    unsigned int access_list = {
126
        SND_PCM_ACCESS_MMAP_INTERLEAVED,
127
@@ -995,6 +951,7 @@
128
 #endif
129
        SND_PCM_FORMAT_U8,
130
    };
131
+   int val;
132
    int min_rate;
133
    int max_rate;
134
    int min_channels;
135
@@ -1003,29 +960,35 @@
136
    int max_period_bytes;
137
    int min_buffer_bytes;
138
    int max_buffer_bytes;
139
+   const char *str;
140
+   snd_pcm_format_t format;
141
    int err;
142
 
143
-   if (p->rate > 0) {
144
-       min_rate = max_rate = SPA_CLAMP(p->rate, 1, MAX_RATE);
145
+   val = pw_properties_get_uint32(pw->props, "alsa.rate", 0);
146
+   if (val > 0) {
147
+       min_rate = max_rate = SPA_CLAMP(val, 1, MAX_RATE);
148
    } else {
149
        min_rate = 1;
150
        max_rate = MAX_RATE;
151
    }
152
-   if (p->channels > 0) {
153
-       min_channels = max_channels = SPA_CLAMP(p->channels, 1, MAX_CHANNELS);
154
+   val = pw_properties_get_uint32(pw->props, "alsa.channels", 0);
155
+   if (val > 0) {
156
+       min_channels = max_channels = SPA_CLAMP(val, 1, MAX_CHANNELS);
157
    } else {
158
        min_channels = 1;
159
        max_channels = MAX_CHANNELS;
160
    }
161
-   if (p->period_bytes > 0) {
162
-       min_period_bytes = max_period_bytes = SPA_CLAMP(p->period_bytes,
163
+   val = pw_properties_get_uint32(pw->props, "alsa.period-bytes", 0);
164
+   if (val > 0) {
165
+       min_period_bytes = max_period_bytes = SPA_CLAMP(val,
166
                MIN_PERIOD_BYTES, MAX_PERIOD_BYTES);
167
    } else {
168
        min_period_bytes = MIN_PERIOD_BYTES;
169
        max_period_bytes = MAX_PERIOD_BYTES;
170
    }
171
-   if (p->buffer_bytes > 0) {
172
-       min_buffer_bytes = max_buffer_bytes = SPA_CLAMP(p->buffer_bytes,
173
+   val = pw_properties_get_uint32(pw->props, "alsa.buffer-bytes", 0);
174
+   if (val > 0) {
175
+       min_buffer_bytes = max_buffer_bytes = SPA_CLAMP(val,
176
                MIN_BUFFER_BYTES, MAX_BUFFER_BYTES);
177
    } else {
178
        min_buffer_bytes = MIN_BUFFER_BYTES;
179
@@ -1052,11 +1015,14 @@
180
        pw_log_warn("Can't set param list: %s", snd_strerror(err));
181
        return err;
182
    }
183
+   format = SND_PCM_FORMAT_UNKNOWN;
184
+   if ((str = pw_properties_get(pw->props, "alsa.format")))
185
+       format = snd_pcm_format_value(str);
186
 
187
-   if (p->format != SND_PCM_FORMAT_UNKNOWN) {
188
+   if (format != SND_PCM_FORMAT_UNKNOWN) {
189
        err = snd_pcm_ioplug_set_param_list(&pw->io,
190
                SND_PCM_IOPLUG_HW_FORMAT,
191
-               1, (unsigned int *)&p->format);
192
+               1, (unsigned int *)&format);
193
        if (err < 0) {
194
            pw_log_warn("Can't set param list: %s", snd_strerror(err));
195
            return err;
196
@@ -1113,61 +1079,31 @@
197
    .write = log_write,
198
 };
199
 
200
+static int execute_match(void *data, const char *location, const char *action,
201
pipewire-0.3.64.tar.gz/pipewire-jack/src/pipewire-jack.c -> pipewire-0.3.65.tar.gz/pipewire-jack/src/pipewire-jack.c Changed
10
 
1
@@ -3480,7 +3480,7 @@
2
    client->info.change_mask = 0;
3
 
4
    client->show_monitor = pw_properties_get_bool(client->props, "jack.show-monitor", true);
5
-   client->merge_monitor = pw_properties_get_bool(client->props, "jack.merge-monitor", false);
6
+   client->merge_monitor = pw_properties_get_bool(client->props, "jack.merge-monitor", true);
7
    client->short_name = pw_properties_get_bool(client->props, "jack.short-name", false);
8
    client->filter_name = pw_properties_get_bool(client->props, "jack.filter-name", false);
9
    client->filter_char = ' ';
10
pipewire-0.3.64.tar.gz/spa/include/spa/buffer/meta.h -> pipewire-0.3.65.tar.gz/spa/include/spa/buffer/meta.h Changed
11
 
1
@@ -177,7 +177,8 @@
2
 
3
 /** a transformation of the buffer */
4
 struct spa_meta_videotransform {
5
-   uint32_t transform;     /**< orientation transformation that was applied to the buffer */
6
+   uint32_t transform;         /**< orientation transformation that was applied to the buffer,
7
+                         *  one of enum spa_meta_videotransform_value */
8
 };
9
 
10
 /**
11
pipewire-0.3.64.tar.gz/spa/include/spa/buffer/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/buffer/type-info.h Changed
9
 
1
@@ -79,6 +79,7 @@
2
    { SPA_META_Cursor, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Cursor", NULL },
3
    { SPA_META_Control, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Control", NULL },
4
    { SPA_META_Busy, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Busy", NULL },
5
+   { SPA_META_VideoTransform, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "VideoTransform", NULL },
6
    { 0, 0, NULL, NULL },
7
 };
8
 
9
pipewire-0.3.64.tar.gz/spa/include/spa/debug/buffer.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/buffer.h Changed
125
 
1
@@ -38,56 +38,56 @@
2
  * \{
3
  */
4
 
5
-#include <spa/debug/log.h>
6
+#include <spa/debug/context.h>
7
 #include <spa/debug/mem.h>
8
 #include <spa/debug/types.h>
9
 #include <spa/buffer/type-info.h>
10
 
11
-static inline int spa_debug_buffer(int indent, const struct spa_buffer *buffer)
12
+static inline int spa_debugc_buffer(struct spa_debug_context *ctx, int indent, const struct spa_buffer *buffer)
13
 {
14
    uint32_t i;
15
 
16
-   spa_debug("%*s" "struct spa_buffer %p:", indent, "", buffer);
17
-   spa_debug("%*s" " n_metas: %u (at %p)", indent, "", buffer->n_metas, buffer->metas);
18
+   spa_debugc(ctx, "%*s" "struct spa_buffer %p:", indent, "", buffer);
19
+   spa_debugc(ctx, "%*s" " n_metas: %u (at %p)", indent, "", buffer->n_metas, buffer->metas);
20
    for (i = 0; i < buffer->n_metas; i++) {
21
        struct spa_meta *m = &buffer->metasi;
22
        const char *type_name;
23
 
24
        type_name = spa_debug_type_find_name(spa_type_meta_type, m->type);
25
-       spa_debug("%*s" "  meta %d: type %d (%s), data %p, size %d:", indent, "", i, m->type,
26
+       spa_debugc(ctx, "%*s" "  meta %d: type %d (%s), data %p, size %d:", indent, "", i, m->type,
27
            type_name, m->data, m->size);
28
 
29
        switch (m->type) {
30
        case SPA_META_Header:
31
        {
32
            struct spa_meta_header *h = (struct spa_meta_header*)m->data;
33
-           spa_debug("%*s" "    struct spa_meta_header:", indent, "");
34
-           spa_debug("%*s" "      flags:      %08x", indent, "", h->flags);
35
-           spa_debug("%*s" "      offset:     %u", indent, "", h->offset);
36
-           spa_debug("%*s" "      seq:        %" PRIu64, indent, "", h->seq);
37
-           spa_debug("%*s" "      pts:        %" PRIi64, indent, "", h->pts);
38
-           spa_debug("%*s" "      dts_offset: %" PRIi64, indent, "", h->dts_offset);
39
+           spa_debugc(ctx, "%*s" "    struct spa_meta_header:", indent, "");
40
+           spa_debugc(ctx, "%*s" "      flags:      %08x", indent, "", h->flags);
41
+           spa_debugc(ctx, "%*s" "      offset:     %u", indent, "", h->offset);
42
+           spa_debugc(ctx, "%*s" "      seq:        %" PRIu64, indent, "", h->seq);
43
+           spa_debugc(ctx, "%*s" "      pts:        %" PRIi64, indent, "", h->pts);
44
+           spa_debugc(ctx, "%*s" "      dts_offset: %" PRIi64, indent, "", h->dts_offset);
45
            break;
46
        }
47
        case SPA_META_VideoCrop:
48
        {
49
            struct spa_meta_region *h = (struct spa_meta_region*)m->data;
50
-           spa_debug("%*s" "    struct spa_meta_region:", indent, "");
51
-           spa_debug("%*s" "      x:      %d", indent, "", h->region.position.x);
52
-           spa_debug("%*s" "      y:      %d", indent, "", h->region.position.y);
53
-           spa_debug("%*s" "      width:  %d", indent, "", h->region.size.width);
54
-           spa_debug("%*s" "      height: %d", indent, "", h->region.size.height);
55
+           spa_debugc(ctx, "%*s" "    struct spa_meta_region:", indent, "");
56
+           spa_debugc(ctx, "%*s" "      x:      %d", indent, "", h->region.position.x);
57
+           spa_debugc(ctx, "%*s" "      y:      %d", indent, "", h->region.position.y);
58
+           spa_debugc(ctx, "%*s" "      width:  %d", indent, "", h->region.size.width);
59
+           spa_debugc(ctx, "%*s" "      height: %d", indent, "", h->region.size.height);
60
            break;
61
        }
62
        case SPA_META_VideoDamage:
63
        {
64
            struct spa_meta_region *h;
65
            spa_meta_for_each(h, m) {
66
-               spa_debug("%*s" "    struct spa_meta_region:", indent, "");
67
-               spa_debug("%*s" "      x:      %d", indent, "", h->region.position.x);
68
-               spa_debug("%*s" "      y:      %d", indent, "", h->region.position.y);
69
-               spa_debug("%*s" "      width:  %d", indent, "", h->region.size.width);
70
-               spa_debug("%*s" "      height: %d", indent, "", h->region.size.height);
71
+               spa_debugc(ctx, "%*s" "    struct spa_meta_region:", indent, "");
72
+               spa_debugc(ctx, "%*s" "      x:      %d", indent, "", h->region.position.x);
73
+               spa_debugc(ctx, "%*s" "      y:      %d", indent, "", h->region.position.y);
74
+               spa_debugc(ctx, "%*s" "      width:  %d", indent, "", h->region.size.width);
75
+               spa_debugc(ctx, "%*s" "      height: %d", indent, "", h->region.size.height);
76
            }
77
            break;
78
        }
79
@@ -96,28 +96,32 @@
80
        case SPA_META_Cursor:
81
            break;
82
        default:
83
-           spa_debug("%*s" "    Unknown:", indent, "");
84
-           spa_debug_mem(5, m->data, m->size);
85
+           spa_debugc(ctx, "%*s" "    Unknown:", indent, "");
86
+           spa_debugc_mem(ctx, 5, m->data, m->size);
87
        }
88
    }
89
-   spa_debug("%*s" " n_datas: \t%u (at %p)", indent, "", buffer->n_datas, buffer->datas);
90
+   spa_debugc(ctx, "%*s" " n_datas: \t%u (at %p)", indent, "", buffer->n_datas, buffer->datas);
91
    for (i = 0; i < buffer->n_datas; i++) {
92
        struct spa_data *d = &buffer->datasi;
93
-       spa_debug("%*s" "   type:    %d (%s)", indent, "", d->type,
94
+       spa_debugc(ctx, "%*s" "   type:    %d (%s)", indent, "", d->type,
95
            spa_debug_type_find_name(spa_type_data_type, d->type));
96
-       spa_debug("%*s" "   flags:   %d", indent, "", d->flags);
97
-       spa_debug("%*s" "   data:    %p", indent, "", d->data);
98
-       spa_debug("%*s" "   fd:      %" PRIi64, indent, "", d->fd);
99
-       spa_debug("%*s" "   offset:  %d", indent, "", d->mapoffset);
100
-       spa_debug("%*s" "   maxsize: %u", indent, "", d->maxsize);
101
-       spa_debug("%*s" "   chunk:   %p", indent, "", d->chunk);
102
-       spa_debug("%*s" "    offset: %d", indent, "", d->chunk->offset);
103
-       spa_debug("%*s" "    size:   %u", indent, "", d->chunk->size);
104
-       spa_debug("%*s" "    stride: %d", indent, "", d->chunk->stride);
105
+       spa_debugc(ctx, "%*s" "   flags:   %d", indent, "", d->flags);
106
+       spa_debugc(ctx, "%*s" "   data:    %p", indent, "", d->data);
107
+       spa_debugc(ctx, "%*s" "   fd:      %" PRIi64, indent, "", d->fd);
108
+       spa_debugc(ctx, "%*s" "   offset:  %d", indent, "", d->mapoffset);
109
+       spa_debugc(ctx, "%*s" "   maxsize: %u", indent, "", d->maxsize);
110
+       spa_debugc(ctx, "%*s" "   chunk:   %p", indent, "", d->chunk);
111
+       spa_debugc(ctx, "%*s" "    offset: %d", indent, "", d->chunk->offset);
112
+       spa_debugc(ctx, "%*s" "    size:   %u", indent, "", d->chunk->size);
113
+       spa_debugc(ctx, "%*s" "    stride: %d", indent, "", d->chunk->stride);
114
    }
115
    return 0;
116
 }
117
 
118
+static inline int spa_debug_buffer(int indent, const struct spa_buffer *buffer)
119
+{
120
+   return spa_debugc_buffer(NULL, indent, buffer);
121
+}
122
 /**
123
  * \}
124
  */
125
pipewire-0.3.65.tar.gz/spa/include/spa/debug/context.h Added
64
 
1
@@ -0,0 +1,62 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_DEBUG_CONTEXT_H
27
+#define SPA_DEBUG_CONTEXT_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <stdio.h>
34
+#include <stdarg.h>
35
+
36
+#include <spa/utils/defs.h>
37
+/**
38
+ * \addtogroup spa_debug
39
+ * \{
40
+ */
41
+
42
+#ifndef spa_debugn
43
+#define spa_debugn(_fmt,...)   printf((_fmt), ## __VA_ARGS__)
44
+#endif
45
+#ifndef spa_debug
46
+#define spa_debug(_fmt,...)    spa_debugn(_fmt"\n", ## __VA_ARGS__)
47
+#endif
48
+
49
+struct spa_debug_context {
50
+   void (*log) (struct spa_debug_context *ctx, const char *fmt, ...) SPA_PRINTF_FUNC(2, 3);
51
+};
52
+
53
+#define spa_debugc(_c,_fmt,...)    (_c)?((_c)->log((_c),_fmt, ## __VA_ARGS__)):(void)spa_debug(_fmt, ## __VA_ARGS__)
54
+
55
+/**
56
+ * \}
57
+ */
58
+
59
+#ifdef __cplusplus
60
+}  /* extern "C" */
61
+#endif
62
+
63
+#endif /* SPA_DEBUG_CONTEXT_H */
64
pipewire-0.3.64.tar.gz/spa/include/spa/debug/dict.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/dict.h Changed
29
 
1
@@ -34,19 +34,23 @@
2
  * \{
3
  */
4
 
5
-#include <spa/debug/log.h>
6
+#include <spa/debug/context.h>
7
 #include <spa/utils/dict.h>
8
 
9
-static inline int spa_debug_dict(int indent, const struct spa_dict *dict)
10
+static inline int spa_debugc_dict(struct spa_debug_context *ctx, int indent, const struct spa_dict *dict)
11
 {
12
    const struct spa_dict_item *item;
13
-   spa_debug("%*sflags:%08x n_items:%d", indent, "", dict->flags, dict->n_items);
14
+   spa_debugc(ctx, "%*sflags:%08x n_items:%d", indent, "", dict->flags, dict->n_items);
15
    spa_dict_for_each(item, dict) {
16
-       spa_debug("%*s  %s = \"%s\"", indent, "", item->key, item->value);
17
+       spa_debugc(ctx, "%*s  %s = \"%s\"", indent, "", item->key, item->value);
18
    }
19
    return 0;
20
 }
21
 
22
+static inline int spa_debug_dict(int indent, const struct spa_dict *dict)
23
+{
24
+   return spa_debugc_dict(NULL, indent, dict);
25
+}
26
 /**
27
  * \}
28
  */
29
pipewire-0.3.64.tar.gz/spa/include/spa/debug/format.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/format.h Changed
185
 
1
@@ -35,18 +35,20 @@
2
  */
3
 
4
 #include <spa/pod/parser.h>
5
-#include <spa/debug/log.h>
6
+#include <spa/utils/string.h>
7
+#include <spa/debug/context.h>
8
 #include <spa/debug/types.h>
9
 #include <spa/param/type-info.h>
10
 #include <spa/param/format-utils.h>
11
 
12
 static inline int
13
-spa_debug_format_value(const struct spa_type_info *info,
14
+spa_debug_strbuf_format_value(struct spa_strbuf *buffer, const struct spa_type_info *info,
15
        uint32_t type, void *body, uint32_t size)
16
 {
17
+
18
    switch (type) {
19
    case SPA_TYPE_Bool:
20
-       spa_debugn("%s", *(int32_t *) body ? "true" : "false");
21
+       spa_strbuf_append(buffer, "%s", *(int32_t *) body ? "true" : "false");
22
        break;
23
    case SPA_TYPE_Id:
24
    {
25
@@ -56,41 +58,41 @@
26
            snprintf(tmp, sizeof(tmp), "%d", *(int32_t*)body);
27
            str = tmp;
28
        }
29
-       spa_debugn("%s", str);
30
+       spa_strbuf_append(buffer, "%s", str);
31
        break;
32
    }
33
    case SPA_TYPE_Int:
34
-       spa_debugn("%d", *(int32_t *) body);
35
+       spa_strbuf_append(buffer, "%d", *(int32_t *) body);
36
        break;
37
    case SPA_TYPE_Long:
38
-       spa_debugn("%" PRIi64, *(int64_t *) body);
39
+       spa_strbuf_append(buffer, "%" PRIi64, *(int64_t *) body);
40
        break;
41
    case SPA_TYPE_Float:
42
-       spa_debugn("%f", *(float *) body);
43
+       spa_strbuf_append(buffer, "%f", *(float *) body);
44
        break;
45
    case SPA_TYPE_Double:
46
-       spa_debugn("%f", *(double *) body);
47
+       spa_strbuf_append(buffer, "%f", *(double *) body);
48
        break;
49
    case SPA_TYPE_String:
50
-       spa_debugn("%s", (char *) body);
51
+       spa_strbuf_append(buffer, "%s", (char *) body);
52
        break;
53
    case SPA_TYPE_Rectangle:
54
    {
55
        struct spa_rectangle *r = (struct spa_rectangle *)body;
56
-       spa_debugn("%" PRIu32 "x%" PRIu32, r->width, r->height);
57
+       spa_strbuf_append(buffer, "%" PRIu32 "x%" PRIu32, r->width, r->height);
58
        break;
59
    }
60
    case SPA_TYPE_Fraction:
61
    {
62
        struct spa_fraction *f = (struct spa_fraction *)body;
63
-       spa_debugn("%" PRIu32 "/%" PRIu32, f->num, f->denom);
64
+       spa_strbuf_append(buffer, "%" PRIu32 "/%" PRIu32, f->num, f->denom);
65
        break;
66
    }
67
    case SPA_TYPE_Bitmap:
68
-       spa_debugn("Bitmap");
69
+       spa_strbuf_append(buffer, "Bitmap");
70
        break;
71
    case SPA_TYPE_Bytes:
72
-       spa_debugn("Bytes");
73
+       spa_strbuf_append(buffer, "Bytes");
74
        break;
75
    case SPA_TYPE_Array:
76
    {
77
@@ -98,23 +100,35 @@
78
        struct spa_pod_array_body *b = (struct spa_pod_array_body *)body;
79
        int i = 0;
80
        info = info && info->values ? info->values : info;
81
-       spa_debugn("< ");
82
+       spa_strbuf_append(buffer, "< ");
83
        SPA_POD_ARRAY_BODY_FOREACH(b, size, p) {
84
            if (i++ > 0)
85
-               spa_debugn(", ");
86
-           spa_debug_format_value(info, b->child.type, p, b->child.size);
87
+               spa_strbuf_append(buffer, ", ");
88
+           spa_debug_strbuf_format_value(buffer, info, b->child.type, p, b->child.size);
89
        }
90
-       spa_debugn(" >");
91
+       spa_strbuf_append(buffer, " >");
92
        break;
93
    }
94
    default:
95
-       spa_debugn("INVALID type %d", type);
96
+       spa_strbuf_append(buffer, "INVALID type %d", type);
97
        break;
98
    }
99
    return 0;
100
 }
101
 
102
-static inline int spa_debug_format(int indent,
103
+static inline int
104
+spa_debug_format_value(const struct spa_type_info *info,
105
+       uint32_t type, void *body, uint32_t size)
106
+{
107
+   char buffer1024;
108
+   struct spa_strbuf buf;
109
+   spa_strbuf_init(&buf, buffer, sizeof(buffer));
110
+   spa_debug_strbuf_format_value(&buf, info, type, body, size);
111
+   spa_debugn("%s", buffer);
112
+   return 0;
113
+}
114
+
115
+static inline int spa_debugc_format(struct spa_debug_context *ctx, int indent,
116
        const struct spa_type_info *info, const struct spa_pod *format)
117
 {
118
    const char *media_type;
119
@@ -134,7 +148,7 @@
120
    media_type = spa_debug_type_find_name(spa_type_media_type, mtype);
121
    media_subtype = spa_debug_type_find_name(spa_type_media_subtype, mstype);
122
 
123
-   spa_debug("%*s %s/%s", indent, "",
124
+   spa_debugc(ctx, "%*s %s/%s", indent, "",
125
        media_type ? spa_debug_type_short_name(media_type) : "unknown",
126
        media_subtype ? spa_debug_type_short_name(media_subtype) : "unknown");
127
 
128
@@ -144,6 +158,8 @@
129
        uint32_t i, type, size, n_vals, choice;
130
        const struct spa_pod *val;
131
        void *vals;
132
+       char buffer1024;
133
+       struct spa_strbuf buf;
134
 
135
        if (prop->key == SPA_FORMAT_mediaType ||
136
            prop->key == SPA_FORMAT_mediaSubtype)
137
@@ -161,12 +177,13 @@
138
        ti = spa_debug_type_find(info, prop->key);
139
        key = ti ? ti->name : NULL;
140
 
141
-       spa_debugn("%*s %16s : (%s) ", indent, "",
142
+       spa_strbuf_init(&buf, buffer, sizeof(buffer));
143
+       spa_strbuf_append(&buf, "%*s %16s : (%s) ", indent, "",
144
            key ? spa_debug_type_short_name(key) : "unknown",
145
            spa_debug_type_short_name(spa_typestype.name));
146
 
147
        if (choice == SPA_CHOICE_None) {
148
-           spa_debug_format_value(ti ? ti->values : NULL, type, vals, size);
149
+           spa_debug_strbuf_format_value(&buf, ti ? ti->values : NULL, type, vals, size);
150
        } else {
151
            const char *ssep, *esep, *sep;
152
 
153
@@ -186,21 +203,26 @@
154
                break;
155
            }
156
 
157
-           spa_debugn("%s", ssep);
158
+           spa_strbuf_append(&buf, "%s", ssep);
159
 
160
            for (i = 1; i < n_vals; i++) {
161
                vals = SPA_PTROFF(vals, size, void);
162
                if (i > 1)
163
-                   spa_debugn("%s", sep);
164
-               spa_debug_format_value(ti ? ti->values : NULL, type, vals, size);
165
+                   spa_strbuf_append(&buf, "%s", sep);
166
+               spa_debug_strbuf_format_value(&buf, ti ? ti->values : NULL, type, vals, size);
167
            }
168
-           spa_debugn("%s", esep);
169
+           spa_strbuf_append(&buf, "%s", esep);
170
        }
171
-       spa_debugn("\n");
172
+       spa_debugc(ctx, "%s", buffer);
173
    }
174
    return 0;
175
 }
176
 
177
+static inline int spa_debug_format(int indent,
178
+       const struct spa_type_info *info, const struct spa_pod *format)
179
+{
180
+   return spa_debugc_format(NULL, indent, info, format);
181
+}
182
 /**
183
  * \}
184
  */
185
pipewire-0.3.64.tar.gz/spa/include/spa/debug/log.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/log.h Changed
81
 
1
@@ -30,17 +30,67 @@
2
 #endif
3
 
4
 #include <stdio.h>
5
+#include <stdarg.h>
6
+
7
+#include <spa/utils/defs.h>
8
+#include <spa/support/log.h>
9
+#include <spa/debug/context.h>
10
+
11
 /**
12
  * \addtogroup spa_debug
13
  * \{
14
  */
15
 
16
-#ifndef spa_debug
17
-#define spa_debug(fmt,...) ({ printf((fmt"\n"), ## __VA_ARGS__); })
18
-#endif
19
-#ifndef spa_debugn
20
-#define spa_debugn(fmt,...)    ({ printf((fmt), ## __VA_ARGS__); })
21
-#endif
22
+struct spa_debug_log_ctx {
23
+   struct spa_debug_context ctx;
24
+   struct spa_log *log;
25
+   enum spa_log_level level;
26
+   const struct spa_log_topic *topic;
27
+   const char *file;
28
+   int line;
29
+   const char *func;
30
+};
31
+
32
+SPA_PRINTF_FUNC(2,3)
33
+static inline void spa_debug_log_log(struct spa_debug_context *ctx, const char *fmt, ...)
34
+{
35
+   struct spa_debug_log_ctx *c = (struct spa_debug_log_ctx*)ctx;
36
+   va_list args;
37
+   va_start(args, fmt);
38
+   spa_log_logtv(c->log, c->level, c->topic, c->file, c->line, c->func, fmt, args);
39
+   va_end(args);
40
+}
41
+
42
+#define SPA_LOGF_DEBUG_INIT(_l,_lev,_t,_file,_line,_func)          \
43
+   (struct spa_debug_log_ctx){ { spa_debug_log_log }, _l, _lev, _t,    \
44
+       _file, _line, _func }
45
+
46
+#define SPA_LOGT_DEBUG_INIT(_l,_lev,_t)                        \
47
+   SPA_LOGF_DEBUG_INIT(_l,_lev,_t,__FILE__,__LINE__,__func__)
48
+
49
+#define SPA_LOG_DEBUG_INIT(l,lev)  \
50
+   SPA_LOGT_DEBUG_INIT(l,lev,SPA_LOG_TOPIC_DEFAULT)
51
+
52
+#define spa_debug_log_pod(l,lev,indent,info,pod)               \
53
+({                                     \
54
+   struct spa_debug_log_ctx c = SPA_LOG_DEBUG_INIT(l,lev);         \
55
+   if (SPA_UNLIKELY(spa_log_level_topic_enabled(c.log, c.topic, c.level))) \
56
+       spa_debugc_pod(&c.ctx, indent, info, pod);          \
57
+})
58
+
59
+#define spa_debug_log_format(l,lev,indent,info,format)                 \
60
+({                                     \
61
+   struct spa_debug_log_ctx c = SPA_LOG_DEBUG_INIT(l,lev);         \
62
+   if (SPA_UNLIKELY(spa_log_level_topic_enabled(c.log, c.topic, c.level))) \
63
+       spa_debugc_format(&c.ctx, indent, info, format);        \
64
+})
65
+
66
+#define spa_debug_log_mem(l,lev,indent,data,len)               \
67
+({                                     \
68
+   struct spa_debug_log_ctx c = SPA_LOG_DEBUG_INIT(l,lev);         \
69
+   if (SPA_UNLIKELY(spa_log_level_topic_enabled(c.log, c.topic, c.level))) \
70
+       spa_debugc_mem(&c.ctx, indent, data, len);          \
71
+})
72
 
73
 /**
74
  * \}
75
@@ -50,4 +100,4 @@
76
 }  /* extern "C" */
77
 #endif
78
 
79
-#endif /* SPA_DEBUG_LOGH */
80
+#endif /* SPA_DEBUG_LOG_H */
81
pipewire-0.3.64.tar.gz/spa/include/spa/debug/mem.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/mem.h Changed
31
 
1
@@ -36,9 +36,9 @@
2
  * \{
3
  */
4
 
5
-#include <spa/debug/log.h>
6
+#include <spa/debug/context.h>
7
 
8
-static inline int spa_debug_mem(int indent, const void *data, size_t size)
9
+static inline int spa_debugc_mem(struct spa_debug_context *ctx, int indent, const void *data, size_t size)
10
 {
11
    const uint8_t *t = (const uint8_t*)data;
12
    char buffer512;
13
@@ -50,12 +50,16 @@
14
            pos = sprintf(buffer, "%p: ", &ti);
15
        pos += sprintf(buffer + pos, "%02x ", ti);
16
        if (i % 16 == 15 || i == size - 1) {
17
-           spa_debug("%*s" "%s", indent, "", buffer);
18
+           spa_debugc(ctx, "%*s" "%s", indent, "", buffer);
19
        }
20
    }
21
    return 0;
22
 }
23
 
24
+static inline int spa_debug_mem(int indent, const void *data, size_t size)
25
+{
26
+   return spa_debugc_mem(NULL, indent, data, size);
27
+}
28
 /**
29
  * \}
30
  */
31
pipewire-0.3.64.tar.gz/spa/include/spa/debug/node.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/node.h Changed
36
 
1
@@ -35,22 +35,26 @@
2
  */
3
 
4
 #include <spa/node/node.h>
5
-#include <spa/debug/log.h>
6
+#include <spa/debug/context.h>
7
 #include <spa/debug/dict.h>
8
 
9
-static inline int spa_debug_port_info(int indent, const struct spa_port_info *info)
10
+static inline int spa_debugc_port_info(struct spa_debug_context *ctx, int indent, const struct spa_port_info *info)
11
 {
12
-        spa_debug("%*s" "struct spa_port_info %p:", indent, "", info);
13
-        spa_debug("%*s" " flags: \t%08" PRIx64, indent, "", info->flags);
14
-        spa_debug("%*s" " rate: \t%d/%d", indent, "", info->rate.num, info->rate.denom);
15
-        spa_debug("%*s" " props:", indent, "");
16
+        spa_debugc(ctx, "%*s" "struct spa_port_info %p:", indent, "", info);
17
+        spa_debugc(ctx, "%*s" " flags: \t%08" PRIx64, indent, "", info->flags);
18
+        spa_debugc(ctx, "%*s" " rate: \t%d/%d", indent, "", info->rate.num, info->rate.denom);
19
+        spa_debugc(ctx, "%*s" " props:", indent, "");
20
         if (info->props)
21
-                spa_debug_dict(indent + 2, info->props);
22
+                spa_debugc_dict(ctx, indent + 2, info->props);
23
         else
24
-                spa_debug("%*s" "  none", indent, "");
25
+                spa_debugc(ctx, "%*s" "  none", indent, "");
26
         return 0;
27
 }
28
 
29
+static inline int spa_debug_port_info(int indent, const struct spa_port_info *info)
30
+{
31
+   return spa_debugc_port_info(NULL, indent, info);
32
+}
33
 /**
34
  * \}
35
  */
36
pipewire-0.3.64.tar.gz/spa/include/spa/debug/pod.h -> pipewire-0.3.65.tar.gz/spa/include/spa/debug/pod.h Changed
201
 
1
@@ -34,63 +34,63 @@
2
  * \{
3
  */
4
 
5
-#include <spa/debug/log.h>
6
+#include <spa/debug/context.h>
7
 #include <spa/debug/mem.h>
8
 #include <spa/debug/types.h>
9
 #include <spa/pod/pod.h>
10
 #include <spa/pod/iter.h>
11
 
12
 static inline int
13
-spa_debug_pod_value(int indent, const struct spa_type_info *info,
14
+spa_debugc_pod_value(struct spa_debug_context *ctx, int indent, const struct spa_type_info *info,
15
        uint32_t type, void *body, uint32_t size)
16
 {
17
    switch (type) {
18
    case SPA_TYPE_Bool:
19
-       spa_debug("%*s" "Bool %s", indent, "", (*(int32_t *) body) ? "true" : "false");
20
+       spa_debugc(ctx, "%*s" "Bool %s", indent, "", (*(int32_t *) body) ? "true" : "false");
21
        break;
22
    case SPA_TYPE_Id:
23
-       spa_debug("%*s" "Id %-8d (%s)", indent, "", *(int32_t *) body,
24
+       spa_debugc(ctx, "%*s" "Id %-8d (%s)", indent, "", *(int32_t *) body,
25
               spa_debug_type_find_name(info, *(int32_t *) body));
26
        break;
27
    case SPA_TYPE_Int:
28
-       spa_debug("%*s" "Int %d", indent, "", *(int32_t *) body);
29
+       spa_debugc(ctx, "%*s" "Int %d", indent, "", *(int32_t *) body);
30
        break;
31
    case SPA_TYPE_Long:
32
-       spa_debug("%*s" "Long %" PRIi64 "", indent, "", *(int64_t *) body);
33
+       spa_debugc(ctx, "%*s" "Long %" PRIi64 "", indent, "", *(int64_t *) body);
34
        break;
35
    case SPA_TYPE_Float:
36
-       spa_debug("%*s" "Float %f", indent, "", *(float *) body);
37
+       spa_debugc(ctx, "%*s" "Float %f", indent, "", *(float *) body);
38
        break;
39
    case SPA_TYPE_Double:
40
-       spa_debug("%*s" "Double %f", indent, "", *(double *) body);
41
+       spa_debugc(ctx, "%*s" "Double %f", indent, "", *(double *) body);
42
        break;
43
    case SPA_TYPE_String:
44
-       spa_debug("%*s" "String \"%s\"", indent, "", (char *) body);
45
+       spa_debugc(ctx, "%*s" "String \"%s\"", indent, "", (char *) body);
46
        break;
47
    case SPA_TYPE_Fd:
48
-       spa_debug("%*s" "Fd %d", indent, "", *(int *) body);
49
+       spa_debugc(ctx, "%*s" "Fd %d", indent, "", *(int *) body);
50
        break;
51
    case SPA_TYPE_Pointer:
52
    {
53
        struct spa_pod_pointer_body *b = (struct spa_pod_pointer_body *)body;
54
-       spa_debug("%*s" "Pointer %s %p", indent, "",
55
+       spa_debugc(ctx, "%*s" "Pointer %s %p", indent, "",
56
               spa_debug_type_find_name(SPA_TYPE_ROOT, b->type), b->value);
57
        break;
58
    }
59
    case SPA_TYPE_Rectangle:
60
    {
61
        struct spa_rectangle *r = (struct spa_rectangle *)body;
62
-       spa_debug("%*s" "Rectangle %dx%d", indent, "", r->width, r->height);
63
+       spa_debugc(ctx, "%*s" "Rectangle %dx%d", indent, "", r->width, r->height);
64
        break;
65
    }
66
    case SPA_TYPE_Fraction:
67
    {
68
        struct spa_fraction *f = (struct spa_fraction *)body;
69
-       spa_debug("%*s" "Fraction %d/%d", indent, "", f->num, f->denom);
70
+       spa_debugc(ctx, "%*s" "Fraction %d/%d", indent, "", f->num, f->denom);
71
        break;
72
    }
73
    case SPA_TYPE_Bitmap:
74
-       spa_debug("%*s" "Bitmap", indent, "");
75
+       spa_debugc(ctx, "%*s" "Bitmap", indent, "");
76
        break;
77
    case SPA_TYPE_Array:
78
    {
79
@@ -98,12 +98,12 @@
80
        void *p;
81
        const struct spa_type_info *ti = spa_debug_type_find(SPA_TYPE_ROOT, b->child.type);
82
 
83
-       spa_debug("%*s" "Array: child.size %d, child.type %s", indent, "",
84
+       spa_debugc(ctx, "%*s" "Array: child.size %d, child.type %s", indent, "",
85
               b->child.size, ti ? ti->name : "unknown");
86
 
87
        info = info && info->values ? info->values : info;
88
        SPA_POD_ARRAY_BODY_FOREACH(b, size, p)
89
-           spa_debug_pod_value(indent + 2, info, b->child.type, p, b->child.size);
90
+           spa_debugc_pod_value(ctx, indent + 2, info, b->child.type, p, b->child.size);
91
        break;
92
    }
93
    case SPA_TYPE_Choice:
94
@@ -112,19 +112,19 @@
95
        void *p;
96
        const struct spa_type_info *ti = spa_debug_type_find(spa_type_choice, b->type);
97
 
98
-       spa_debug("%*s" "Choice: type %s, flags %08x %d %d", indent, "",
99
+       spa_debugc(ctx, "%*s" "Choice: type %s, flags %08x %d %d", indent, "",
100
               ti ? ti->name : "unknown", b->flags, size, b->child.size);
101
 
102
        SPA_POD_CHOICE_BODY_FOREACH(b, size, p)
103
-           spa_debug_pod_value(indent + 2, info, b->child.type, p, b->child.size);
104
+           spa_debugc_pod_value(ctx, indent + 2, info, b->child.type, p, b->child.size);
105
        break;
106
    }
107
    case SPA_TYPE_Struct:
108
    {
109
        struct spa_pod *b = (struct spa_pod *)body, *p;
110
-       spa_debug("%*s" "Struct: size %d", indent, "", size);
111
+       spa_debugc(ctx, "%*s" "Struct: size %d", indent, "", size);
112
        SPA_POD_FOREACH(b, size, p)
113
-           spa_debug_pod_value(indent + 2, info, p->type, SPA_POD_BODY(p), p->size);
114
+           spa_debugc_pod_value(ctx, indent + 2, info, p->type, SPA_POD_BODY(p), p->size);
115
        break;
116
    }
117
    case SPA_TYPE_Object:
118
@@ -137,7 +137,7 @@
119
        ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
120
        ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
121
 
122
-       spa_debug("%*s" "Object: size %d, type %s (%d), id %s (%d)", indent, "", size,
123
+       spa_debugc(ctx, "%*s" "Object: size %d, type %s (%d), id %s (%d)", indent, "", size,
124
               ti ? ti->name : "unknown", b->type, ii ? ii->name : "unknown", b->id);
125
 
126
        info = ti ? ti->values : info;
127
@@ -145,10 +145,10 @@
128
        SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
129
            ii = spa_debug_type_find(info, p->key);
130
 
131
-           spa_debug("%*s" "Prop: key %s (%d), flags %08x", indent+2, "",
132
+           spa_debugc(ctx, "%*s" "Prop: key %s (%d), flags %08x", indent+2, "",
133
                    ii ? ii->name : "unknown", p->key, p->flags);
134
 
135
-           spa_debug_pod_value(indent + 4, ii ? ii->values : NULL,
136
+           spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
137
                    p->value.type,
138
                    SPA_POD_CONTENTS(struct spa_pod_prop, p),
139
                    p->value.size);
140
@@ -163,16 +163,16 @@
141
 
142
        ti = spa_debug_type_find(info, b->unit);
143
 
144
-       spa_debug("%*s" "Sequence: size %d, unit %s", indent, "", size,
145
+       spa_debugc(ctx, "%*s" "Sequence: size %d, unit %s", indent, "", size,
146
               ti ? ti->name : "unknown");
147
 
148
        SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) {
149
            ii = spa_debug_type_find(spa_type_control, c->type);
150
 
151
-           spa_debug("%*s" "Control: offset %d, type %s", indent+2, "",
152
+           spa_debugc(ctx, "%*s" "Control: offset %d, type %s", indent+2, "",
153
                    c->offset, ii ? ii->name : "unknown");
154
 
155
-           spa_debug_pod_value(indent + 4, ii ? ii->values : NULL,
156
+           spa_debugc_pod_value(ctx, indent + 4, ii ? ii->values : NULL,
157
                    c->value.type,
158
                    SPA_POD_CONTENTS(struct spa_pod_control, c),
159
                    c->value.size);
160
@@ -180,29 +180,41 @@
161
        break;
162
    }
163
    case SPA_TYPE_Bytes:
164
-       spa_debug("%*s" "Bytes", indent, "");
165
-       spa_debug_mem(indent + 2, body, size);
166
+       spa_debugc(ctx, "%*s" "Bytes", indent, "");
167
+       spa_debugc_mem(ctx, indent + 2, body, size);
168
        break;
169
    case SPA_TYPE_None:
170
-       spa_debug("%*s" "None", indent, "");
171
-       spa_debug_mem(indent + 2, body, size);
172
+       spa_debugc(ctx, "%*s" "None", indent, "");
173
+       spa_debugc_mem(ctx, indent + 2, body, size);
174
        break;
175
    default:
176
-       spa_debug("%*s" "unhandled POD type %d", indent, "", type);
177
+       spa_debugc(ctx, "%*s" "unhandled POD type %d", indent, "", type);
178
        break;
179
    }
180
    return 0;
181
 }
182
 
183
-static inline int spa_debug_pod(int indent,
184
+static inline int spa_debugc_pod(struct spa_debug_context *ctx, int indent,
185
        const struct spa_type_info *info, const struct spa_pod *pod)
186
 {
187
-   return spa_debug_pod_value(indent, info ? info : SPA_TYPE_ROOT,
188
+   return spa_debugc_pod_value(ctx, indent, info ? info : SPA_TYPE_ROOT,
189
            SPA_POD_TYPE(pod),
190
            SPA_POD_BODY(pod),
191
            SPA_POD_BODY_SIZE(pod));
192
 }
193
 
194
+static inline int
195
+spa_debug_pod_value(int indent, const struct spa_type_info *info,
196
+       uint32_t type, void *body, uint32_t size)
197
+{
198
+   return spa_debugc_pod_value(NULL, indent, info, type, body, size);
199
+}
200
+
201
pipewire-0.3.64.tar.gz/spa/include/spa/node/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/node/type-info.h Changed
10
 
1
@@ -34,7 +34,7 @@
2
  * \{
3
  */
4
 
5
-#include <spa/utils/type-info.h>
6
+#include <spa/utils/type.h>
7
 
8
 #include <spa/node/command.h>
9
 #include <spa/node/event.h>
10
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/aac-types.h Added
60
 
1
@@ -0,0 +1,58 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AAC_TYPES_H
27
+#define SPA_AUDIO_AAC_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+#include <spa/param/audio/aac.h>
35
+
36
+#define SPA_TYPE_INFO_AudioAACStreamFormat     SPA_TYPE_INFO_ENUM_BASE "AudioAACStreamFormat"
37
+#define SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE SPA_TYPE_INFO_AudioAACStreamFormat ":"
38
+
39
+static const struct spa_type_info spa_type_audio_aac_stream_format = {
40
+   { SPA_AUDIO_AAC_STREAM_FORMAT_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "UNKNOWN", NULL },
41
+   { SPA_AUDIO_AAC_STREAM_FORMAT_RAW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "RAW", NULL },
42
+   { SPA_AUDIO_AAC_STREAM_FORMAT_MP2ADTS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "MP2ADTS", NULL },
43
+   { SPA_AUDIO_AAC_STREAM_FORMAT_MP4ADTS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "MP4ADTS", NULL },
44
+   { SPA_AUDIO_AAC_STREAM_FORMAT_MP4LOAS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "MP4LOAS", NULL },
45
+   { SPA_AUDIO_AAC_STREAM_FORMAT_MP4LATM, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "MP4LATM", NULL },
46
+   { SPA_AUDIO_AAC_STREAM_FORMAT_ADIF, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "ADIF", NULL },
47
+   { SPA_AUDIO_AAC_STREAM_FORMAT_MP4FF, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE "MP4FF", NULL },
48
+   { 0, 0, NULL, NULL },
49
+};
50
+
51
+/**
52
+ * \}
53
+ */
54
+
55
+#ifdef __cplusplus
56
+}  /* extern "C" */
57
+#endif
58
+
59
+#endif /* SPA_AUDIO_AAC_TYPES_H */
60
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/aac-utils.h Added
91
 
1
@@ -0,0 +1,89 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AAC_UTILS_H
27
+#define SPA_AUDIO_AAC_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_aac_parse(const struct spa_pod *format, struct spa_audio_info_aac *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
51
+           SPA_FORMAT_AUDIO_bitrate,   SPA_POD_OPT_Int(&info->bitrate),
52
+           SPA_FORMAT_AUDIO_AAC_streamFormat,  SPA_POD_OPT_Id(&info->stream_format));
53
+
54
+   return res;
55
+}
56
+
57
+static inline struct spa_pod *
58
+spa_format_audio_aac_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_aac *info)
59
+{
60
+   struct spa_pod_frame f;
61
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
62
+   spa_pod_builder_add(builder,
63
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
64
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_aac),
65
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
66
+           0);
67
+   if (info->rate != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
70
+   if (info->channels != 0)
71
+       spa_pod_builder_add(builder,
72
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
73
+   if (info->bitrate != 0)
74
+       spa_pod_builder_add(builder,
75
+           SPA_FORMAT_AUDIO_bitrate,   SPA_POD_Int(info->bitrate), 0);
76
+   if (info->stream_format != 0)
77
+       spa_pod_builder_add(builder,
78
+           SPA_FORMAT_AUDIO_AAC_streamFormat,  SPA_POD_Id(info->stream_format), 0);
79
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
80
+}
81
+
82
+/**
83
+ * \}
84
+ */
85
+
86
+#ifdef __cplusplus
87
+}  /* extern "C" */
88
+#endif
89
+
90
+#endif /* SPA_AUDIO_AAC_UTILS_H */
91
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/aac.h Added
73
 
1
@@ -0,0 +1,71 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AAC_H
27
+#define SPA_AUDIO_AAC_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+enum spa_audio_aac_stream_format {
36
+   SPA_AUDIO_AAC_STREAM_FORMAT_UNKNOWN,
37
+   /* Raw AAC frames */
38
+   SPA_AUDIO_AAC_STREAM_FORMAT_RAW,
39
+   /* ISO/IEC 13818-7 MPEG-2 Audio Data Transport Stream (ADTS) */
40
+   SPA_AUDIO_AAC_STREAM_FORMAT_MP2ADTS,
41
+   /* ISO/IEC 14496-3 MPEG-4 Audio Data Transport Stream (ADTS) */
42
+   SPA_AUDIO_AAC_STREAM_FORMAT_MP4ADTS,
43
+   /* ISO/IEC 14496-3 Low Overhead Audio Stream (LOAS) */
44
+   SPA_AUDIO_AAC_STREAM_FORMAT_MP4LOAS,
45
+   /* ISO/IEC 14496-3 Low Overhead Audio Transport Multiplex (LATM) */
46
+   SPA_AUDIO_AAC_STREAM_FORMAT_MP4LATM,
47
+   /* ISO/IEC 14496-3 Audio Data Interchange Format (ADIF) */
48
+   SPA_AUDIO_AAC_STREAM_FORMAT_ADIF,
49
+   /* ISO/IEC 14496-12 MPEG-4 file format */
50
+   SPA_AUDIO_AAC_STREAM_FORMAT_MP4FF,
51
+
52
+   SPA_AUDIO_AAC_STREAM_FORMAT_CUSTOM = 0x10000,
53
+};
54
+
55
+struct spa_audio_info_aac {
56
+   uint32_t rate;                  /*< sample rate */
57
+   uint32_t channels;              /*< number of channels */
58
+   uint32_t bitrate;               /*< stream bitrate */
59
+   enum spa_audio_aac_stream_format stream_format; /*< AAC audio stream format */
60
+};
61
+
62
+#define SPA_AUDIO_INFO_AAC_INIT(...)       ((struct spa_audio_info_aac) { __VA_ARGS__ })
63
+
64
+/**
65
+ * \}
66
+ */
67
+
68
+#ifdef __cplusplus
69
+}  /* extern "C" */
70
+#endif
71
+
72
+#endif /* SPA_AUDIO_AAC_H */
73
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/alac-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_ALAC_UTILS_H
27
+#define SPA_AUDIO_ALAC_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_alac_parse(const struct spa_pod *format, struct spa_audio_info_alac *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_alac_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_alac *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_alac),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_ALAC_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/alac.h Added
51
 
1
@@ -0,0 +1,49 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_ALAC_H
27
+#define SPA_AUDIO_ALAC_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_alac {
36
+   uint32_t rate;              /*< sample rate */
37
+   uint32_t channels;          /*< number of channels */
38
+};
39
+
40
+#define SPA_AUDIO_INFO_ALAC_INIT(...)      ((struct spa_audio_info_alac) { __VA_ARGS__ })
41
+
42
+/**
43
+ * \}
44
+ */
45
+
46
+#ifdef __cplusplus
47
+}  /* extern "C" */
48
+#endif
49
+
50
+#endif /* SPA_AUDIO_ALAC_H */
51
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/amr-types.h Added
54
 
1
@@ -0,0 +1,52 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AMR_TYPES_H
27
+#define SPA_AUDIO_AMR_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+#include <spa/param/audio/amr.h>
35
+
36
+#define SPA_TYPE_INFO_AudioAMRBandMode     SPA_TYPE_INFO_ENUM_BASE "AudioAMRBandMode"
37
+#define SPA_TYPE_INFO_AUDIO_AMR_BAND_MODE_BASE SPA_TYPE_INFO_AudioAMRBandMode ":"
38
+
39
+static const struct spa_type_info spa_type_audio_amr_band_mode = {
40
+   { SPA_AUDIO_AMR_BAND_MODE_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AMR_BAND_MODE_BASE "UNKNOWN", NULL },
41
+   { SPA_AUDIO_AMR_BAND_MODE_NB, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AMR_BAND_MODE_BASE "NB", NULL },
42
+   { SPA_AUDIO_AMR_BAND_MODE_WB, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_AMR_BAND_MODE_BASE "WB", NULL },
43
+   { 0, 0, NULL, NULL },
44
+};
45
+/**
46
+ * \}
47
+ */
48
+
49
+#ifdef __cplusplus
50
+}  /* extern "C" */
51
+#endif
52
+
53
+#endif /* SPA_AUDIO_AMR_TYPES_H */
54
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/amr-utils.h Added
86
 
1
@@ -0,0 +1,84 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AMR_UTILS_H
27
+#define SPA_AUDIO_AMR_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_amr_parse(const struct spa_pod *format, struct spa_audio_info_amr *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
51
+           SPA_FORMAT_AUDIO_AMR_bandMode,  SPA_POD_OPT_Id(&info->band_mode));
52
+   return res;
53
+}
54
+
55
+static inline struct spa_pod *
56
+spa_format_audio_amr_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_amr *info)
57
+{
58
+   struct spa_pod_frame f;
59
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
60
+   spa_pod_builder_add(builder,
61
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
62
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_amr),
63
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
64
+           0);
65
+   if (info->rate != 0)
66
+       spa_pod_builder_add(builder,
67
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
68
+   if (info->channels != 0)
69
+       spa_pod_builder_add(builder,
70
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
71
+   if (info->band_mode != 0)
72
+       spa_pod_builder_add(builder,
73
+           SPA_FORMAT_AUDIO_AMR_bandMode,  SPA_POD_Id(info->band_mode), 0);
74
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
75
+}
76
+
77
+/**
78
+ * \}
79
+ */
80
+
81
+#ifdef __cplusplus
82
+}  /* extern "C" */
83
+#endif
84
+
85
+#endif /* SPA_AUDIO_AMR_UTILS_H */
86
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/amr.h Added
58
 
1
@@ -0,0 +1,56 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_AMR_H
27
+#define SPA_AUDIO_AMR_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+enum spa_audio_amr_band_mode {
36
+   SPA_AUDIO_AMR_BAND_MODE_UNKNOWN,
37
+   SPA_AUDIO_AMR_BAND_MODE_NB,
38
+   SPA_AUDIO_AMR_BAND_MODE_WB,
39
+};
40
+
41
+struct spa_audio_info_amr {
42
+   uint32_t rate;              /*< sample rate */
43
+   uint32_t channels;          /*< number of channels */
44
+   enum spa_audio_amr_band_mode band_mode;
45
+};
46
+
47
+#define SPA_AUDIO_INFO_AMR_INIT(...)       ((struct spa_audio_info_amr) { __VA_ARGS__ })
48
+
49
+/**
50
+ * \}
51
+ */
52
+
53
+#ifdef __cplusplus
54
+}  /* extern "C" */
55
+#endif
56
+
57
+#endif /* SPA_AUDIO_AMR_H */
58
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/ape-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_APE_UTILS_H
27
+#define SPA_AUDIO_APE_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_ape_parse(const struct spa_pod *format, struct spa_audio_info_ape *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_ape_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_ape *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_ape),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_APE_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/ape.h Added
51
 
1
@@ -0,0 +1,49 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_APE_H
27
+#define SPA_AUDIO_APE_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_ape {
36
+   uint32_t rate;              /*< sample rate */
37
+   uint32_t channels;          /*< number of channels */
38
+};
39
+
40
+#define SPA_AUDIO_INFO_APE_INIT(...)       ((struct spa_audio_info_ape) { __VA_ARGS__ })
41
+
42
+/**
43
+ * \}
44
+ */
45
+
46
+#ifdef __cplusplus
47
+}  /* extern "C" */
48
+#endif
49
+
50
+#endif /* SPA_AUDIO_APE_H */
51
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/compressed.h Added
41
 
1
@@ -0,0 +1,39 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2021 Wim Taymans
5
+ *           © 2022 Asymptotic Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a
8
+ * copy of this software and associated documentation files (the "Software"),
9
+ * to deal in the Software without restriction, including without limitation
10
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ * and/or sell copies of the Software, and to permit persons to whom the
12
+ * Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice (including the next
15
+ * paragraph) shall be included in all copies or substantial portions of the
16
+ * Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
+ * DEALINGS IN THE SOFTWARE.
25
+ */
26
+
27
+#ifndef SPA_AUDIO_COMPRESSED_H
28
+#define SPA_AUDIO_COMPRESSED_H
29
+
30
+#include <spa/param/audio/aac.h>
31
+#include <spa/param/audio/alac.h>
32
+#include <spa/param/audio/amr.h>
33
+#include <spa/param/audio/ape.h>
34
+#include <spa/param/audio/flac.h>
35
+#include <spa/param/audio/mp3.h>
36
+#include <spa/param/audio/ra.h>
37
+#include <spa/param/audio/vorbis.h>
38
+#include <spa/param/audio/wma.h>
39
+
40
+#endif /* SPA_AUDIO_COMPRESSED_H */
41
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/dsd-utils.h Added
102
 
1
@@ -0,0 +1,100 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_DSD_UTILS_H
27
+#define SPA_AUDIO_DSD_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/format-utils.h>
41
+#include <spa/param/audio/format.h>
42
+
43
+static inline int
44
+spa_format_audio_dsd_parse(const struct spa_pod *format, struct spa_audio_info_dsd *info)
45
+{
46
+   struct spa_pod *position = NULL;
47
+   int res;
48
+   info->flags = 0;
49
+   res = spa_pod_parse_object(format,
50
+           SPA_TYPE_OBJECT_Format, NULL,
51
+           SPA_FORMAT_AUDIO_bitorder,  SPA_POD_OPT_Id(&info->bitorder),
52
+           SPA_FORMAT_AUDIO_interleave,    SPA_POD_OPT_Int(&info->interleave),
53
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
54
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
55
+           SPA_FORMAT_AUDIO_position,  SPA_POD_OPT_Pod(&position));
56
+   if (position == NULL ||
57
+       !spa_pod_copy_array(position, SPA_TYPE_Id, info->position, SPA_AUDIO_MAX_CHANNELS))
58
+       SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
59
+
60
+   return res;
61
+}
62
+
63
+static inline struct spa_pod *
64
+spa_format_audio_dsd_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_dsd *info)
65
+{
66
+   struct spa_pod_frame f;
67
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
68
+   spa_pod_builder_add(builder,
69
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
70
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsd),
71
+           0);
72
+   if (info->bitorder != SPA_PARAM_BITORDER_unknown)
73
+       spa_pod_builder_add(builder,
74
+           SPA_FORMAT_AUDIO_bitorder,  SPA_POD_Id(info->bitorder), 0);
75
+   if (info->interleave != 0)
76
+       spa_pod_builder_add(builder,
77
+           SPA_FORMAT_AUDIO_interleave,    SPA_POD_Int(info->interleave), 0);
78
+   if (info->rate != 0)
79
+       spa_pod_builder_add(builder,
80
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
81
+   if (info->channels != 0) {
82
+       spa_pod_builder_add(builder,
83
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
84
+       if (!SPA_FLAG_IS_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
85
+           spa_pod_builder_add(builder, SPA_FORMAT_AUDIO_position,
86
+               SPA_POD_Array(sizeof(uint32_t), SPA_TYPE_Id,
87
+                   info->channels, info->position), 0);
88
+       }
89
+   }
90
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
91
+}
92
+
93
+/**
94
+ * \}
95
+ */
96
+
97
+#ifdef __cplusplus
98
+}  /* extern "C" */
99
+#endif
100
+
101
+#endif /* SPA_AUDIO_DSD_UTILS_H */
102
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/dsp-utils.h Added
77
 
1
@@ -0,0 +1,75 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_DSP_UTILS_H
27
+#define SPA_AUDIO_DSP_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_dsp_parse(const struct spa_pod *format, struct spa_audio_info_dsp *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_format,    SPA_POD_OPT_Id(&info->format));
50
+   return res;
51
+}
52
+
53
+static inline struct spa_pod *
54
+spa_format_audio_dsp_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_dsp *info)
55
+{
56
+   struct spa_pod_frame f;
57
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
58
+   spa_pod_builder_add(builder,
59
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
60
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsp),
61
+           0);
62
+   if (info->format != SPA_AUDIO_FORMAT_UNKNOWN)
63
+       spa_pod_builder_add(builder,
64
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(info->format), 0);
65
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
66
+}
67
+
68
+/**
69
+ * \}
70
+ */
71
+
72
+#ifdef __cplusplus
73
+}  /* extern "C" */
74
+#endif
75
+
76
+#endif /* SPA_AUDIO_DSP_UTILS_H */
77
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/dsp.h Added
50
 
1
@@ -0,0 +1,48 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_DSP_H
27
+#define SPA_AUDIO_DSP_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_dsp {
36
+   enum spa_audio_format format;       /*< format, one of the DSP formats in enum spa_audio_format */
37
+};
38
+
39
+#define SPA_AUDIO_INFO_DSP_INIT(...)       ((struct spa_audio_info_dsp) { __VA_ARGS__ })
40
+
41
+/**
42
+ * \}
43
+ */
44
+
45
+#ifdef __cplusplus
46
+}  /* extern "C" */
47
+#endif
48
+
49
+#endif /* SPA_AUDIO_DSP_H */
50
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/flac-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_FLAC_UTILS_H
27
+#define SPA_AUDIO_FLAC_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_flac_parse(const struct spa_pod *format, struct spa_audio_info_flac *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_flac_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_flac *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_flac),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_FLAC_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/flac.h Added
51
 
1
@@ -0,0 +1,49 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_FLAC_H
27
+#define SPA_AUDIO_FLAC_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_flac {
36
+   uint32_t rate;              /*< sample rate */
37
+   uint32_t channels;          /*< number of channels */
38
+};
39
+
40
+#define SPA_AUDIO_INFO_FLAC_INIT(...)      ((struct spa_audio_info_flac) { __VA_ARGS__ })
41
+
42
+/**
43
+ * \}
44
+ */
45
+
46
+#ifdef __cplusplus
47
+}  /* extern "C" */
48
+#endif
49
+
50
+#endif /* SPA_AUDIO_FLAC_H */
51
pipewire-0.3.64.tar.gz/spa/include/spa/param/audio/format-utils.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/format-utils.h Changed
201
 
1
@@ -29,167 +29,107 @@
2
 extern "C" {
3
 #endif
4
 
5
-/**
6
- * \addtogroup spa_param
7
- * \{
8
- */
9
-
10
 #include <spa/pod/parser.h>
11
 #include <spa/pod/builder.h>
12
 #include <spa/param/audio/format.h>
13
 #include <spa/param/format-utils.h>
14
 
15
-static inline int
16
-spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_raw *info)
17
-{
18
-   struct spa_pod *position = NULL;
19
-   int res;
20
-   info->flags = 0;
21
-   res = spa_pod_parse_object(format,
22
-           SPA_TYPE_OBJECT_Format, NULL,
23
-           SPA_FORMAT_AUDIO_format,    SPA_POD_OPT_Id(&info->format),
24
-           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
25
-           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
26
-           SPA_FORMAT_AUDIO_position,  SPA_POD_OPT_Pod(&position));
27
-   if (position == NULL ||
28
-       !spa_pod_copy_array(position, SPA_TYPE_Id, info->position, SPA_AUDIO_MAX_CHANNELS))
29
-       SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
30
-
31
-   return res;
32
-}
33
+#include <spa/param/audio/raw-utils.h>
34
+#include <spa/param/audio/dsp-utils.h>
35
+#include <spa/param/audio/iec958-utils.h>
36
+#include <spa/param/audio/dsd-utils.h>
37
+#include <spa/param/audio/mp3-utils.h>
38
+#include <spa/param/audio/aac-utils.h>
39
+#include <spa/param/audio/vorbis-utils.h>
40
+#include <spa/param/audio/wma-utils.h>
41
+#include <spa/param/audio/ra-utils.h>
42
+#include <spa/param/audio/amr-utils.h>
43
+#include <spa/param/audio/alac-utils.h>
44
+#include <spa/param/audio/flac-utils.h>
45
+#include <spa/param/audio/ape-utils.h>
46
 
47
-static inline int
48
-spa_format_audio_dsp_parse(const struct spa_pod *format, struct spa_audio_info_dsp *info)
49
-{
50
-   int res;
51
-   res = spa_pod_parse_object(format,
52
-           SPA_TYPE_OBJECT_Format, NULL,
53
-           SPA_FORMAT_AUDIO_format,    SPA_POD_OPT_Id(&info->format));
54
-   return res;
55
-}
56
 
57
-static inline int
58
-spa_format_audio_iec958_parse(const struct spa_pod *format, struct spa_audio_info_iec958 *info)
59
-{
60
-   int res;
61
-   res = spa_pod_parse_object(format,
62
-           SPA_TYPE_OBJECT_Format, NULL,
63
-           SPA_FORMAT_AUDIO_iec958Codec,   SPA_POD_OPT_Id(&info->codec),
64
-           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate));
65
-   return res;
66
-}
67
+/**
68
+ * \addtogroup spa_param
69
+ * \{
70
+ */
71
 
72
 static inline int
73
-spa_format_audio_dsd_parse(const struct spa_pod *format, struct spa_audio_info_dsd *info)
74
+spa_format_audio_parse(const struct spa_pod *format, struct spa_audio_info *info)
75
 {
76
-   struct spa_pod *position = NULL;
77
    int res;
78
-   info->flags = 0;
79
-   res = spa_pod_parse_object(format,
80
-           SPA_TYPE_OBJECT_Format, NULL,
81
-           SPA_FORMAT_AUDIO_bitorder,  SPA_POD_OPT_Id(&info->bitorder),
82
-           SPA_FORMAT_AUDIO_interleave,    SPA_POD_OPT_Int(&info->interleave),
83
-           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
84
-           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
85
-           SPA_FORMAT_AUDIO_position,  SPA_POD_OPT_Pod(&position));
86
-   if (position == NULL ||
87
-       !spa_pod_copy_array(position, SPA_TYPE_Id, info->position, SPA_AUDIO_MAX_CHANNELS))
88
-       SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
89
 
90
-   return res;
91
-}
92
-
93
-static inline struct spa_pod *
94
-spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_raw *info)
95
-{
96
-   struct spa_pod_frame f;
97
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
98
-   spa_pod_builder_add(builder,
99
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
100
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
101
-           0);
102
-   if (info->format != SPA_AUDIO_FORMAT_UNKNOWN)
103
-       spa_pod_builder_add(builder,
104
-           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(info->format), 0);
105
-   if (info->rate != 0)
106
-       spa_pod_builder_add(builder,
107
-           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
108
-   if (info->channels != 0) {
109
-       spa_pod_builder_add(builder,
110
-           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
111
-       if (!SPA_FLAG_IS_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
112
-           spa_pod_builder_add(builder, SPA_FORMAT_AUDIO_position,
113
-               SPA_POD_Array(sizeof(uint32_t), SPA_TYPE_Id,
114
-                   info->channels, info->position), 0);
115
-       }
116
+   if ((res = spa_format_parse(format, &info->media_type, &info->media_subtype)) < 0)
117
+       return res;
118
+
119
+   if (info->media_type != SPA_MEDIA_TYPE_audio)
120
+       return -EINVAL;
121
+
122
+   switch (info->media_subtype) {
123
+   case SPA_MEDIA_SUBTYPE_raw:
124
+       return spa_format_audio_raw_parse(format, &info->info.raw);
125
+   case SPA_MEDIA_SUBTYPE_dsp:
126
+       return spa_format_audio_dsp_parse(format, &info->info.dsp);
127
+   case SPA_MEDIA_SUBTYPE_iec958:
128
+       return spa_format_audio_iec958_parse(format, &info->info.iec958);
129
+   case SPA_MEDIA_SUBTYPE_dsd:
130
+       return spa_format_audio_dsd_parse(format, &info->info.dsd);
131
+   case SPA_MEDIA_SUBTYPE_mp3:
132
+       return spa_format_audio_mp3_parse(format, &info->info.mp3);
133
+   case SPA_MEDIA_SUBTYPE_aac:
134
+       return spa_format_audio_aac_parse(format, &info->info.aac);
135
+   case SPA_MEDIA_SUBTYPE_vorbis:
136
+       return spa_format_audio_vorbis_parse(format, &info->info.vorbis);
137
+   case SPA_MEDIA_SUBTYPE_wma:
138
+       return spa_format_audio_wma_parse(format, &info->info.wma);
139
+   case SPA_MEDIA_SUBTYPE_ra:
140
+       return spa_format_audio_ra_parse(format, &info->info.ra);
141
+   case SPA_MEDIA_SUBTYPE_amr:
142
+       return spa_format_audio_amr_parse(format, &info->info.amr);
143
+   case SPA_MEDIA_SUBTYPE_alac:
144
+       return spa_format_audio_alac_parse(format, &info->info.alac);
145
+   case SPA_MEDIA_SUBTYPE_flac:
146
+       return spa_format_audio_flac_parse(format, &info->info.flac);
147
+   case SPA_MEDIA_SUBTYPE_ape:
148
+       return spa_format_audio_ape_parse(format, &info->info.ape);
149
    }
150
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
151
-}
152
-
153
-static inline struct spa_pod *
154
-spa_format_audio_dsp_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_dsp *info)
155
-{
156
-   struct spa_pod_frame f;
157
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
158
-   spa_pod_builder_add(builder,
159
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
160
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsp),
161
-           0);
162
-   if (info->format != SPA_AUDIO_FORMAT_UNKNOWN)
163
-       spa_pod_builder_add(builder,
164
-           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(info->format), 0);
165
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
166
+   return -ENOTSUP;
167
 }
168
 
169
-
170
 static inline struct spa_pod *
171
-spa_format_audio_iec958_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_iec958 *info)
172
+spa_format_audio_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info *info)
173
 {
174
-   struct spa_pod_frame f;
175
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
176
-   spa_pod_builder_add(builder,
177
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
178
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_iec958),
179
-           0);
180
-   if (info->codec != SPA_AUDIO_IEC958_CODEC_UNKNOWN)
181
-       spa_pod_builder_add(builder,
182
-           SPA_FORMAT_AUDIO_iec958Codec,   SPA_POD_Id(info->codec), 0);
183
-   if (info->rate != 0)
184
-       spa_pod_builder_add(builder,
185
-           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
186
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
187
-}
188
-
189
-static inline struct spa_pod *
190
-spa_format_audio_dsd_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_dsd *info)
191
-{
192
-   struct spa_pod_frame f;
193
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
194
-   spa_pod_builder_add(builder,
195
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
196
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsd),
197
-           0);
198
-   if (info->bitorder != SPA_PARAM_BITORDER_unknown)
199
-       spa_pod_builder_add(builder,
200
-           SPA_FORMAT_AUDIO_bitorder,  SPA_POD_Id(info->bitorder), 0);
201
pipewire-0.3.64.tar.gz/spa/include/spa/param/audio/format.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/format.h Changed
36
 
1
@@ -36,8 +36,18 @@
2
 
3
 #include <spa/param/format.h>
4
 #include <spa/param/audio/raw.h>
5
+#include <spa/param/audio/dsp.h>
6
 #include <spa/param/audio/iec958.h>
7
 #include <spa/param/audio/dsd.h>
8
+#include <spa/param/audio/mp3.h>
9
+#include <spa/param/audio/aac.h>
10
+#include <spa/param/audio/vorbis.h>
11
+#include <spa/param/audio/wma.h>
12
+#include <spa/param/audio/ra.h>
13
+#include <spa/param/audio/amr.h>
14
+#include <spa/param/audio/alac.h>
15
+#include <spa/param/audio/flac.h>
16
+#include <spa/param/audio/ape.h>
17
 
18
 struct spa_audio_info {
19
    uint32_t media_type;
20
@@ -47,6 +57,15 @@
21
        struct spa_audio_info_dsp dsp;
22
        struct spa_audio_info_iec958 iec958;
23
        struct spa_audio_info_dsd dsd;
24
+       struct spa_audio_info_mp3 mp3;
25
+       struct spa_audio_info_aac aac;
26
+       struct spa_audio_info_vorbis vorbis;
27
+       struct spa_audio_info_wma wma;
28
+       struct spa_audio_info_ra ra;
29
+       struct spa_audio_info_amr amr;
30
+       struct spa_audio_info_alac alac;
31
+       struct spa_audio_info_flac flac;
32
+       struct spa_audio_info_ape ape;
33
    } info;
34
 };
35
 
36
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/iec958-types.h Added
61
 
1
@@ -0,0 +1,59 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_IEC958_TYPES_H
27
+#define SPA_AUDIO_IEC958_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+#include <spa/param/audio/iec958.h>
35
+
36
+#define SPA_TYPE_INFO_AudioIEC958Codec     SPA_TYPE_INFO_ENUM_BASE "AudioIEC958Codec"
37
+#define SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE  SPA_TYPE_INFO_AudioIEC958Codec ":"
38
+
39
+static const struct spa_type_info spa_type_audio_iec958_codec = {
40
+   { SPA_AUDIO_IEC958_CODEC_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "UNKNOWN", NULL },
41
+   { SPA_AUDIO_IEC958_CODEC_PCM, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "PCM", NULL },
42
+   { SPA_AUDIO_IEC958_CODEC_DTS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "DTS", NULL },
43
+   { SPA_AUDIO_IEC958_CODEC_AC3, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "AC3", NULL },
44
+   { SPA_AUDIO_IEC958_CODEC_MPEG, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "MPEG", NULL },
45
+   { SPA_AUDIO_IEC958_CODEC_MPEG2_AAC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "MPEG2-AAC", NULL },
46
+   { SPA_AUDIO_IEC958_CODEC_EAC3, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "EAC3", NULL },
47
+   { SPA_AUDIO_IEC958_CODEC_TRUEHD, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "TrueHD", NULL },
48
+   { SPA_AUDIO_IEC958_CODEC_DTSHD, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE "DTS-HD", NULL },
49
+   { 0, 0, NULL, NULL },
50
+};
51
+
52
+/**
53
+ * \}
54
+ */
55
+
56
+#ifdef __cplusplus
57
+}  /* extern "C" */
58
+#endif
59
+
60
+#endif /* SPA_AUDIO_RAW_IEC958_TYPES_H */
61
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/iec958-utils.h Added
81
 
1
@@ -0,0 +1,79 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_IEC958_UTILS_H
27
+#define SPA_AUDIO_IEC958_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_iec958_parse(const struct spa_pod *format, struct spa_audio_info_iec958 *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_iec958Codec,   SPA_POD_OPT_Id(&info->codec),
50
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_iec958_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_iec958 *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_iec958),
62
+           0);
63
+   if (info->codec != SPA_AUDIO_IEC958_CODEC_UNKNOWN)
64
+       spa_pod_builder_add(builder,
65
+           SPA_FORMAT_AUDIO_iec958Codec,   SPA_POD_Id(info->codec), 0);
66
+   if (info->rate != 0)
67
+       spa_pod_builder_add(builder,
68
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
69
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
70
+}
71
+
72
+/**
73
+ * \}
74
+ */
75
+
76
+#ifdef __cplusplus
77
+}  /* extern "C" */
78
+#endif
79
+
80
+#endif /* SPA_AUDIO_IEC958_UTILS_H */
81
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/mp3-types.h Added
56
 
1
@@ -0,0 +1,54 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_MP3_TYPES_H
27
+#define SPA_AUDIO_MP3_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+#include <spa/param/audio/mp3.h>
35
+
36
+#define SPA_TYPE_INFO_AudioMP3ChannelMode      SPA_TYPE_INFO_ENUM_BASE "AudioMP3ChannelMode"
37
+#define SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE  SPA_TYPE_INFO_AudioMP3ChannelMode ":"
38
+
39
+static const struct spa_type_info spa_type_audio_mp3_channel_mode = {
40
+   { SPA_AUDIO_MP3_CHANNEL_MODE_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE "UNKNOWN", NULL },
41
+   { SPA_AUDIO_MP3_CHANNEL_MODE_MONO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE "Mono", NULL },
42
+   { SPA_AUDIO_MP3_CHANNEL_MODE_STEREO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE "Stereo", NULL },
43
+   { SPA_AUDIO_MP3_CHANNEL_MODE_JOINTSTEREO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE "Joint-stereo", NULL },
44
+   { SPA_AUDIO_MP3_CHANNEL_MODE_DUAL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE "Dual", NULL },
45
+   { 0, 0, NULL, NULL },
46
+};
47
+/**
48
+ * \}
49
+ */
50
+
51
+#ifdef __cplusplus
52
+}  /* extern "C" */
53
+#endif
54
+
55
+#endif /* SPA_AUDIO_MP3_TYPES_H */
56
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/mp3-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_MP3_UTILS_H
27
+#define SPA_AUDIO_MP3_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_mp3_parse(const struct spa_pod *format, struct spa_audio_info_mp3 *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_mp3_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_mp3 *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_mp3),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_MP3_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/mp3.h Added
59
 
1
@@ -0,0 +1,57 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_MP3_H
27
+#define SPA_AUDIO_MP3_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+enum spa_audio_mp3_channel_mode {
36
+   SPA_AUDIO_MP3_CHANNEL_MODE_UNKNOWN,
37
+   SPA_AUDIO_MP3_CHANNEL_MODE_MONO,
38
+   SPA_AUDIO_MP3_CHANNEL_MODE_STEREO,
39
+   SPA_AUDIO_MP3_CHANNEL_MODE_JOINTSTEREO,
40
+   SPA_AUDIO_MP3_CHANNEL_MODE_DUAL,
41
+};
42
+
43
+struct spa_audio_info_mp3 {
44
+   uint32_t rate;              /*< sample rate */
45
+   uint32_t channels;          /*< number of channels */
46
+};
47
+
48
+#define SPA_AUDIO_INFO_MP3_INIT(...)       ((struct spa_audio_info_mp3) { __VA_ARGS__ })
49
+
50
+/**
51
+ * \}
52
+ */
53
+
54
+#ifdef __cplusplus
55
+}  /* extern "C" */
56
+#endif
57
+
58
+#endif /* SPA_AUDIO_MP3_H */
59
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/ra-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_RA_UTILS_H
27
+#define SPA_AUDIO_RA_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_ra_parse(const struct spa_pod *format, struct spa_audio_info_ra *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_ra_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_ra *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_ra),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_RA_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/ra.h Added
51
 
1
@@ -0,0 +1,49 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_RA_H
27
+#define SPA_AUDIO_RA_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_ra {
36
+   uint32_t rate;              /*< sample rate */
37
+   uint32_t channels;          /*< number of channels */
38
+};
39
+
40
+#define SPA_AUDIO_INFO_RA_INIT(...)        ((struct spa_audio_info_ra) { __VA_ARGS__ })
41
+
42
+/**
43
+ * \}
44
+ */
45
+
46
+#ifdef __cplusplus
47
+}  /* extern "C" */
48
+#endif
49
+
50
+#endif /* SPA_AUDIO_RA_H */
51
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/raw-types.h Added
201
 
1
@@ -0,0 +1,278 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_RAW_TYPES_H
27
+#define SPA_AUDIO_RAW_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/utils/type.h>
39
+#include <spa/param/audio/raw.h>
40
+
41
+#define SPA_TYPE_INFO_AudioFormat      SPA_TYPE_INFO_ENUM_BASE "AudioFormat"
42
+#define SPA_TYPE_INFO_AUDIO_FORMAT_BASE        SPA_TYPE_INFO_AudioFormat ":"
43
+
44
+static const struct spa_type_info spa_type_audio_format = {
45
+   { SPA_AUDIO_FORMAT_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "UNKNOWN", NULL },
46
+   { SPA_AUDIO_FORMAT_ENCODED, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ENCODED", NULL },
47
+   { SPA_AUDIO_FORMAT_S8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S8", NULL },
48
+   { SPA_AUDIO_FORMAT_U8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U8", NULL },
49
+   { SPA_AUDIO_FORMAT_S16_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16LE", NULL },
50
+   { SPA_AUDIO_FORMAT_S16_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16BE", NULL },
51
+   { SPA_AUDIO_FORMAT_U16_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16LE", NULL },
52
+   { SPA_AUDIO_FORMAT_U16_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16BE", NULL },
53
+   { SPA_AUDIO_FORMAT_S24_32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32LE", NULL },
54
+   { SPA_AUDIO_FORMAT_S24_32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32BE", NULL },
55
+   { SPA_AUDIO_FORMAT_U24_32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32LE", NULL },
56
+   { SPA_AUDIO_FORMAT_U24_32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32BE", NULL },
57
+   { SPA_AUDIO_FORMAT_S32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32LE", NULL },
58
+   { SPA_AUDIO_FORMAT_S32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32BE", NULL },
59
+   { SPA_AUDIO_FORMAT_U32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32LE", NULL },
60
+   { SPA_AUDIO_FORMAT_U32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32BE", NULL },
61
+   { SPA_AUDIO_FORMAT_S24_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24LE", NULL },
62
+   { SPA_AUDIO_FORMAT_S24_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24BE", NULL },
63
+   { SPA_AUDIO_FORMAT_U24_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24LE", NULL },
64
+   { SPA_AUDIO_FORMAT_U24_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24BE", NULL },
65
+   { SPA_AUDIO_FORMAT_S20_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20LE", NULL },
66
+   { SPA_AUDIO_FORMAT_S20_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20BE", NULL },
67
+   { SPA_AUDIO_FORMAT_U20_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20LE", NULL },
68
+   { SPA_AUDIO_FORMAT_U20_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20BE", NULL },
69
+   { SPA_AUDIO_FORMAT_S18_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18LE", NULL },
70
+   { SPA_AUDIO_FORMAT_S18_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18BE", NULL },
71
+   { SPA_AUDIO_FORMAT_U18_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18LE", NULL },
72
+   { SPA_AUDIO_FORMAT_U18_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18BE", NULL },
73
+   { SPA_AUDIO_FORMAT_F32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32LE", NULL },
74
+   { SPA_AUDIO_FORMAT_F32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32BE", NULL },
75
+   { SPA_AUDIO_FORMAT_F64_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64LE", NULL },
76
+   { SPA_AUDIO_FORMAT_F64_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64BE", NULL },
77
+
78
+   { SPA_AUDIO_FORMAT_ULAW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ULAW", NULL },
79
+   { SPA_AUDIO_FORMAT_ALAW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ALAW", NULL },
80
+
81
+   { SPA_AUDIO_FORMAT_U8P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U8P", NULL },
82
+   { SPA_AUDIO_FORMAT_S16P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16P", NULL },
83
+   { SPA_AUDIO_FORMAT_S24_32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32P", NULL },
84
+   { SPA_AUDIO_FORMAT_S32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32P", NULL },
85
+   { SPA_AUDIO_FORMAT_S24P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24P", NULL },
86
+   { SPA_AUDIO_FORMAT_F32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32P", NULL },
87
+   { SPA_AUDIO_FORMAT_F64P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64P", NULL },
88
+   { SPA_AUDIO_FORMAT_S8P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S8P", NULL },
89
+
90
+#if __BYTE_ORDER == __BIG_ENDIAN
91
+   { SPA_AUDIO_FORMAT_S16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16OE", NULL },
92
+   { SPA_AUDIO_FORMAT_S16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16", NULL },
93
+   { SPA_AUDIO_FORMAT_U16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16OE", NULL },
94
+   { SPA_AUDIO_FORMAT_U16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16", NULL },
95
+   { SPA_AUDIO_FORMAT_S24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32OE", NULL },
96
+   { SPA_AUDIO_FORMAT_S24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32", NULL },
97
+   { SPA_AUDIO_FORMAT_U24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32OE", NULL },
98
+   { SPA_AUDIO_FORMAT_U24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32", NULL },
99
+   { SPA_AUDIO_FORMAT_S32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32OE", NULL },
100
+   { SPA_AUDIO_FORMAT_S32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32", NULL },
101
+   { SPA_AUDIO_FORMAT_U32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32OE", NULL },
102
+   { SPA_AUDIO_FORMAT_U32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32", NULL },
103
+   { SPA_AUDIO_FORMAT_S24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24OE", NULL },
104
+   { SPA_AUDIO_FORMAT_S24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24", NULL },
105
+   { SPA_AUDIO_FORMAT_U24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24OE", NULL },
106
+   { SPA_AUDIO_FORMAT_U24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24", NULL },
107
+   { SPA_AUDIO_FORMAT_S20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20OE", NULL },
108
+   { SPA_AUDIO_FORMAT_S20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20", NULL },
109
+   { SPA_AUDIO_FORMAT_U20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20OE", NULL },
110
+   { SPA_AUDIO_FORMAT_U20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20", NULL },
111
+   { SPA_AUDIO_FORMAT_S18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18OE", NULL },
112
+   { SPA_AUDIO_FORMAT_S18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18", NULL },
113
+   { SPA_AUDIO_FORMAT_U18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18OE", NULL },
114
+   { SPA_AUDIO_FORMAT_U18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18", NULL },
115
+   { SPA_AUDIO_FORMAT_F32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32OE", NULL },
116
+   { SPA_AUDIO_FORMAT_F32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32", NULL },
117
+   { SPA_AUDIO_FORMAT_F64_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64OE", NULL },
118
+   { SPA_AUDIO_FORMAT_F64, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64", NULL },
119
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
120
+   { SPA_AUDIO_FORMAT_S16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16", NULL },
121
+   { SPA_AUDIO_FORMAT_S16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16OE", NULL },
122
+   { SPA_AUDIO_FORMAT_U16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16", NULL },
123
+   { SPA_AUDIO_FORMAT_U16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16OE", NULL },
124
+   { SPA_AUDIO_FORMAT_S24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32", NULL },
125
+   { SPA_AUDIO_FORMAT_S24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32OE", NULL },
126
+   { SPA_AUDIO_FORMAT_U24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32", NULL },
127
+   { SPA_AUDIO_FORMAT_U24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32OE", NULL },
128
+   { SPA_AUDIO_FORMAT_S32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32", NULL },
129
+   { SPA_AUDIO_FORMAT_S32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32OE", NULL },
130
+   { SPA_AUDIO_FORMAT_U32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32", NULL },
131
+   { SPA_AUDIO_FORMAT_U32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32OE", NULL },
132
+   { SPA_AUDIO_FORMAT_S24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24", NULL },
133
+   { SPA_AUDIO_FORMAT_S24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24OE", NULL },
134
+   { SPA_AUDIO_FORMAT_U24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24", NULL },
135
+   { SPA_AUDIO_FORMAT_U24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24OE", NULL },
136
+   { SPA_AUDIO_FORMAT_S20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20", NULL },
137
+   { SPA_AUDIO_FORMAT_S20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20OE", NULL },
138
+   { SPA_AUDIO_FORMAT_U20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20", NULL },
139
+   { SPA_AUDIO_FORMAT_U20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20OE", NULL },
140
+   { SPA_AUDIO_FORMAT_S18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18", NULL },
141
+   { SPA_AUDIO_FORMAT_S18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18OE", NULL },
142
+   { SPA_AUDIO_FORMAT_U18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18", NULL },
143
+   { SPA_AUDIO_FORMAT_U18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18OE", NULL },
144
+   { SPA_AUDIO_FORMAT_F32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32", NULL },
145
+   { SPA_AUDIO_FORMAT_F32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32OE", NULL },
146
+   { SPA_AUDIO_FORMAT_F64, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64", NULL },
147
+   { SPA_AUDIO_FORMAT_F64_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64OE", NULL },
148
+#endif
149
+   { 0, 0, NULL, NULL },
150
+};
151
+
152
+#define SPA_TYPE_INFO_AudioFlags   SPA_TYPE_INFO_FLAGS_BASE "AudioFlags"
153
+#define SPA_TYPE_INFO_AUDIO_FLAGS_BASE SPA_TYPE_INFO_AudioFlags ":"
154
+
155
+static const struct spa_type_info spa_type_audio_flags = {
156
+   { SPA_AUDIO_FLAG_NONE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FLAGS_BASE "none", NULL },
157
+   { SPA_AUDIO_FLAG_UNPOSITIONED, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FLAGS_BASE "unpositioned", NULL },
158
+   { 0, 0, NULL, NULL },
159
+};
160
+
161
+#define SPA_TYPE_INFO_AudioChannel     SPA_TYPE_INFO_ENUM_BASE "AudioChannel"
162
+#define SPA_TYPE_INFO_AUDIO_CHANNEL_BASE   SPA_TYPE_INFO_AudioChannel ":"
163
+
164
+static const struct spa_type_info spa_type_audio_channel = {
165
+   { SPA_AUDIO_CHANNEL_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "UNK", NULL },
166
+   { SPA_AUDIO_CHANNEL_NA, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "NA", NULL },
167
+   { SPA_AUDIO_CHANNEL_MONO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "MONO", NULL },
168
+   { SPA_AUDIO_CHANNEL_FL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FL", NULL },
169
+   { SPA_AUDIO_CHANNEL_FR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FR", NULL },
170
+   { SPA_AUDIO_CHANNEL_FC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FC", NULL },
171
+   { SPA_AUDIO_CHANNEL_LFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LFE", NULL },
172
+   { SPA_AUDIO_CHANNEL_SL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "SL", NULL },
173
+   { SPA_AUDIO_CHANNEL_SR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "SR", NULL },
174
+   { SPA_AUDIO_CHANNEL_FLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLC", NULL },
175
+   { SPA_AUDIO_CHANNEL_FRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRC", NULL },
176
+   { SPA_AUDIO_CHANNEL_RC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RC", NULL },
177
+   { SPA_AUDIO_CHANNEL_RL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RL", NULL },
178
+   { SPA_AUDIO_CHANNEL_RR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RR", NULL },
179
+   { SPA_AUDIO_CHANNEL_TC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TC", NULL },
180
+   { SPA_AUDIO_CHANNEL_TFL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFL", NULL },
181
+   { SPA_AUDIO_CHANNEL_TFC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFC", NULL },
182
+   { SPA_AUDIO_CHANNEL_TFR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFR", NULL },
183
+   { SPA_AUDIO_CHANNEL_TRL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRL", NULL },
184
+   { SPA_AUDIO_CHANNEL_TRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRC", NULL },
185
+   { SPA_AUDIO_CHANNEL_TRR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRR", NULL },
186
+   { SPA_AUDIO_CHANNEL_RLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RLC", NULL },
187
+   { SPA_AUDIO_CHANNEL_RRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RRC", NULL },
188
+   { SPA_AUDIO_CHANNEL_FLW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLW", NULL },
189
+   { SPA_AUDIO_CHANNEL_FRW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRW", NULL },
190
+   { SPA_AUDIO_CHANNEL_LFE2, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LFE2", NULL },
191
+   { SPA_AUDIO_CHANNEL_FLH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLH", NULL },
192
+   { SPA_AUDIO_CHANNEL_FCH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FCH", NULL },
193
+   { SPA_AUDIO_CHANNEL_FRH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRH", NULL },
194
+   { SPA_AUDIO_CHANNEL_TFLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFLC", NULL },
195
+   { SPA_AUDIO_CHANNEL_TFRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFRC", NULL },
196
+   { SPA_AUDIO_CHANNEL_TSL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TSL", NULL },
197
+   { SPA_AUDIO_CHANNEL_TSR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TSR", NULL },
198
+   { SPA_AUDIO_CHANNEL_LLFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LLFR", NULL },
199
+   { SPA_AUDIO_CHANNEL_RLFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RLFE", NULL },
200
+   { SPA_AUDIO_CHANNEL_BC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "BC", NULL },
201
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/raw-utils.h Added
98
 
1
@@ -0,0 +1,96 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_RAW_UTILS_H
27
+#define SPA_AUDIO_RAW_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_raw *info)
45
+{
46
+   struct spa_pod *position = NULL;
47
+   int res;
48
+   info->flags = 0;
49
+   res = spa_pod_parse_object(format,
50
+           SPA_TYPE_OBJECT_Format, NULL,
51
+           SPA_FORMAT_AUDIO_format,    SPA_POD_OPT_Id(&info->format),
52
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
53
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
54
+           SPA_FORMAT_AUDIO_position,  SPA_POD_OPT_Pod(&position));
55
+   if (position == NULL ||
56
+       !spa_pod_copy_array(position, SPA_TYPE_Id, info->position, SPA_AUDIO_MAX_CHANNELS))
57
+       SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
58
+
59
+   return res;
60
+}
61
+
62
+static inline struct spa_pod *
63
+spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_raw *info)
64
+{
65
+   struct spa_pod_frame f;
66
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
67
+   spa_pod_builder_add(builder,
68
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
69
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
70
+           0);
71
+   if (info->format != SPA_AUDIO_FORMAT_UNKNOWN)
72
+       spa_pod_builder_add(builder,
73
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(info->format), 0);
74
+   if (info->rate != 0)
75
+       spa_pod_builder_add(builder,
76
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
77
+   if (info->channels != 0) {
78
+       spa_pod_builder_add(builder,
79
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
80
+       if (!SPA_FLAG_IS_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
81
+           spa_pod_builder_add(builder, SPA_FORMAT_AUDIO_position,
82
+               SPA_POD_Array(sizeof(uint32_t), SPA_TYPE_Id,
83
+                   info->channels, info->position), 0);
84
+       }
85
+   }
86
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
87
+}
88
+
89
+/**
90
+ * \}
91
+ */
92
+
93
+#ifdef __cplusplus
94
+}  /* extern "C" */
95
+#endif
96
+
97
+#endif /* SPA_AUDIO_RAW_UTILS_H */
98
pipewire-0.3.64.tar.gz/spa/include/spa/param/audio/raw.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/raw.h Changed
15
 
1
@@ -306,13 +306,6 @@
2
                                  *  of channels ex. "FL,FR" */
3
 #define SPA_KEY_AUDIO_ALLOWED_RATES    "audio.allowed-rates"   /**< a list of allowed samplerates
4
                                  *  ex. " 44100 48000 " */
5
-
6
-struct spa_audio_info_dsp {
7
-   enum spa_audio_format format;       /*< format, one of the DSP formats in enum spa_audio_format_dsp */
8
-};
9
-
10
-#define SPA_AUDIO_INFO_DSP_INIT(...)       ((struct spa_audio_info_dsp) { __VA_ARGS__ })
11
-
12
 /**
13
  * \}
14
  */
15
pipewire-0.3.64.tar.gz/spa/include/spa/param/audio/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/type-info.h Changed
201
 
1
@@ -25,272 +25,11 @@
2
 #ifndef SPA_AUDIO_TYPES_H
3
 #define SPA_AUDIO_TYPES_H
4
 
5
-#ifdef __cplusplus
6
-extern "C" {
7
-#endif
8
-
9
-/**
10
- * \addtogroup spa_param
11
- * \{
12
- */
13
-
14
-#include <spa/param/audio/raw.h>
15
-
16
-#define SPA_TYPE_INFO_AudioFormat      SPA_TYPE_INFO_ENUM_BASE "AudioFormat"
17
-#define SPA_TYPE_INFO_AUDIO_FORMAT_BASE        SPA_TYPE_INFO_AudioFormat ":"
18
-
19
-static const struct spa_type_info spa_type_audio_format = {
20
-   { SPA_AUDIO_FORMAT_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "UNKNOWN", NULL },
21
-   { SPA_AUDIO_FORMAT_ENCODED, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ENCODED", NULL },
22
-   { SPA_AUDIO_FORMAT_S8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S8", NULL },
23
-   { SPA_AUDIO_FORMAT_U8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U8", NULL },
24
-   { SPA_AUDIO_FORMAT_S16_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16LE", NULL },
25
-   { SPA_AUDIO_FORMAT_S16_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16BE", NULL },
26
-   { SPA_AUDIO_FORMAT_U16_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16LE", NULL },
27
-   { SPA_AUDIO_FORMAT_U16_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16BE", NULL },
28
-   { SPA_AUDIO_FORMAT_S24_32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32LE", NULL },
29
-   { SPA_AUDIO_FORMAT_S24_32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32BE", NULL },
30
-   { SPA_AUDIO_FORMAT_U24_32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32LE", NULL },
31
-   { SPA_AUDIO_FORMAT_U24_32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32BE", NULL },
32
-   { SPA_AUDIO_FORMAT_S32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32LE", NULL },
33
-   { SPA_AUDIO_FORMAT_S32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32BE", NULL },
34
-   { SPA_AUDIO_FORMAT_U32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32LE", NULL },
35
-   { SPA_AUDIO_FORMAT_U32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32BE", NULL },
36
-   { SPA_AUDIO_FORMAT_S24_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24LE", NULL },
37
-   { SPA_AUDIO_FORMAT_S24_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24BE", NULL },
38
-   { SPA_AUDIO_FORMAT_U24_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24LE", NULL },
39
-   { SPA_AUDIO_FORMAT_U24_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24BE", NULL },
40
-   { SPA_AUDIO_FORMAT_S20_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20LE", NULL },
41
-   { SPA_AUDIO_FORMAT_S20_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20BE", NULL },
42
-   { SPA_AUDIO_FORMAT_U20_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20LE", NULL },
43
-   { SPA_AUDIO_FORMAT_U20_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20BE", NULL },
44
-   { SPA_AUDIO_FORMAT_S18_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18LE", NULL },
45
-   { SPA_AUDIO_FORMAT_S18_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18BE", NULL },
46
-   { SPA_AUDIO_FORMAT_U18_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18LE", NULL },
47
-   { SPA_AUDIO_FORMAT_U18_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18BE", NULL },
48
-   { SPA_AUDIO_FORMAT_F32_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32LE", NULL },
49
-   { SPA_AUDIO_FORMAT_F32_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32BE", NULL },
50
-   { SPA_AUDIO_FORMAT_F64_LE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64LE", NULL },
51
-   { SPA_AUDIO_FORMAT_F64_BE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64BE", NULL },
52
-
53
-   { SPA_AUDIO_FORMAT_ULAW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ULAW", NULL },
54
-   { SPA_AUDIO_FORMAT_ALAW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "ALAW", NULL },
55
-
56
-   { SPA_AUDIO_FORMAT_U8P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U8P", NULL },
57
-   { SPA_AUDIO_FORMAT_S16P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16P", NULL },
58
-   { SPA_AUDIO_FORMAT_S24_32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32P", NULL },
59
-   { SPA_AUDIO_FORMAT_S32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32P", NULL },
60
-   { SPA_AUDIO_FORMAT_S24P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24P", NULL },
61
-   { SPA_AUDIO_FORMAT_F32P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32P", NULL },
62
-   { SPA_AUDIO_FORMAT_F64P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64P", NULL },
63
-   { SPA_AUDIO_FORMAT_S8P, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S8P", NULL },
64
-
65
-#if __BYTE_ORDER == __BIG_ENDIAN
66
-   { SPA_AUDIO_FORMAT_S16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16OE", NULL },
67
-   { SPA_AUDIO_FORMAT_S16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16", NULL },
68
-   { SPA_AUDIO_FORMAT_U16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16OE", NULL },
69
-   { SPA_AUDIO_FORMAT_U16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16", NULL },
70
-   { SPA_AUDIO_FORMAT_S24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32OE", NULL },
71
-   { SPA_AUDIO_FORMAT_S24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32", NULL },
72
-   { SPA_AUDIO_FORMAT_U24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32OE", NULL },
73
-   { SPA_AUDIO_FORMAT_U24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32", NULL },
74
-   { SPA_AUDIO_FORMAT_S32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32OE", NULL },
75
-   { SPA_AUDIO_FORMAT_S32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32", NULL },
76
-   { SPA_AUDIO_FORMAT_U32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32OE", NULL },
77
-   { SPA_AUDIO_FORMAT_U32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32", NULL },
78
-   { SPA_AUDIO_FORMAT_S24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24OE", NULL },
79
-   { SPA_AUDIO_FORMAT_S24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24", NULL },
80
-   { SPA_AUDIO_FORMAT_U24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24OE", NULL },
81
-   { SPA_AUDIO_FORMAT_U24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24", NULL },
82
-   { SPA_AUDIO_FORMAT_S20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20OE", NULL },
83
-   { SPA_AUDIO_FORMAT_S20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20", NULL },
84
-   { SPA_AUDIO_FORMAT_U20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20OE", NULL },
85
-   { SPA_AUDIO_FORMAT_U20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20", NULL },
86
-   { SPA_AUDIO_FORMAT_S18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18OE", NULL },
87
-   { SPA_AUDIO_FORMAT_S18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18", NULL },
88
-   { SPA_AUDIO_FORMAT_U18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18OE", NULL },
89
-   { SPA_AUDIO_FORMAT_U18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18", NULL },
90
-   { SPA_AUDIO_FORMAT_F32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32OE", NULL },
91
-   { SPA_AUDIO_FORMAT_F32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32", NULL },
92
-   { SPA_AUDIO_FORMAT_F64_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64OE", NULL },
93
-   { SPA_AUDIO_FORMAT_F64, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64", NULL },
94
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
95
-   { SPA_AUDIO_FORMAT_S16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16", NULL },
96
-   { SPA_AUDIO_FORMAT_S16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S16OE", NULL },
97
-   { SPA_AUDIO_FORMAT_U16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16", NULL },
98
-   { SPA_AUDIO_FORMAT_U16_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U16OE", NULL },
99
-   { SPA_AUDIO_FORMAT_S24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32", NULL },
100
-   { SPA_AUDIO_FORMAT_S24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24_32OE", NULL },
101
-   { SPA_AUDIO_FORMAT_U24_32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32", NULL },
102
-   { SPA_AUDIO_FORMAT_U24_32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24_32OE", NULL },
103
-   { SPA_AUDIO_FORMAT_S32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32", NULL },
104
-   { SPA_AUDIO_FORMAT_S32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S32OE", NULL },
105
-   { SPA_AUDIO_FORMAT_U32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32", NULL },
106
-   { SPA_AUDIO_FORMAT_U32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U32OE", NULL },
107
-   { SPA_AUDIO_FORMAT_S24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24", NULL },
108
-   { SPA_AUDIO_FORMAT_S24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S24OE", NULL },
109
-   { SPA_AUDIO_FORMAT_U24, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24", NULL },
110
-   { SPA_AUDIO_FORMAT_U24_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U24OE", NULL },
111
-   { SPA_AUDIO_FORMAT_S20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20", NULL },
112
-   { SPA_AUDIO_FORMAT_S20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S20OE", NULL },
113
-   { SPA_AUDIO_FORMAT_U20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20", NULL },
114
-   { SPA_AUDIO_FORMAT_U20_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U20OE", NULL },
115
-   { SPA_AUDIO_FORMAT_S18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18", NULL },
116
-   { SPA_AUDIO_FORMAT_S18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "S18OE", NULL },
117
-   { SPA_AUDIO_FORMAT_U18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18", NULL },
118
-   { SPA_AUDIO_FORMAT_U18_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "U18OE", NULL },
119
-   { SPA_AUDIO_FORMAT_F32, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32", NULL },
120
-   { SPA_AUDIO_FORMAT_F32_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F32OE", NULL },
121
-   { SPA_AUDIO_FORMAT_F64, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64", NULL },
122
-   { SPA_AUDIO_FORMAT_F64_OE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FORMAT_BASE "F64OE", NULL },
123
-#endif
124
-   { 0, 0, NULL, NULL },
125
-};
126
-
127
-#define SPA_TYPE_INFO_AudioFlags       SPA_TYPE_INFO_FLAGS_BASE "AudioFlags"
128
-#define SPA_TYPE_INFO_AUDIO_FLAGS_BASE SPA_TYPE_INFO_AudioFlags ":"
129
-
130
-static const struct spa_type_info spa_type_audio_flags = {
131
-   { SPA_AUDIO_FLAG_NONE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FLAGS_BASE "none", NULL },
132
-   { SPA_AUDIO_FLAG_UNPOSITIONED, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_FLAGS_BASE "unpositioned", NULL },
133
-   { 0, 0, NULL, NULL },
134
-};
135
-
136
-#define SPA_TYPE_INFO_AudioChannel     SPA_TYPE_INFO_ENUM_BASE "AudioChannel"
137
-#define SPA_TYPE_INFO_AUDIO_CHANNEL_BASE   SPA_TYPE_INFO_AudioChannel ":"
138
-
139
-static const struct spa_type_info spa_type_audio_channel = {
140
-   { SPA_AUDIO_CHANNEL_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "UNK", NULL },
141
-   { SPA_AUDIO_CHANNEL_NA, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "NA", NULL },
142
-   { SPA_AUDIO_CHANNEL_MONO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "MONO", NULL },
143
-   { SPA_AUDIO_CHANNEL_FL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FL", NULL },
144
-   { SPA_AUDIO_CHANNEL_FR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FR", NULL },
145
-   { SPA_AUDIO_CHANNEL_FC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FC", NULL },
146
-   { SPA_AUDIO_CHANNEL_LFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LFE", NULL },
147
-   { SPA_AUDIO_CHANNEL_SL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "SL", NULL },
148
-   { SPA_AUDIO_CHANNEL_SR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "SR", NULL },
149
-   { SPA_AUDIO_CHANNEL_FLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLC", NULL },
150
-   { SPA_AUDIO_CHANNEL_FRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRC", NULL },
151
-   { SPA_AUDIO_CHANNEL_RC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RC", NULL },
152
-   { SPA_AUDIO_CHANNEL_RL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RL", NULL },
153
-   { SPA_AUDIO_CHANNEL_RR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RR", NULL },
154
-   { SPA_AUDIO_CHANNEL_TC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TC", NULL },
155
-   { SPA_AUDIO_CHANNEL_TFL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFL", NULL },
156
-   { SPA_AUDIO_CHANNEL_TFC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFC", NULL },
157
-   { SPA_AUDIO_CHANNEL_TFR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFR", NULL },
158
-   { SPA_AUDIO_CHANNEL_TRL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRL", NULL },
159
-   { SPA_AUDIO_CHANNEL_TRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRC", NULL },
160
-   { SPA_AUDIO_CHANNEL_TRR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TRR", NULL },
161
-   { SPA_AUDIO_CHANNEL_RLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RLC", NULL },
162
-   { SPA_AUDIO_CHANNEL_RRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RRC", NULL },
163
-   { SPA_AUDIO_CHANNEL_FLW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLW", NULL },
164
-   { SPA_AUDIO_CHANNEL_FRW, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRW", NULL },
165
-   { SPA_AUDIO_CHANNEL_LFE2, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LFE2", NULL },
166
-   { SPA_AUDIO_CHANNEL_FLH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FLH", NULL },
167
-   { SPA_AUDIO_CHANNEL_FCH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FCH", NULL },
168
-   { SPA_AUDIO_CHANNEL_FRH, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "FRH", NULL },
169
-   { SPA_AUDIO_CHANNEL_TFLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFLC", NULL },
170
-   { SPA_AUDIO_CHANNEL_TFRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TFRC", NULL },
171
-   { SPA_AUDIO_CHANNEL_TSL, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TSL", NULL },
172
-   { SPA_AUDIO_CHANNEL_TSR, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "TSR", NULL },
173
-   { SPA_AUDIO_CHANNEL_LLFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "LLFR", NULL },
174
-   { SPA_AUDIO_CHANNEL_RLFE, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "RLFE", NULL },
175
-   { SPA_AUDIO_CHANNEL_BC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "BC", NULL },
176
-   { SPA_AUDIO_CHANNEL_BLC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "BLC", NULL },
177
-   { SPA_AUDIO_CHANNEL_BRC, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "BRC", NULL },
178
-
179
-   { SPA_AUDIO_CHANNEL_AUX0, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX0", NULL },
180
-   { SPA_AUDIO_CHANNEL_AUX1, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX1", NULL },
181
-   { SPA_AUDIO_CHANNEL_AUX2, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX2", NULL },
182
-   { SPA_AUDIO_CHANNEL_AUX3, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX3", NULL },
183
-   { SPA_AUDIO_CHANNEL_AUX4, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX4", NULL },
184
-   { SPA_AUDIO_CHANNEL_AUX5, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX5", NULL },
185
-   { SPA_AUDIO_CHANNEL_AUX6, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX6", NULL },
186
-   { SPA_AUDIO_CHANNEL_AUX7, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX7", NULL },
187
-   { SPA_AUDIO_CHANNEL_AUX8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX8", NULL },
188
-   { SPA_AUDIO_CHANNEL_AUX9, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX9", NULL },
189
-   { SPA_AUDIO_CHANNEL_AUX10, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX10", NULL },
190
-   { SPA_AUDIO_CHANNEL_AUX11, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX11", NULL },
191
-   { SPA_AUDIO_CHANNEL_AUX12, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX12", NULL },
192
-   { SPA_AUDIO_CHANNEL_AUX13, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX13", NULL },
193
-   { SPA_AUDIO_CHANNEL_AUX14, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX14", NULL },
194
-   { SPA_AUDIO_CHANNEL_AUX15, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX15", NULL },
195
-   { SPA_AUDIO_CHANNEL_AUX16, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX16", NULL },
196
-   { SPA_AUDIO_CHANNEL_AUX17, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX17", NULL },
197
-   { SPA_AUDIO_CHANNEL_AUX18, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX18", NULL },
198
-   { SPA_AUDIO_CHANNEL_AUX19, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX19", NULL },
199
-   { SPA_AUDIO_CHANNEL_AUX20, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX20", NULL },
200
-   { SPA_AUDIO_CHANNEL_AUX21, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_CHANNEL_BASE "AUX21", NULL },
201
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/vorbis-utils.h Added
82
 
1
@@ -0,0 +1,80 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_VORBIS_UTILS_H
27
+#define SPA_AUDIO_VORBIS_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_vorbis_parse(const struct spa_pod *format, struct spa_audio_info_vorbis *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels));
51
+   return res;
52
+}
53
+
54
+static inline struct spa_pod *
55
+spa_format_audio_vorbis_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_vorbis *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_vorbis),
62
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
63
+           0);
64
+   if (info->rate != 0)
65
+       spa_pod_builder_add(builder,
66
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
67
+   if (info->channels != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
70
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
71
+}
72
+
73
+/**
74
+ * \}
75
+ */
76
+
77
+#ifdef __cplusplus
78
+}  /* extern "C" */
79
+#endif
80
+
81
+#endif /* SPA_AUDIO_VORBIS_UTILS_H */
82
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/vorbis.h Added
51
 
1
@@ -0,0 +1,49 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_VORBIS_H
27
+#define SPA_AUDIO_VORBIS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+struct spa_audio_info_vorbis {
36
+   uint32_t rate;              /*< sample rate */
37
+   uint32_t channels;          /*< number of channels */
38
+};
39
+
40
+#define SPA_AUDIO_INFO_VORBIS_INIT(...)        ((struct spa_audio_info_vorbis) { __VA_ARGS__ })
41
+
42
+/**
43
+ * \}
44
+ */
45
+
46
+#ifdef __cplusplus
47
+}  /* extern "C" */
48
+#endif
49
+
50
+#endif /* SPA_AUDIO_VORBIS_H */
51
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/wma-types.h Added
59
 
1
@@ -0,0 +1,57 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_WMA_TYPES_H
27
+#define SPA_AUDIO_WMA_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+#include <spa/param/audio/wma.h>
35
+
36
+#define SPA_TYPE_INFO_AudioWMAProfile      SPA_TYPE_INFO_ENUM_BASE "AudioWMAProfile"
37
+#define SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE   SPA_TYPE_INFO_AudioWMAProfile ":"
38
+
39
+static const struct spa_type_info spa_type_audio_wma_profile = {
40
+   { SPA_AUDIO_WMA_PROFILE_UNKNOWN, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "UNKNOWN", NULL },
41
+   { SPA_AUDIO_WMA_PROFILE_WMA7, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA7", NULL },
42
+   { SPA_AUDIO_WMA_PROFILE_WMA8, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA8", NULL },
43
+   { SPA_AUDIO_WMA_PROFILE_WMA9, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA9", NULL },
44
+   { SPA_AUDIO_WMA_PROFILE_WMA10, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA10", NULL },
45
+   { SPA_AUDIO_WMA_PROFILE_WMA9_PRO, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA9-Pro", NULL },
46
+   { SPA_AUDIO_WMA_PROFILE_WMA9_LOSSLESS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA9-Lossless", NULL },
47
+   { SPA_AUDIO_WMA_PROFILE_WMA10_LOSSLESS, SPA_TYPE_Int, SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE "WMA10-Lossless", NULL },
48
+   { 0, 0, NULL, NULL },
49
+};
50
+/**
51
+ * \}
52
+ */
53
+
54
+#ifdef __cplusplus
55
+}  /* extern "C" */
56
+#endif
57
+
58
+#endif /* SPA_AUDIO_WMA_TYPES_H */
59
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/wma-utils.h Added
95
 
1
@@ -0,0 +1,93 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_WMA_UTILS_H
27
+#define SPA_AUDIO_WMA_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/audio/format.h>
41
+#include <spa/param/format-utils.h>
42
+
43
+static inline int
44
+spa_format_audio_wma_parse(const struct spa_pod *format, struct spa_audio_info_wma *info)
45
+{
46
+   int res;
47
+   res = spa_pod_parse_object(format,
48
+           SPA_TYPE_OBJECT_Format, NULL,
49
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_OPT_Int(&info->rate),
50
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_OPT_Int(&info->channels),
51
+           SPA_FORMAT_AUDIO_bitrate,   SPA_POD_OPT_Int(&info->bitrate),
52
+           SPA_FORMAT_AUDIO_blockAlign,    SPA_POD_OPT_Int(&info->block_align),
53
+           SPA_FORMAT_AUDIO_WMA_profile,   SPA_POD_OPT_Id(&info->profile));
54
+   return res;
55
+}
56
+
57
+static inline struct spa_pod *
58
+spa_format_audio_wma_build(struct spa_pod_builder *builder, uint32_t id, struct spa_audio_info_wma *info)
59
+{
60
+   struct spa_pod_frame f;
61
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
62
+   spa_pod_builder_add(builder,
63
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_audio),
64
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_wma),
65
+           SPA_FORMAT_AUDIO_format,    SPA_POD_Id(SPA_AUDIO_FORMAT_ENCODED),
66
+           0);
67
+   if (info->rate != 0)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_AUDIO_rate,      SPA_POD_Int(info->rate), 0);
70
+   if (info->channels != 0)
71
+       spa_pod_builder_add(builder,
72
+           SPA_FORMAT_AUDIO_channels,  SPA_POD_Int(info->channels), 0);
73
+   if (info->bitrate != 0)
74
+       spa_pod_builder_add(builder,
75
+           SPA_FORMAT_AUDIO_bitrate,   SPA_POD_Int(info->bitrate), 0);
76
+   if (info->block_align != 0)
77
+       spa_pod_builder_add(builder,
78
+           SPA_FORMAT_AUDIO_blockAlign,    SPA_POD_Int(info->block_align), 0);
79
+   if (info->profile != 0)
80
+       spa_pod_builder_add(builder,
81
+           SPA_FORMAT_AUDIO_WMA_profile,   SPA_POD_Id(info->profile), 0);
82
+
83
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
84
+}
85
+
86
+/**
87
+ * \}
88
+ */
89
+
90
+#ifdef __cplusplus
91
+}  /* extern "C" */
92
+#endif
93
+
94
+#endif /* SPA_AUDIO_WMA_UTILS_H */
95
pipewire-0.3.65.tar.gz/spa/include/spa/param/audio/wma.h Added
69
 
1
@@ -0,0 +1,67 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_AUDIO_WMA_H
27
+#define SPA_AUDIO_WMA_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/param/audio/raw.h>
34
+
35
+enum spa_audio_wma_profile {
36
+   SPA_AUDIO_WMA_PROFILE_UNKNOWN,
37
+
38
+   SPA_AUDIO_WMA_PROFILE_WMA7,
39
+   SPA_AUDIO_WMA_PROFILE_WMA8,
40
+   SPA_AUDIO_WMA_PROFILE_WMA9,
41
+   SPA_AUDIO_WMA_PROFILE_WMA10,
42
+   SPA_AUDIO_WMA_PROFILE_WMA9_PRO,
43
+   SPA_AUDIO_WMA_PROFILE_WMA9_LOSSLESS,
44
+   SPA_AUDIO_WMA_PROFILE_WMA10_LOSSLESS,
45
+
46
+   SPA_AUDIO_WMA_PROFILE_CUSTOM = 0x10000,
47
+};
48
+
49
+struct spa_audio_info_wma {
50
+   uint32_t rate;              /*< sample rate */
51
+   uint32_t channels;          /*< number of channels */
52
+   uint32_t bitrate;           /*< stream bitrate */
53
+   uint32_t block_align;           /*< block alignment */
54
+   enum spa_audio_wma_profile profile; /*< WMA profile */
55
+
56
+};
57
+
58
+#define SPA_AUDIO_INFO_WMA_INIT(...)       ((struct spa_audio_info_wma) { __VA_ARGS__ })
59
+
60
+/**
61
+ * \}
62
+ */
63
+
64
+#ifdef __cplusplus
65
+}  /* extern "C" */
66
+#endif
67
+
68
+#endif /* SPA_AUDIO_WMA_H */
69
pipewire-0.3.65.tar.gz/spa/include/spa/param/buffers-types.h Added
92
 
1
@@ -0,0 +1,90 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_BUFFERS_TYPES_H
27
+#define SPA_PARAM_BUFFERS_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param-types.h>
39
+#include <spa/node/type-info.h>
40
+
41
+#include <spa/param/buffers.h>
42
+
43
+#define SPA_TYPE_INFO_PARAM_Meta       SPA_TYPE_INFO_PARAM_BASE "Meta"
44
+#define SPA_TYPE_INFO_PARAM_META_BASE      SPA_TYPE_INFO_PARAM_Meta ":"
45
+
46
+static const struct spa_type_info spa_type_param_meta = {
47
+   { SPA_PARAM_META_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_META_BASE, spa_type_param },
48
+   { SPA_PARAM_META_type, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_META_BASE "type", spa_type_meta_type },
49
+   { SPA_PARAM_META_size, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_META_BASE "size", NULL },
50
+   { 0, 0, NULL, NULL },
51
+};
52
+
53
+/** Base for parameters that describe IO areas to exchange data,
54
+ * control and properties with a node.
55
+ */
56
+#define SPA_TYPE_INFO_PARAM_IO     SPA_TYPE_INFO_PARAM_BASE "IO"
57
+#define SPA_TYPE_INFO_PARAM_IO_BASE        SPA_TYPE_INFO_PARAM_IO ":"
58
+
59
+static const struct spa_type_info spa_type_param_io = {
60
+   { SPA_PARAM_IO_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_IO_BASE, spa_type_param, },
61
+   { SPA_PARAM_IO_id, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_IO_BASE "id", spa_type_io },
62
+   { SPA_PARAM_IO_size, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_IO_BASE "size", NULL },
63
+   { 0, 0, NULL, NULL },
64
+};
65
+
66
+#define SPA_TYPE_INFO_PARAM_Buffers            SPA_TYPE_INFO_PARAM_BASE "Buffers"
67
+#define SPA_TYPE_INFO_PARAM_BUFFERS_BASE       SPA_TYPE_INFO_PARAM_Buffers ":"
68
+
69
+#define SPA_TYPE_INFO_PARAM_BlockInfo          SPA_TYPE_INFO_PARAM_BUFFERS_BASE "BlockInfo"
70
+#define SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE        SPA_TYPE_INFO_PARAM_BlockInfo ":"
71
+
72
+static const struct spa_type_info spa_type_param_buffers = {
73
+   { SPA_PARAM_BUFFERS_START,    SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_BUFFERS_BASE, spa_type_param, },
74
+   { SPA_PARAM_BUFFERS_buffers,  SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BUFFERS_BASE "buffers", NULL },
75
+   { SPA_PARAM_BUFFERS_blocks,   SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BUFFERS_BASE "blocks", NULL },
76
+   { SPA_PARAM_BUFFERS_size,     SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "size", NULL },
77
+   { SPA_PARAM_BUFFERS_stride,   SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "stride", NULL },
78
+   { SPA_PARAM_BUFFERS_align,    SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "align", NULL },
79
+   { SPA_PARAM_BUFFERS_dataType, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "dataType", NULL },
80
+   { 0, 0, NULL, NULL },
81
+};
82
+
83
+/**
84
+ * \}
85
+ */
86
+
87
+#ifdef __cplusplus
88
+}  /* extern "C" */
89
+#endif
90
+
91
+#endif /* SPA_PARAM_BUFFERS_TYPES_H */
92
pipewire-0.3.65.tar.gz/spa/include/spa/param/buffers.h Added
74
 
1
@@ -0,0 +1,72 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_BUFFERS_H
27
+#define SPA_PARAM_BUFFERS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param.h>
39
+
40
+/** properties for SPA_TYPE_OBJECT_ParamBuffers */
41
+enum spa_param_buffers {
42
+   SPA_PARAM_BUFFERS_START,
43
+   SPA_PARAM_BUFFERS_buffers,  /**< number of buffers (Int) */
44
+   SPA_PARAM_BUFFERS_blocks,   /**< number of data blocks per buffer (Int) */
45
+   SPA_PARAM_BUFFERS_size,     /**< size of a data block memory (Int)*/
46
+   SPA_PARAM_BUFFERS_stride,   /**< stride of data block memory (Int) */
47
+   SPA_PARAM_BUFFERS_align,    /**< alignment of data block memory (Int) */
48
+   SPA_PARAM_BUFFERS_dataType, /**< possible memory types (Int, mask of enum spa_data_type) */
49
+};
50
+
51
+/** properties for SPA_TYPE_OBJECT_ParamMeta */
52
+enum spa_param_meta {
53
+   SPA_PARAM_META_START,
54
+   SPA_PARAM_META_type,    /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
55
+   SPA_PARAM_META_size,    /**< the expected maximum size the meta (Int) */
56
+};
57
+
58
+/** properties for SPA_TYPE_OBJECT_ParamIO */
59
+enum spa_param_io {
60
+   SPA_PARAM_IO_START,
61
+   SPA_PARAM_IO_id,    /**< type ID, uniquely identifies the io area (Id enum spa_io_type) */
62
+   SPA_PARAM_IO_size,  /**< size of the io area (Int) */
63
+};
64
+
65
+/**
66
+ * \}
67
+ */
68
+
69
+#ifdef __cplusplus
70
+}  /* extern "C" */
71
+#endif
72
+
73
+#endif /* SPA_PARAM_BUFFERS_H */
74
pipewire-0.3.65.tar.gz/spa/include/spa/param/format-types.h Added
193
 
1
@@ -0,0 +1,191 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_FORMAT_TYPES_H
27
+#define SPA_PARAM_FORMAT_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/format.h>
39
+#include <spa/param/param-types.h>
40
+
41
+#include <spa/param/audio/type-info.h>
42
+#include <spa/param/video/type-info.h>
43
+
44
+#define SPA_TYPE_INFO_Format           SPA_TYPE_INFO_PARAM_BASE "Format"
45
+#define SPA_TYPE_INFO_FORMAT_BASE      SPA_TYPE_INFO_Format ":"
46
+
47
+#define SPA_TYPE_INFO_MediaType        SPA_TYPE_INFO_ENUM_BASE "MediaType"
48
+#define SPA_TYPE_INFO_MEDIA_TYPE_BASE  SPA_TYPE_INFO_MediaType ":"
49
+
50
+static const struct spa_type_info spa_type_media_type = {
51
+   { SPA_MEDIA_TYPE_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "unknown", NULL },
52
+   { SPA_MEDIA_TYPE_audio,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "audio", NULL },
53
+   { SPA_MEDIA_TYPE_video,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "video", NULL },
54
+   { SPA_MEDIA_TYPE_image,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "image", NULL },
55
+   { SPA_MEDIA_TYPE_binary,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "binary", NULL },
56
+   { SPA_MEDIA_TYPE_stream,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "stream", NULL },
57
+   { SPA_MEDIA_TYPE_application,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "application", NULL },
58
+   { 0, 0, NULL, NULL },
59
+};
60
+
61
+#define SPA_TYPE_INFO_MediaSubtype     SPA_TYPE_INFO_ENUM_BASE "MediaSubtype"
62
+#define SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE   SPA_TYPE_INFO_MediaSubtype ":"
63
+
64
+static const struct spa_type_info spa_type_media_subtype = {
65
+   { SPA_MEDIA_SUBTYPE_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "unknown", NULL },
66
+   /* generic subtypes */
67
+   { SPA_MEDIA_SUBTYPE_raw, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "raw", NULL },
68
+   { SPA_MEDIA_SUBTYPE_dsp, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "dsp", NULL },
69
+   { SPA_MEDIA_SUBTYPE_iec958, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "iec958", NULL },
70
+   { SPA_MEDIA_SUBTYPE_dsd, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "dsd", NULL },
71
+   /* audio subtypes */
72
+   { SPA_MEDIA_SUBTYPE_mp3, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mp3", NULL },
73
+   { SPA_MEDIA_SUBTYPE_aac, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "aac", NULL },
74
+   { SPA_MEDIA_SUBTYPE_vorbis, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "vorbis", NULL },
75
+   { SPA_MEDIA_SUBTYPE_wma, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "wma", NULL },
76
+   { SPA_MEDIA_SUBTYPE_ra, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "ra", NULL },
77
+   { SPA_MEDIA_SUBTYPE_sbc, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "sbc", NULL },
78
+   { SPA_MEDIA_SUBTYPE_adpcm, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "adpcm", NULL },
79
+   { SPA_MEDIA_SUBTYPE_g723, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "g723", NULL },
80
+   { SPA_MEDIA_SUBTYPE_g726, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "g726", NULL },
81
+   { SPA_MEDIA_SUBTYPE_g729, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "g729", NULL },
82
+   { SPA_MEDIA_SUBTYPE_amr, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "amr", NULL },
83
+   { SPA_MEDIA_SUBTYPE_gsm, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "gsm", NULL },
84
+   { SPA_MEDIA_SUBTYPE_alac, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "alac", NULL },
85
+   { SPA_MEDIA_SUBTYPE_flac, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "flac", NULL },
86
+   { SPA_MEDIA_SUBTYPE_ape, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "ape", NULL },
87
+   /* video subtypes */
88
+   { SPA_MEDIA_SUBTYPE_h264, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "h264", NULL },
89
+   { SPA_MEDIA_SUBTYPE_mjpg, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mjpg", NULL },
90
+   { SPA_MEDIA_SUBTYPE_dv, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "dv", NULL },
91
+   { SPA_MEDIA_SUBTYPE_mpegts, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mpegts", NULL },
92
+   { SPA_MEDIA_SUBTYPE_h263, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "h263", NULL },
93
+   { SPA_MEDIA_SUBTYPE_mpeg1, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mpeg1", NULL },
94
+   { SPA_MEDIA_SUBTYPE_mpeg2, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mpeg2", NULL },
95
+   { SPA_MEDIA_SUBTYPE_mpeg4, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mpeg4", NULL },
96
+   { SPA_MEDIA_SUBTYPE_xvid, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "xvid", NULL },
97
+   { SPA_MEDIA_SUBTYPE_vc1, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "vc1", NULL },
98
+   { SPA_MEDIA_SUBTYPE_vp8, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "vp8", NULL },
99
+   { SPA_MEDIA_SUBTYPE_vp9, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "vp9", NULL },
100
+   { SPA_MEDIA_SUBTYPE_bayer, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "bayer", NULL },
101
+   /* image subtypes */
102
+   { SPA_MEDIA_SUBTYPE_jpeg, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "jpeg", NULL },
103
+   /* stream subtypes */
104
+   { SPA_MEDIA_SUBTYPE_midi, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "midi", NULL },
105
+   /* application subtypes */
106
+   { SPA_MEDIA_SUBTYPE_control, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "control", NULL },
107
+   { 0, 0, NULL, NULL },
108
+};
109
+
110
+#define SPA_TYPE_INFO_FormatAudio      SPA_TYPE_INFO_FORMAT_BASE "Audio"
111
+#define SPA_TYPE_INFO_FORMAT_AUDIO_BASE        SPA_TYPE_INFO_FormatAudio ":"
112
+
113
+#define SPA_TYPE_INFO_FORMAT_AUDIO_AAC     SPA_TYPE_INFO_FORMAT_AUDIO_BASE "AAC"
114
+#define SPA_TYPE_INFO_FORMAT_AUDIO_AAC_BASE    SPA_TYPE_INFO_FORMAT_AUDIO_AAC ":"
115
+#define SPA_TYPE_INFO_FORMAT_AUDIO_WMA     SPA_TYPE_INFO_FORMAT_AUDIO_BASE "WMA"
116
+#define SPA_TYPE_INFO_FORMAT_AUDIO_WMA_BASE    SPA_TYPE_INFO_FORMAT_AUDIO_WMA ":"
117
+#define SPA_TYPE_INFO_FORMAT_AUDIO_AMR     SPA_TYPE_INFO_FORMAT_AUDIO_BASE "AMR"
118
+#define SPA_TYPE_INFO_FORMAT_AUDIO_AMR_BASE    SPA_TYPE_INFO_FORMAT_AUDIO_AMR ":"
119
+
120
+#define SPA_TYPE_INFO_FormatVideo      SPA_TYPE_INFO_FORMAT_BASE "Video"
121
+#define SPA_TYPE_INFO_FORMAT_VIDEO_BASE        SPA_TYPE_INFO_FormatVideo ":"
122
+
123
+#define SPA_TYPE_INFO_FORMAT_VIDEO_H264        SPA_TYPE_INFO_FORMAT_VIDEO_BASE "H264"
124
+#define SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE   SPA_TYPE_INFO_FORMAT_VIDEO_H264 ":"
125
+
126
+static const struct spa_type_info spa_type_format = {
127
+   { SPA_FORMAT_START, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_BASE, spa_type_param, },
128
+
129
+   { SPA_FORMAT_mediaType, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_BASE "mediaType",
130
+       spa_type_media_type, },
131
+   { SPA_FORMAT_mediaSubtype, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_BASE "mediaSubtype",
132
+       spa_type_media_subtype, },
133
+
134
+   { SPA_FORMAT_AUDIO_format, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "format",
135
+       spa_type_audio_format },
136
+   { SPA_FORMAT_AUDIO_flags, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "flags",
137
+       spa_type_audio_flags },
138
+   { SPA_FORMAT_AUDIO_rate, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "rate", NULL },
139
+   { SPA_FORMAT_AUDIO_channels, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "channels", NULL },
140
+   { SPA_FORMAT_AUDIO_position, SPA_TYPE_Array, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "position",
141
+       spa_type_prop_channel_map },
142
+
143
+   { SPA_FORMAT_AUDIO_iec958Codec, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "iec958Codec",
144
+       spa_type_audio_iec958_codec },
145
+
146
+   { SPA_FORMAT_AUDIO_bitorder, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "bitorder",
147
+       spa_type_param_bitorder },
148
+   { SPA_FORMAT_AUDIO_interleave, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "interleave", NULL },
149
+   { SPA_FORMAT_AUDIO_bitrate, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "bitrate", NULL },
150
+   { SPA_FORMAT_AUDIO_blockAlign, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_AUDIO_BASE "blockAlign", NULL },
151
+
152
+   { SPA_FORMAT_AUDIO_AAC_streamFormat, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_AAC_BASE "streamFormat",
153
+       spa_type_audio_aac_stream_format },
154
+   { SPA_FORMAT_AUDIO_WMA_profile, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_WMA_BASE "profile",
155
+       spa_type_audio_wma_profile },
156
+   { SPA_FORMAT_AUDIO_AMR_bandMode, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_AMR_BASE "bandMode",
157
+       spa_type_audio_amr_band_mode },
158
+
159
+   { SPA_FORMAT_VIDEO_format, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "format",
160
+       spa_type_video_format, },
161
+   { SPA_FORMAT_VIDEO_modifier, SPA_TYPE_Long, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "modifier", NULL },
162
+   { SPA_FORMAT_VIDEO_size,  SPA_TYPE_Rectangle, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "size", NULL },
163
+   { SPA_FORMAT_VIDEO_framerate, SPA_TYPE_Fraction, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "framerate", NULL },
164
+   { SPA_FORMAT_VIDEO_maxFramerate, SPA_TYPE_Fraction, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "maxFramerate", NULL },
165
+   { SPA_FORMAT_VIDEO_views, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "views", NULL },
166
+   { SPA_FORMAT_VIDEO_interlaceMode, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "interlaceMode",
167
+       spa_type_video_interlace_mode, },
168
+   { SPA_FORMAT_VIDEO_pixelAspectRatio, SPA_TYPE_Fraction, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "pixelAspectRatio", NULL },
169
+   { SPA_FORMAT_VIDEO_multiviewMode, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "multiviewMode", NULL },
170
+   { SPA_FORMAT_VIDEO_multiviewFlags, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "multiviewFlags", NULL },
171
+   { SPA_FORMAT_VIDEO_chromaSite, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "chromaSite", NULL },
172
+   { SPA_FORMAT_VIDEO_colorRange, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "colorRange", NULL },
173
+   { SPA_FORMAT_VIDEO_colorMatrix, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "colorMatrix", NULL },
174
+   { SPA_FORMAT_VIDEO_transferFunction, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "transferFunction", NULL },
175
+   { SPA_FORMAT_VIDEO_colorPrimaries, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "colorPrimaries", NULL },
176
+   { SPA_FORMAT_VIDEO_profile, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "profile", NULL },
177
+   { SPA_FORMAT_VIDEO_level, SPA_TYPE_Int, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "level", NULL },
178
+
179
+   { SPA_FORMAT_VIDEO_H264_streamFormat, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE "streamFormat", NULL },
180
+   { SPA_FORMAT_VIDEO_H264_alignment, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_H264_BASE "alignment", NULL },
181
+   { 0, 0, NULL, NULL },
182
+};
183
+
184
+/**
185
+ * \}
186
+ */
187
+
188
+#ifdef __cplusplus
189
+}  /* extern "C" */
190
+#endif
191
+
192
+#endif /* SPA_PARAM_FORMAT_TYPES_H */
193
pipewire-0.3.64.tar.gz/spa/include/spa/param/format.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/format.h Changed
45
 
1
@@ -68,6 +68,9 @@
2
    SPA_MEDIA_SUBTYPE_g729,
3
    SPA_MEDIA_SUBTYPE_amr,
4
    SPA_MEDIA_SUBTYPE_gsm,
5
+   SPA_MEDIA_SUBTYPE_alac,     /** since 0.3.65 */
6
+   SPA_MEDIA_SUBTYPE_flac,     /** since 0.3.65 */
7
+   SPA_MEDIA_SUBTYPE_ape,      /** since 0.3.65 */
8
 
9
    SPA_MEDIA_SUBTYPE_START_Video   = 0x20000,
10
    SPA_MEDIA_SUBTYPE_h264,
11
@@ -106,16 +109,25 @@
12
 
13
    /* Audio format keys */
14
    SPA_FORMAT_START_Audio = 0x10000,
15
-   SPA_FORMAT_AUDIO_format,    /**< audio format, (Id enum spa_audio_format) */
16
-   SPA_FORMAT_AUDIO_flags,     /**< optional flags (Int) */
17
-   SPA_FORMAT_AUDIO_rate,      /**< sample rate (Int) */
18
-   SPA_FORMAT_AUDIO_channels,  /**< number of audio channels (Int) */
19
-   SPA_FORMAT_AUDIO_position,  /**< channel positions (Id enum spa_audio_position) */
20
+   SPA_FORMAT_AUDIO_format,        /**< audio format, (Id enum spa_audio_format) */
21
+   SPA_FORMAT_AUDIO_flags,         /**< optional flags (Int) */
22
+   SPA_FORMAT_AUDIO_rate,          /**< sample rate (Int) */
23
+   SPA_FORMAT_AUDIO_channels,      /**< number of audio channels (Int) */
24
+   SPA_FORMAT_AUDIO_position,      /**< channel positions (Id enum spa_audio_position) */
25
 
26
-   SPA_FORMAT_AUDIO_iec958Codec,   /**< codec used (IEC958) (Id enum spa_audio_iec958_codec) */
27
+   SPA_FORMAT_AUDIO_iec958Codec,       /**< codec used (IEC958) (Id enum spa_audio_iec958_codec) */
28
+
29
+   SPA_FORMAT_AUDIO_bitorder,      /**< bit order (Id enum spa_param_bitorder) */
30
+   SPA_FORMAT_AUDIO_interleave,        /**< Interleave bytes (Int) */
31
+   SPA_FORMAT_AUDIO_bitrate,       /**< bit rate (Int) */
32
+   SPA_FORMAT_AUDIO_blockAlign,        /**< audio data block alignment (Int) */
33
+
34
+   SPA_FORMAT_AUDIO_AAC_streamFormat,  /**< AAC stream format, (Id enum spa_audio_aac_stream_format) */
35
+
36
+   SPA_FORMAT_AUDIO_WMA_profile,       /**< WMA profile (Id enum spa_audio_wma_profile) */
37
+
38
+   SPA_FORMAT_AUDIO_AMR_bandMode,      /**< AMR band mode (Id enum spa_audio_amr_band_mode) */
39
 
40
-   SPA_FORMAT_AUDIO_bitorder,  /**< bit order (Id enum spa_param_bitorder) */
41
-   SPA_FORMAT_AUDIO_interleave,    /**< Interleave bytes (Int) */
42
 
43
    /* Video Format keys */
44
    SPA_FORMAT_START_Video = 0x20000,
45
pipewire-0.3.65.tar.gz/spa/include/spa/param/latency-types.h Added
77
 
1
@@ -0,0 +1,75 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_LATENCY_TYPES_H
27
+#define SPA_PARAM_LATENCY_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/utils/enum-types.h>
39
+#include <spa/param/param-types.h>
40
+#include <spa/param/latency.h>
41
+
42
+#define SPA_TYPE_INFO_PARAM_Latency        SPA_TYPE_INFO_PARAM_BASE "Latency"
43
+#define SPA_TYPE_INFO_PARAM_LATENCY_BASE   SPA_TYPE_INFO_PARAM_Latency ":"
44
+
45
+static const struct spa_type_info spa_type_param_latency = {
46
+   { SPA_PARAM_LATENCY_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_LATENCY_BASE, spa_type_param, },
47
+   { SPA_PARAM_LATENCY_direction, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_LATENCY_BASE "direction", spa_type_direction, },
48
+   { SPA_PARAM_LATENCY_minQuantum, SPA_TYPE_Float, SPA_TYPE_INFO_PARAM_LATENCY_BASE "minQuantum", NULL, },
49
+   { SPA_PARAM_LATENCY_maxQuantum, SPA_TYPE_Float, SPA_TYPE_INFO_PARAM_LATENCY_BASE "maxQuantum", NULL, },
50
+   { SPA_PARAM_LATENCY_minRate, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_LATENCY_BASE "minRate", NULL, },
51
+   { SPA_PARAM_LATENCY_maxRate, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_LATENCY_BASE "maxRate", NULL, },
52
+   { SPA_PARAM_LATENCY_minNs, SPA_TYPE_Long, SPA_TYPE_INFO_PARAM_LATENCY_BASE "minNs", NULL, },
53
+   { SPA_PARAM_LATENCY_maxNs, SPA_TYPE_Long, SPA_TYPE_INFO_PARAM_LATENCY_BASE "maxNs", NULL, },
54
+   { 0, 0, NULL, NULL },
55
+};
56
+
57
+#define SPA_TYPE_INFO_PARAM_ProcessLatency     SPA_TYPE_INFO_PARAM_BASE "ProcessLatency"
58
+#define SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE   SPA_TYPE_INFO_PARAM_ProcessLatency ":"
59
+
60
+static const struct spa_type_info spa_type_param_process_latency = {
61
+   { SPA_PARAM_PROCESS_LATENCY_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_LATENCY_BASE, spa_type_param, },
62
+   { SPA_PARAM_PROCESS_LATENCY_quantum, SPA_TYPE_Float, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "quantum", NULL, },
63
+   { SPA_PARAM_PROCESS_LATENCY_rate, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "rate", NULL, },
64
+   { SPA_PARAM_PROCESS_LATENCY_ns, SPA_TYPE_Long, SPA_TYPE_INFO_PARAM_PROCESS_LATENCY_BASE "ns", NULL, },
65
+   { 0, 0, NULL, NULL },
66
+};
67
+
68
+/**
69
+ * \}
70
+ */
71
+
72
+#ifdef __cplusplus
73
+}  /* extern "C" */
74
+#endif
75
+
76
+#endif /* SPA_PARAM_LATENCY_TYPES_H */
77
pipewire-0.3.64.tar.gz/spa/include/spa/param/latency-utils.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/latency-utils.h Changed
37
 
1
@@ -38,19 +38,7 @@
2
 
3
 #include <spa/pod/builder.h>
4
 #include <spa/pod/parser.h>
5
-#include <spa/param/param.h>
6
-
7
-struct spa_latency_info {
8
-   enum spa_direction direction;
9
-   float min_quantum;
10
-   float max_quantum;
11
-   uint32_t min_rate;
12
-   uint32_t max_rate;
13
-   uint64_t min_ns;
14
-   uint64_t max_ns;
15
-};
16
-
17
-#define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
18
+#include <spa/param/latency.h>
19
 
20
 static inline int
21
 spa_latency_info_compare(const struct spa_latency_info *a, struct spa_latency_info *b)
22
@@ -140,14 +128,6 @@
23
            SPA_PARAM_LATENCY_maxNs, SPA_POD_Long(info->max_ns));
24
 }
25
 
26
-struct spa_process_latency_info {
27
-   float quantum;
28
-   uint32_t rate;
29
-   uint64_t ns;
30
-};
31
-
32
-#define SPA_PROCESS_LATENCY_INFO_INIT(...) ((struct spa_process_latency_info) { __VA_ARGS__ })
33
-
34
 static inline int
35
 spa_process_latency_parse(const struct spa_pod *latency, struct spa_process_latency_info *info)
36
 {
37
pipewire-0.3.65.tar.gz/spa/include/spa/param/latency.h Added
91
 
1
@@ -0,0 +1,89 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_LATENY_H
27
+#define SPA_PARAM_LATENY_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param.h>
39
+
40
+/** properties for SPA_TYPE_OBJECT_ParamLatency */
41
+enum spa_param_latency {
42
+   SPA_PARAM_LATENCY_START,
43
+   SPA_PARAM_LATENCY_direction,        /**< direction, input/output (Id enum spa_direction) */
44
+   SPA_PARAM_LATENCY_minQuantum,       /**< min latency relative to quantum (Float) */
45
+   SPA_PARAM_LATENCY_maxQuantum,       /**< max latency relative to quantum (Float) */
46
+   SPA_PARAM_LATENCY_minRate,      /**< min latency (Int) relative to rate */
47
+   SPA_PARAM_LATENCY_maxRate,      /**< max latency (Int) relative to rate */
48
+   SPA_PARAM_LATENCY_minNs,        /**< min latency (Long) in nanoseconds */
49
+   SPA_PARAM_LATENCY_maxNs,        /**< max latency (Long) in nanoseconds */
50
+};
51
+
52
+/** helper structure for managing latency objects */
53
+struct spa_latency_info {
54
+   enum spa_direction direction;
55
+   float min_quantum;
56
+   float max_quantum;
57
+   uint32_t min_rate;
58
+   uint32_t max_rate;
59
+   uint64_t min_ns;
60
+   uint64_t max_ns;
61
+};
62
+
63
+#define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
64
+
65
+/** properties for SPA_TYPE_OBJECT_ParamProcessLatency */
66
+enum spa_param_process_latency {
67
+   SPA_PARAM_PROCESS_LATENCY_START,
68
+   SPA_PARAM_PROCESS_LATENCY_quantum,  /**< latency relative to quantum (Float) */
69
+   SPA_PARAM_PROCESS_LATENCY_rate,     /**< latency (Int) relative to rate */
70
+   SPA_PARAM_PROCESS_LATENCY_ns,       /**< latency (Long) in nanoseconds */
71
+};
72
+
73
+/** Helper structure for managing process latency objects */
74
+struct spa_process_latency_info {
75
+   float quantum;
76
+   uint32_t rate;
77
+   uint64_t ns;
78
+};
79
+
80
+#define SPA_PROCESS_LATENCY_INFO_INIT(...) ((struct spa_process_latency_info) { __VA_ARGS__ })
81
+
82
+/**
83
+ * \}
84
+ */
85
+
86
+#ifdef __cplusplus
87
+}  /* extern "C" */
88
+#endif
89
+
90
+#endif /* SPA_PARAM_LATENY_H */
91
pipewire-0.3.65.tar.gz/spa/include/spa/param/param-types.h Added
117
 
1
@@ -0,0 +1,115 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_TYPES_H
27
+#define SPA_PARAM_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/props.h>
39
+#include <spa/param/format.h>
40
+#include <spa/buffer/type-info.h>
41
+
42
+/* base for parameter object enumerations */
43
+#define SPA_TYPE_INFO_ParamId      SPA_TYPE_INFO_ENUM_BASE "ParamId"
44
+#define SPA_TYPE_INFO_PARAM_ID_BASE    SPA_TYPE_INFO_ParamId ":"
45
+
46
+static const struct spa_type_info spa_type_param = {
47
+   { SPA_PARAM_Invalid, SPA_TYPE_None, SPA_TYPE_INFO_PARAM_ID_BASE "Invalid", NULL },
48
+   { SPA_PARAM_PropInfo, SPA_TYPE_OBJECT_PropInfo, SPA_TYPE_INFO_PARAM_ID_BASE "PropInfo", NULL },
49
+   { SPA_PARAM_Props, SPA_TYPE_OBJECT_Props, SPA_TYPE_INFO_PARAM_ID_BASE "Props", NULL },
50
+   { SPA_PARAM_EnumFormat, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_ID_BASE "EnumFormat", NULL },
51
+   { SPA_PARAM_Format, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_ID_BASE "Format", NULL },
52
+   { SPA_PARAM_Buffers, SPA_TYPE_OBJECT_ParamBuffers, SPA_TYPE_INFO_PARAM_ID_BASE "Buffers", NULL },
53
+   { SPA_PARAM_Meta, SPA_TYPE_OBJECT_ParamMeta, SPA_TYPE_INFO_PARAM_ID_BASE "Meta", NULL },
54
+   { SPA_PARAM_IO, SPA_TYPE_OBJECT_ParamIO, SPA_TYPE_INFO_PARAM_ID_BASE "IO", NULL },
55
+   { SPA_PARAM_EnumProfile, SPA_TYPE_OBJECT_ParamProfile, SPA_TYPE_INFO_PARAM_ID_BASE "EnumProfile", NULL },
56
+   { SPA_PARAM_Profile, SPA_TYPE_OBJECT_ParamProfile, SPA_TYPE_INFO_PARAM_ID_BASE "Profile", NULL },
57
+   { SPA_PARAM_EnumPortConfig, SPA_TYPE_OBJECT_ParamPortConfig, SPA_TYPE_INFO_PARAM_ID_BASE "EnumPortConfig", NULL },
58
+   { SPA_PARAM_PortConfig, SPA_TYPE_OBJECT_ParamPortConfig, SPA_TYPE_INFO_PARAM_ID_BASE "PortConfig", NULL },
59
+   { SPA_PARAM_EnumRoute, SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_INFO_PARAM_ID_BASE "EnumRoute", NULL },
60
+   { SPA_PARAM_Route, SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_INFO_PARAM_ID_BASE "Route", NULL },
61
+   { SPA_PARAM_Control, SPA_TYPE_Sequence, SPA_TYPE_INFO_PARAM_ID_BASE "Control", NULL },
62
+   { SPA_PARAM_Latency, SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_INFO_PARAM_ID_BASE "Latency", NULL },
63
+   { SPA_PARAM_ProcessLatency, SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_INFO_PARAM_ID_BASE "ProcessLatency", NULL },
64
+   { 0, 0, NULL, NULL },
65
+};
66
+
67
+/* base for parameter objects */
68
+#define SPA_TYPE_INFO_Param            SPA_TYPE_INFO_OBJECT_BASE "Param"
69
+#define SPA_TYPE_INFO_PARAM_BASE       SPA_TYPE_INFO_Param ":"
70
+
71
+#include <spa/param/audio/type-info.h>
72
+
73
+static const struct spa_type_info spa_type_prop_float_array = {
74
+   { SPA_PROP_START, SPA_TYPE_Float, SPA_TYPE_INFO_BASE "floatArray", NULL, },
75
+   { 0, 0, NULL, NULL },
76
+};
77
+
78
+static const struct spa_type_info spa_type_prop_channel_map = {
79
+   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "channelMap", spa_type_audio_channel, },
80
+   { 0, 0, NULL, NULL },
81
+};
82
+
83
+static const struct spa_type_info spa_type_prop_iec958_codec = {
84
+   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "iec958Codec", spa_type_audio_iec958_codec, },
85
+   { 0, 0, NULL, NULL },
86
+};
87
+
88
+#define SPA_TYPE_INFO_ParamBitorder        SPA_TYPE_INFO_ENUM_BASE "ParamBitorder"
89
+#define SPA_TYPE_INFO_PARAM_BITORDER_BASE  SPA_TYPE_INFO_ParamBitorder ":"
90
+
91
+static const struct spa_type_info spa_type_param_bitorder = {
92
+   { SPA_PARAM_BITORDER_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "unknown", NULL },
93
+   { SPA_PARAM_BITORDER_msb, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "msb", NULL },
94
+   { SPA_PARAM_BITORDER_lsb, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "lsb", NULL },
95
+   { 0, 0, NULL, NULL },
96
+};
97
+
98
+#define SPA_TYPE_INFO_ParamAvailability        SPA_TYPE_INFO_ENUM_BASE "ParamAvailability"
99
+#define SPA_TYPE_INFO_PARAM_AVAILABILITY_BASE  SPA_TYPE_INFO_ParamAvailability ":"
100
+
101
+static const struct spa_type_info spa_type_param_availability = {
102
+   { SPA_PARAM_AVAILABILITY_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_AVAILABILITY_BASE "unknown", NULL },
103
+   { SPA_PARAM_AVAILABILITY_no, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_AVAILABILITY_BASE "no", NULL },
104
+   { SPA_PARAM_AVAILABILITY_yes, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_AVAILABILITY_BASE "yes", NULL },
105
+   { 0, 0, NULL, NULL },
106
+};
107
+
108
+/**
109
+ * \}
110
+ */
111
+
112
+#ifdef __cplusplus
113
+}  /* extern "C" */
114
+#endif
115
+
116
+#endif /* SPA_PARAM_TYPES_H */
117
pipewire-0.3.64.tar.gz/spa/include/spa/param/param.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/param.h Changed
138
 
1
@@ -79,29 +79,10 @@
2
 
3
 #define SPA_PARAM_INFO(id,flags) ((struct spa_param_info){ (id), (flags) })
4
 
5
-/** properties for SPA_TYPE_OBJECT_ParamBuffers */
6
-enum spa_param_buffers {
7
-   SPA_PARAM_BUFFERS_START,
8
-   SPA_PARAM_BUFFERS_buffers,  /**< number of buffers (Int) */
9
-   SPA_PARAM_BUFFERS_blocks,   /**< number of data blocks per buffer (Int) */
10
-   SPA_PARAM_BUFFERS_size,     /**< size of a data block memory (Int)*/
11
-   SPA_PARAM_BUFFERS_stride,   /**< stride of data block memory (Int) */
12
-   SPA_PARAM_BUFFERS_align,    /**< alignment of data block memory (Int) */
13
-   SPA_PARAM_BUFFERS_dataType, /**< possible memory types (Int, mask of enum spa_data_type) */
14
-};
15
-
16
-/** properties for SPA_TYPE_OBJECT_ParamMeta */
17
-enum spa_param_meta {
18
-   SPA_PARAM_META_START,
19
-   SPA_PARAM_META_type,    /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
20
-   SPA_PARAM_META_size,    /**< the expected maximum size the meta (Int) */
21
-};
22
-
23
-/** properties for SPA_TYPE_OBJECT_ParamIO */
24
-enum spa_param_io {
25
-   SPA_PARAM_IO_START,
26
-   SPA_PARAM_IO_id,    /**< type ID, uniquely identifies the io area (Id enum spa_io_type) */
27
-   SPA_PARAM_IO_size,  /**< size of the io area (Int) */
28
+enum spa_param_bitorder {
29
+   SPA_PARAM_BITORDER_unknown, /**< unknown bitorder */
30
+   SPA_PARAM_BITORDER_msb,     /**< most significant bit */
31
+   SPA_PARAM_BITORDER_lsb,     /**< least significant bit */
32
 };
33
 
34
 enum spa_param_availability {
35
@@ -110,98 +91,10 @@
36
    SPA_PARAM_AVAILABILITY_yes, /**< available */
37
 };
38
 
39
-/** properties for SPA_TYPE_OBJECT_ParamProfile */
40
-enum spa_param_profile {
41
-   SPA_PARAM_PROFILE_START,
42
-   SPA_PARAM_PROFILE_index,    /**< profile index (Int) */
43
-   SPA_PARAM_PROFILE_name,     /**< profile name (String) */
44
-   SPA_PARAM_PROFILE_description,  /**< profile description (String) */
45
-   SPA_PARAM_PROFILE_priority, /**< profile priority (Int) */
46
-   SPA_PARAM_PROFILE_available,    /**< availability of the profile
47
-                     *  (Id enum spa_param_availability) */
48
-   SPA_PARAM_PROFILE_info,     /**< info (Struct(
49
-                     *       Int : n_items,
50
-                     *       (String : key,
51
-                     *        String : value)*)) */
52
-   SPA_PARAM_PROFILE_classes,  /**< node classes provided by this profile
53
-                     *  (Struct(
54
-                     *    Int : number of items following
55
-                     *        Struct(
56
-                     *           String : class name (eg. "Audio/Source"),
57
-                     *           Int : number of nodes
58
-                     *           String : property (eg. "card.profile.devices"),
59
-                     *           Array of Int: device indexes
60
-                     *         )*)) */
61
-   SPA_PARAM_PROFILE_save,     /**< If profile should be saved (Bool) */
62
-};
63
-
64
-enum spa_param_port_config_mode {
65
-   SPA_PARAM_PORT_CONFIG_MODE_none,    /**< no configuration */
66
-   SPA_PARAM_PORT_CONFIG_MODE_passthrough, /**< passthrough configuration */
67
-   SPA_PARAM_PORT_CONFIG_MODE_convert, /**< convert configuration */
68
-   SPA_PARAM_PORT_CONFIG_MODE_dsp,     /**< dsp configuration, depending on the external
69
-                         *  format. For audio, ports will be configured for
70
-                         *  the given number of channels with F32 format. */
71
-};
72
-
73
-/** properties for SPA_TYPE_OBJECT_ParamPortConfig */
74
-enum spa_param_port_config {
75
-   SPA_PARAM_PORT_CONFIG_START,
76
-   SPA_PARAM_PORT_CONFIG_direction,    /**< direction, input/output (Id enum spa_direction) */
77
-   SPA_PARAM_PORT_CONFIG_mode,     /**< (Id enum spa_param_port_config_mode) mode */
78
-   SPA_PARAM_PORT_CONFIG_monitor,      /**< (Bool) enable monitor output ports on input ports */
79
-   SPA_PARAM_PORT_CONFIG_control,      /**< (Bool) enable control ports */
80
-   SPA_PARAM_PORT_CONFIG_format,       /**< (Object) format filter */
81
-};
82
-
83
-/** properties for SPA_TYPE_OBJECT_ParamRoute */
84
-enum spa_param_route {
85
-   SPA_PARAM_ROUTE_START,
86
-   SPA_PARAM_ROUTE_index,          /**< index of the routing destination (Int) */
87
-   SPA_PARAM_ROUTE_direction,      /**< direction, input/output (Id enum spa_direction) */
88
-   SPA_PARAM_ROUTE_device,         /**< device id (Int) */
89
-   SPA_PARAM_ROUTE_name,           /**< name of the routing destination (String) */
90
-   SPA_PARAM_ROUTE_description,        /**< description of the destination (String) */
91
-   SPA_PARAM_ROUTE_priority,       /**< priority of the destination (Int) */
92
-   SPA_PARAM_ROUTE_available,      /**< availability of the destination
93
-                         *  (Id enum spa_param_availability) */
94
-   SPA_PARAM_ROUTE_info,           /**< info (Struct(
95
-                         *       Int : n_items,
96
-                         *       (String : key,
97
-                         *        String : value)*)) */
98
-   SPA_PARAM_ROUTE_profiles,       /**< associated profile indexes (Array of Int) */
99
-   SPA_PARAM_ROUTE_props,          /**< properties SPA_TYPE_OBJECT_Props */
100
-   SPA_PARAM_ROUTE_devices,        /**< associated device indexes (Array of Int) */
101
-   SPA_PARAM_ROUTE_profile,        /**< profile id (Int) */
102
-   SPA_PARAM_ROUTE_save,           /**< If route should be saved (Bool) */
103
-};
104
-
105
-
106
-/** properties for SPA_TYPE_OBJECT_ParamLatency */
107
-enum spa_param_latency {
108
-   SPA_PARAM_LATENCY_START,
109
-   SPA_PARAM_LATENCY_direction,        /**< direction, input/output (Id enum spa_direction) */
110
-   SPA_PARAM_LATENCY_minQuantum,       /**< min latency relative to quantum (Float) */
111
-   SPA_PARAM_LATENCY_maxQuantum,       /**< max latency relative to quantum (Float) */
112
-   SPA_PARAM_LATENCY_minRate,      /**< min latency (Int) relative to rate */
113
-   SPA_PARAM_LATENCY_maxRate,      /**< max latency (Int) relative to rate */
114
-   SPA_PARAM_LATENCY_minNs,        /**< min latency (Long) in nanoseconds */
115
-   SPA_PARAM_LATENCY_maxNs,        /**< max latency (Long) in nanoseconds */
116
-};
117
-
118
-/** properties for SPA_TYPE_OBJECT_ParamProcessLatency */
119
-enum spa_param_process_latency {
120
-   SPA_PARAM_PROCESS_LATENCY_START,
121
-   SPA_PARAM_PROCESS_LATENCY_quantum,  /**< latency relative to quantum (Float) */
122
-   SPA_PARAM_PROCESS_LATENCY_rate,     /**< latency (Int) relative to rate */
123
-   SPA_PARAM_PROCESS_LATENCY_ns,       /**< latency (Long) in nanoseconds */
124
-};
125
-
126
-enum spa_param_bitorder {
127
-   SPA_PARAM_BITORDER_unknown, /**< unknown bitorder */
128
-   SPA_PARAM_BITORDER_msb,     /**< most significant bit */
129
-   SPA_PARAM_BITORDER_lsb,     /**< least significant bit */
130
-};
131
+#include <spa/param/buffers.h>
132
+#include <spa/param/profile.h>
133
+#include <spa/param/port-config.h>
134
+#include <spa/param/route.h>
135
 
136
 /**
137
  * \}
138
pipewire-0.3.65.tar.gz/spa/include/spa/param/port-config-types.h Added
75
 
1
@@ -0,0 +1,73 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PORT_CONFIG_TYPES_H
27
+#define SPA_PARAM_PORT_CONFIG_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/utils/enum-types.h>
39
+#include <spa/param/param-types.h>
40
+#include <spa/param/port-config.h>
41
+
42
+#define SPA_TYPE_INFO_ParamPortConfigMode      SPA_TYPE_INFO_ENUM_BASE "ParamPortConfigMode"
43
+#define SPA_TYPE_INFO_PARAM_PORT_CONFIG_MODE_BASE  SPA_TYPE_INFO_ParamPortConfigMode ":"
44
+
45
+static const struct spa_type_info spa_type_param_port_config_mode = {
46
+   { SPA_PARAM_PORT_CONFIG_MODE_none, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PORT_CONFIG_MODE_BASE "none", NULL },
47
+   { SPA_PARAM_PORT_CONFIG_MODE_passthrough, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PORT_CONFIG_MODE_BASE "passthrough", NULL },
48
+   { SPA_PARAM_PORT_CONFIG_MODE_convert, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PORT_CONFIG_MODE_BASE "convert", NULL },
49
+   { SPA_PARAM_PORT_CONFIG_MODE_dsp, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PORT_CONFIG_MODE_BASE "dsp", NULL },
50
+   { 0, 0, NULL, NULL },
51
+};
52
+
53
+#define SPA_TYPE_INFO_PARAM_PortConfig     SPA_TYPE_INFO_PARAM_BASE "PortConfig"
54
+#define SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE   SPA_TYPE_INFO_PARAM_PortConfig ":"
55
+
56
+static const struct spa_type_info spa_type_param_port_config = {
57
+   { SPA_PARAM_PORT_CONFIG_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE, spa_type_param, },
58
+   { SPA_PARAM_PORT_CONFIG_direction, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "direction", spa_type_direction, },
59
+   { SPA_PARAM_PORT_CONFIG_mode, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "mode", spa_type_param_port_config_mode },
60
+   { SPA_PARAM_PORT_CONFIG_monitor, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "monitor", NULL },
61
+   { SPA_PARAM_PORT_CONFIG_control, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "control", NULL },
62
+   { SPA_PARAM_PORT_CONFIG_format, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_PORT_CONFIG_BASE "format", NULL },
63
+   { 0, 0, NULL, NULL },
64
+};
65
+
66
+/**
67
+ * \}
68
+ */
69
+
70
+#ifdef __cplusplus
71
+}  /* extern "C" */
72
+#endif
73
+
74
+#endif /* SPA_PARAM_PORT_CONFIG_TYPES_H */
75
pipewire-0.3.65.tar.gz/spa/include/spa/param/port-config.h Added
68
 
1
@@ -0,0 +1,66 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PORT_CONFIG_H
27
+#define SPA_PARAM_PORT_CONFIG_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param.h>
39
+
40
+enum spa_param_port_config_mode {
41
+   SPA_PARAM_PORT_CONFIG_MODE_none,    /**< no configuration */
42
+   SPA_PARAM_PORT_CONFIG_MODE_passthrough, /**< passthrough configuration */
43
+   SPA_PARAM_PORT_CONFIG_MODE_convert, /**< convert configuration */
44
+   SPA_PARAM_PORT_CONFIG_MODE_dsp,     /**< dsp configuration, depending on the external
45
+                         *  format. For audio, ports will be configured for
46
+                         *  the given number of channels with F32 format. */
47
+};
48
+
49
+/** properties for SPA_TYPE_OBJECT_ParamPortConfig */
50
+enum spa_param_port_config {
51
+   SPA_PARAM_PORT_CONFIG_START,
52
+   SPA_PARAM_PORT_CONFIG_direction,    /**< direction, input/output (Id enum spa_direction) */
53
+   SPA_PARAM_PORT_CONFIG_mode,     /**< (Id enum spa_param_port_config_mode) mode */
54
+   SPA_PARAM_PORT_CONFIG_monitor,      /**< (Bool) enable monitor output ports on input ports */
55
+   SPA_PARAM_PORT_CONFIG_control,      /**< (Bool) enable control ports */
56
+   SPA_PARAM_PORT_CONFIG_format,       /**< (Object) format filter */
57
+};
58
+
59
+/**
60
+ * \}
61
+ */
62
+
63
+#ifdef __cplusplus
64
+}  /* extern "C" */
65
+#endif
66
+
67
+#endif /* SPA_PARAM_PORT_CONFIG_H */
68
pipewire-0.3.65.tar.gz/spa/include/spa/param/profile-types.h Added
67
 
1
@@ -0,0 +1,65 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PROFILE_TYPES_H
27
+#define SPA_PARAM_PROFILE_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param-types.h>
39
+
40
+#include <spa/param/profile.h>
41
+
42
+#define SPA_TYPE_INFO_PARAM_Profile        SPA_TYPE_INFO_PARAM_BASE "Profile"
43
+#define SPA_TYPE_INFO_PARAM_PROFILE_BASE   SPA_TYPE_INFO_PARAM_Profile ":"
44
+
45
+static const struct spa_type_info spa_type_param_profile = {
46
+   { SPA_PARAM_PROFILE_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_PROFILE_BASE, spa_type_param, },
47
+   { SPA_PARAM_PROFILE_index, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PROFILE_BASE "index", NULL },
48
+   { SPA_PARAM_PROFILE_name, SPA_TYPE_String, SPA_TYPE_INFO_PARAM_PROFILE_BASE "name", NULL },
49
+   { SPA_PARAM_PROFILE_description, SPA_TYPE_String, SPA_TYPE_INFO_PARAM_PROFILE_BASE "description", NULL },
50
+   { SPA_PARAM_PROFILE_priority, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_PROFILE_BASE "priority", NULL },
51
+   { SPA_PARAM_PROFILE_available, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_PROFILE_BASE "available", spa_type_param_availability, },
52
+   { SPA_PARAM_PROFILE_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_PROFILE_BASE "info", NULL, },
53
+   { SPA_PARAM_PROFILE_classes, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_PROFILE_BASE "classes", NULL, },
54
+   { SPA_PARAM_PROFILE_save, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_PROFILE_BASE "save", NULL, },
55
+   { 0, 0, NULL, NULL },
56
+};
57
+
58
+/**
59
+ * \}
60
+ */
61
+
62
+#ifdef __cplusplus
63
+}  /* extern "C" */
64
+#endif
65
+
66
+#endif /* SPA_PARAM_PROFILE_TYPES_H */
67
pipewire-0.3.65.tar.gz/spa/include/spa/param/profile.h Added
74
 
1
@@ -0,0 +1,72 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PROFILE_H
27
+#define SPA_PARAM_PROFILE_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param.h>
39
+
40
+/** properties for SPA_TYPE_OBJECT_ParamProfile */
41
+enum spa_param_profile {
42
+   SPA_PARAM_PROFILE_START,
43
+   SPA_PARAM_PROFILE_index,    /**< profile index (Int) */
44
+   SPA_PARAM_PROFILE_name,     /**< profile name (String) */
45
+   SPA_PARAM_PROFILE_description,  /**< profile description (String) */
46
+   SPA_PARAM_PROFILE_priority, /**< profile priority (Int) */
47
+   SPA_PARAM_PROFILE_available,    /**< availability of the profile
48
+                     *  (Id enum spa_param_availability) */
49
+   SPA_PARAM_PROFILE_info,     /**< info (Struct(
50
+                     *       Int : n_items,
51
+                     *       (String : key,
52
+                     *        String : value)*)) */
53
+   SPA_PARAM_PROFILE_classes,  /**< node classes provided by this profile
54
+                     *  (Struct(
55
+                     *    Int : number of items following
56
+                     *        Struct(
57
+                     *           String : class name (eg. "Audio/Source"),
58
+                     *           Int : number of nodes
59
+                     *           String : property (eg. "card.profile.devices"),
60
+                     *           Array of Int: device indexes
61
+                     *         )*)) */
62
+   SPA_PARAM_PROFILE_save,     /**< If profile should be saved (Bool) */
63
+};
64
+
65
+/**
66
+ * \}
67
+ */
68
+
69
+#ifdef __cplusplus
70
+}  /* extern "C" */
71
+#endif
72
+
73
+#endif /* SPA_PARAM_PROFILE_H */
74
pipewire-0.3.65.tar.gz/spa/include/spa/param/profiler-types.h Added
62
 
1
@@ -0,0 +1,60 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PROFILER_TYPES_H
27
+#define SPA_PARAM_PROFILER_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param-types.h>
39
+#include <spa/param/profiler.h>
40
+
41
+#define SPA_TYPE_INFO_Profiler     SPA_TYPE_INFO_OBJECT_BASE "Profiler"
42
+#define SPA_TYPE_INFO_PROFILER_BASE    SPA_TYPE_INFO_Profiler ":"
43
+
44
+static const struct spa_type_info spa_type_profiler = {
45
+   { SPA_PROFILER_START, SPA_TYPE_Id, SPA_TYPE_INFO_PROFILER_BASE, spa_type_param, },
46
+   { SPA_PROFILER_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "info", NULL, },
47
+   { SPA_PROFILER_clock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "clock", NULL, },
48
+   { SPA_PROFILER_driverBlock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "driverBlock", NULL, },
49
+   { SPA_PROFILER_followerBlock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "followerBlock", NULL, },
50
+   { 0, 0, NULL, NULL },
51
+};
52
+
53
+/**
54
+ * \}
55
+ */
56
+
57
+#ifdef __cplusplus
58
+}  /* extern "C" */
59
+#endif
60
+
61
+#endif /* SPA_PARAM_PROFILER_TYPES_H */
62
pipewire-0.3.65.tar.gz/spa/include/spa/param/props-types.h Added
121
 
1
@@ -0,0 +1,119 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_PROPS_TYPES_H
27
+#define SPA_PARAM_PROPS_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param-types.h>
39
+
40
+#include <spa/param/bluetooth/type-info.h>
41
+
42
+/** Props Param */
43
+#define SPA_TYPE_INFO_Props            SPA_TYPE_INFO_PARAM_BASE "Props"
44
+#define SPA_TYPE_INFO_PROPS_BASE       SPA_TYPE_INFO_Props ":"
45
+
46
+static const struct spa_type_info spa_type_props = {
47
+   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE, spa_type_param, },
48
+   { SPA_PROP_unknown, SPA_TYPE_None, SPA_TYPE_INFO_PROPS_BASE "unknown", NULL },
49
+   { SPA_PROP_device, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "device", NULL },
50
+   { SPA_PROP_deviceName, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "deviceName", NULL },
51
+   { SPA_PROP_deviceFd, SPA_TYPE_Fd, SPA_TYPE_INFO_PROPS_BASE "deviceFd", NULL },
52
+   { SPA_PROP_card, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "card", NULL },
53
+   { SPA_PROP_cardName, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "cardName", NULL },
54
+   { SPA_PROP_minLatency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "minLatency", NULL },
55
+   { SPA_PROP_maxLatency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "maxLatency", NULL },
56
+   { SPA_PROP_periods, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "periods", NULL },
57
+   { SPA_PROP_periodSize, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "periodSize", NULL },
58
+   { SPA_PROP_periodEvent, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "periodEvent", NULL },
59
+   { SPA_PROP_live, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "live", NULL },
60
+   { SPA_PROP_rate, SPA_TYPE_Double, SPA_TYPE_INFO_PROPS_BASE "rate", NULL },
61
+   { SPA_PROP_quality, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "quality", NULL },
62
+   { SPA_PROP_bluetoothAudioCodec, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "bluetoothAudioCodec", spa_type_bluetooth_audio_codec },
63
+   { SPA_PROP_bluetoothOffloadActive, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "bluetoothOffloadActive", NULL },
64
+
65
+   { SPA_PROP_waveType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "waveType", NULL },
66
+   { SPA_PROP_frequency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "frequency", NULL },
67
+   { SPA_PROP_volume, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volume", NULL },
68
+   { SPA_PROP_mute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "mute", NULL },
69
+   { SPA_PROP_patternType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "patternType", NULL },
70
+   { SPA_PROP_ditherType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "ditherType", NULL },
71
+   { SPA_PROP_truncate, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "truncate", NULL },
72
+   { SPA_PROP_channelVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "channelVolumes", spa_type_prop_float_array },
73
+   { SPA_PROP_volumeBase, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volumeBase", NULL },
74
+   { SPA_PROP_volumeStep, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volumeStep", NULL },
75
+   { SPA_PROP_channelMap, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "channelMap", spa_type_prop_channel_map },
76
+   { SPA_PROP_monitorMute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "monitorMute", NULL },
77
+   { SPA_PROP_monitorVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "monitorVolumes", spa_type_prop_float_array },
78
+   { SPA_PROP_latencyOffsetNsec, SPA_TYPE_Long, SPA_TYPE_INFO_PROPS_BASE "latencyOffsetNsec", NULL },
79
+   { SPA_PROP_softMute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "softMute", NULL },
80
+   { SPA_PROP_softVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "softVolumes", spa_type_prop_float_array },
81
+   { SPA_PROP_iec958Codecs, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "iec958Codecs", spa_type_prop_iec958_codec },
82
+
83
+   { SPA_PROP_brightness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "brightness", NULL },
84
+   { SPA_PROP_contrast, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "contrast", NULL },
85
+   { SPA_PROP_saturation, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "saturation", NULL },
86
+   { SPA_PROP_hue, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "hue", NULL },
87
+   { SPA_PROP_gamma, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gamma", NULL },
88
+   { SPA_PROP_exposure, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "exposure", NULL },
89
+   { SPA_PROP_gain, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gain", NULL },
90
+   { SPA_PROP_sharpness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "sharpness", NULL },
91
+
92
+   { SPA_PROP_params, SPA_TYPE_Struct, SPA_TYPE_INFO_PROPS_BASE "params", NULL },
93
+   { 0, 0, NULL, NULL },
94
+};
95
+
96
+/** Enum Property info */
97
+#define SPA_TYPE_INFO_PropInfo         SPA_TYPE_INFO_PARAM_BASE "PropInfo"
98
+#define SPA_TYPE_INFO_PROP_INFO_BASE       SPA_TYPE_INFO_PropInfo ":"
99
+
100
+static const struct spa_type_info spa_type_prop_info = {
101
+   { SPA_PROP_INFO_START, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE, spa_type_param, },
102
+   { SPA_PROP_INFO_id, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE "id", spa_type_props },
103
+   { SPA_PROP_INFO_name, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "name", NULL },
104
+   { SPA_PROP_INFO_type, SPA_TYPE_Pod, SPA_TYPE_INFO_PROP_INFO_BASE "type", NULL },
105
+   { SPA_PROP_INFO_labels, SPA_TYPE_Struct, SPA_TYPE_INFO_PROP_INFO_BASE "labels", NULL },
106
+   { SPA_PROP_INFO_container, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE "container", NULL },
107
+   { SPA_PROP_INFO_params, SPA_TYPE_Bool, SPA_TYPE_INFO_PROP_INFO_BASE "params", NULL },
108
+   { SPA_PROP_INFO_description, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "description", NULL },
109
+   { 0, 0, NULL, NULL },
110
+};
111
+
112
+/**
113
+ * \}
114
+ */
115
+
116
+#ifdef __cplusplus
117
+}  /* extern "C" */
118
+#endif
119
+
120
+#endif /* SPA_PARAM_PROPS_TYPES_H */
121
pipewire-0.3.65.tar.gz/spa/include/spa/param/route-types.h Added
73
 
1
@@ -0,0 +1,71 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_ROUTE_TYPES_H
27
+#define SPA_PARAM_ROUTE_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/utils/enum-types.h>
39
+#include <spa/param/param-types.h>
40
+
41
+#include <spa/param/route.h>
42
+
43
+#define SPA_TYPE_INFO_PARAM_Route      SPA_TYPE_INFO_PARAM_BASE "Route"
44
+#define SPA_TYPE_INFO_PARAM_ROUTE_BASE     SPA_TYPE_INFO_PARAM_Route ":"
45
+
46
+static const struct spa_type_info spa_type_param_route = {
47
+   { SPA_PARAM_ROUTE_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_ROUTE_BASE, spa_type_param, },
48
+   { SPA_PARAM_ROUTE_index, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "index", NULL, },
49
+   { SPA_PARAM_ROUTE_direction, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_ROUTE_BASE "direction", spa_type_direction, },
50
+   { SPA_PARAM_ROUTE_device, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "device", NULL, },
51
+   { SPA_PARAM_ROUTE_name, SPA_TYPE_String, SPA_TYPE_INFO_PARAM_ROUTE_BASE "name", NULL, },
52
+   { SPA_PARAM_ROUTE_description, SPA_TYPE_String, SPA_TYPE_INFO_PARAM_ROUTE_BASE "description", NULL, },
53
+   { SPA_PARAM_ROUTE_priority, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "priority", NULL, },
54
+   { SPA_PARAM_ROUTE_available, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_ROUTE_BASE "available", spa_type_param_availability, },
55
+   { SPA_PARAM_ROUTE_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_ROUTE_BASE "info", NULL, },
56
+   { SPA_PARAM_ROUTE_profiles, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", NULL, },
57
+   { SPA_PARAM_ROUTE_props, SPA_TYPE_OBJECT_Props, SPA_TYPE_INFO_PARAM_ROUTE_BASE "props", NULL, },
58
+   { SPA_PARAM_ROUTE_devices, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", NULL, },
59
+   { SPA_PARAM_ROUTE_profile, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profile", NULL, },
60
+   { SPA_PARAM_ROUTE_save, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_ROUTE_BASE "save", NULL, },
61
+   { 0, 0, NULL, NULL },
62
+};
63
+
64
+/**
65
+ * \}
66
+ */
67
+
68
+#ifdef __cplusplus
69
+}  /* extern "C" */
70
+#endif
71
+
72
+#endif /* SPA_PARAM_ROUTE_TYPES_H */
73
pipewire-0.3.65.tar.gz/spa/include/spa/param/route.h Added
71
 
1
@@ -0,0 +1,69 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_PARAM_ROUTE_H
27
+#define SPA_PARAM_ROUTE_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/param.h>
39
+
40
+/** properties for SPA_TYPE_OBJECT_ParamRoute */
41
+enum spa_param_route {
42
+   SPA_PARAM_ROUTE_START,
43
+   SPA_PARAM_ROUTE_index,          /**< index of the routing destination (Int) */
44
+   SPA_PARAM_ROUTE_direction,      /**< direction, input/output (Id enum spa_direction) */
45
+   SPA_PARAM_ROUTE_device,         /**< device id (Int) */
46
+   SPA_PARAM_ROUTE_name,           /**< name of the routing destination (String) */
47
+   SPA_PARAM_ROUTE_description,        /**< description of the destination (String) */
48
+   SPA_PARAM_ROUTE_priority,       /**< priority of the destination (Int) */
49
+   SPA_PARAM_ROUTE_available,      /**< availability of the destination
50
+                         *  (Id enum spa_param_availability) */
51
+   SPA_PARAM_ROUTE_info,           /**< info (Struct(
52
+                         *       Int : n_items,
53
+                         *       (String : key,
54
+                         *        String : value)*)) */
55
+   SPA_PARAM_ROUTE_profiles,       /**< associated profile indexes (Array of Int) */
56
+   SPA_PARAM_ROUTE_props,          /**< properties SPA_TYPE_OBJECT_Props */
57
+   SPA_PARAM_ROUTE_devices,        /**< associated device indexes (Array of Int) */
58
+   SPA_PARAM_ROUTE_profile,        /**< profile id (Int) */
59
+   SPA_PARAM_ROUTE_save,           /**< If route should be saved (Bool) */
60
+};
61
+
62
+/**
63
+ * \}
64
+ */
65
+
66
+#ifdef __cplusplus
67
+}  /* extern "C" */
68
+#endif
69
+
70
+#endif /* SPA_PARAM_ROUTE_H */
71
pipewire-0.3.64.tar.gz/spa/include/spa/param/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/type-info.h Changed
201
 
1
@@ -22,428 +22,17 @@
2
  * DEALINGS IN THE SOFTWARE.
3
  */
4
 
5
-#ifndef SPA_PARAM_TYPES_H
6
-#define SPA_PARAM_TYPES_H
7
-
8
-#ifdef __cplusplus
9
-extern "C" {
10
-#endif
11
-
12
-/**
13
- * \addtogroup spa_param
14
- * \{
15
- */
16
-
17
-#include <spa/utils/defs.h>
18
-#include <spa/param/props.h>
19
-#include <spa/param/format.h>
20
-#include <spa/buffer/type-info.h>
21
-
22
-/* base for parameter object enumerations */
23
-#define SPA_TYPE_INFO_ParamId      SPA_TYPE_INFO_ENUM_BASE "ParamId"
24
-#define SPA_TYPE_INFO_PARAM_ID_BASE    SPA_TYPE_INFO_ParamId ":"
25
-
26
-static const struct spa_type_info spa_type_param = {
27
-   { SPA_PARAM_Invalid, SPA_TYPE_None, SPA_TYPE_INFO_PARAM_ID_BASE "Invalid", NULL },
28
-   { SPA_PARAM_PropInfo, SPA_TYPE_OBJECT_PropInfo, SPA_TYPE_INFO_PARAM_ID_BASE "PropInfo", NULL },
29
-   { SPA_PARAM_Props, SPA_TYPE_OBJECT_Props, SPA_TYPE_INFO_PARAM_ID_BASE "Props", NULL },
30
-   { SPA_PARAM_EnumFormat, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_ID_BASE "EnumFormat", NULL },
31
-   { SPA_PARAM_Format, SPA_TYPE_OBJECT_Format, SPA_TYPE_INFO_PARAM_ID_BASE "Format", NULL },
32
-   { SPA_PARAM_Buffers, SPA_TYPE_OBJECT_ParamBuffers, SPA_TYPE_INFO_PARAM_ID_BASE "Buffers", NULL },
33
-   { SPA_PARAM_Meta, SPA_TYPE_OBJECT_ParamMeta, SPA_TYPE_INFO_PARAM_ID_BASE "Meta", NULL },
34
-   { SPA_PARAM_IO, SPA_TYPE_OBJECT_ParamIO, SPA_TYPE_INFO_PARAM_ID_BASE "IO", NULL },
35
-   { SPA_PARAM_EnumProfile, SPA_TYPE_OBJECT_ParamProfile, SPA_TYPE_INFO_PARAM_ID_BASE "EnumProfile", NULL },
36
-   { SPA_PARAM_Profile, SPA_TYPE_OBJECT_ParamProfile, SPA_TYPE_INFO_PARAM_ID_BASE "Profile", NULL },
37
-   { SPA_PARAM_EnumPortConfig, SPA_TYPE_OBJECT_ParamPortConfig, SPA_TYPE_INFO_PARAM_ID_BASE "EnumPortConfig", NULL },
38
-   { SPA_PARAM_PortConfig, SPA_TYPE_OBJECT_ParamPortConfig, SPA_TYPE_INFO_PARAM_ID_BASE "PortConfig", NULL },
39
-   { SPA_PARAM_EnumRoute, SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_INFO_PARAM_ID_BASE "EnumRoute", NULL },
40
-   { SPA_PARAM_Route, SPA_TYPE_OBJECT_ParamRoute, SPA_TYPE_INFO_PARAM_ID_BASE "Route", NULL },
41
-   { SPA_PARAM_Control, SPA_TYPE_Sequence, SPA_TYPE_INFO_PARAM_ID_BASE "Control", NULL },
42
-   { SPA_PARAM_Latency, SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_INFO_PARAM_ID_BASE "Latency", NULL },
43
-   { SPA_PARAM_ProcessLatency, SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_INFO_PARAM_ID_BASE "ProcessLatency", NULL },
44
-   { 0, 0, NULL, NULL },
45
-};
46
-
47
-/* base for parameter objects */
48
-#define SPA_TYPE_INFO_Param            SPA_TYPE_INFO_OBJECT_BASE "Param"
49
-#define SPA_TYPE_INFO_PARAM_BASE       SPA_TYPE_INFO_Param ":"
50
-
51
-#define SPA_TYPE_INFO_Props            SPA_TYPE_INFO_PARAM_BASE "Props"
52
-#define SPA_TYPE_INFO_PROPS_BASE       SPA_TYPE_INFO_Props ":"
53
-
54
-#include <spa/param/audio/type-info.h>
55
-#include <spa/param/video/type-info.h>
56
-#include <spa/param/bluetooth/type-info.h>
57
-
58
-static const struct spa_type_info spa_type_prop_float_array = {
59
-   { SPA_PROP_START, SPA_TYPE_Float, SPA_TYPE_INFO_BASE "floatArray", NULL, },
60
-   { 0, 0, NULL, NULL },
61
-};
62
-
63
-static const struct spa_type_info spa_type_prop_channel_map = {
64
-   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "channelMap", spa_type_audio_channel, },
65
-   { 0, 0, NULL, NULL },
66
-};
67
-
68
-static const struct spa_type_info spa_type_prop_iec958_codec = {
69
-   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "iec958Codec", spa_type_audio_iec958_codec, },
70
-   { 0, 0, NULL, NULL },
71
-};
72
-
73
-#define SPA_TYPE_INFO_ParamBitorder        SPA_TYPE_INFO_ENUM_BASE "ParamBitorder"
74
-#define SPA_TYPE_INFO_PARAM_BITORDER_BASE  SPA_TYPE_INFO_ParamBitorder ":"
75
-
76
-static const struct spa_type_info spa_type_param_bitorder = {
77
-   { SPA_PARAM_BITORDER_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "unknown", NULL },
78
-   { SPA_PARAM_BITORDER_msb, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "msb", NULL },
79
-   { SPA_PARAM_BITORDER_lsb, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BITORDER_BASE "lsb", NULL },
80
-   { 0, 0, NULL, NULL },
81
-};
82
-
83
-static const struct spa_type_info spa_type_props = {
84
-   { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE, spa_type_param, },
85
-   { SPA_PROP_unknown, SPA_TYPE_None, SPA_TYPE_INFO_PROPS_BASE "unknown", NULL },
86
-   { SPA_PROP_device, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "device", NULL },
87
-   { SPA_PROP_deviceName, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "deviceName", NULL },
88
-   { SPA_PROP_deviceFd, SPA_TYPE_Fd, SPA_TYPE_INFO_PROPS_BASE "deviceFd", NULL },
89
-   { SPA_PROP_card, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "card", NULL },
90
-   { SPA_PROP_cardName, SPA_TYPE_String, SPA_TYPE_INFO_PROPS_BASE "cardName", NULL },
91
-   { SPA_PROP_minLatency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "minLatency", NULL },
92
-   { SPA_PROP_maxLatency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "maxLatency", NULL },
93
-   { SPA_PROP_periods, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "periods", NULL },
94
-   { SPA_PROP_periodSize, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "periodSize", NULL },
95
-   { SPA_PROP_periodEvent, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "periodEvent", NULL },
96
-   { SPA_PROP_live, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "live", NULL },
97
-   { SPA_PROP_rate, SPA_TYPE_Double, SPA_TYPE_INFO_PROPS_BASE "rate", NULL },
98
-   { SPA_PROP_quality, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "quality", NULL },
99
-   { SPA_PROP_bluetoothAudioCodec, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "bluetoothAudioCodec", spa_type_bluetooth_audio_codec },
100
-   { SPA_PROP_bluetoothOffloadActive, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "bluetoothOffloadActive", NULL },
101
-
102
-   { SPA_PROP_waveType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "waveType", NULL },
103
-   { SPA_PROP_frequency, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "frequency", NULL },
104
-   { SPA_PROP_volume, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volume", NULL },
105
-   { SPA_PROP_mute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "mute", NULL },
106
-   { SPA_PROP_patternType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "patternType", NULL },
107
-   { SPA_PROP_ditherType, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "ditherType", NULL },
108
-   { SPA_PROP_truncate, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "truncate", NULL },
109
-   { SPA_PROP_channelVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "channelVolumes", spa_type_prop_float_array },
110
-   { SPA_PROP_volumeBase, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volumeBase", NULL },
111
-   { SPA_PROP_volumeStep, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "volumeStep", NULL },
112
-   { SPA_PROP_channelMap, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "channelMap", spa_type_prop_channel_map },
113
-   { SPA_PROP_monitorMute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "monitorMute", NULL },
114
-   { SPA_PROP_monitorVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "monitorVolumes", spa_type_prop_float_array },
115
-   { SPA_PROP_latencyOffsetNsec, SPA_TYPE_Long, SPA_TYPE_INFO_PROPS_BASE "latencyOffsetNsec", NULL },
116
-   { SPA_PROP_softMute, SPA_TYPE_Bool, SPA_TYPE_INFO_PROPS_BASE "softMute", NULL },
117
-   { SPA_PROP_softVolumes, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "softVolumes", spa_type_prop_float_array },
118
-   { SPA_PROP_iec958Codecs, SPA_TYPE_Array, SPA_TYPE_INFO_PROPS_BASE "iec958Codecs", spa_type_prop_iec958_codec },
119
-
120
-   { SPA_PROP_brightness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "brightness", NULL },
121
-   { SPA_PROP_contrast, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "contrast", NULL },
122
-   { SPA_PROP_saturation, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "saturation", NULL },
123
-   { SPA_PROP_hue, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "hue", NULL },
124
-   { SPA_PROP_gamma, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gamma", NULL },
125
-   { SPA_PROP_exposure, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "exposure", NULL },
126
-   { SPA_PROP_gain, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gain", NULL },
127
-   { SPA_PROP_sharpness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "sharpness", NULL },
128
-
129
-   { SPA_PROP_params, SPA_TYPE_Struct, SPA_TYPE_INFO_PROPS_BASE "params", NULL },
130
-   { 0, 0, NULL, NULL },
131
-};
132
-
133
-/** Enum Property info */
134
-#define SPA_TYPE_INFO_PropInfo         SPA_TYPE_INFO_PARAM_BASE "PropInfo"
135
-#define SPA_TYPE_INFO_PROP_INFO_BASE       SPA_TYPE_INFO_PropInfo ":"
136
-
137
-static const struct spa_type_info spa_type_prop_info = {
138
-   { SPA_PROP_INFO_START, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE, spa_type_param, },
139
-   { SPA_PROP_INFO_id, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE "id", spa_type_props },
140
-   { SPA_PROP_INFO_name, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "name", NULL },
141
-   { SPA_PROP_INFO_type, SPA_TYPE_Pod, SPA_TYPE_INFO_PROP_INFO_BASE "type", NULL },
142
-   { SPA_PROP_INFO_labels, SPA_TYPE_Struct, SPA_TYPE_INFO_PROP_INFO_BASE "labels", NULL },
143
-   { SPA_PROP_INFO_container, SPA_TYPE_Id, SPA_TYPE_INFO_PROP_INFO_BASE "container", NULL },
144
-   { SPA_PROP_INFO_params, SPA_TYPE_Bool, SPA_TYPE_INFO_PROP_INFO_BASE "params", NULL },
145
-   { SPA_PROP_INFO_description, SPA_TYPE_String, SPA_TYPE_INFO_PROP_INFO_BASE "description", NULL },
146
-   { 0, 0, NULL, NULL },
147
-};
148
-
149
-#define SPA_TYPE_INFO_PARAM_Meta       SPA_TYPE_INFO_PARAM_BASE "Meta"
150
-#define SPA_TYPE_INFO_PARAM_META_BASE      SPA_TYPE_INFO_PARAM_Meta ":"
151
-
152
-static const struct spa_type_info spa_type_param_meta = {
153
-   { SPA_PARAM_META_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_META_BASE, spa_type_param },
154
-   { SPA_PARAM_META_type, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_META_BASE "type", spa_type_meta_type },
155
-   { SPA_PARAM_META_size, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_META_BASE "size", NULL },
156
-   { 0, 0, NULL, NULL },
157
-};
158
-
159
-/** Base for parameters that describe IO areas to exchange data,
160
- * control and properties with a node.
161
- */
162
-#define SPA_TYPE_INFO_PARAM_IO     SPA_TYPE_INFO_PARAM_BASE "IO"
163
-#define SPA_TYPE_INFO_PARAM_IO_BASE        SPA_TYPE_INFO_PARAM_IO ":"
164
-
165
-static const struct spa_type_info spa_type_param_io = {
166
-   { SPA_PARAM_IO_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_IO_BASE, spa_type_param, },
167
-   { SPA_PARAM_IO_id, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_IO_BASE "id", spa_type_io },
168
-   { SPA_PARAM_IO_size, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_IO_BASE "size", NULL },
169
-   { 0, 0, NULL, NULL },
170
-};
171
-
172
-#define SPA_TYPE_INFO_Format           SPA_TYPE_INFO_PARAM_BASE "Format"
173
-#define SPA_TYPE_INFO_FORMAT_BASE      SPA_TYPE_INFO_Format ":"
174
-
175
-#define SPA_TYPE_INFO_MediaType        SPA_TYPE_INFO_ENUM_BASE "MediaType"
176
-#define SPA_TYPE_INFO_MEDIA_TYPE_BASE  SPA_TYPE_INFO_MediaType ":"
177
-
178
-static const struct spa_type_info spa_type_media_type = {
179
-   { SPA_MEDIA_TYPE_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "unknown", NULL },
180
-   { SPA_MEDIA_TYPE_audio,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "audio", NULL },
181
-   { SPA_MEDIA_TYPE_video,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "video", NULL },
182
-   { SPA_MEDIA_TYPE_image,   SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "image", NULL },
183
-   { SPA_MEDIA_TYPE_binary,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "binary", NULL },
184
-   { SPA_MEDIA_TYPE_stream,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "stream", NULL },
185
-   { SPA_MEDIA_TYPE_application,  SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_TYPE_BASE "application", NULL },
186
-   { 0, 0, NULL, NULL },
187
-};
188
-
189
-#define SPA_TYPE_INFO_MediaSubtype     SPA_TYPE_INFO_ENUM_BASE "MediaSubtype"
190
-#define SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE   SPA_TYPE_INFO_MediaSubtype ":"
191
-
192
-static const struct spa_type_info spa_type_media_subtype = {
193
-   { SPA_MEDIA_SUBTYPE_unknown, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "unknown", NULL },
194
-   /* generic subtypes */
195
-   { SPA_MEDIA_SUBTYPE_raw, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "raw", NULL },
196
-   { SPA_MEDIA_SUBTYPE_dsp, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "dsp", NULL },
197
-   { SPA_MEDIA_SUBTYPE_iec958, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "iec958", NULL },
198
-   { SPA_MEDIA_SUBTYPE_dsd, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "dsd", NULL },
199
-   /* audio subtypes */
200
-   { SPA_MEDIA_SUBTYPE_mp3, SPA_TYPE_Int, SPA_TYPE_INFO_MEDIA_SUBTYPE_BASE "mp3", NULL },
201
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/dsp-utils.h Added
85
 
1
@@ -0,0 +1,83 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_DSP_UTILS_H
27
+#define SPA_VIDEO_DSP_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/video/dsp.h>
41
+
42
+static inline int
43
+spa_format_video_dsp_parse(const struct spa_pod *format,
44
+              struct spa_video_info_dsp *info)
45
+{
46
+   info->flags = SPA_VIDEO_FLAG_NONE;
47
+   if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) {
48
+       info->flags |= SPA_VIDEO_FLAG_MODIFIER;
49
+   }
50
+
51
+   return spa_pod_parse_object(format,
52
+       SPA_TYPE_OBJECT_Format, NULL,
53
+       SPA_FORMAT_VIDEO_format,        SPA_POD_OPT_Id(&info->format),
54
+       SPA_FORMAT_VIDEO_modifier,      SPA_POD_OPT_Long(&info->modifier));
55
+}
56
+
57
+static inline struct spa_pod *
58
+spa_format_video_dsp_build(struct spa_pod_builder *builder, uint32_t id,
59
+              struct spa_video_info_dsp *info)
60
+{
61
+   struct spa_pod_frame f;
62
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
63
+   spa_pod_builder_add(builder,
64
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
65
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsp),
66
+           0);
67
+   if (info->format != SPA_VIDEO_FORMAT_UNKNOWN)
68
+       spa_pod_builder_add(builder,
69
+           SPA_FORMAT_VIDEO_format,    SPA_POD_Id(info->format), 0);
70
+   if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER)
71
+       spa_pod_builder_add(builder,
72
+           SPA_FORMAT_VIDEO_modifier,  SPA_POD_Long(info->modifier), 0);
73
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
74
+}
75
+
76
+/**
77
+ * \}
78
+ */
79
+
80
+#ifdef __cplusplus
81
+} /* extern "C" */
82
+#endif
83
+
84
+#endif /* SPA_VIDEO_DSP_UTILS_H */
85
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/dsp.h Added
57
 
1
@@ -0,0 +1,55 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_DSP_H
27
+#define SPA_VIDEO_DSP_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/video/raw.h>
39
+
40
+struct spa_video_info_dsp {
41
+   enum spa_video_format format;
42
+   uint32_t flags;
43
+   uint64_t modifier;
44
+};
45
+
46
+#define SPA_VIDEO_INFO_DSP_INIT(...)   ((struct spa_video_info_dsp) { __VA_ARGS__ })
47
+
48
+/**
49
+ * \}
50
+ */
51
+
52
+#ifdef __cplusplus
53
+} /* extern "C" */
54
+#endif
55
+
56
+#endif /* SPA_VIDEO_DSP_H */
57
pipewire-0.3.64.tar.gz/spa/include/spa/param/video/encoded.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/video/encoded.h Changed
54
 
1
@@ -25,50 +25,7 @@
2
 #ifndef SPA_VIDEO_ENCODED_H
3
 #define SPA_VIDEO_ENCODED_H
4
 
5
-#ifdef __cplusplus
6
-extern "C" {
7
-#endif
8
-
9
-/**
10
- * \addtogroup spa_param
11
- * \{
12
- */
13
-
14
-#include <spa/param/format.h>
15
-
16
-enum spa_h264_stream_format {
17
-   SPA_H264_STREAM_FORMAT_UNKNOWN = 0,
18
-   SPA_H264_STREAM_FORMAT_AVC,
19
-   SPA_H264_STREAM_FORMAT_AVC3,
20
-   SPA_H264_STREAM_FORMAT_BYTESTREAM
21
-};
22
-
23
-enum spa_h264_alignment {
24
-   SPA_H264_ALIGNMENT_UNKNOWN = 0,
25
-   SPA_H264_ALIGNMENT_AU,
26
-   SPA_H264_ALIGNMENT_NAL
27
-};
28
-
29
-struct spa_video_info_h264 {
30
-   struct spa_rectangle size;
31
-   struct spa_fraction framerate;
32
-   struct spa_fraction max_framerate;
33
-   enum spa_h264_stream_format stream_format;
34
-   enum spa_h264_alignment alignment;
35
-};
36
-
37
-struct spa_video_info_mjpg {
38
-   struct spa_rectangle size;
39
-   struct spa_fraction framerate;
40
-   struct spa_fraction max_framerate;
41
-};
42
-
43
-/**
44
- * \}
45
- */
46
-
47
-#ifdef __cplusplus
48
-} /* extern "C" */
49
-#endif
50
+#include <spa/param/video/h264.h>
51
+#include <spa/param/video/mjpg.h>
52
 
53
 #endif /* SPA_VIDEO_ENCODED_H */
54
pipewire-0.3.64.tar.gz/spa/include/spa/param/video/format-utils.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/video/format-utils.h Changed
201
 
1
@@ -29,203 +29,54 @@
2
 extern "C" {
3
 #endif
4
 
5
-/**
6
- * \addtogroup spa_param
7
- * \{
8
- */
9
-#include <spa/pod/parser.h>
10
-#include <spa/pod/builder.h>
11
-#include <spa/param/video/format.h>
12
 #include <spa/param/format-utils.h>
13
+#include <spa/param/video/format.h>
14
+#include <spa/param/video/raw-utils.h>
15
+#include <spa/param/video/dsp-utils.h>
16
+#include <spa/param/video/h264-utils.h>
17
+#include <spa/param/video/mjpg-utils.h>
18
 
19
 static inline int
20
-spa_format_video_raw_parse(const struct spa_pod *format,
21
-              struct spa_video_info_raw *info)
22
-{
23
-   return spa_pod_parse_object(format,
24
-       SPA_TYPE_OBJECT_Format, NULL,
25
-       SPA_FORMAT_VIDEO_format,        SPA_POD_OPT_Id(&info->format),
26
-       SPA_FORMAT_VIDEO_modifier,      SPA_POD_OPT_Long(&info->modifier),
27
-       SPA_FORMAT_VIDEO_size,          SPA_POD_OPT_Rectangle(&info->size),
28
-       SPA_FORMAT_VIDEO_framerate,     SPA_POD_OPT_Fraction(&info->framerate),
29
-       SPA_FORMAT_VIDEO_maxFramerate,      SPA_POD_OPT_Fraction(&info->max_framerate),
30
-       SPA_FORMAT_VIDEO_views,         SPA_POD_OPT_Int(&info->views),
31
-       SPA_FORMAT_VIDEO_interlaceMode,     SPA_POD_OPT_Id(&info->interlace_mode),
32
-       SPA_FORMAT_VIDEO_pixelAspectRatio,  SPA_POD_OPT_Fraction(&info->pixel_aspect_ratio),
33
-       SPA_FORMAT_VIDEO_multiviewMode,     SPA_POD_OPT_Id(&info->multiview_mode),
34
-       SPA_FORMAT_VIDEO_multiviewFlags,    SPA_POD_OPT_Id(&info->multiview_flags),
35
-       SPA_FORMAT_VIDEO_chromaSite,        SPA_POD_OPT_Id(&info->chroma_site),
36
-       SPA_FORMAT_VIDEO_colorRange,        SPA_POD_OPT_Id(&info->color_range),
37
-       SPA_FORMAT_VIDEO_colorMatrix,       SPA_POD_OPT_Id(&info->color_matrix),
38
-       SPA_FORMAT_VIDEO_transferFunction,  SPA_POD_OPT_Id(&info->transfer_function),
39
-       SPA_FORMAT_VIDEO_colorPrimaries,    SPA_POD_OPT_Id(&info->color_primaries));
40
-}
41
-
42
-static inline int
43
-spa_format_video_dsp_parse(const struct spa_pod *format,
44
-              struct spa_video_info_dsp *info)
45
-{
46
-   return spa_pod_parse_object(format,
47
-       SPA_TYPE_OBJECT_Format, NULL,
48
-       SPA_FORMAT_VIDEO_format,        SPA_POD_OPT_Id(&info->format),
49
-       SPA_FORMAT_VIDEO_modifier,      SPA_POD_OPT_Long(&info->modifier));
50
-}
51
-
52
-static inline struct spa_pod *
53
-spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
54
-              struct spa_video_info_raw *info)
55
-{
56
-   struct spa_pod_frame f;
57
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
58
-   spa_pod_builder_add(builder,
59
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
60
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
61
-           0);
62
-   if (info->format != SPA_VIDEO_FORMAT_UNKNOWN)
63
-       spa_pod_builder_add(builder,
64
-           SPA_FORMAT_VIDEO_format,    SPA_POD_Id(info->format), 0);
65
-   if (info->size.width != 0 && info->size.height != 0)
66
-       spa_pod_builder_add(builder,
67
-           SPA_FORMAT_VIDEO_size,      SPA_POD_Rectangle(&info->size), 0);
68
-   if (info->framerate.denom != 0)
69
-       spa_pod_builder_add(builder,
70
-           SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0);
71
-   if (info->modifier != 0)
72
-       spa_pod_builder_add(builder,
73
-           SPA_FORMAT_VIDEO_modifier,  SPA_POD_Long(info->modifier), 0);
74
-   if (info->max_framerate.denom != 0)
75
-       spa_pod_builder_add(builder,
76
-           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_Fraction(info->max_framerate), 0);
77
-   if (info->views != 0)
78
-       spa_pod_builder_add(builder,
79
-           SPA_FORMAT_VIDEO_views,     SPA_POD_Int(info->views), 0);
80
-   if (info->interlace_mode != 0)
81
-       spa_pod_builder_add(builder,
82
-           SPA_FORMAT_VIDEO_interlaceMode, SPA_POD_Id(info->interlace_mode), 0);
83
-   if (info->pixel_aspect_ratio.denom != 0)
84
-       spa_pod_builder_add(builder,
85
-           SPA_FORMAT_VIDEO_pixelAspectRatio,SPA_POD_Fraction(info->pixel_aspect_ratio), 0);
86
-   if (info->multiview_mode != 0)
87
-       spa_pod_builder_add(builder,
88
-           SPA_FORMAT_VIDEO_multiviewMode, SPA_POD_Id(info->multiview_mode), 0);
89
-   if (info->multiview_flags != 0)
90
-       spa_pod_builder_add(builder,
91
-           SPA_FORMAT_VIDEO_multiviewFlags,SPA_POD_Id(info->multiview_flags), 0);
92
-   if (info->chroma_site != 0)
93
-       spa_pod_builder_add(builder,
94
-           SPA_FORMAT_VIDEO_chromaSite,    SPA_POD_Id(info->chroma_site), 0);
95
-   if (info->color_range != 0)
96
-       spa_pod_builder_add(builder,
97
-           SPA_FORMAT_VIDEO_colorRange,    SPA_POD_Id(info->color_range), 0);
98
-   if (info->color_matrix != 0)
99
-       spa_pod_builder_add(builder,
100
-           SPA_FORMAT_VIDEO_colorMatrix,   SPA_POD_Id(info->color_matrix), 0);
101
-   if (info->transfer_function != 0)
102
-       spa_pod_builder_add(builder,
103
-           SPA_FORMAT_VIDEO_transferFunction,SPA_POD_Id(info->transfer_function), 0);
104
-   if (info->color_primaries != 0)
105
-       spa_pod_builder_add(builder,
106
-           SPA_FORMAT_VIDEO_colorPrimaries,SPA_POD_Id(info->color_primaries), 0);
107
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
108
-}
109
-
110
-static inline struct spa_pod *
111
-spa_format_video_dsp_build(struct spa_pod_builder *builder, uint32_t id,
112
-              struct spa_video_info_dsp *info)
113
+spa_format_video_parse(const struct spa_pod *format, struct spa_video_info *info)
114
 {
115
-   struct spa_pod_frame f;
116
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
117
-   spa_pod_builder_add(builder,
118
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
119
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_dsp),
120
-           0);
121
-   if (info->format != SPA_VIDEO_FORMAT_UNKNOWN)
122
-       spa_pod_builder_add(builder,
123
-           SPA_FORMAT_VIDEO_format,    SPA_POD_Id(info->format), 0);
124
-   if (info->modifier)
125
-       spa_pod_builder_add(builder,
126
-           SPA_FORMAT_VIDEO_modifier,  SPA_POD_Long(info->modifier), 0);
127
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
128
-}
129
+   int res;
130
 
131
-static inline int
132
-spa_format_video_h264_parse(const struct spa_pod *format,
133
-               struct spa_video_info_h264 *info)
134
-{
135
-   return spa_pod_parse_object(format,
136
-           SPA_TYPE_OBJECT_Format, NULL,
137
-           SPA_FORMAT_VIDEO_size,          SPA_POD_OPT_Rectangle(&info->size),
138
-           SPA_FORMAT_VIDEO_framerate,     SPA_POD_OPT_Fraction(&info->framerate),
139
-           SPA_FORMAT_VIDEO_maxFramerate,      SPA_POD_OPT_Fraction(&info->max_framerate),
140
-           SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_OPT_Id(&info->stream_format),
141
-           SPA_FORMAT_VIDEO_H264_alignment,    SPA_POD_OPT_Id(&info->alignment));
142
-}
143
+   if ((res = spa_format_parse(format, &info->media_type, &info->media_subtype)) < 0)
144
+       return res;
145
 
146
-static inline struct spa_pod *
147
-spa_format_video_h264_build(struct spa_pod_builder *builder, uint32_t id,
148
-              struct spa_video_info_h264 *info)
149
-{
150
-   struct spa_pod_frame f;
151
-   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
152
-   spa_pod_builder_add(builder,
153
-           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
154
-           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_h264),
155
-           0);
156
-   if (info->size.width != 0 && info->size.height != 0)
157
-       spa_pod_builder_add(builder,
158
-           SPA_FORMAT_VIDEO_size,      SPA_POD_Rectangle(&info->size), 0);
159
-   if (info->framerate.denom != 0)
160
-       spa_pod_builder_add(builder,
161
-           SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0);
162
-   if (info->max_framerate.denom != 0)
163
-       spa_pod_builder_add(builder,
164
-           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_Fraction(info->max_framerate), 0);
165
-   if (info->stream_format != 0)
166
-       spa_pod_builder_add(builder,
167
-           SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_Id(info->stream_format), 0);
168
-   if (info->alignment != 0)
169
-       spa_pod_builder_add(builder,
170
-           SPA_FORMAT_VIDEO_H264_alignment, SPA_POD_Id(info->alignment), 0);
171
-   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
172
-}
173
+   if (info->media_type != SPA_MEDIA_TYPE_video)
174
+       return -EINVAL;
175
 
176
-static inline int
177
-spa_format_video_mjpg_parse(const struct spa_pod *format,
178
-               struct spa_video_info_mjpg *info)
179
-{
180
-   return spa_pod_parse_object(format,
181
-           SPA_TYPE_OBJECT_Format, NULL,
182
-           SPA_FORMAT_VIDEO_size,      SPA_POD_OPT_Rectangle(&info->size),
183
-           SPA_FORMAT_VIDEO_framerate, SPA_POD_OPT_Fraction(&info->framerate),
184
-           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_OPT_Fraction(&info->max_framerate));
185
+   switch (info->media_subtype) {
186
+   case SPA_MEDIA_SUBTYPE_raw:
187
+       return spa_format_video_raw_parse(format, &info->info.raw);
188
+   case SPA_MEDIA_SUBTYPE_dsp:
189
+       return spa_format_video_dsp_parse(format, &info->info.dsp);
190
+   case SPA_MEDIA_SUBTYPE_h264:
191
+       return spa_format_video_h264_parse(format, &info->info.h264);
192
+   case SPA_MEDIA_SUBTYPE_mjpg:
193
+       return spa_format_video_mjpg_parse(format, &info->info.mjpg);
194
+   }
195
+   return -ENOTSUP;
196
 }
197
 
198
 static inline struct spa_pod *
199
-spa_format_video_mjpg_build(struct spa_pod_builder *builder, uint32_t id,
200
-              struct spa_video_info_mjpg *info)
201
pipewire-0.3.64.tar.gz/spa/include/spa/param/video/format.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/video/format.h Changed
11
 
1
@@ -34,7 +34,9 @@
2
  * \{
3
  */
4
 
5
+#include <spa/param/format.h>
6
 #include <spa/param/video/raw.h>
7
+#include <spa/param/video/dsp.h>
8
 #include <spa/param/video/encoded.h>
9
 
10
 struct spa_video_info {
11
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/h264-utils.h Added
92
 
1
@@ -0,0 +1,90 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_H264_UTILS_H
27
+#define SPA_VIDEO_H264_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/video/h264.h>
41
+
42
+static inline int
43
+spa_format_video_h264_parse(const struct spa_pod *format,
44
+               struct spa_video_info_h264 *info)
45
+{
46
+   return spa_pod_parse_object(format,
47
+           SPA_TYPE_OBJECT_Format, NULL,
48
+           SPA_FORMAT_VIDEO_size,          SPA_POD_OPT_Rectangle(&info->size),
49
+           SPA_FORMAT_VIDEO_framerate,     SPA_POD_OPT_Fraction(&info->framerate),
50
+           SPA_FORMAT_VIDEO_maxFramerate,      SPA_POD_OPT_Fraction(&info->max_framerate),
51
+           SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_OPT_Id(&info->stream_format),
52
+           SPA_FORMAT_VIDEO_H264_alignment,    SPA_POD_OPT_Id(&info->alignment));
53
+}
54
+
55
+static inline struct spa_pod *
56
+spa_format_video_h264_build(struct spa_pod_builder *builder, uint32_t id,
57
+              struct spa_video_info_h264 *info)
58
+{
59
+   struct spa_pod_frame f;
60
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
61
+   spa_pod_builder_add(builder,
62
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
63
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_h264),
64
+           0);
65
+   if (info->size.width != 0 && info->size.height != 0)
66
+       spa_pod_builder_add(builder,
67
+           SPA_FORMAT_VIDEO_size,      SPA_POD_Rectangle(&info->size), 0);
68
+   if (info->framerate.denom != 0)
69
+       spa_pod_builder_add(builder,
70
+           SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0);
71
+   if (info->max_framerate.denom != 0)
72
+       spa_pod_builder_add(builder,
73
+           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_Fraction(info->max_framerate), 0);
74
+   if (info->stream_format != 0)
75
+       spa_pod_builder_add(builder,
76
+           SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_Id(info->stream_format), 0);
77
+   if (info->alignment != 0)
78
+       spa_pod_builder_add(builder,
79
+           SPA_FORMAT_VIDEO_H264_alignment, SPA_POD_Id(info->alignment), 0);
80
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
81
+}
82
+
83
+/**
84
+ * \}
85
+ */
86
+
87
+#ifdef __cplusplus
88
+} /* extern "C" */
89
+#endif
90
+
91
+#endif /* SPA_VIDEO_H264_UTILS_H */
92
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/h264.h Added
70
 
1
@@ -0,0 +1,68 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_H264_H
27
+#define SPA_VIDEO_H264_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/format.h>
39
+
40
+enum spa_h264_stream_format {
41
+   SPA_H264_STREAM_FORMAT_UNKNOWN = 0,
42
+   SPA_H264_STREAM_FORMAT_AVC,
43
+   SPA_H264_STREAM_FORMAT_AVC3,
44
+   SPA_H264_STREAM_FORMAT_BYTESTREAM
45
+};
46
+
47
+enum spa_h264_alignment {
48
+   SPA_H264_ALIGNMENT_UNKNOWN = 0,
49
+   SPA_H264_ALIGNMENT_AU,
50
+   SPA_H264_ALIGNMENT_NAL
51
+};
52
+
53
+struct spa_video_info_h264 {
54
+   struct spa_rectangle size;
55
+   struct spa_fraction framerate;
56
+   struct spa_fraction max_framerate;
57
+   enum spa_h264_stream_format stream_format;
58
+   enum spa_h264_alignment alignment;
59
+};
60
+
61
+/**
62
+ * \}
63
+ */
64
+
65
+#ifdef __cplusplus
66
+} /* extern "C" */
67
+#endif
68
+
69
+#endif /* SPA_VIDEO_H264_H */
70
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/mjpg-utils.h Added
84
 
1
@@ -0,0 +1,82 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_MJPG_UTILS_H
27
+#define SPA_VIDEO_MJPG_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/video/mjpg.h>
41
+
42
+static inline int
43
+spa_format_video_mjpg_parse(const struct spa_pod *format,
44
+               struct spa_video_info_mjpg *info)
45
+{
46
+   return spa_pod_parse_object(format,
47
+           SPA_TYPE_OBJECT_Format, NULL,
48
+           SPA_FORMAT_VIDEO_size,      SPA_POD_OPT_Rectangle(&info->size),
49
+           SPA_FORMAT_VIDEO_framerate, SPA_POD_OPT_Fraction(&info->framerate),
50
+           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_OPT_Fraction(&info->max_framerate));
51
+}
52
+
53
+static inline struct spa_pod *
54
+spa_format_video_mjpg_build(struct spa_pod_builder *builder, uint32_t id,
55
+              struct spa_video_info_mjpg *info)
56
+{
57
+   struct spa_pod_frame f;
58
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
59
+   spa_pod_builder_add(builder,
60
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
61
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_mjpg),
62
+           0);
63
+   if (info->size.width != 0 && info->size.height != 0)
64
+       spa_pod_builder_add(builder,
65
+           SPA_FORMAT_VIDEO_size,      SPA_POD_Rectangle(&info->size), 0);
66
+   if (info->framerate.denom != 0)
67
+       spa_pod_builder_add(builder,
68
+           SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0);
69
+   if (info->max_framerate.denom != 0)
70
+       spa_pod_builder_add(builder,
71
+           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_Fraction(info->max_framerate), 0);
72
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
73
+}
74
+
75
+/**
76
+ * \}
77
+ */
78
+
79
+#ifdef __cplusplus
80
+} /* extern "C" */
81
+#endif
82
+
83
+#endif /* SPA_VIDEO_MJPG_UTILS_H */
84
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/mjpg.h Added
55
 
1
@@ -0,0 +1,53 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_MJPG_H
27
+#define SPA_VIDEO_MJPG_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/param/format.h>
39
+
40
+struct spa_video_info_mjpg {
41
+   struct spa_rectangle size;
42
+   struct spa_fraction framerate;
43
+   struct spa_fraction max_framerate;
44
+};
45
+
46
+/**
47
+ * \}
48
+ */
49
+
50
+#ifdef __cplusplus
51
+} /* extern "C" */
52
+#endif
53
+
54
+#endif /* SPA_VIDEO_MJPG_H */
55
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/raw-types.h Added
166
 
1
@@ -0,0 +1,164 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_RAW_TYPES_H
27
+#define SPA_VIDEO_RAW_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+#include <spa/utils/type.h>
38
+#include <spa/param/video/raw.h>
39
+
40
+#define SPA_TYPE_INFO_VideoFormat      SPA_TYPE_INFO_ENUM_BASE "VideoFormat"
41
+#define SPA_TYPE_INFO_VIDEO_FORMAT_BASE        SPA_TYPE_INFO_VideoFormat ":"
42
+
43
+static const struct spa_type_info spa_type_video_format = {
44
+   { SPA_VIDEO_FORMAT_ENCODED, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "encoded", NULL },
45
+   { SPA_VIDEO_FORMAT_I420,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420", NULL },
46
+   { SPA_VIDEO_FORMAT_YV12,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YV12", NULL },
47
+   { SPA_VIDEO_FORMAT_YUY2,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YUY2", NULL },
48
+   { SPA_VIDEO_FORMAT_UYVY,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "UYVY", NULL },
49
+   { SPA_VIDEO_FORMAT_AYUV,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "AYUV", NULL },
50
+   { SPA_VIDEO_FORMAT_RGBx,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBx", NULL },
51
+   { SPA_VIDEO_FORMAT_BGRx,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRx", NULL },
52
+   { SPA_VIDEO_FORMAT_xRGB,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xRGB", NULL },
53
+   { SPA_VIDEO_FORMAT_xBGR,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xBGR", NULL },
54
+   { SPA_VIDEO_FORMAT_RGBA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA", NULL },
55
+   { SPA_VIDEO_FORMAT_BGRA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRA", NULL },
56
+   { SPA_VIDEO_FORMAT_ARGB,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB", NULL },
57
+   { SPA_VIDEO_FORMAT_ABGR,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ABGR", NULL },
58
+   { SPA_VIDEO_FORMAT_RGB,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB", NULL },
59
+   { SPA_VIDEO_FORMAT_BGR,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR", NULL },
60
+   { SPA_VIDEO_FORMAT_Y41B,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y41B", NULL },
61
+   { SPA_VIDEO_FORMAT_Y42B,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y42B", NULL },
62
+   { SPA_VIDEO_FORMAT_YVYU,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YVYU", NULL },
63
+   { SPA_VIDEO_FORMAT_Y444,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444", NULL },
64
+   { SPA_VIDEO_FORMAT_v210,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v210", NULL },
65
+   { SPA_VIDEO_FORMAT_v216,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v216", NULL },
66
+   { SPA_VIDEO_FORMAT_NV12,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV12", NULL },
67
+   { SPA_VIDEO_FORMAT_NV21,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV21", NULL },
68
+   { SPA_VIDEO_FORMAT_GRAY8,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY8", NULL },
69
+   { SPA_VIDEO_FORMAT_GRAY16_BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY16_BE", NULL },
70
+   { SPA_VIDEO_FORMAT_GRAY16_LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY16_LE", NULL },
71
+   { SPA_VIDEO_FORMAT_v308,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v308", NULL },
72
+   { SPA_VIDEO_FORMAT_RGB16,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB16", NULL },
73
+   { SPA_VIDEO_FORMAT_BGR16,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR16", NULL },
74
+   { SPA_VIDEO_FORMAT_RGB15,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB15", NULL },
75
+   { SPA_VIDEO_FORMAT_BGR15,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR15", NULL },
76
+   { SPA_VIDEO_FORMAT_UYVP,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "UYVP", NULL },
77
+   { SPA_VIDEO_FORMAT_A420,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420", NULL },
78
+   { SPA_VIDEO_FORMAT_RGB8P,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB8P", NULL },
79
+   { SPA_VIDEO_FORMAT_YUV9,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YUV9", NULL },
80
+   { SPA_VIDEO_FORMAT_YVU9,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YVU9", NULL },
81
+   { SPA_VIDEO_FORMAT_IYU1,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "IYU1", NULL },
82
+   { SPA_VIDEO_FORMAT_ARGB64,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB64", NULL },
83
+   { SPA_VIDEO_FORMAT_AYUV64,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "AYUV64", NULL },
84
+   { SPA_VIDEO_FORMAT_r210,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "r210", NULL },
85
+   { SPA_VIDEO_FORMAT_I420_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_10BE", NULL },
86
+   { SPA_VIDEO_FORMAT_I420_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_10LE", NULL },
87
+   { SPA_VIDEO_FORMAT_I422_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_10BE", NULL },
88
+   { SPA_VIDEO_FORMAT_I422_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_10LE", NULL },
89
+   { SPA_VIDEO_FORMAT_Y444_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_10BE", NULL },
90
+   { SPA_VIDEO_FORMAT_Y444_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_10LE", NULL },
91
+   { SPA_VIDEO_FORMAT_GBR,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR", NULL },
92
+   { SPA_VIDEO_FORMAT_GBR_10BE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_10BE", NULL },
93
+   { SPA_VIDEO_FORMAT_GBR_10LE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_10LE", NULL },
94
+   { SPA_VIDEO_FORMAT_NV16,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV16", NULL },
95
+   { SPA_VIDEO_FORMAT_NV24,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV24", NULL },
96
+   { SPA_VIDEO_FORMAT_NV12_64Z32,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV12_64Z32", NULL },
97
+   { SPA_VIDEO_FORMAT_A420_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420_10BE", NULL },
98
+   { SPA_VIDEO_FORMAT_A420_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420_10LE", NULL },
99
+   { SPA_VIDEO_FORMAT_A422_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A422_10BE", NULL },
100
+   { SPA_VIDEO_FORMAT_A422_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A422_10LE", NULL },
101
+   { SPA_VIDEO_FORMAT_A444_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A444_10BE", NULL },
102
+   { SPA_VIDEO_FORMAT_A444_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A444_10LE", NULL },
103
+   { SPA_VIDEO_FORMAT_NV61,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV61", NULL },
104
+   { SPA_VIDEO_FORMAT_P010_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "P010_10BE", NULL },
105
+   { SPA_VIDEO_FORMAT_P010_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "P010_10LE", NULL },
106
+   { SPA_VIDEO_FORMAT_IYU2,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "IYU2", NULL },
107
+   { SPA_VIDEO_FORMAT_VYUY,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "VYUY", NULL },
108
+   { SPA_VIDEO_FORMAT_GBRA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA", NULL },
109
+   { SPA_VIDEO_FORMAT_GBRA_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_10BE", NULL },
110
+   { SPA_VIDEO_FORMAT_GBRA_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_10LE", NULL },
111
+   { SPA_VIDEO_FORMAT_GBR_12BE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_12BE", NULL },
112
+   { SPA_VIDEO_FORMAT_GBR_12LE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_12LE", NULL },
113
+   { SPA_VIDEO_FORMAT_GBRA_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_12BE", NULL },
114
+   { SPA_VIDEO_FORMAT_GBRA_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_12LE", NULL },
115
+   { SPA_VIDEO_FORMAT_I420_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_12BE", NULL },
116
+   { SPA_VIDEO_FORMAT_I420_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_12LE", NULL },
117
+   { SPA_VIDEO_FORMAT_I422_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_12BE", NULL },
118
+   { SPA_VIDEO_FORMAT_I422_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_12LE", NULL },
119
+   { SPA_VIDEO_FORMAT_Y444_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_12BE", NULL },
120
+   { SPA_VIDEO_FORMAT_Y444_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_12LE", NULL },
121
+   { SPA_VIDEO_FORMAT_RGBA_F16,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_F16", NULL },
122
+   { SPA_VIDEO_FORMAT_RGBA_F32,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_F32", NULL },
123
+   { SPA_VIDEO_FORMAT_xRGB_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xRGB_210LE", NULL },
124
+   { SPA_VIDEO_FORMAT_xBGR_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xBGR_210LE", NULL },
125
+   { SPA_VIDEO_FORMAT_RGBx_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBx_102LE", NULL },
126
+   { SPA_VIDEO_FORMAT_BGRx_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRx_102LE", NULL },
127
+   { SPA_VIDEO_FORMAT_ARGB_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB_210LE", NULL },
128
+   { SPA_VIDEO_FORMAT_ABGR_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ABGR_210LE", NULL },
129
+   { SPA_VIDEO_FORMAT_RGBA_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_102LE", NULL },
130
+   { SPA_VIDEO_FORMAT_BGRA_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRA_102LE", NULL },
131
+   { 0, 0, NULL, NULL },
132
+};
133
+
134
+#define SPA_TYPE_INFO_VideoFlags   SPA_TYPE_INFO_FLAGS_BASE "VideoFlags"
135
+#define SPA_TYPE_INFO_VIDEO_FLAGS_BASE SPA_TYPE_INFO_VideoFlags ":"
136
+
137
+static const struct spa_type_info spa_type_video_flags = {
138
+
139
+   { SPA_VIDEO_FLAG_NONE, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FLAGS_BASE "none", NULL },
140
+   { SPA_VIDEO_FLAG_VARIABLE_FPS, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FLAGS_BASE "variable-fps", NULL },
141
+   { SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FLAGS_BASE "premultiplied-alpha", NULL },
142
+   { SPA_VIDEO_FLAG_MODIFIER, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FLAGS_BASE "modifier", NULL },
143
+   { 0, 0, NULL, NULL },
144
+};
145
+
146
+#define SPA_TYPE_INFO_VideoInterlaceMode       SPA_TYPE_INFO_ENUM_BASE "VideoInterlaceMode"
147
+#define SPA_TYPE_INFO_VIDEO_INTERLACE_MODE_BASE        SPA_TYPE_INFO_VideoInterlaceMode ":"
148
+
149
+static const struct spa_type_info spa_type_video_interlace_mode = {
150
+   { SPA_VIDEO_INTERLACE_MODE_PROGRESSIVE, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_INTERLACE_MODE_BASE "progressive", NULL },
151
+   { SPA_VIDEO_INTERLACE_MODE_INTERLEAVED, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_INTERLACE_MODE_BASE "interleaved", NULL },
152
+   { SPA_VIDEO_INTERLACE_MODE_MIXED,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_INTERLACE_MODE_BASE "mixed", NULL },
153
+   { SPA_VIDEO_INTERLACE_MODE_FIELDS,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_INTERLACE_MODE_BASE "fields", NULL },
154
+   { 0, 0, NULL, NULL },
155
+};
156
+
157
+/**
158
+ * \}
159
+ */
160
+
161
+#ifdef __cplusplus
162
+}  /* extern "C" */
163
+#endif
164
+
165
+#endif /* SPA_VIDEO_RAW_TYPES_H */
166
pipewire-0.3.65.tar.gz/spa/include/spa/param/video/raw-utils.h Added
137
 
1
@@ -0,0 +1,135 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_VIDEO_RAW_UTILS_H
27
+#define SPA_VIDEO_RAW_UTILS_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+/**
34
+ * \addtogroup spa_param
35
+ * \{
36
+ */
37
+
38
+#include <spa/pod/parser.h>
39
+#include <spa/pod/builder.h>
40
+#include <spa/param/video/raw.h>
41
+
42
+static inline int
43
+spa_format_video_raw_parse(const struct spa_pod *format,
44
+              struct spa_video_info_raw *info)
45
+{
46
+   info->flags = SPA_VIDEO_FLAG_NONE;
47
+   if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) {
48
+       info->flags |= SPA_VIDEO_FLAG_MODIFIER;
49
+   }
50
+
51
+   return spa_pod_parse_object(format,
52
+       SPA_TYPE_OBJECT_Format, NULL,
53
+       SPA_FORMAT_VIDEO_format,        SPA_POD_OPT_Id(&info->format),
54
+       SPA_FORMAT_VIDEO_modifier,      SPA_POD_OPT_Long(&info->modifier),
55
+       SPA_FORMAT_VIDEO_size,          SPA_POD_OPT_Rectangle(&info->size),
56
+       SPA_FORMAT_VIDEO_framerate,     SPA_POD_OPT_Fraction(&info->framerate),
57
+       SPA_FORMAT_VIDEO_maxFramerate,      SPA_POD_OPT_Fraction(&info->max_framerate),
58
+       SPA_FORMAT_VIDEO_views,         SPA_POD_OPT_Int(&info->views),
59
+       SPA_FORMAT_VIDEO_interlaceMode,     SPA_POD_OPT_Id(&info->interlace_mode),
60
+       SPA_FORMAT_VIDEO_pixelAspectRatio,  SPA_POD_OPT_Fraction(&info->pixel_aspect_ratio),
61
+       SPA_FORMAT_VIDEO_multiviewMode,     SPA_POD_OPT_Id(&info->multiview_mode),
62
+       SPA_FORMAT_VIDEO_multiviewFlags,    SPA_POD_OPT_Id(&info->multiview_flags),
63
+       SPA_FORMAT_VIDEO_chromaSite,        SPA_POD_OPT_Id(&info->chroma_site),
64
+       SPA_FORMAT_VIDEO_colorRange,        SPA_POD_OPT_Id(&info->color_range),
65
+       SPA_FORMAT_VIDEO_colorMatrix,       SPA_POD_OPT_Id(&info->color_matrix),
66
+       SPA_FORMAT_VIDEO_transferFunction,  SPA_POD_OPT_Id(&info->transfer_function),
67
+       SPA_FORMAT_VIDEO_colorPrimaries,    SPA_POD_OPT_Id(&info->color_primaries));
68
+}
69
+
70
+static inline struct spa_pod *
71
+spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
72
+              struct spa_video_info_raw *info)
73
+{
74
+   struct spa_pod_frame f;
75
+   spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
76
+   spa_pod_builder_add(builder,
77
+           SPA_FORMAT_mediaType,       SPA_POD_Id(SPA_MEDIA_TYPE_video),
78
+           SPA_FORMAT_mediaSubtype,    SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
79
+           0);
80
+   if (info->format != SPA_VIDEO_FORMAT_UNKNOWN)
81
+       spa_pod_builder_add(builder,
82
+           SPA_FORMAT_VIDEO_format,    SPA_POD_Id(info->format), 0);
83
+   if (info->size.width != 0 && info->size.height != 0)
84
+       spa_pod_builder_add(builder,
85
+           SPA_FORMAT_VIDEO_size,      SPA_POD_Rectangle(&info->size), 0);
86
+   if (info->framerate.denom != 0)
87
+       spa_pod_builder_add(builder,
88
+           SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&info->framerate), 0);
89
+   if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER)
90
+       spa_pod_builder_add(builder,
91
+           SPA_FORMAT_VIDEO_modifier,  SPA_POD_Long(info->modifier), 0);
92
+   if (info->max_framerate.denom != 0)
93
+       spa_pod_builder_add(builder,
94
+           SPA_FORMAT_VIDEO_maxFramerate,  SPA_POD_Fraction(info->max_framerate), 0);
95
+   if (info->views != 0)
96
+       spa_pod_builder_add(builder,
97
+           SPA_FORMAT_VIDEO_views,     SPA_POD_Int(info->views), 0);
98
+   if (info->interlace_mode != 0)
99
+       spa_pod_builder_add(builder,
100
+           SPA_FORMAT_VIDEO_interlaceMode, SPA_POD_Id(info->interlace_mode), 0);
101
+   if (info->pixel_aspect_ratio.denom != 0)
102
+       spa_pod_builder_add(builder,
103
+           SPA_FORMAT_VIDEO_pixelAspectRatio,SPA_POD_Fraction(info->pixel_aspect_ratio), 0);
104
+   if (info->multiview_mode != 0)
105
+       spa_pod_builder_add(builder,
106
+           SPA_FORMAT_VIDEO_multiviewMode, SPA_POD_Id(info->multiview_mode), 0);
107
+   if (info->multiview_flags != 0)
108
+       spa_pod_builder_add(builder,
109
+           SPA_FORMAT_VIDEO_multiviewFlags,SPA_POD_Id(info->multiview_flags), 0);
110
+   if (info->chroma_site != 0)
111
+       spa_pod_builder_add(builder,
112
+           SPA_FORMAT_VIDEO_chromaSite,    SPA_POD_Id(info->chroma_site), 0);
113
+   if (info->color_range != 0)
114
+       spa_pod_builder_add(builder,
115
+           SPA_FORMAT_VIDEO_colorRange,    SPA_POD_Id(info->color_range), 0);
116
+   if (info->color_matrix != 0)
117
+       spa_pod_builder_add(builder,
118
+           SPA_FORMAT_VIDEO_colorMatrix,   SPA_POD_Id(info->color_matrix), 0);
119
+   if (info->transfer_function != 0)
120
+       spa_pod_builder_add(builder,
121
+           SPA_FORMAT_VIDEO_transferFunction,SPA_POD_Id(info->transfer_function), 0);
122
+   if (info->color_primaries != 0)
123
+       spa_pod_builder_add(builder,
124
+           SPA_FORMAT_VIDEO_colorPrimaries,SPA_POD_Id(info->color_primaries), 0);
125
+   return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
126
+}
127
+
128
+/**
129
+ * \}
130
+ */
131
+
132
+#ifdef __cplusplus
133
+} /* extern "C" */
134
+#endif
135
+
136
+#endif /* SPA_VIDEO_RAW_UTILS_H */
137
pipewire-0.3.64.tar.gz/spa/include/spa/param/video/raw.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/video/raw.h Changed
42
 
1
@@ -34,7 +34,7 @@
2
  * \{
3
  */
4
 
5
-#include <spa/utils/defs.h>
6
+#include <spa/param/format.h>
7
 #include <spa/param/video/chroma.h>
8
 #include <spa/param/video/color.h>
9
 #include <spa/param/video/multiview.h>
10
@@ -158,6 +158,7 @@
11
    SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),     /**< a variable fps is selected, fps_n and fps_d
12
                             *   denote the maximum fps of the video */
13
    SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1),  /**< Each color has been scaled by the alpha value. */
14
+   SPA_VIDEO_FLAG_MODIFIER = (1 << 2),     /**< use the format modifier */
15
 };
16
 
17
 /**
18
@@ -186,7 +187,8 @@
19
  */
20
 struct spa_video_info_raw {
21
    enum spa_video_format format;               /**< the format */
22
-   int64_t modifier;                   /**< format modifier
23
+   uint32_t flags;                     /**< extra video flags */
24
+   uint64_t modifier;                  /**< format modifier
25
                                  * only used with DMA-BUF */
26
    struct spa_rectangle size;              /**< the frame size of the video */
27
    struct spa_fraction framerate;              /**< the framerate of the video, 0/1 means variable rate */
28
@@ -208,13 +210,6 @@
29
 
30
 #define SPA_VIDEO_INFO_RAW_INIT(...)   ((struct spa_video_info_raw) { __VA_ARGS__ })
31
 
32
-struct spa_video_info_dsp {
33
-   enum spa_video_format format;
34
-   int64_t modifier;
35
-};
36
-
37
-#define SPA_VIDEO_INFO_DSP_INIT(...)   ((struct spa_video_info_dsp) { __VA_ARGS__ })
38
-
39
 /**
40
  * \}
41
  */
42
pipewire-0.3.64.tar.gz/spa/include/spa/param/video/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/param/video/type-info.h Changed
120
 
1
@@ -25,116 +25,6 @@
2
 #ifndef SPA_VIDEO_TYPES_H
3
 #define SPA_VIDEO_TYPES_H
4
 
5
-#ifdef __cplusplus
6
-extern "C" {
7
-#endif
8
+#include <spa/param/video/raw-types.h>
9
 
10
-/**
11
- * \addtogroup spa_param
12
- * \{
13
- */
14
-#include <spa/param/video/raw.h>
15
-
16
-#define SPA_TYPE_INFO_VideoFormat      SPA_TYPE_INFO_ENUM_BASE "VideoFormat"
17
-#define SPA_TYPE_INFO_VIDEO_FORMAT_BASE        SPA_TYPE_INFO_VideoFormat ":"
18
-
19
-static const struct spa_type_info spa_type_video_format = {
20
-   { SPA_VIDEO_FORMAT_ENCODED, SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "encoded", NULL },
21
-   { SPA_VIDEO_FORMAT_I420,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420", NULL },
22
-   { SPA_VIDEO_FORMAT_YV12,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YV12", NULL },
23
-   { SPA_VIDEO_FORMAT_YUY2,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YUY2", NULL },
24
-   { SPA_VIDEO_FORMAT_UYVY,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "UYVY", NULL },
25
-   { SPA_VIDEO_FORMAT_AYUV,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "AYUV", NULL },
26
-   { SPA_VIDEO_FORMAT_RGBx,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBx", NULL },
27
-   { SPA_VIDEO_FORMAT_BGRx,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRx", NULL },
28
-   { SPA_VIDEO_FORMAT_xRGB,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xRGB", NULL },
29
-   { SPA_VIDEO_FORMAT_xBGR,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xBGR", NULL },
30
-   { SPA_VIDEO_FORMAT_RGBA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA", NULL },
31
-   { SPA_VIDEO_FORMAT_BGRA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRA", NULL },
32
-   { SPA_VIDEO_FORMAT_ARGB,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB", NULL },
33
-   { SPA_VIDEO_FORMAT_ABGR,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ABGR", NULL },
34
-   { SPA_VIDEO_FORMAT_RGB,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB", NULL },
35
-   { SPA_VIDEO_FORMAT_BGR,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR", NULL },
36
-   { SPA_VIDEO_FORMAT_Y41B,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y41B", NULL },
37
-   { SPA_VIDEO_FORMAT_Y42B,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y42B", NULL },
38
-   { SPA_VIDEO_FORMAT_YVYU,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YVYU", NULL },
39
-   { SPA_VIDEO_FORMAT_Y444,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444", NULL },
40
-   { SPA_VIDEO_FORMAT_v210,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v210", NULL },
41
-   { SPA_VIDEO_FORMAT_v216,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v216", NULL },
42
-   { SPA_VIDEO_FORMAT_NV12,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV12", NULL },
43
-   { SPA_VIDEO_FORMAT_NV21,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV21", NULL },
44
-   { SPA_VIDEO_FORMAT_GRAY8,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY8", NULL },
45
-   { SPA_VIDEO_FORMAT_GRAY16_BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY16_BE", NULL },
46
-   { SPA_VIDEO_FORMAT_GRAY16_LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GRAY16_LE", NULL },
47
-   { SPA_VIDEO_FORMAT_v308,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "v308", NULL },
48
-   { SPA_VIDEO_FORMAT_RGB16,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB16", NULL },
49
-   { SPA_VIDEO_FORMAT_BGR16,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR16", NULL },
50
-   { SPA_VIDEO_FORMAT_RGB15,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB15", NULL },
51
-   { SPA_VIDEO_FORMAT_BGR15,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGR15", NULL },
52
-   { SPA_VIDEO_FORMAT_UYVP,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "UYVP", NULL },
53
-   { SPA_VIDEO_FORMAT_A420,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420", NULL },
54
-   { SPA_VIDEO_FORMAT_RGB8P,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGB8P", NULL },
55
-   { SPA_VIDEO_FORMAT_YUV9,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YUV9", NULL },
56
-   { SPA_VIDEO_FORMAT_YVU9,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YVU9", NULL },
57
-   { SPA_VIDEO_FORMAT_IYU1,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "IYU1", NULL },
58
-   { SPA_VIDEO_FORMAT_ARGB64,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB64", NULL },
59
-   { SPA_VIDEO_FORMAT_AYUV64,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "AYUV64", NULL },
60
-   { SPA_VIDEO_FORMAT_r210,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "r210", NULL },
61
-   { SPA_VIDEO_FORMAT_I420_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_10BE", NULL },
62
-   { SPA_VIDEO_FORMAT_I420_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_10LE", NULL },
63
-   { SPA_VIDEO_FORMAT_I422_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_10BE", NULL },
64
-   { SPA_VIDEO_FORMAT_I422_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_10LE", NULL },
65
-   { SPA_VIDEO_FORMAT_Y444_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_10BE", NULL },
66
-   { SPA_VIDEO_FORMAT_Y444_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_10LE", NULL },
67
-   { SPA_VIDEO_FORMAT_GBR,     SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR", NULL },
68
-   { SPA_VIDEO_FORMAT_GBR_10BE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_10BE", NULL },
69
-   { SPA_VIDEO_FORMAT_GBR_10LE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_10LE", NULL },
70
-   { SPA_VIDEO_FORMAT_NV16,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV16", NULL },
71
-   { SPA_VIDEO_FORMAT_NV24,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV24", NULL },
72
-   { SPA_VIDEO_FORMAT_NV12_64Z32,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV12_64Z32", NULL },
73
-   { SPA_VIDEO_FORMAT_A420_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420_10BE", NULL },
74
-   { SPA_VIDEO_FORMAT_A420_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A420_10LE", NULL },
75
-   { SPA_VIDEO_FORMAT_A422_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A422_10BE", NULL },
76
-   { SPA_VIDEO_FORMAT_A422_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A422_10LE", NULL },
77
-   { SPA_VIDEO_FORMAT_A444_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A444_10BE", NULL },
78
-   { SPA_VIDEO_FORMAT_A444_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "A444_10LE", NULL },
79
-   { SPA_VIDEO_FORMAT_NV61,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "NV61", NULL },
80
-   { SPA_VIDEO_FORMAT_P010_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "P010_10BE", NULL },
81
-   { SPA_VIDEO_FORMAT_P010_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "P010_10LE", NULL },
82
-   { SPA_VIDEO_FORMAT_IYU2,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "IYU2", NULL },
83
-   { SPA_VIDEO_FORMAT_VYUY,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "VYUY", NULL },
84
-   { SPA_VIDEO_FORMAT_GBRA,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA", NULL },
85
-   { SPA_VIDEO_FORMAT_GBRA_10BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_10BE", NULL },
86
-   { SPA_VIDEO_FORMAT_GBRA_10LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_10LE", NULL },
87
-   { SPA_VIDEO_FORMAT_GBR_12BE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_12BE", NULL },
88
-   { SPA_VIDEO_FORMAT_GBR_12LE,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBR_12LE", NULL },
89
-   { SPA_VIDEO_FORMAT_GBRA_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_12BE", NULL },
90
-   { SPA_VIDEO_FORMAT_GBRA_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "GBRA_12LE", NULL },
91
-   { SPA_VIDEO_FORMAT_I420_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_12BE", NULL },
92
-   { SPA_VIDEO_FORMAT_I420_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420_12LE", NULL },
93
-   { SPA_VIDEO_FORMAT_I422_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_12BE", NULL },
94
-   { SPA_VIDEO_FORMAT_I422_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I422_12LE", NULL },
95
-   { SPA_VIDEO_FORMAT_Y444_12BE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_12BE", NULL },
96
-   { SPA_VIDEO_FORMAT_Y444_12LE,   SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "Y444_12LE", NULL },
97
-   { SPA_VIDEO_FORMAT_RGBA_F16,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_F16", NULL },
98
-   { SPA_VIDEO_FORMAT_RGBA_F32,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_F32", NULL },
99
-   { SPA_VIDEO_FORMAT_xRGB_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xRGB_210LE", NULL },
100
-   { SPA_VIDEO_FORMAT_xBGR_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "xBGR_210LE", NULL },
101
-   { SPA_VIDEO_FORMAT_RGBx_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBx_102LE", NULL },
102
-   { SPA_VIDEO_FORMAT_BGRx_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRx_102LE", NULL },
103
-   { SPA_VIDEO_FORMAT_ARGB_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ARGB_210LE", NULL },
104
-   { SPA_VIDEO_FORMAT_ABGR_210LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ABGR_210LE", NULL },
105
-   { SPA_VIDEO_FORMAT_RGBA_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "RGBA_102LE", NULL },
106
-   { SPA_VIDEO_FORMAT_BGRA_102LE,  SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "BGRA_102LE", NULL },
107
-   { 0, 0, NULL, NULL },
108
-};
109
-
110
-/**
111
- * \}
112
- */
113
-
114
-#ifdef __cplusplus
115
-}  /* extern "C" */
116
-#endif
117
-
118
-#endif /* SPA_VIDEO_RAW_TYPES_H */
119
+#endif /* SPA_VIDEO_TYPES_H */
120
pipewire-0.3.64.tar.gz/spa/include/spa/support/log.h -> pipewire-0.3.65.tar.gz/spa/include/spa/support/log.h Changed
23
 
1
@@ -299,21 +299,6 @@
2
 #define spa_log_trace_fp(l,...)
3
 #endif
4
 
5
-#define spa_log_hexdump(l,lev,indent,data,len)                     \
6
-({                                         \
7
-   char str512;                                    \
8
-   uint8_t *buf = (uint8_t *)(data);                       \
9
-   size_t i, j = (len);                                \
10
-   int pos = 0;                                    \
11
-                                           \
12
-   for (i = 0; i < j; i++) {                           \
13
-       if (i % 16 == 0)                            \
14
-           pos = 0;                            \
15
-       pos += sprintf(str + pos, "%02x ", bufi);               \
16
-       if (i % 16 == 15 || i == j - 1)                     \
17
-           spa_log_lev(l,lev, "%*s" "%s",indent,"", str);          \
18
-   }                                       \
19
-})
20
 
21
 /** \fn spa_log_error */
22
 
23
pipewire-0.3.64.tar.gz/spa/include/spa/utils/defs.h -> pipewire-0.3.65.tar.gz/spa/include/spa/utils/defs.h Changed
16
 
1
@@ -274,6 +274,14 @@
2
 #define SPA_ROUND_DOWN_N(num,align)    ((num) & ~SPA_ROUND_MASK(num, align))
3
 #define SPA_ROUND_UP_N(num,align)  ((((num)-1) | SPA_ROUND_MASK(num, align))+1)
4
 
5
+#define SPA_SCALE32_UP(val,num,denom)              \
6
+({                             \
7
+   uint64_t _val = (val);                  \
8
+   uint64_t _denom = (denom);              \
9
+   (uint32_t)(((_val) * (num) + (_denom)-1) / (_denom));   \
10
+})
11
+
12
+
13
 #define SPA_PTR_ALIGNMENT(p,align) ((intptr_t)(p) & ((align)-1))
14
 #define SPA_IS_ALIGNED(p,align)        (SPA_PTR_ALIGNMENT(p,align) == 0)
15
 #define SPA_PTR_ALIGN(p,align,type)    ((type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align)))
16
pipewire-0.3.65.tar.gz/spa/include/spa/utils/enum-types.h Added
67
 
1
@@ -0,0 +1,65 @@
2
+/* Simple Plugin API
3
+ *
4
+ * Copyright © 2018 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#ifndef SPA_ENUM_TYPES_H
27
+#define SPA_ENUM_TYPES_H
28
+
29
+#ifdef __cplusplus
30
+extern "C" {
31
+#endif
32
+
33
+#include <spa/utils/type.h>
34
+
35
+#define SPA_TYPE_INFO_Direction            SPA_TYPE_INFO_ENUM_BASE "Direction"
36
+#define SPA_TYPE_INFO_DIRECTION_BASE       SPA_TYPE_INFO_Direction ":"
37
+
38
+static const struct spa_type_info spa_type_direction = {
39
+   { SPA_DIRECTION_INPUT, SPA_TYPE_Int, SPA_TYPE_INFO_DIRECTION_BASE "Input", NULL  },
40
+   { SPA_DIRECTION_OUTPUT, SPA_TYPE_Int, SPA_TYPE_INFO_DIRECTION_BASE "Output", NULL  },
41
+   { 0, 0, NULL, NULL }
42
+};
43
+
44
+#include <spa/pod/pod.h>
45
+
46
+#define SPA_TYPE_INFO_Choice           SPA_TYPE_INFO_ENUM_BASE "Choice"
47
+#define SPA_TYPE_INFO_CHOICE_BASE      SPA_TYPE_INFO_Choice ":"
48
+
49
+static const struct spa_type_info spa_type_choice = {
50
+   { SPA_CHOICE_None, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "None", NULL  },
51
+   { SPA_CHOICE_Range, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Range", NULL  },
52
+   { SPA_CHOICE_Step, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Step", NULL  },
53
+   { SPA_CHOICE_Enum, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Enum", NULL  },
54
+   { SPA_CHOICE_Flags, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Flags", NULL  },
55
+   { 0, 0, NULL, NULL }
56
+};
57
+
58
+/**
59
+ * \}
60
+ */
61
+
62
+#ifdef __cplusplus
63
+}  /* extern "C" */
64
+#endif
65
+
66
+#endif /* SPA_TYPE_INFO_H */
67
pipewire-0.3.64.tar.gz/spa/include/spa/utils/keys.h -> pipewire-0.3.65.tar.gz/spa/include/spa/utils/keys.h Changed
19
 
1
@@ -129,12 +129,17 @@
2
 #define SPA_KEY_API_BLUEZ5_CODEC   "api.bluez5.codec"      /**< a bluetooth codec */
3
 #define SPA_KEY_API_BLUEZ5_CLASS   "api.bluez5.class"      /**< a bluetooth class */
4
 #define SPA_KEY_API_BLUEZ5_ICON        "api.bluez5.icon"       /**< a bluetooth icon */
5
+#define SPA_KEY_API_BLUEZ5_ROLE        "api.bluez5.role"       /**< "client" or "server" */
6
 
7
 /** keys for jack api */
8
 #define SPA_KEY_API_JACK       "api.jack"          /**< key for the JACK api */
9
 #define SPA_KEY_API_JACK_SERVER        "api.jack.server"       /**< a jack server name */
10
 #define SPA_KEY_API_JACK_CLIENT        "api.jack.client"       /**< an internal jack client */
11
 
12
+/** keys for glib api */
13
+#define SPA_KEY_API_GLIB_MAINLOOP  "api.glib.mainloop"     /**< whether glib mainloop runs
14
+                                    * in same thread as PW loop */
15
+
16
 /**
17
  * \}
18
  */
19
pipewire-0.3.64.tar.gz/spa/include/spa/utils/names.h -> pipewire-0.3.65.tar.gz/spa/include/spa/utils/names.h Changed
19
 
1
@@ -110,6 +110,8 @@
2
 #define SPA_NAME_API_ALSA_SEQ_BRIDGE   "api.alsa.seq.bridge"       /**< an alsa Node interface for
3
                                      *  bridging midi ports */
4
 #define SPA_NAME_API_ALSA_ACP_DEVICE   "api.alsa.acp.device"       /**< an alsa ACP Device interface */
5
+#define SPA_NAME_API_ALSA_COMPRESS_OFFLOAD_SINK    "api.alsa.compress.offload.sink"    /**< an alsa Node interface for
6
+                                             * compressed audio */
7
 
8
 /** keys for bluez5 factory names */
9
 #define SPA_NAME_API_BLUEZ5_ENUM_DBUS  "api.bluez5.enum.dbus"      /**< a dbus Device interface */
10
@@ -120,6 +122,8 @@
11
 #define SPA_NAME_API_BLUEZ5_A2DP_SOURCE    "api.bluez5.a2dp.source"    /**< alias for media.source */
12
 #define SPA_NAME_API_BLUEZ5_SCO_SINK   "api.bluez5.sco.sink"       /**< a playback Node interface for HSP/HFP profiles */
13
 #define SPA_NAME_API_BLUEZ5_SCO_SOURCE "api.bluez5.sco.source"     /**< a capture Node interface for HSP/HFP profiles */
14
+#define SPA_NAME_API_BLUEZ5_MIDI_ENUM  "api.bluez5.midi.enum"      /**< a dbus midi Device interface */
15
+#define SPA_NAME_API_BLUEZ5_MIDI_NODE  "api.bluez5.midi.node"      /**< a midi Node interface */
16
 
17
 /** keys for codec factory names */
18
 #define SPA_NAME_API_CODEC_BLUEZ5_MEDIA    "api.codec.bluez5.media"    /**< Bluez5 Media codec plugin */
19
pipewire-0.3.64.tar.gz/spa/include/spa/utils/string.h -> pipewire-0.3.65.tar.gz/spa/include/spa/utils/string.h Changed
35
 
1
@@ -376,6 +376,33 @@
2
    return str;
3
 }
4
 
5
+struct spa_strbuf {
6
+   char *buffer;
7
+   size_t maxsize;
8
+   size_t pos;
9
+};
10
+
11
+static inline void spa_strbuf_init(struct spa_strbuf *buf, char *buffer, size_t maxsize)
12
+{
13
+   buf->buffer = buffer;
14
+   buf->maxsize = maxsize;
15
+   buf->pos = 0;
16
+}
17
+
18
+SPA_PRINTF_FUNC(2, 3)
19
+static inline int spa_strbuf_append(struct spa_strbuf *buf, const char *fmt, ...)
20
+{
21
+   size_t remain = buf->maxsize - buf->pos;
22
+   ssize_t written;
23
+   va_list args;
24
+   va_start(args, fmt);
25
+   written = vsnprintf(&buf->bufferbuf->pos, remain, fmt, args);
26
+   va_end(args);
27
+   if (written > 0)
28
+       buf->pos += SPA_MIN(remain, (size_t)written);
29
+   return written;
30
+}
31
+
32
 /**
33
  * \}
34
  */
35
pipewire-0.3.64.tar.gz/spa/include/spa/utils/type-info.h -> pipewire-0.3.65.tar.gz/spa/include/spa/utils/type-info.h Changed
38
 
1
@@ -46,35 +46,13 @@
2
 }
3
 
4
 #include <spa/utils/type.h>
5
-
6
-/* base for parameter object enumerations */
7
-#define SPA_TYPE_INFO_Direction            SPA_TYPE_INFO_ENUM_BASE "Direction"
8
-#define SPA_TYPE_INFO_DIRECTION_BASE       SPA_TYPE_INFO_Direction ":"
9
-
10
-static const struct spa_type_info spa_type_direction = {
11
-   { SPA_DIRECTION_INPUT, SPA_TYPE_Int, SPA_TYPE_INFO_DIRECTION_BASE "Input", NULL  },
12
-   { SPA_DIRECTION_OUTPUT, SPA_TYPE_Int, SPA_TYPE_INFO_DIRECTION_BASE "Output", NULL  },
13
-   { 0, 0, NULL, NULL }
14
-};
15
+#include <spa/utils/enum-types.h>
16
 
17
 #include <spa/monitor/type-info.h>
18
 #include <spa/node/type-info.h>
19
 #include <spa/param/type-info.h>
20
 #include <spa/control/type-info.h>
21
 
22
-/* base for parameter object enumerations */
23
-#define SPA_TYPE_INFO_Choice           SPA_TYPE_INFO_ENUM_BASE "Choice"
24
-#define SPA_TYPE_INFO_CHOICE_BASE      SPA_TYPE_INFO_Choice ":"
25
-
26
-static const struct spa_type_info spa_type_choice = {
27
-   { SPA_CHOICE_None, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "None", NULL  },
28
-   { SPA_CHOICE_Range, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Range", NULL  },
29
-   { SPA_CHOICE_Step, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Step", NULL  },
30
-   { SPA_CHOICE_Enum, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Enum", NULL  },
31
-   { SPA_CHOICE_Flags, SPA_TYPE_Int, SPA_TYPE_INFO_CHOICE_BASE "Flags", NULL  },
32
-   { 0, 0, NULL, NULL }
33
-};
34
-
35
 static const struct spa_type_info spa_types = {
36
         /* Basic types */
37
    { SPA_TYPE_START, SPA_TYPE_START, SPA_TYPE_INFO_BASE, NULL },
38
pipewire-0.3.64.tar.gz/spa/meson.build -> pipewire-0.3.65.tar.gz/spa/meson.build Changed
34
 
1
@@ -42,8 +42,11 @@
2
   alsa_dep = dependency('alsa', required: get_option('alsa'))
3
   summary({'ALSA': alsa_dep.found()}, bool_yn: true, section: 'Backend')
4
   bluez_dep = dependency('bluez', version : '>= 4.101', required: get_option('bluez5'))
5
-  summary({'Bluetooth audio': bluez_dep.found()}, bool_yn: true, section: 'Backend')
6
-  if bluez_dep.found()
7
+  gio_dep = dependency('gio-2.0', required : get_option('bluez5'))
8
+  gio_unix_dep = dependency('gio-unix-2.0', required : get_option('bluez5'))
9
+  bluez_deps_found = bluez_dep.found() and gio_dep.found() and gio_unix_dep.found()
10
+  summary({'Bluetooth audio': bluez_deps_found}, bool_yn: true, section: 'Backend')
11
+  if bluez_deps_found
12
     sbc_dep = dependency('sbc', required: get_option('bluez5'))
13
     summary({'SBC': sbc_dep.found()}, bool_yn: true, section: 'Bluetooth audio codecs')
14
     ldac_dep = dependency('ldacBT-enc', required : get_option('bluez5-codec-ldac'))
15
@@ -71,7 +74,6 @@
16
       summary({'ModemManager': mm_dep.found()}, bool_yn: true, section: 'Bluetooth backends')
17
     endif
18
   endif
19
-  avcodec_dep = dependency('libavcodec', required: get_option('ffmpeg'))
20
   jack_dep = dependency('jack', version : '>= 1.9.10', required: get_option('jack'))
21
   summary({'JACK2': jack_dep.found()}, bool_yn: true, section: 'Backend')
22
   vulkan_dep = dependency('vulkan', disabler : true, version : '>= 1.1.69', required: get_option('vulkan'))
23
@@ -81,6 +83,10 @@
24
   libcamera_dep = dependency('libcamera', required: get_option('libcamera'))
25
   summary({'libcamera': libcamera_dep.found()}, bool_yn: true, section: 'Backend')
26
 
27
+  tinycompress_dep = cc.find_library('tinycompress', has_headers: 'tinycompress/tinycompress.h' , required: get_option('compress-offload'))
28
+  summary({'Compress-Offload': tinycompress_dep.found()}, bool_yn: true, section: 'Backend')
29
+  cdata.set('HAVE_ALSA_COMPRESS_OFFLOAD', tinycompress_dep.found())
30
+
31
   # common dependencies
32
   libudev_dep = dependency('libudev', required: alsa_dep.found() or get_option('udev').enabled() or get_option('v4l2').enabled())
33
   summary({'Udev': libudev_dep.found()}, bool_yn: true, section: 'Backend')
34
pipewire-0.3.64.tar.gz/spa/plugins/alsa/90-pipewire-alsa.rules -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/90-pipewire-alsa.rules Changed
14
 
1
@@ -163,10 +163,12 @@
2
 
3
 # ID 1395:005e is for Sennheiser GSX 1000
4
 # ID 1395:00a0 is for Sennheiser GSX 1000
5
+# ID 1395:00b1 is for Sennheiser GSX 1000 v2
6
 # ID 1395:005f is for Sennheiser GSX 1200
7
 # ID 1395:00a1 is for Sennheiser GSX 1200
8
 ATTRS{idVendor}=="1395", ATTRS{idProduct}=="005e", ENV{ACP_PROFILE_SET}="sennheiser-gsx.conf"
9
 ATTRS{idVendor}=="1395", ATTRS{idProduct}=="00a0", ENV{ACP_PROFILE_SET}="sennheiser-gsx.conf"
10
+ATTRS{idVendor}=="1395", ATTRS{idProduct}=="00b1", ENV{ACP_PROFILE_SET}="sennheiser-gsx.conf"
11
 ATTRS{idVendor}=="1395", ATTRS{idProduct}=="005f", ENV{ACP_PROFILE_SET}="sennheiser-gsx.conf"
12
 ATTRS{idVendor}=="1395", ATTRS{idProduct}=="00a1", ENV{ACP_PROFILE_SET}="sennheiser-gsx.conf"
13
 
14
pipewire-0.3.64.tar.gz/spa/plugins/alsa/alsa-acp-device.c -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa-acp-device.c Changed
41
 
1
@@ -31,11 +31,12 @@
2
 
3
 #include <alsa/asoundlib.h>
4
 
5
-#include <spa/utils/type.h>
6
 #include <spa/node/node.h>
7
+#include <spa/utils/type.h>
8
 #include <spa/utils/keys.h>
9
 #include <spa/utils/names.h>
10
 #include <spa/utils/string.h>
11
+#include <spa/support/log.h>
12
 #include <spa/support/loop.h>
13
 #include <spa/support/plugin.h>
14
 #include <spa/support/i18n.h>
15
@@ -46,6 +47,7 @@
16
 #include <spa/pod/filter.h>
17
 #include <spa/pod/parser.h>
18
 #include <spa/debug/pod.h>
19
+#include <spa/debug/log.h>
20
 
21
 #include "alsa.h"
22
 
23
@@ -735,7 +737,7 @@
24
                SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx),
25
                SPA_PARAM_PROFILE_save, SPA_POD_OPT_Bool(&save))) < 0) {
26
            spa_log_warn(this->log, "can't parse profile");
27
-           spa_debug_pod(0, NULL, param);
28
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
29
            return res;
30
        }
31
 
32
@@ -760,7 +762,7 @@
33
                SPA_PARAM_ROUTE_props, SPA_POD_OPT_Pod(&props),
34
                SPA_PARAM_ROUTE_save, SPA_POD_OPT_Bool(&save))) < 0) {
35
            spa_log_warn(this->log, "can't parse route");
36
-           spa_debug_pod(0, NULL, param);
37
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
38
            return res;
39
        }
40
        if (device >= this->card->n_devices)
41
pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa-compress-offload-sink.c Added
201
 
1
@@ -0,0 +1,1143 @@
2
+/* Spa ALSA Compress-Offload sink
3
+ *
4
+ * Copyright © 2022 Wim Taymans
5
+ *           © 2022 Asymptotic Inc.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a
8
+ * copy of this software and associated documentation files (the "Software"),
9
+ * to deal in the Software without restriction, including without limitation
10
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
+ * and/or sell copies of the Software, and to permit persons to whom the
12
+ * Software is furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice (including the next
15
+ * paragraph) shall be included in all copies or substantial portions of the
16
+ * Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
21
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24
+ * DEALINGS IN THE SOFTWARE.
25
+ */
26
+
27
+#include <errno.h>
28
+#include <stddef.h>
29
+#include <unistd.h>
30
+#include <string.h>
31
+#include <stdio.h>
32
+#include <fcntl.h>
33
+
34
+#include <spa/monitor/device.h>
35
+#include <spa/support/plugin.h>
36
+#include <spa/support/log.h>
37
+#include <spa/support/system.h>
38
+#include <spa/support/loop.h>
39
+#include <spa/utils/list.h>
40
+#include <spa/utils/keys.h>
41
+#include <spa/utils/json.h>
42
+#include <spa/utils/names.h>
43
+#include <spa/utils/string.h>
44
+#include <spa/utils/result.h>
45
+#include <spa/node/node.h>
46
+#include <spa/node/utils.h>
47
+#include <spa/node/io.h>
48
+#include <spa/node/keys.h>
49
+#include <spa/param/audio/format-utils.h>
50
+#include <spa/debug/types.h>
51
+#include <spa/debug/mem.h>
52
+#include <spa/param/audio/type-info.h>
53
+#include <spa/param/param.h>
54
+#include <spa/pod/filter.h>
55
+#include <spa/control/control.h>
56
+
57
+#include <sound/compress_params.h>
58
+#include <tinycompress/tinycompress.h>
59
+
60
+/*
61
+ * This creates a PipeWire sink node which uses the tinycompress user space
62
+ * library to use the ALSA Compress-Offload API for writing compressed data
63
+ * like MP3, FLAC etc. to an DSP that can handle such data directly.
64
+ *
65
+ * These show up under /dev/snd like comprCxDx, as opposed to regular
66
+ * ALSA PCM devices.
67
+ *
68
+ * root@dragonboard-845c:~# ls /dev/snd
69
+ * by-path  comprC0D3  controlC0  pcmC0D0c  pcmC0D0p  pcmC0D1c  pcmC0D1p  pcmC0D2c  pcmC0D2p  timer
70
+ *
71
+ * ## Example configuration
72
+ *\code{.unparsed}
73
+ * context.objects = 
74
+ *  {   factory = spa-node-factory
75
+ *      args = {
76
+ *          factory.name   = api.alsa.compress.offload.sink
77
+ *          node.name      = Compress-Offload-Sink
78
+ *          media.class    = "Audio/Sink"
79
+ *          api.alsa.path  = "hw:0,3"
80
+ *      }
81
+ *  }
82
+ *
83
+ *\endcode
84
+ *
85
+ * TODO:
86
+ * - Clocking
87
+ * - Implement pause and resume
88
+ * - Having a better wait mechanism
89
+ * - Automatic loading using alsa-udev
90
+ *
91
+ */
92
+
93
+#define NAME                "compress-offload-audio-sink"
94
+#define DEFAULT_CHANNELS    2
95
+#define DEFAULT_RATE        44100
96
+#define MAX_BUFFERS         4
97
+#define MAX_PORTS           1
98
+#define MAX_CODECS          32 /* See include/sound/compress_params.h */
99
+
100
+#define MIN_FRAGMENT_SIZE   (4 * 1024)
101
+#define MAX_FRAGMENT_SIZE   (64 * 1024)
102
+#define MIN_NUM_FRAGMENTS   (4)
103
+#define MAX_NUM_FRAGMENTS   (8 * 4)
104
+
105
+struct props {
106
+   uint32_t channels;
107
+   uint32_t rate;
108
+   uint32_t posSPA_AUDIO_MAX_CHANNELS;
109
+   char device64;
110
+};
111
+
112
+static void reset_props(struct props *props)
113
+{
114
+   props->channels = 0;
115
+   props->rate = 0;
116
+}
117
+
118
+struct buffer {
119
+   uint32_t id;
120
+   uint32_t flags;
121
+   struct spa_buffer *outbuf;
122
+};
123
+
124
+struct impl;
125
+
126
+struct port {
127
+   uint64_t info_all;
128
+   struct spa_port_info info;
129
+   struct spa_param_info params5;
130
+
131
+   struct spa_io_buffers *io;
132
+
133
+   bool have_format;
134
+   struct spa_audio_info current_format;
135
+
136
+   struct buffer buffersMAX_BUFFERS;
137
+   uint32_t n_buffers;
138
+   uint32_t written;
139
+};
140
+
141
+struct impl {
142
+   struct spa_handle handle;
143
+   struct spa_node node;
144
+   struct spa_log *log;
145
+   struct props props;
146
+
147
+   struct spa_node_info info;
148
+   struct spa_param_info params1;
149
+
150
+   struct spa_hook_list hooks;
151
+   struct spa_callbacks callbacks;
152
+   struct port port;
153
+
154
+   unsigned int started_node:1;
155
+   unsigned int started_compress:1;
156
+   uint64_t info_all;
157
+   uint32_t quantum_limit;
158
+
159
+   struct compr_config compr_conf;
160
+   struct snd_codec codec;
161
+   struct compress *compress;
162
+
163
+   int32_t codecs_supportedMAX_CODECS;
164
+   uint32_t num_codecs;
165
+};
166
+
167
+#define CHECK_PORT(this,d,p)  ((d) == SPA_DIRECTION_INPUT && (p) < MAX_PORTS)
168
+
169
+static const struct spa_dict_item node_info_items = {
170
+   { SPA_KEY_DEVICE_API, "alsa" },
171
+   { SPA_KEY_MEDIA_CLASS, "Audio/Sink" },
172
+   { SPA_KEY_NODE_DRIVER, "false" },
173
+   { SPA_KEY_NODE_PAUSE_ON_IDLE, "false" },
174
+};
175
+
176
+static const struct codec_id {
177
+   uint32_t codec_id;
178
+} codec_info = {
179
+   { SND_AUDIOCODEC_MP3, },
180
+   { SND_AUDIOCODEC_AAC, },
181
+   { SND_AUDIOCODEC_WMA, },
182
+   { SND_AUDIOCODEC_VORBIS, },
183
+   { SND_AUDIOCODEC_FLAC, },
184
+   { SND_AUDIOCODEC_ALAC, },
185
+   { SND_AUDIOCODEC_APE, },
186
+   { SND_AUDIOCODEC_REAL, },
187
+   { SND_AUDIOCODEC_AMR, },
188
+   { SND_AUDIOCODEC_AMRWB, },
189
+};
190
+
191
+static int
192
+open_compress(struct impl *this)
193
+{
194
+   struct compress *compress;
195
+
196
+   compress = compress_open_by_name(this->props.device, COMPRESS_IN, &this->compr_conf);
197
+   if (!compress || !is_compress_ready(compress)) {
198
+       spa_log_error(this->log, NAME " %p: Unable to open compress device", this);
199
+       return -EINVAL;
200
+   }
201
pipewire-0.3.64.tar.gz/spa/plugins/alsa/alsa-pcm-device.c -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa-pcm-device.c Changed
32
 
1
@@ -31,11 +31,12 @@
2
 
3
 #include <alsa/asoundlib.h>
4
 
5
-#include <spa/utils/type.h>
6
 #include <spa/node/node.h>
7
+#include <spa/utils/type.h>
8
 #include <spa/utils/keys.h>
9
 #include <spa/utils/names.h>
10
 #include <spa/utils/string.h>
11
+#include <spa/support/log.h>
12
 #include <spa/support/loop.h>
13
 #include <spa/support/plugin.h>
14
 #include <spa/monitor/device.h>
15
@@ -44,6 +45,7 @@
16
 #include <spa/pod/filter.h>
17
 #include <spa/pod/parser.h>
18
 #include <spa/debug/pod.h>
19
+#include <spa/debug/log.h>
20
 
21
 #include "alsa.h"
22
 
23
@@ -462,7 +464,7 @@
24
                SPA_TYPE_OBJECT_ParamProfile, NULL,
25
                SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx))) < 0) {
26
            spa_log_warn(this->log, "can't parse profile");
27
-           spa_debug_pod(0, NULL, param);
28
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
29
            return res;
30
        }
31
 
32
pipewire-0.3.64.tar.gz/spa/plugins/alsa/alsa-pcm-sink.c -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa-pcm-sink.c Changed
9
 
1
@@ -35,7 +35,6 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/param/audio/format.h>
4
 #include <spa/pod/filter.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include "alsa-pcm.h"
8
 
9
pipewire-0.3.64.tar.gz/spa/plugins/alsa/alsa-pcm.c -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa-pcm.c Changed
67
 
1
@@ -1519,6 +1519,11 @@
2
        fmt->info.raw.rate = rrate;
3
        match = false;
4
    }
5
+   if (rchannels == 0 || rrate == 0) {
6
+       spa_log_error(state->log, "%s: invalid channels:%d or rate:%d",
7
+               state->props.device, rchannels, rrate);
8
+       return -EIO;
9
+   }
10
 
11
    state->format = rformat;
12
    state->channels = rchannels;
13
@@ -1563,6 +1568,11 @@
14
 
15
    CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near");
16
 
17
+   if (period_size == 0) {
18
+       spa_log_error(state->log, "%s: invalid period_size 0 (driver error?)", state->props.device);
19
+       return -EIO;
20
+   }
21
+
22
    state->period_frames = period_size;
23
 
24
    if (state->default_period_num != 0) {
25
@@ -1578,6 +1588,10 @@
26
        CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");
27
        periods = state->buffer_frames / period_size;
28
    }
29
+   if (state->buffer_frames == 0) {
30
+       spa_log_error(state->log, "%s: invalid buffer_frames 0 (driver error?)", state->props.device);
31
+       return -EIO;
32
+   }
33
 
34
    state->headroom = state->default_headroom;
35
    if (is_batch)
36
@@ -1985,7 +1999,7 @@
37
        (state->rate_denom != state->position->clock.rate.denom))) {
38
        state->duration = state->position->clock.duration;
39
        state->rate_denom = state->position->clock.rate.denom;
40
-       state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom;
41
+       state->threshold = SPA_SCALE32_UP(state->duration, state->rate, state->rate_denom);
42
        state->max_error = SPA_MAX(256.0f, state->threshold / 2.0f);
43
        state->resample = ((uint32_t)state->rate != state->rate_denom) || state->matching;
44
        state->alsa_sync = true;
45
@@ -2542,12 +2556,20 @@
46
        state->duration = 1024;
47
        state->rate_denom = state->rate;
48
    }
49
+   if (state->rate_denom == 0) {
50
+       spa_log_error(state->log, "%s: unset rate_denom", state->props.device);
51
+       return -EIO;
52
+   }
53
+   if (state->duration == 0) {
54
+       spa_log_error(state->log, "%s: unset duration", state->props.device);
55
+       return -EIO;
56
+   }
57
 
58
    state->following = is_following(state);
59
    setup_matching(state);
60
 
61
    spa_dll_init(&state->dll);
62
-   state->threshold = (state->duration * state->rate + state->rate_denom-1) / state->rate_denom;
63
+   state->threshold = SPA_SCALE32_UP(state->duration, state->rate, state->rate_denom);
64
    state->last_threshold = state->threshold;
65
    state->max_error = SPA_MAX(256.0f, state->threshold / 2.0f);
66
 
67
pipewire-0.3.64.tar.gz/spa/plugins/alsa/alsa.c -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/alsa.c Changed
32
 
1
@@ -22,6 +22,8 @@
2
  * DEALINGS IN THE SOFTWARE.
3
  */
4
 
5
+#include "config.h"
6
+
7
 #include <errno.h>
8
 
9
 #include <spa/support/plugin.h>
10
@@ -33,6 +35,9 @@
11
 extern const struct spa_handle_factory spa_alsa_device_factory;
12
 extern const struct spa_handle_factory spa_alsa_seq_bridge_factory;
13
 extern const struct spa_handle_factory spa_alsa_acp_device_factory;
14
+#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
15
+extern const struct spa_handle_factory spa_alsa_compress_offload_sink_factory;
16
+#endif
17
 
18
 struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.alsa");
19
 struct spa_log_topic *alsa_log_topic = &log_topic;
20
@@ -62,6 +67,11 @@
21
    case 5:
22
        *factory = &spa_alsa_acp_device_factory;
23
        break;
24
+#ifdef HAVE_ALSA_COMPRESS_OFFLOAD
25
+   case 6:
26
+       *factory = &spa_alsa_compress_offload_sink_factory;
27
+       break;
28
+#endif
29
    default:
30
        return 0;
31
    }
32
pipewire-0.3.64.tar.gz/spa/plugins/alsa/meson.build -> pipewire-0.3.65.tar.gz/spa/plugins/alsa/meson.build Changed
29
 
1
@@ -1,6 +1,8 @@
2
 subdir('acp')
3
 subdir('mixer')
4
 
5
+spa_alsa_dependencies =  spa_dep, alsa_dep, libudev_dep, mathlib, epoll_shim_dep, libinotify_dep 
6
+
7
 spa_alsa_sources = 'alsa.c',
8
                 'alsa.h',
9
                 'alsa-udev.c',
10
@@ -12,12 +14,17 @@
11
                 'alsa-seq-bridge.c',
12
                 'alsa-seq.c'
13
 
14
+if tinycompress_dep.found()
15
+  spa_alsa_sources +=  'alsa-compress-offload-sink.c' 
16
+  spa_alsa_dependencies += tinycompress_dep
17
+endif
18
+
19
 spa_alsa = shared_library(
20
   'spa-alsa',
21
    spa_alsa_sources ,
22
   c_args : acp_c_args,
23
   include_directories : configinc,
24
-  dependencies :  spa_dep, alsa_dep, libudev_dep, mathlib, epoll_shim_dep, libinotify_dep ,
25
+  dependencies : spa_alsa_dependencies,
26
   link_with :  acp_lib ,
27
   install : true,
28
   install_dir : spa_plugindir / 'alsa'
29
pipewire-0.3.64.tar.gz/spa/plugins/audioconvert/audioadapter.c -> pipewire-0.3.65.tar.gz/spa/plugins/audioconvert/audioadapter.c Changed
38
 
1
@@ -42,6 +42,7 @@
2
 #include <spa/param/latency-utils.h>
3
 #include <spa/debug/format.h>
4
 #include <spa/debug/pod.h>
5
+#include <spa/debug/log.h>
6
 
7
 #undef SPA_LOG_TOPIC_DEFAULT
8
 #define SPA_LOG_TOPIC_DEFAULT log_topic
9
@@ -333,7 +334,7 @@
10
 
11
    if (filter) {
12
        spa_log_error(this->log, "with this filter:");
13
-       spa_debug_pod(2, NULL, filter);
14
+       spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 2, NULL, filter);
15
    } else {
16
        spa_log_error(this->log, "there was no filter");
17
    }
18
@@ -351,7 +352,7 @@
19
            break;
20
        }
21
        spa_log_error(this->log, "unmatched %s %d:", debug, count);
22
-       spa_debug_pod(2, NULL, param);
23
+       spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 2, NULL, param);
24
        count++;
25
    }
26
    if (count == 0)
27
@@ -480,8 +481,8 @@
28
        return 0;
29
 
30
    spa_log_debug(this->log, "%p: configure format:", this);
31
-   if (format && spa_log_level_enabled(this->log, SPA_LOG_LEVEL_DEBUG))
32
-       spa_debug_format(0, NULL, format);
33
+   if (format)
34
+       spa_debug_log_format(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, format);
35
 
36
    if ((res = spa_node_port_set_param(this->follower,
37
                       this->direction, 0,
38
pipewire-0.3.64.tar.gz/spa/plugins/audioconvert/audioconvert.c -> pipewire-0.3.65.tar.gz/spa/plugins/audioconvert/audioconvert.c Changed
18
 
1
@@ -44,7 +44,6 @@
2
 #include <spa/param/latency-utils.h>
3
 #include <spa/pod/filter.h>
4
 #include <spa/debug/types.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include "volume-ops.h"
8
 #include "fmt-ops.h"
9
@@ -1755,7 +1754,7 @@
10
            size = this->quantum_limit * 2;
11
            /*  scale the buffer size when we can. */
12
            if (irate != 0 && orate != 0)
13
-               size = size * (irate + orate - 1) / orate;
14
+               size = SPA_SCALE32_UP(size, irate, orate);
15
        }
16
 
17
        param = spa_pod_builder_add_object(&b,
18
pipewire-0.3.64.tar.gz/spa/plugins/audioconvert/fmt-ops.h -> pipewire-0.3.65.tar.gz/spa/plugins/audioconvert/fmt-ops.h Changed
52
 
1
@@ -97,34 +97,42 @@
2
 #define F32_TO_S24(v)      F32_TO_S24_D(v, 0.0f)
3
 #define F32_TO_S24S(v)     bswap_s24(F32_TO_S24(v))
4
 
5
-#define U24_32_TO_F32(v)   U32_TO_F32((v)<<8)
6
+#define U24_32_TO_U32(v)   (((uint32_t)(v)) << 8)
7
+
8
+#define U24_32_TO_F32(v)   U32_TO_F32(U24_32_TO_U32(v))
9
 #define U24_32S_TO_F32(v)  U24_32_TO_F32(bswap_32(v))
10
 #define F32_TO_U24_32_D(v,d)   FTOI(uint32_t, v, U24_SCALE, U24_OFFS, d, U24_MIN, U24_MAX)
11
 #define F32_TO_U24_32(v)   F32_TO_U24_32_D(v, 0.0f)
12
 #define F32_TO_U24_32S(v)  bswap_32(F32_TO_U24_32(v))
13
 #define F32_TO_U24_32S_D(v,d)  bswap_32(F32_TO_U24_32_D(v,d))
14
 
15
+#define U32_TO_U24_32(v)   (((uint32_t)(v)) >> 8)
16
+
17
 #define U32_MIN            0u
18
 #define U32_MAX            4294967295u
19
 #define U32_SCALE      2147483648.f
20
 #define U32_OFFS       2147483648.f
21
-#define U32_TO_F32(v)      ITOF(uint32_t, (v) >> 8, U24_SCALE, 1.0f)
22
-#define F32_TO_U32(v)      (F32_TO_U24_32(v) << 8)
23
-#define F32_TO_U32_D(v,d)  (F32_TO_U24_32_D(v,d) << 8)
24
+#define U32_TO_F32(v)      ITOF(uint32_t, U32_TO_U24_32(v), U24_SCALE, 1.0f)
25
+#define F32_TO_U32(v)      U24_32_TO_U32(F32_TO_U24_32(v))
26
+#define F32_TO_U32_D(v,d)  U24_32_TO_U32(F32_TO_U24_32_D(v,d))
27
 
28
-#define S24_32_TO_F32(v)   S32_TO_F32((v)<<8)
29
+#define S24_32_TO_S32(v)   ((int32_t)(((uint32_t)(v)) << 8))
30
+
31
+#define S24_32_TO_F32(v)   S32_TO_F32(S24_32_TO_S32(v))
32
 #define S24_32S_TO_F32(v)  S24_32_TO_F32(bswap_32(v))
33
 #define F32_TO_S24_32_D(v,d)   FTOI(int32_t, v, S24_SCALE, 0.0f, d, S24_MIN, S24_MAX)
34
 #define F32_TO_S24_32(v)   F32_TO_S24_32_D(v, 0.0f)
35
 #define F32_TO_S24_32S(v)  bswap_32(F32_TO_S24_32(v))
36
 #define F32_TO_S24_32S_D(v,d)  bswap_32(F32_TO_S24_32_D(v,d))
37
 
38
+#define S32_TO_S24_32(v)   (((int32_t)(v)) >> 8)
39
+
40
 #define S32_MIN            (S24_MIN * 256)
41
 #define S32_MAX            (S24_MAX * 256)
42
-#define S32_TO_F32(v)      ITOF(int32_t, (v) >> 8, S24_SCALE, 0.0f)
43
+#define S32_TO_F32(v)      ITOF(int32_t, S32_TO_S24_32(v), S24_SCALE, 0.0f)
44
 #define S32S_TO_F32(v)     S32_TO_F32(bswap_32(v))
45
-#define F32_TO_S32(v)      (F32_TO_S24_32(v) << 8)
46
-#define F32_TO_S32_D(v,d)  (F32_TO_S24_32_D(v,d) << 8)
47
+#define F32_TO_S32(v)      S24_32_TO_S32(F32_TO_S24_32(v))
48
+#define F32_TO_S32_D(v,d)  S24_32_TO_S32(F32_TO_S24_32_D(v,d))
49
 #define F32_TO_S32S(v)     bswap_32(F32_TO_S32(v))
50
 #define F32_TO_S32S_D(v,d) bswap_32(F32_TO_S32_D(v,d))
51
 
52
pipewire-0.3.64.tar.gz/spa/plugins/avb/avb-pcm-sink.c -> pipewire-0.3.65.tar.gz/spa/plugins/avb/avb-pcm-sink.c Changed
9
 
1
@@ -33,7 +33,6 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/param/audio/format.h>
4
 #include <spa/pod/filter.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include "avb-pcm.h"
8
 
9
pipewire-0.3.64.tar.gz/spa/plugins/avb/avb-pcm-source.c -> pipewire-0.3.65.tar.gz/spa/plugins/avb/avb-pcm-source.c Changed
9
 
1
@@ -33,7 +33,6 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/param/audio/format.h>
4
 #include <spa/pod/filter.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include "avb-pcm.h"
8
 
9
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/README-MIDI.md Added
26
 
1
@@ -0,0 +1,24 @@
2
+## BLE MIDI & SELinux
3
+
4
+The SELinux configuration on Fedora 37 (as of 2022-11-10) does not
5
+permit access to the bluetoothd APIs needed for BLE MIDI.
6
+
7
+As a workaround, hopefully to be not necessary in future, you can
8
+permit such access by creating a file `blemidi.te` with contents:
9
+
10
+    policy_module(blemidi, 1.0);
11
+
12
+    require {
13
+        type system_dbusd_t;
14
+        type unconfined_t;
15
+        type bluetooth_t;
16
+    }
17
+
18
+    allow bluetooth_t unconfined_t:unix_stream_socket { read write };
19
+    allow system_dbusd_t bluetooth_t:unix_stream_socket { read write };
20
+
21
+Then having package `selinux-policy-devel` installed, running
22
+`make -f /usr/share/selinux/devel/Makefile blemidi.pp`, and finally
23
+to insert the rules via `sudo semodule -i blemidi.pp`.
24
+
25
+The policy change can be removed by `sudo semodule -r blemidi`.
26
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/backend-native.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/backend-native.c Changed
33
 
1
@@ -36,6 +36,8 @@
2
 
3
 #include <dbus/dbus.h>
4
 
5
+#include <spa/debug/mem.h>
6
+#include <spa/debug/log.h>
7
 #include <spa/support/log.h>
8
 #include <spa/support/loop.h>
9
 #include <spa/support/dbus.h>
10
@@ -779,6 +781,12 @@
11
    int xapl_product;
12
    int xapl_features;
13
 
14
+   spa_debug_log_mem(backend->log, SPA_LOG_LEVEL_DEBUG, 2, buf, strlen(buf));
15
+
16
+   /* Some devices send initial \n: be permissive */
17
+   while (*buf == '\n')
18
+       ++buf;
19
+
20
    if (sscanf(buf, "AT+BRSF=%u", &features) == 1) {
21
        unsigned int ag_features = SPA_BT_HFP_AG_FEATURE_NONE;
22
 
23
@@ -880,6 +888,9 @@
24
                rfcomm_emit_volume_changed(rfcomm, -1, SPA_BT_VOLUME_INVALID);
25
            }
26
        }
27
+   } else if (spa_streq(buf, "\r")) {
28
+       /* No commands, reply OK (ITU-T Rec. V.250 Sec. 5.2.1 & 5.6) */
29
+       rfcomm_send_reply(rfcomm, "OK");
30
    } else if (!rfcomm->slc_configured) {
31
        spa_log_warn(backend->log, "RFCOMM receive command before SLC completed: %s", buf);
32
        rfcomm_send_error(rfcomm, CMEE_AG_FAILURE);
33
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/bap-codec-lc3.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/bap-codec-lc3.c Changed
201
 
1
@@ -39,6 +39,8 @@
2
 #include "media-codecs.h"
3
 #include "bap-codec-caps.h"
4
 
5
+#define MAX_PACS   64
6
+
7
 struct impl {
8
    lc3_encoder_t encLC3_MAX_CHANNELS;
9
    lc3_decoder_t decLC3_MAX_CHANNELS;
10
@@ -52,11 +54,16 @@
11
    unsigned int codesize;
12
 };
13
 
14
-struct ltv {
15
+struct __attribute__((packed)) ltv {
16
    uint8_t  len;
17
    uint8_t  type;
18
-   uint8_t  value0;
19
-} __packed;
20
+   uint8_t  value;
21
+};
22
+
23
+struct pac_data {
24
+   const uint8_t *data;
25
+   size_t size;
26
+};
27
 
28
 static int write_ltv(uint8_t *dest, uint8_t type, void* value, size_t len)
29
 {
30
@@ -100,6 +107,38 @@
31
    return data - caps;
32
 }
33
 
34
+static int parse_bluez_pacs(const uint8_t *data, size_t data_size, struct pac_data pacsMAX_PACS)
35
+{
36
+   /*
37
+    * BlueZ capabilites for the same codec may contain multiple
38
+    * PACs separated by zero-length LTV (see BlueZ b907befc2d80)
39
+    */
40
+   int pac = 0;
41
+
42
+   pacspac = (struct pac_data){ data, 0 };
43
+
44
+   while (data_size > 0) {
45
+       struct ltv *ltv = (struct ltv *)data;
46
+
47
+       if (ltv->len == 0) {
48
+           /* delimiter */
49
+           if (pac + 1 >= MAX_PACS)
50
+               break;
51
+
52
+           ++pac;
53
+           pacspac = (struct pac_data){ data + 1, 0 };
54
+       } else if (ltv->len >= data_size) {
55
+           return -EINVAL;
56
+       } else {
57
+           pacspac.size += ltv->len + 1;
58
+       }
59
+       data_size -= ltv->len + 1;
60
+       data += ltv->len + 1;
61
+   }
62
+
63
+   return pac + 1;
64
+}
65
+
66
 static bool parse_capabilities(bap_lc3_t *conf, const uint8_t *data, size_t data_size)
67
 {
68
    uint16_t framelen_min = 0, framelen_max = 0;
69
@@ -113,7 +152,7 @@
70
    while (data_size > 0) {
71
        struct ltv *ltv = (struct ltv *)data;
72
 
73
-       if (ltv->len > data_size)
74
+       if (ltv->len < sizeof(struct ltv) || ltv->len >= data_size)
75
            return false;
76
 
77
        switch (ltv->type) {
78
@@ -227,7 +266,7 @@
79
    while (data_size > 0) {
80
        struct ltv *ltv = (struct ltv *)data;
81
 
82
-       if (ltv->len > data_size)
83
+       if (ltv->len < sizeof(struct ltv) || ltv->len >= data_size)
84
            return false;
85
 
86
        switch (ltv->type) {
87
@@ -266,18 +305,75 @@
88
    return true;
89
 }
90
 
91
+static int conf_cmp(const bap_lc3_t *conf1, int res1, const bap_lc3_t *conf2, int res2)
92
+{
93
+   const bap_lc3_t *conf;
94
+   int a, b;
95
+
96
+#define PREFER_EXPR(expr)          \
97
+       do {                \
98
+           conf = conf1;       \
99
+           a = (expr);     \
100
+           conf = conf2;       \
101
+           b = (expr);     \
102
+           if (a != b)     \
103
+               return b - a;   \
104
+       } while (0)
105
+
106
+#define PREFER_BOOL(expr)  PREFER_EXPR((expr) ? 1 : 0)
107
+
108
+   /* Prefer valid */
109
+   a = (res1 > 0 && (size_t)res1 == sizeof(bap_lc3_t)) ? 1 : 0;
110
+   b = (res2 > 0 && (size_t)res2 == sizeof(bap_lc3_t)) ? 1 : 0;
111
+   if (!a || !b)
112
+       return b - a;
113
+
114
+   PREFER_BOOL(conf->channels & LC3_CHAN_2);
115
+   PREFER_BOOL(conf->rate & (LC3_CONFIG_FREQ_48KHZ | LC3_CONFIG_FREQ_24KHZ | LC3_CONFIG_FREQ_16KHZ | LC3_CONFIG_FREQ_8KHZ));
116
+   PREFER_BOOL(conf->rate & LC3_CONFIG_FREQ_48KHZ);
117
+
118
+   return 0;
119
+
120
+#undef PREFER_EXPR
121
+#undef PREFER_BOOL
122
+}
123
+
124
+static int pac_cmp(const void *p1, const void *p2)
125
+{
126
+   const struct pac_data *pac1 = p1;
127
+   const struct pac_data *pac2 = p2;
128
+   bap_lc3_t conf1, conf2;
129
+   int res1, res2;
130
+
131
+   res1 = parse_capabilities(&conf1, pac1->data, pac1->size) ? (int)sizeof(bap_lc3_t) : -EINVAL;
132
+   res2 = parse_capabilities(&conf2, pac2->data, pac2->size) ? (int)sizeof(bap_lc3_t) : -EINVAL;
133
+
134
+   return conf_cmp(&conf1, res1, &conf2, res2);
135
+}
136
+
137
 static int codec_select_config(const struct media_codec *codec, uint32_t flags,
138
        const void *caps, size_t caps_size,
139
        const struct media_codec_audio_info *info,
140
        const struct spa_dict *settings, uint8_t configA2DP_MAX_CAPS_SIZE)
141
 {
142
+   struct pac_data pacsMAX_PACS;
143
+   int npacs;
144
    bap_lc3_t conf;
145
    uint8_t *data = config;
146
 
147
    if (caps == NULL)
148
        return -EINVAL;
149
 
150
-   if (!parse_capabilities(&conf, caps, caps_size))
151
+   /* Select best conf from those possible */
152
+   npacs = parse_bluez_pacs(caps, caps_size, pacs);
153
+   if (npacs < 0)
154
+       return npacs;
155
+   else if (npacs == 0)
156
+       return -EINVAL;
157
+
158
+   qsort(pacs, npacs, sizeof(struct pac_data), pac_cmp);
159
+
160
+   if (!parse_capabilities(&conf, pacs0.data, pacs0.size))
161
        return -ENOTSUP;
162
 
163
    data += write_ltv_uint8(data, LC3_TYPE_FREQ, conf.rate);
164
@@ -293,40 +389,13 @@
165
        const void *caps2, size_t caps2_size, const struct media_codec_audio_info *info, const struct spa_dict *global_settings)
166
 {
167
    bap_lc3_t conf1, conf2;
168
-   bap_lc3_t *conf;
169
    int res1, res2;
170
-   int a, b;
171
 
172
    /* Order selected configurations by preference */
173
    res1 = codec->select_config(codec, 0, caps1, caps1_size, info, NULL, (uint8_t *)&conf1);
174
    res2 = codec->select_config(codec, 0, caps2, caps2_size, info , NULL, (uint8_t *)&conf2);
175
 
176
-#define PREFER_EXPR(expr)          \
177
-       do {                \
178
-           conf = &conf1;      \
179
-           a = (expr);     \
180
-           conf = &conf2;      \
181
-           b = (expr);     \
182
-           if (a != b)     \
183
-               return b - a;   \
184
-       } while (0)
185
-
186
-#define PREFER_BOOL(expr)  PREFER_EXPR((expr) ? 1 : 0)
187
-
188
-   /* Prefer valid */
189
-   a = (res1 > 0 && (size_t)res1 == sizeof(bap_lc3_t)) ? 1 : 0;
190
-   b = (res2 > 0 && (size_t)res2 == sizeof(bap_lc3_t)) ? 1 : 0;
191
-   if (!a || !b)
192
-       return b - a;
193
-
194
-   PREFER_BOOL(conf->channels & LC3_CHAN_2);
195
-   PREFER_BOOL(conf->rate & (LC3_CONFIG_FREQ_48KHZ | LC3_CONFIG_FREQ_24KHZ | LC3_CONFIG_FREQ_16KHZ | LC3_CONFIG_FREQ_8KHZ));
196
-   PREFER_BOOL(conf->rate & LC3_CONFIG_FREQ_48KHZ);
197
-
198
-   return 0;
199
-
200
-#undef PREFER_EXPR
201
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/bluez5-dbus.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/bluez5-dbus.c Changed
120
 
1
@@ -35,6 +35,8 @@
2
 
3
 #include <dbus/dbus.h>
4
 
5
+#include <spa/debug/mem.h>
6
+#include <spa/debug/log.h>
7
 #include <spa/support/log.h>
8
 #include <spa/support/loop.h>
9
 #include <spa/support/dbus.h>
10
@@ -563,7 +565,7 @@
11
        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
12
    }
13
    spa_log_info(monitor->log, "%p: %s select conf %d", monitor, path, size);
14
-   spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, cap, (size_t)size);
15
+   spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, cap, (size_t)size);
16
 
17
    /* For codecs sharing the same endpoint, BlueZ-initiated connections
18
     * always pick the default one. The session manager will
19
@@ -592,7 +594,7 @@
20
            return DBUS_HANDLER_RESULT_NEED_MEMORY;
21
        goto exit_send;
22
    }
23
-   spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, pconf, (size_t)size);
24
+   spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, pconf, (size_t)size);
25
 
26
    if ((r = dbus_message_new_method_return(m)) == NULL)
27
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
28
@@ -628,6 +630,7 @@
29
    uint8_t capsA2DP_MAX_CAPS_SIZE;
30
    uint8_t configA2DP_MAX_CAPS_SIZE;
31
    int caps_size = 0;
32
+   int conf_size;
33
    DBusMessageIter dict;
34
    struct bap_endpoint_qos endpoint_qos;
35
 
36
@@ -688,10 +691,14 @@
37
            }
38
 
39
            dbus_message_iter_get_fixed_array(&array, &buf, &caps_size);
40
+           if (caps_size > (int)sizeof(caps)) {
41
+               spa_log_error(monitor->log, "%s size:%d too large", key, (int)caps_size);
42
+               goto error_invalid;
43
+           }
44
            memcpy(caps, buf, caps_size);
45
 
46
            spa_log_info(monitor->log, "%p: %s %s size:%d", monitor, path, key, caps_size);
47
-           spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, ' ', caps, (size_t)caps_size);
48
+           spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, ' ', caps, (size_t)caps_size);
49
        } else if (spa_streq(key, "Endpoint")) {
50
            if (type != DBUS_TYPE_OBJECT_PATH) {
51
                spa_log_error(monitor->log, "Property %s of wrong type %c", key, (char)type);
52
@@ -764,15 +771,14 @@
53
    /* TODO: determine which device the SelectConfiguration() call is associated
54
     * with; it's known here based on the remote endpoint.
55
     */
56
-   res = codec->select_config(codec, 0, caps, caps_size, &monitor->default_audio_info, NULL, config);
57
-
58
-   if (res < 0 || res != caps_size) {
59
+   conf_size = codec->select_config(codec, 0, caps, caps_size, &monitor->default_audio_info, NULL, config);
60
+   if (conf_size < 0) {
61
        spa_log_error(monitor->log, "can't select config: %d (%s)",
62
-               res, spa_strerror(res));
63
+               conf_size, spa_strerror(conf_size));
64
        goto error_invalid;
65
    }
66
-   spa_log_info(monitor->log, "%p: selected conf %d", monitor, caps_size);
67
-   spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, ' ', (uint8_t *)config, (size_t)caps_size);
68
+   spa_log_info(monitor->log, "%p: selected conf %d", monitor, conf_size);
69
+   spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, ' ', (uint8_t *)config, (size_t)conf_size);
70
 
71
    if ((r = dbus_message_new_method_return(m)) == NULL)
72
        return DBUS_HANDLER_RESULT_NEED_MEMORY;
73
@@ -784,7 +790,7 @@
74
            DBUS_TYPE_VARIANT_AS_STRING
75
            DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
76
            &dict);
77
-   append_basic_array_variant_dict_entry(&dict, "Capabilities", "ay", "y", DBUS_TYPE_BYTE, &config, caps_size);
78
+   append_basic_array_variant_dict_entry(&dict, "Capabilities", "ay", "y", DBUS_TYPE_BYTE, &config, conf_size);
79
 
80
    if (codec->get_qos) {
81
        struct bap_codec_qos qos;
82
@@ -793,7 +799,7 @@
83
 
84
        spa_zero(qos);
85
 
86
-       res = codec->get_qos(codec, config, caps_size, &endpoint_qos, &qos);
87
+       res = codec->get_qos(codec, config, conf_size, &endpoint_qos, &qos);
88
        if (res < 0) {
89
            spa_log_error(monitor->log, "can't select QOS config: %d (%s)",
90
                    res, spa_strerror(res));
91
@@ -2060,7 +2066,7 @@
92
            dbus_message_iter_get_fixed_array(&iter, &value, &len);
93
 
94
            spa_log_debug(monitor->log, "remote_endpoint %p: %s=%d", remote_endpoint, key, len);
95
-           spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
96
+           spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
97
 
98
            free(remote_endpoint->capabilities);
99
            remote_endpoint->capabilities_len = 0;
100
@@ -2612,7 +2618,7 @@
101
            dbus_message_iter_get_fixed_array(&iter, &value, &len);
102
 
103
            spa_log_debug(monitor->log, "transport %p: %s=%d", transport, key, len);
104
-           spa_log_hexdump(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
105
+           spa_debug_log_mem(monitor->log, SPA_LOG_LEVEL_DEBUG, 2, value, (size_t)len);
106
 
107
            free(transport->configuration);
108
            transport->configuration_len = 0;
109
@@ -3807,7 +3813,9 @@
110
     * */
111
    spa_log_warn(monitor->log,
112
             "Using legacy bluez5 API for A2DP - only SBC will be supported. "
113
-            "Please upgrade bluez5.");
114
+            "No LE Audio. Please upgrade bluez5.");
115
+
116
+   monitor->le_audio_supported = false;
117
 
118
    for (i = 0; media_codecsi; i++) {
119
        const struct media_codec *codec = media_codecsi;
120
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/bluez5-device.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/bluez5-device.c Changed
58
 
1
@@ -49,6 +49,7 @@
2
 #include <spa/param/bluetooth/audio.h>
3
 #include <spa/param/bluetooth/type-info.h>
4
 #include <spa/debug/pod.h>
5
+#include <spa/debug/log.h>
6
 
7
 #include "defs.h"
8
 #include "media-codecs.h"
9
@@ -1150,13 +1151,20 @@
10
    if (profile == DEVICE_PROFILE_OFF || profile == DEVICE_PROFILE_AG)
11
        return profile;
12
 
13
-   if (profile == DEVICE_PROFILE_A2DP || profile == DEVICE_PROFILE_BAP) {
14
+   if (profile == DEVICE_PROFILE_A2DP) {
15
        if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_MEDIA_SOURCE))
16
            return profile;
17
 
18
        return codec + DEVICE_PROFILE_LAST;
19
    }
20
 
21
+   if (profile == DEVICE_PROFILE_BAP) {
22
+       if (codec == 0)
23
+           return profile;
24
+
25
+       return codec + DEVICE_PROFILE_LAST;
26
+   }
27
+
28
    if (profile == DEVICE_PROFILE_HSP_HFP) {
29
        if (codec == 0 || (this->bt_dev->connected_profiles & SPA_BT_PROFILE_HFP_AG))
30
            return profile;
31
@@ -2107,7 +2115,7 @@
32
                SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx),
33
                SPA_PARAM_PROFILE_save, SPA_POD_OPT_Bool(&save))) < 0) {
34
            spa_log_warn(this->log, "can't parse profile");
35
-           spa_debug_pod(0, NULL, param);
36
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
37
            return res;
38
        }
39
 
40
@@ -2135,7 +2143,7 @@
41
                SPA_PARAM_ROUTE_props, SPA_POD_OPT_Pod(&props),
42
                SPA_PARAM_ROUTE_save, SPA_POD_OPT_Bool(&save))) < 0) {
43
            spa_log_warn(this->log, "can't parse route");
44
-           spa_debug_pod(0, NULL, param);
45
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
46
            return res;
47
        }
48
        if (device > 1 || !this->nodesdevice.active)
49
@@ -2166,7 +2174,7 @@
50
                SPA_PROP_bluetoothAudioCodec, SPA_POD_OPT_Id(&codec_id),
51
                SPA_PROP_bluetoothOffloadActive, SPA_POD_OPT_Bool(&offload_active))) < 0) {
52
            spa_log_warn(this->log, "can't parse props");
53
-           spa_debug_pod(0, NULL, param);
54
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
55
            return res;
56
        }
57
 
58
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/dbus-monitor.c Added
201
 
1
@@ -0,0 +1,265 @@
2
+/* Spa midi dbus
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+#include <gio/gio.h>
26
+
27
+#include <spa/utils/defs.h>
28
+#include <spa/utils/string.h>
29
+#include <spa/support/log.h>
30
+
31
+#include "dbus-monitor.h"
32
+
33
+
34
+static void on_g_properties_changed(GDBusProxy *proxy,
35
+       GVariant *changed_properties, char **invalidated_properties,
36
+       gpointer user_data)
37
+{
38
+   struct dbus_monitor *monitor = user_data;
39
+   GDBusInterfaceInfo *info = g_dbus_interface_get_info(G_DBUS_INTERFACE(proxy));
40
+   const char *name = info ? info->name : NULL;
41
+   const struct dbus_monitor_proxy_type *p;
42
+
43
+   spa_log_trace(monitor->log, "%p: dbus object updated path=%s, name=%s",
44
+           monitor, g_dbus_proxy_get_object_path(proxy), name ? name : "<null>");
45
+
46
+   for (p = monitor->proxy_types; p && p->proxy_type != G_TYPE_INVALID ; ++p) {
47
+       if (G_TYPE_CHECK_INSTANCE_TYPE(proxy, p->proxy_type)) {
48
+           if (p->on_update)
49
+               p->on_update(monitor, G_DBUS_INTERFACE(proxy));
50
+       }
51
+   }
52
+}
53
+
54
+static void on_remove(struct dbus_monitor *monitor, GDBusProxy *proxy)
55
+{
56
+   const struct dbus_monitor_proxy_type *p;
57
+
58
+   for (p = monitor->proxy_types; p && p->proxy_type != G_TYPE_INVALID ; ++p) {
59
+       if (G_TYPE_CHECK_INSTANCE_TYPE(proxy, p->proxy_type)) {
60
+           if (p->on_remove)
61
+               p->on_remove(monitor, G_DBUS_INTERFACE(proxy));
62
+       }
63
+   }
64
+}
65
+
66
+static void on_interface_added(GDBusObjectManager *self, GDBusObject *object,
67
+       GDBusInterface *iface, gpointer user_data)
68
+{
69
+   struct dbus_monitor *monitor = user_data;
70
+   GDBusInterfaceInfo *info = g_dbus_interface_get_info(iface);
71
+   const char *name = info ? info->name : NULL;
72
+
73
+   spa_log_trace(monitor->log, "%p: dbus interface added path=%s, name=%s",
74
+           monitor, g_dbus_object_get_object_path(object), name ? name : "<null>");
75
+
76
+   if (!g_object_get_data(G_OBJECT(iface), "dbus-monitor-signals-connected")) {
77
+       g_object_set_data(G_OBJECT(iface), "dbus-monitor-signals-connected", GUINT_TO_POINTER(1));
78
+       g_signal_connect(iface, "g-properties-changed",
79
+               G_CALLBACK(on_g_properties_changed),
80
+               monitor);
81
+   }
82
+
83
+   on_g_properties_changed(G_DBUS_PROXY(iface),
84
+           NULL, NULL, monitor);
85
+}
86
+
87
+static void on_interface_removed(GDBusObjectManager *manager, GDBusObject *object,
88
+       GDBusInterface *iface, gpointer user_data)
89
+{
90
+   struct dbus_monitor *monitor = user_data;
91
+   GDBusInterfaceInfo *info = g_dbus_interface_get_info(iface);
92
+   const char *name = info ? info->name : NULL;
93
+
94
+   spa_log_trace(monitor->log, "%p: dbus interface removed path=%s, name=%s",
95
+           monitor, g_dbus_object_get_object_path(object), name ? name : "<null>");
96
+
97
+   if (g_object_get_data(G_OBJECT(iface), "dbus-monitor-signals-connected")) {
98
+       g_object_disconnect(G_OBJECT(iface), "g-properties-changed",
99
+               G_CALLBACK(on_g_properties_changed),
100
+               monitor, NULL);
101
+       g_object_set_data(G_OBJECT(iface), "dbus-monitor-signals-connected", NULL);
102
+   }
103
+
104
+   on_remove(monitor, G_DBUS_PROXY(iface));
105
+}
106
+
107
+static void on_object_added(GDBusObjectManager *self, GDBusObject *object,
108
+       gpointer user_data)
109
+{
110
+   struct dbus_monitor *monitor = user_data;
111
+   GList *interfaces = g_dbus_object_get_interfaces(object);
112
+
113
+   /*
114
+    * on_interface_added won't necessarily be called on objects on
115
+    * name owner changes, so we have to call it here for all interfaces.
116
+    */
117
+   for (GList *lli = g_list_first(interfaces); lli; lli = lli->next) {
118
+       on_interface_added(dbus_monitor_manager(monitor),
119
+               object, G_DBUS_INTERFACE(lli->data), monitor);
120
+   }
121
+
122
+   g_list_free_full(interfaces, g_object_unref);
123
+}
124
+
125
+static void on_object_removed(GDBusObjectManager *manager, GDBusObject *object,
126
+       gpointer user_data)
127
+{
128
+   struct dbus_monitor *monitor = user_data;
129
+   GList *interfaces = g_dbus_object_get_interfaces(object);
130
+
131
+   for (GList *lli = g_list_first(interfaces); lli; lli = lli->next) {
132
+       on_interface_removed(dbus_monitor_manager(monitor),
133
+               object, G_DBUS_INTERFACE(lli->data), monitor);
134
+   }
135
+
136
+   g_list_free_full(interfaces, g_object_unref);
137
+}
138
+
139
+static void on_notify(GObject *gobject, GParamSpec *pspec, gpointer user_data)
140
+{
141
+   struct dbus_monitor *monitor = user_data;
142
+
143
+   if (spa_streq(pspec->name, "name-owner") && monitor->on_name_owner_change)
144
+       monitor->on_name_owner_change(monitor);
145
+}
146
+
147
+static GType get_proxy_type(GDBusObjectManagerClient *manager, const gchar *object_path,
148
+       const gchar *interface_name, gpointer user_data)
149
+{
150
+   struct dbus_monitor *monitor = user_data;
151
+   const struct dbus_monitor_proxy_type *p;
152
+
153
+   for (p = monitor->proxy_types; p && p->proxy_type != G_TYPE_INVALID; ++p) {
154
+       if (spa_streq(p->interface_name, interface_name))
155
+           return p->proxy_type;
156
+   }
157
+
158
+   return G_TYPE_DBUS_PROXY;
159
+}
160
+
161
+static void init_done(GObject *source_object, GAsyncResult *res, gpointer user_data)
162
+{
163
+   struct dbus_monitor *monitor = user_data;
164
+   GError *error = NULL;
165
+   GList *objects;
166
+   GObject *ret;
167
+
168
+   g_clear_object(&monitor->call);
169
+
170
+   ret = g_async_initable_new_finish(G_ASYNC_INITABLE(source_object), res, &error);
171
+   if (!ret) {
172
+       spa_log_error(monitor->log, "%p: creating DBus object monitor failed: %s",
173
+               monitor, error->message);
174
+       g_error_free(error);
175
+       return;
176
+   }
177
+   monitor->manager = G_DBUS_OBJECT_MANAGER_CLIENT(ret);
178
+
179
+   spa_log_debug(monitor->log, "%p: DBus monitor started", monitor);
180
+
181
+   g_signal_connect(monitor->manager, "interface-added",
182
+           G_CALLBACK(on_interface_added), monitor);
183
+   g_signal_connect(monitor->manager, "interface-removed",
184
+           G_CALLBACK(on_interface_removed), monitor);
185
+   g_signal_connect(monitor->manager, "object-added",
186
+           G_CALLBACK(on_object_added), monitor);
187
+   g_signal_connect(monitor->manager, "object-removed",
188
+           G_CALLBACK(on_object_removed), monitor);
189
+   g_signal_connect(monitor->manager, "notify",
190
+           G_CALLBACK(on_notify), monitor);
191
+
192
+   /* List all objects now */
193
+   objects = g_dbus_object_manager_get_objects(dbus_monitor_manager(monitor));
194
+   for (GList *llo = g_list_first(objects); llo; llo = llo->next) {
195
+       GList *interfaces = g_dbus_object_get_interfaces(G_DBUS_OBJECT(llo->data));
196
+
197
+       for (GList *lli = g_list_first(interfaces); lli; lli = lli->next) {
198
+           on_interface_added(dbus_monitor_manager(monitor),
199
+                   G_DBUS_OBJECT(llo->data), G_DBUS_INTERFACE(lli->data),
200
+                   monitor);
201
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/dbus-monitor.h Added
85
 
1
@@ -0,0 +1,83 @@
2
+/* Spa midi dbus
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+#ifndef DBUS_MONITOR_H_
26
+#define DBUS_MONITOR_H_
27
+
28
+#include <gio/gio.h>
29
+
30
+#include <spa/utils/defs.h>
31
+#include <spa/utils/string.h>
32
+#include <spa/support/log.h>
33
+
34
+#define DBUS_MONITOR_MAX_TYPES 16
35
+
36
+struct dbus_monitor;
37
+
38
+struct dbus_monitor_proxy_type
39
+{
40
+   /** Interface name to monitor, or NULL for object type */
41
+   const char *interface_name;
42
+
43
+   /** GObject type for the proxy */
44
+   GType proxy_type;
45
+
46
+   /** Hook called when object added or properties changed */
47
+   void (*on_update)(struct dbus_monitor *monitor, GDBusInterface *iface);
48
+
49
+   /** Hook called when object is removed (or on monitor shutdown) */
50
+   void (*on_remove)(struct dbus_monitor *monitor, GDBusInterface *iface);
51
+};
52
+
53
+struct dbus_monitor
54
+{
55
+   GDBusObjectManagerClient *manager;
56
+   struct spa_log *log;
57
+   GCancellable *call;
58
+   struct dbus_monitor_proxy_type proxy_typesDBUS_MONITOR_MAX_TYPES+1;
59
+   void (*on_name_owner_change)(struct dbus_monitor *monitor);
60
+   void *user_data;
61
+};
62
+
63
+static inline GDBusObjectManager *dbus_monitor_manager(struct dbus_monitor *monitor)
64
+{
65
+   return G_DBUS_OBJECT_MANAGER(monitor->manager);
66
+}
67
+
68
+/**
69
+ * Create a DBus object monitor, with a given interface to proxy type map.
70
+ *
71
+ * \param proxy_types  Mapping between interface names and watched proxy
72
+ *     types, terminated by G_TYPE_INVALID.
73
+ * \param on_object_update Called for all objects and interfaces on
74
+ * startup, and when object properties are modified.
75
+ */
76
+void dbus_monitor_init(struct dbus_monitor *monitor,
77
+       GType client_type, struct spa_log *log, GDBusConnection *conn,
78
+       const char *name, const char *object_path,
79
+       const struct dbus_monitor_proxy_type *proxy_types,
80
+       void (*on_name_owner_change)(struct dbus_monitor *monitor));
81
+
82
+void dbus_monitor_clear(struct dbus_monitor *monitor);
83
+
84
+#endif DBUS_MONITOR_H_
85
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/media-codecs.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/media-codecs.c Changed
13
 
1
@@ -78,7 +78,10 @@
2
    if (res < 0)
3
        return false;
4
 
5
-   return ((size_t)res == caps_size);
6
+   if (codec->bap)
7
+       return true;
8
+   else
9
+       return ((size_t)res == caps_size);
10
 }
11
 
12
 #ifdef CODEC_PLUGIN
13
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/media-sink.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/media-sink.c Changed
19
 
1
@@ -48,6 +48,8 @@
2
 #include <spa/param/audio/format.h>
3
 #include <spa/param/audio/format-utils.h>
4
 #include <spa/pod/filter.h>
5
+#include <spa/debug/mem.h>
6
+#include <spa/debug/log.h>
7
 
8
 #include <sbc/sbc.h>
9
 
10
@@ -949,7 +951,7 @@
11
    size = this->transport->configuration_len;
12
 
13
    spa_log_debug(this->log, "Transport configuration:");
14
-   spa_log_hexdump(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
15
+   spa_debug_log_mem(this->log, SPA_LOG_LEVEL_DEBUG, 2, conf, (size_t)size);
16
 
17
    flags = this->is_duplex ? MEDIA_CODEC_FLAG_SINK : 0;
18
 
19
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/meson.build -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/meson.build Changed
91
 
1
@@ -1,4 +1,6 @@
2
-bluez5_deps =  mathlib, dbus_dep, sbc_dep, bluez_dep 
3
+gnome = import('gnome')
4
+
5
+bluez5_deps =  mathlib, dbus_dep, glib2_dep, sbc_dep, bluez_dep, gio_dep, gio_unix_dep 
6
 foreach dep: bluez5_deps
7
   if not dep.found()
8
     subdir_done()
9
@@ -28,9 +30,26 @@
10
   'player.c',
11
   'bluez5-device.c',
12
   'bluez5-dbus.c',
13
-  'hci.c'
14
+  'hci.c',
15
+  'dbus-monitor.c',
16
+  'midi-enum.c',
17
+  'midi-parser.c',
18
+  'midi-node.c',
19
+  'midi-server.c',
20
 
21
 
22
+bluez5_interface_src = gnome.gdbus_codegen('bluez5-interface-gen',
23
+  sources: 'org.bluez.xml',
24
+  interface_prefix : 'org.bluez.',
25
+  object_manager: true,
26
+  namespace : 'Bluez5',
27
+  annotations : 
28
+    'org.bluez.GattCharacteristic1.AcquireNotify()', 'org.gtk.GDBus.C.UnixFD', 'true',
29
+    'org.bluez.GattCharacteristic1.AcquireWrite()', 'org.gtk.GDBus.C.UnixFD', 'true',
30
+  
31
+)
32
+bluez5_sources +=  bluez5_interface_src 
33
+
34
 bluez5_data = 'bluez-hardware.conf'
35
 
36
 install_data(bluez5_data, install_dir : spa_datadir / 'bluez5')
37
@@ -54,10 +73,14 @@
38
   bluez5_sources += 'backend-hsphfpd.c'
39
 endif
40
 
41
+# The library uses GObject, and cannot be unloaded
42
+bluez5_link_args =  '-Wl,-z', '-Wl,nodelete' 
43
+
44
 bluez5lib = shared_library('spa-bluez5',
45
   bluez5_sources,
46
   include_directories :  configinc ,
47
   dependencies :  spa_dep, bluez5_deps ,
48
+  link_args : bluez5_link_args,
49
   install : true,
50
   install_dir : spa_plugindir / 'bluez5')
51
 
52
@@ -146,3 +169,38 @@
53
     install : true,
54
     install_dir : spa_plugindir / 'bluez5')
55
 endif
56
+
57
+test_apps = 
58
+  'test-midi',
59
+
60
+bluez5_test_lib = static_library('bluez5_test_lib',
61
+   'midi-parser.c' ,
62
+  include_directories :  configinc ,
63
+  dependencies :  spa_dep, bluez5_deps ,
64
+  install : false
65
+)
66
+
67
+foreach a : test_apps
68
+  test(a,
69
+    executable(a, a + '.c',
70
+      dependencies :  spa_dep, dl_lib, pthread_lib, mathlib, bluez5_deps ,
71
+      include_directories :  configinc ,
72
+      link_with :  bluez5_test_lib ,
73
+      install_rpath : spa_plugindir / 'bluez5',
74
+      install : installed_tests_enabled,
75
+      install_dir : installed_tests_execdir / 'bluez5'),
76
+      env : 
77
+        'SPA_PLUGIN_DIR=@0@'.format(spa_dep.get_variable('plugindir')),
78
+        )
79
+
80
+    if installed_tests_enabled
81
+      test_conf = configuration_data()
82
+      test_conf.set('exec', installed_tests_execdir / 'bluez5' / a)
83
+      configure_file(
84
+        input: installed_tests_template,
85
+        output: a + '.test',
86
+        install_dir: installed_tests_metadir / 'bluez5',
87
+        configuration: test_conf
88
+        )
89
+  endif
90
+endforeach
91
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/midi-enum.c Added
201
 
1
@@ -0,0 +1,887 @@
2
+/* Spa midi dbus
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#include <errno.h>
27
+#include <stddef.h>
28
+
29
+#include <spa/support/log.h>
30
+#include <spa/support/loop.h>
31
+#include <spa/support/plugin.h>
32
+#include <spa/monitor/device.h>
33
+#include <spa/monitor/utils.h>
34
+#include <spa/utils/hook.h>
35
+#include <spa/utils/type.h>
36
+#include <spa/utils/keys.h>
37
+#include <spa/utils/names.h>
38
+#include <spa/utils/result.h>
39
+#include <spa/utils/string.h>
40
+#include <spa/utils/json.h>
41
+#include <spa/node/node.h>
42
+#include <spa/node/keys.h>
43
+
44
+#include "midi.h"
45
+#include "config.h"
46
+
47
+#include "bluez5-interface-gen.h"
48
+#include "dbus-monitor.h"
49
+
50
+#define MIDI_OBJECT_PATH   "/midi"
51
+#define MIDI_PROFILE_PATH  MIDI_OBJECT_PATH "/profile"
52
+
53
+static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.midi");
54
+#undef SPA_LOG_TOPIC_DEFAULT
55
+#define SPA_LOG_TOPIC_DEFAULT &log_topic
56
+
57
+struct impl
58
+{
59
+   struct spa_handle handle;
60
+   struct spa_device device;
61
+
62
+   struct spa_log *log;
63
+
64
+   GDBusConnection *conn;
65
+   struct dbus_monitor monitor;
66
+   GDBusObjectManagerServer *manager;
67
+
68
+   struct spa_hook_list hooks;
69
+
70
+   uint32_t id;
71
+};
72
+
73
+struct _MidiEnumCharacteristicProxy
74
+{
75
+   Bluez5GattCharacteristic1Proxy parent_instance;
76
+
77
+   struct impl *impl;
78
+
79
+   gchar *description;
80
+   uint32_t id;
81
+   GCancellable *read_call;
82
+   GCancellable *dsc_call;
83
+   unsigned int node_emitted:1;
84
+   unsigned int read_probed:1;
85
+   unsigned int read_done:1;
86
+   unsigned int dsc_probed:1;
87
+   unsigned int dsc_done:1;
88
+};
89
+
90
+G_DECLARE_FINAL_TYPE(MidiEnumCharacteristicProxy, midi_enum_characteristic_proxy, MIDI_ENUM,
91
+       CHARACTERISTIC_PROXY, Bluez5GattCharacteristic1Proxy)
92
+G_DEFINE_TYPE(MidiEnumCharacteristicProxy, midi_enum_characteristic_proxy, BLUEZ5_TYPE_GATT_CHARACTERISTIC1_PROXY)
93
+#define MIDI_ENUM_TYPE_CHARACTERISTIC_PROXY    (midi_enum_characteristic_proxy_get_type())
94
+
95
+struct _MidiEnumManagerProxy
96
+{
97
+   Bluez5GattManager1Proxy parent_instance;
98
+
99
+   GCancellable *register_call;
100
+   unsigned int registered:1;
101
+};
102
+
103
+G_DECLARE_FINAL_TYPE(MidiEnumManagerProxy, midi_enum_manager_proxy, MIDI_ENUM,
104
+       MANAGER_PROXY, Bluez5GattManager1Proxy)
105
+G_DEFINE_TYPE(MidiEnumManagerProxy, midi_enum_manager_proxy, BLUEZ5_TYPE_GATT_MANAGER1_PROXY)
106
+#define MIDI_ENUM_TYPE_MANAGER_PROXY   (midi_enum_manager_proxy_get_type())
107
+
108
+
109
+static void emit_chr_node(struct impl *impl, MidiEnumCharacteristicProxy *chr, Bluez5Device1 *device)
110
+{
111
+   struct spa_device_object_info info;
112
+   char nick512, class16;
113
+   struct spa_dict_item items23;
114
+   uint32_t n_items = 0;
115
+   const char *path = g_dbus_proxy_get_object_path(G_DBUS_PROXY(chr));
116
+   const char *alias = bluez5_device1_get_alias(device);
117
+
118
+   spa_log_debug(impl->log, "emit node for path=%s", path);
119
+
120
+   info = SPA_DEVICE_OBJECT_INFO_INIT();
121
+   info.type = SPA_TYPE_INTERFACE_Node;
122
+   info.factory_name = SPA_NAME_API_BLUEZ5_MIDI_NODE;
123
+   info.change_mask = SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS |
124
+       SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS;
125
+   info.flags = 0;
126
+
127
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_API, "bluez5");
128
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_BUS, "bluetooth");
129
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_MEDIA_CLASS, "Midi/Bridge");
130
+   itemsn_items++ = SPA_DICT_ITEM_INIT("node.description",
131
+           alias ? alias : bluez5_device1_get_name(device));
132
+   if (chr->description && chr->description0 != '\0') {
133
+       spa_scnprintf(nick, sizeof(nick), "%s (%s)", alias, chr->description);
134
+       itemsn_items++ = SPA_DICT_ITEM_INIT("node.nick", nick);
135
+   }
136
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_ICON, bluez5_device1_get_icon(device));
137
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_PATH, path);
138
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_ADDRESS, bluez5_device1_get_address(device));
139
+   snprintf(class, sizeof(class), "0x%06x", bluez5_device1_get_class(device));
140
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_CLASS, class);
141
+   itemsn_items++ = SPA_DICT_ITEM_INIT(SPA_KEY_API_BLUEZ5_ROLE, "client");
142
+
143
+   info.props = &SPA_DICT_INIT(items, n_items);
144
+   spa_device_emit_object_info(&impl->hooks, chr->id, &info);
145
+}
146
+
147
+static void remove_chr_node(struct impl *impl, MidiEnumCharacteristicProxy *chr)
148
+{
149
+   spa_log_debug(impl->log, "remove node for path=%s", g_dbus_proxy_get_object_path(G_DBUS_PROXY(chr)));
150
+
151
+   spa_device_emit_object_info(&impl->hooks, chr->id, NULL);
152
+}
153
+
154
+static void check_chr_node(struct impl *impl, MidiEnumCharacteristicProxy *chr);
155
+
156
+static void read_probe_reply(GObject *source_object, GAsyncResult *res, gpointer user_data)
157
+{
158
+   MidiEnumCharacteristicProxy *chr = MIDI_ENUM_CHARACTERISTIC_PROXY(source_object);
159
+   struct impl *impl = user_data;
160
+   gchar *value = NULL;
161
+   GError *err = NULL;
162
+
163
+   bluez5_gatt_characteristic1_call_read_value_finish(
164
+       BLUEZ5_GATT_CHARACTERISTIC1(source_object), &value, res, &err);
165
+
166
+   if (g_error_matches(err, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
167
+       /* Operation canceled: user_data may be invalid by now */
168
+       g_error_free(err);
169
+       goto done;
170
+   }
171
+   if (err) {
172
+       spa_log_error(impl->log, "%s.ReadValue() failed: %s",
173
+               BLUEZ_GATT_CHR_INTERFACE,
174
+               err->message);
175
+       g_error_free(err);
176
+       goto done;
177
+   }
178
+
179
+   g_free(value);
180
+
181
+   spa_log_debug(impl->log, "MIDI GATT read probe done for path=%s",
182
+           g_dbus_proxy_get_object_path(G_DBUS_PROXY(chr)));
183
+
184
+   chr->read_done = true;
185
+
186
+   check_chr_node(impl, chr);
187
+
188
+done:
189
+   g_clear_object(&chr->read_call);
190
+}
191
+
192
+static int read_probe(struct impl *impl, MidiEnumCharacteristicProxy *chr)
193
+{
194
+   GVariantBuilder builder;
195
+   GVariant *options;
196
+
197
+   /*
198
+    * BLE MIDI-1.0 §5: The Central shall read the MIDI I/O characteristic
199
+    * of the Peripheral after establishing a connection with the accessory.
200
+    */
201
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/midi-node.c Added
201
 
1
@@ -0,0 +1,2151 @@
2
+/* Spa MIDI node
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#include <unistd.h>
27
+#include <stddef.h>
28
+#include <stdio.h>
29
+#include <time.h>
30
+#include <fcntl.h>
31
+#include <sys/types.h>
32
+#include <sys/socket.h>
33
+
34
+#include <spa/support/plugin.h>
35
+#include <spa/support/loop.h>
36
+#include <spa/support/log.h>
37
+#include <spa/support/system.h>
38
+#include <spa/utils/list.h>
39
+#include <spa/utils/keys.h>
40
+#include <spa/utils/names.h>
41
+#include <spa/utils/string.h>
42
+#include <spa/utils/result.h>
43
+#include <spa/utils/dll.h>
44
+#include <spa/utils/ringbuffer.h>
45
+#include <spa/monitor/device.h>
46
+#include <spa/control/control.h>
47
+
48
+#include <spa/node/node.h>
49
+#include <spa/node/utils.h>
50
+#include <spa/node/io.h>
51
+#include <spa/node/keys.h>
52
+#include <spa/param/param.h>
53
+#include <spa/param/latency-utils.h>
54
+#include <spa/param/audio/format.h>
55
+#include <spa/param/audio/format-utils.h>
56
+#include <spa/pod/filter.h>
57
+
58
+#include <spa/debug/mem.h>
59
+#include <spa/debug/log.h>
60
+
61
+#include "midi.h"
62
+
63
+#include "bluez5-interface-gen.h"
64
+
65
+static struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.bluez5.midi.node");
66
+#undef SPA_LOG_TOPIC_DEFAULT
67
+#define SPA_LOG_TOPIC_DEFAULT &log_topic
68
+
69
+#define DEFAULT_CLOCK_NAME "clock.system.monotonic"
70
+
71
+#define DLL_BW         0.05
72
+
73
+#define DEFAULT_LATENCY_OFFSET (0 * SPA_NSEC_PER_MSEC)
74
+
75
+#define MAX_BUFFERS        32
76
+
77
+#define MIDI_RINGBUF_SIZE  (8192*4)
78
+
79
+enum node_role {
80
+   NODE_SERVER,
81
+   NODE_CLIENT,
82
+};
83
+
84
+struct props {
85
+   char clock_name64;
86
+   char device_name512;
87
+   int64_t latency_offset;
88
+};
89
+
90
+struct midi_event_ringbuffer_entry {
91
+   uint64_t time;
92
+   unsigned int size;
93
+};
94
+
95
+struct midi_event_ringbuffer {
96
+   struct spa_ringbuffer rbuf;
97
+   uint8_t bufMIDI_RINGBUF_SIZE;
98
+};
99
+
100
+struct buffer {
101
+   uint32_t id;
102
+   unsigned int outgoing:1;
103
+   struct spa_buffer *buf;
104
+   struct spa_meta_header *h;
105
+   struct spa_list link;
106
+};
107
+
108
+struct time_sync {
109
+   uint64_t prev_recv_time;
110
+   uint64_t recv_time;
111
+
112
+   uint16_t prev_device_timestamp;
113
+   uint16_t device_timestamp;
114
+
115
+   uint64_t device_time;
116
+
117
+   struct spa_dll dll;
118
+};
119
+
120
+struct port {
121
+   uint32_t id;
122
+   enum spa_direction direction;
123
+
124
+   struct spa_audio_info current_format;
125
+   unsigned int have_format:1;
126
+
127
+   uint64_t info_all;
128
+   struct spa_port_info info;
129
+   struct spa_io_buffers *io;
130
+   struct spa_latency_info latency;
131
+#define IDX_EnumFormat 0
132
+#define IDX_Meta   1
133
+#define IDX_IO     2
134
+#define IDX_Format 3
135
+#define IDX_Buffers    4
136
+#define IDX_Latency    5
137
+#define N_PORT_PARAMS  6
138
+   struct spa_param_info paramsN_PORT_PARAMS;
139
+
140
+   struct buffer buffersMAX_BUFFERS;
141
+   uint32_t n_buffers;
142
+
143
+   struct spa_list free;
144
+   struct spa_list ready;
145
+
146
+   int fd;
147
+   uint16_t mtu;
148
+
149
+   struct buffer *buffer;
150
+   struct spa_pod_builder builder;
151
+   struct spa_pod_frame frame;
152
+
153
+   struct time_sync sync;
154
+
155
+   unsigned int acquired:1;
156
+   GCancellable *acquire_call;
157
+
158
+   struct spa_source source;
159
+
160
+   struct impl *impl;
161
+};
162
+
163
+struct impl {
164
+   struct spa_handle handle;
165
+   struct spa_node node;
166
+
167
+   struct spa_log *log;
168
+   struct spa_loop *main_loop;
169
+   struct spa_loop *data_loop;
170
+   struct spa_system *data_system;
171
+
172
+   GDBusConnection *conn;
173
+   Bluez5GattCharacteristic1 *proxy;
174
+
175
+   struct spa_hook_list hooks;
176
+   struct spa_callbacks callbacks;
177
+
178
+   uint64_t info_all;
179
+   struct spa_node_info info;
180
+#define IDX_PropInfo   0
181
+#define IDX_Props  1
182
+#define IDX_NODE_IO    2
183
+#define N_NODE_PARAMS  3
184
+   struct spa_param_info paramsN_NODE_PARAMS;
185
+   struct props props;
186
+
187
+#define PORT_IN        0
188
+#define PORT_OUT   1
189
+#define N_PORTS        2
190
+   struct port portsN_PORTS;
191
+
192
+   char *chr_path;
193
+
194
+   unsigned int started:1;
195
+   unsigned int following:1;
196
+
197
+   struct spa_source timer_source;
198
+
199
+   int timerfd;
200
+
201
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/midi-parser.c Added
201
 
1
@@ -0,0 +1,295 @@
2
+/* BLE MIDI parser
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#include <errno.h>
27
+
28
+#include <spa/utils/defs.h>
29
+
30
+#include "midi.h"
31
+
32
+enum midi_event_class {
33
+   MIDI_BASIC,
34
+   MIDI_SYSEX,
35
+   MIDI_SYSCOMMON,
36
+   MIDI_REALTIME,
37
+   MIDI_ERROR
38
+};
39
+
40
+static enum midi_event_class midi_event_info(uint8_t status, unsigned int *size)
41
+{
42
+   switch (status) {
43
+   case 0x80 ... 0x8f:
44
+   case 0x90 ... 0x9f:
45
+   case 0xa0 ... 0xaf:
46
+   case 0xb0 ... 0xbf:
47
+   case 0xe0 ... 0xef:
48
+       *size = 3;
49
+       return MIDI_BASIC;
50
+   case 0xc0 ... 0xcf:
51
+   case 0xd0 ... 0xdf:
52
+       *size = 2;
53
+       return MIDI_BASIC;
54
+   case 0xf0:
55
+       /* variable; count only status byte here */
56
+       *size = 1;
57
+       return MIDI_SYSEX;
58
+   case 0xf1:
59
+   case 0xf3:
60
+       *size = 2;
61
+       return MIDI_SYSCOMMON;
62
+   case 0xf2:
63
+       *size = 3;
64
+       return MIDI_SYSCOMMON;
65
+   case 0xf6:
66
+   case 0xf7:
67
+       *size = 1;
68
+       return MIDI_SYSCOMMON;
69
+   case 0xf8 ... 0xff:
70
+       *size = 1;
71
+       return MIDI_REALTIME;
72
+   case 0xf4:
73
+   case 0xf5:
74
+   default:
75
+       /* undefined MIDI status */
76
+       *size = 0;
77
+       return MIDI_ERROR;
78
+   }
79
+}
80
+
81
+static void timestamp_set_high(uint16_t *time, uint8_t byte)
82
+{
83
+   *time = (byte & 0x3f) << 7;
84
+}
85
+
86
+static void timestamp_set_low(uint16_t *time, uint8_t byte)
87
+{
88
+   if ((*time & 0x7f) > (byte & 0x7f))
89
+       *time += 0x80;
90
+
91
+   *time &= ~0x7f;
92
+   *time |= byte & 0x7f;
93
+}
94
+
95
+int spa_bt_midi_parser_parse(struct spa_bt_midi_parser *parser,
96
+       const uint8_t *src, size_t src_size, bool only_time,
97
+       void (*event)(void *user_data, uint16_t time, uint8_t *event, size_t event_size),
98
+       void *user_data)
99
+{
100
+   const uint8_t *src_end = src + src_size;
101
+   uint8_t running_status = 0;
102
+   uint16_t time;
103
+   uint8_t byte;
104
+
105
+#define NEXT() do { if (src == src_end) return -EINVAL; byte = *src++; } while (0)
106
+#define PUT(byte) do { if (only_time) { parser->size++; break; }   \
107
+       if (parser->size == sizeof(parser->buf)) return -ENOSPC; \
108
+       parser->bufparser->size++ = (byte); } while (0)
109
+
110
+   /* Header */
111
+   NEXT();
112
+   if (!(byte & 0x80))
113
+       return -EINVAL;
114
+   timestamp_set_high(&time, byte);
115
+
116
+   while (src < src_end) {
117
+       NEXT();
118
+
119
+       if (!parser->sysex) {
120
+           uint8_t status = 0;
121
+           unsigned int event_size;
122
+
123
+           if (byte & 0x80) {
124
+               /* Timestamp */
125
+               timestamp_set_low(&time, byte);
126
+               NEXT();
127
+
128
+               /* Status? */
129
+               if (byte & 0x80) {
130
+                   parser->size = 0;
131
+                   PUT(byte);
132
+                   status = byte;
133
+               }
134
+           }
135
+
136
+           if (status == 0) {
137
+               /* Running status */
138
+               parser->size = 0;
139
+               PUT(running_status);
140
+               PUT(byte);
141
+               status = running_status;
142
+           }
143
+
144
+           switch (midi_event_info(status, &event_size)) {
145
+           case MIDI_BASIC:
146
+               running_status = (event_size > 1) ? status : 0;
147
+               break;
148
+           case MIDI_REALTIME:
149
+           case MIDI_SYSCOMMON:
150
+               /* keep previous running status */
151
+               break;
152
+           case MIDI_SYSEX:
153
+               parser->sysex = true;
154
+               /* XXX: not fully clear if SYSEX can be running status, assume no */
155
+               running_status = 0;
156
+               continue;
157
+           default:
158
+               goto malformed;
159
+           }
160
+
161
+           /* Event data */
162
+           while (parser->size < event_size) {
163
+               NEXT();
164
+               if (byte & 0x80) {
165
+                   /* BLE MIDI allows no interleaved events */
166
+                   goto malformed;
167
+               }
168
+               PUT(byte);
169
+           }
170
+
171
+           event(user_data, time, parser->buf, parser->size);
172
+       } else {
173
+           if (byte & 0x80) {
174
+               /* Timestamp */
175
+               timestamp_set_low(&time, byte);
176
+               NEXT();
177
+
178
+               if (byte == 0xf7) {
179
+                   /* Sysex end */
180
+                   PUT(byte);
181
+                   event(user_data, time, parser->buf, parser->size);
182
+                   parser->sysex = false;
183
+               } else {
184
+                   /* Interleaved realtime event */
185
+                   unsigned int event_size;
186
+
187
+                   if (midi_event_info(byte, &event_size) != MIDI_REALTIME)
188
+                       goto malformed;
189
+                   spa_assert(event_size == 1);
190
+                   event(user_data, time, &byte, 1);
191
+               }
192
+           } else {
193
+               PUT(byte);
194
+           }
195
+       }
196
+   }
197
+
198
+#undef NEXT
199
+#undef PUT
200
+
201
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/midi-server.c Added
201
 
1
@@ -0,0 +1,581 @@
2
+/* Spa Bluez5 midi
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#include <errno.h>
27
+#include <sys/socket.h>
28
+#include <unistd.h>
29
+
30
+#include <spa/utils/defs.h>
31
+#include <spa/utils/string.h>
32
+#include <spa/utils/result.h>
33
+
34
+#include "midi.h"
35
+
36
+#include "bluez5-interface-gen.h"
37
+#include "dbus-monitor.h"
38
+
39
+#undef SPA_LOG_TOPIC_DEFAULT
40
+#define SPA_LOG_TOPIC_DEFAULT (&impl->log_topic)
41
+
42
+#define MIDI_SERVER_PATH   "/midiserver%u"
43
+#define MIDI_SERVICE_PATH  "/midiserver%u/service"
44
+#define MIDI_CHR_PATH      "/midiserver%u/service/chr"
45
+#define MIDI_DSC_PATH      "/midiserver%u/service/chr/dsc"
46
+
47
+#define BLE_DEFAULT_MTU        23
48
+
49
+struct impl
50
+{
51
+   struct spa_bt_midi_server this;
52
+
53
+   struct spa_log_topic log_topic;
54
+   struct spa_log *log;
55
+
56
+   const struct spa_bt_midi_server_cb *cb;
57
+
58
+   GDBusConnection *conn;
59
+   struct dbus_monitor monitor;
60
+   GDBusObjectManagerServer *manager;
61
+
62
+   Bluez5GattCharacteristic1 *chr;
63
+
64
+   void *user_data;
65
+
66
+   uint32_t server_id;
67
+
68
+   unsigned int write_acquired:1;
69
+   unsigned int notify_acquired:1;
70
+};
71
+
72
+struct _MidiServerManagerProxy
73
+{
74
+   Bluez5GattManager1Proxy parent_instance;
75
+
76
+   GCancellable *register_call;
77
+   unsigned int registered:1;
78
+};
79
+
80
+G_DECLARE_FINAL_TYPE(MidiServerManagerProxy, midi_server_manager_proxy, MIDI_SERVER,
81
+       MANAGER_PROXY, Bluez5GattManager1Proxy)
82
+G_DEFINE_TYPE(MidiServerManagerProxy, midi_server_manager_proxy, BLUEZ5_TYPE_GATT_MANAGER1_PROXY)
83
+#define MIDI_SERVER_TYPE_MANAGER_PROXY (midi_server_manager_proxy_get_type())
84
+
85
+
86
+/*
87
+ * Characteristic user descriptor: not in BLE MIDI standard, but we
88
+ * put a device name here in case we have multiple MIDI endpoints.
89
+ */
90
+
91
+static gboolean dsc_handle_read_value(Bluez5GattDescriptor1 *iface, GDBusMethodInvocation *invocation,
92
+       GVariant *arg_options, gpointer user_data)
93
+{
94
+   struct impl *impl = user_data;
95
+   const char *description = NULL;
96
+   uint16_t offset = 0;
97
+   int len;
98
+
99
+   g_variant_lookup(arg_options, "offset", "q", &offset);
100
+
101
+   if (impl->cb->get_description)
102
+       description = impl->cb->get_description(impl->user_data);
103
+   if (!description)
104
+       description = "";
105
+
106
+   len = strlen(description);
107
+   if (offset > len) {
108
+       g_dbus_method_invocation_return_dbus_error(invocation,
109
+               "org.freedesktop.DBus.Error.InvalidArgs",
110
+               "Invalid arguments");
111
+       return TRUE;
112
+   }
113
+
114
+   bluez5_gatt_descriptor1_complete_read_value(iface,
115
+           invocation, description + offset);
116
+   return TRUE;
117
+}
118
+
119
+static int export_dsc(struct impl *impl)
120
+{
121
+   static const char * const flags = { "encrypt-read", NULL };
122
+   GDBusObjectSkeleton *skeleton = NULL;
123
+   Bluez5GattDescriptor1 *iface = NULL;
124
+   int res = -ENOMEM;
125
+   char path128;
126
+
127
+   iface = bluez5_gatt_descriptor1_skeleton_new();
128
+   if (!iface)
129
+       goto done;
130
+
131
+   spa_scnprintf(path, sizeof(path), MIDI_DSC_PATH, impl->server_id);
132
+   skeleton = g_dbus_object_skeleton_new(path);
133
+   if (!skeleton)
134
+       goto done;
135
+   g_dbus_object_skeleton_add_interface(skeleton, G_DBUS_INTERFACE_SKELETON(iface));
136
+
137
+   bluez5_gatt_descriptor1_set_uuid(iface, BT_GATT_CHARACTERISTIC_USER_DESCRIPTION_UUID);
138
+   spa_scnprintf(path, sizeof(path), MIDI_CHR_PATH, impl->server_id);
139
+   bluez5_gatt_descriptor1_set_characteristic(iface, path);
140
+   bluez5_gatt_descriptor1_set_flags(iface, flags);
141
+
142
+   g_signal_connect(iface, "handle-read-value", G_CALLBACK(dsc_handle_read_value), impl);
143
+
144
+   g_dbus_object_manager_server_export(impl->manager, skeleton);
145
+
146
+   spa_log_debug(impl->log, "MIDI GATT Descriptor exported, path=%s",
147
+           g_dbus_object_get_object_path(G_DBUS_OBJECT(skeleton)));
148
+
149
+   res = 0;
150
+
151
+done:
152
+   g_clear_object(&iface);
153
+   g_clear_object(&skeleton);
154
+   return res;
155
+}
156
+
157
+
158
+/*
159
+ * MIDI characteristic
160
+ */
161
+
162
+static gboolean chr_handle_read_value(Bluez5GattCharacteristic1 *iface,
163
+       GDBusMethodInvocation *invocation, GVariant *arg_options,
164
+       gpointer user_data)
165
+{
166
+   /* BLE MIDI-1.0: returns empty value */
167
+   bluez5_gatt_characteristic1_complete_read_value(iface, invocation, "");
168
+   return TRUE;
169
+}
170
+
171
+static void chr_change_acquired(struct impl *impl, bool write, bool enabled)
172
+{
173
+   if (write) {
174
+       impl->write_acquired = enabled;
175
+       bluez5_gatt_characteristic1_set_write_acquired(impl->chr, enabled);
176
+   } else {
177
+       impl->notify_acquired = enabled;
178
+       bluez5_gatt_characteristic1_set_notify_acquired(impl->chr, enabled);
179
+   }
180
+}
181
+
182
+static int create_socketpair(int fds2)
183
+{
184
+   if (socketpair(AF_LOCAL, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0)
185
+       return -errno;
186
+   return 0;
187
+}
188
+
189
+static gboolean chr_handle_acquire(Bluez5GattCharacteristic1 *object,
190
+       GDBusMethodInvocation *invocation,
191
+       GUnixFDList *dummy, GVariant *arg_options,
192
+       bool write, gpointer user_data)
193
+{
194
+   struct impl *impl = user_data;
195
+   const char *err_msg = "Failed";
196
+   uint16_t mtu = BLE_DEFAULT_MTU;
197
+   gint fds2 = {-1, -1};
198
+   int res;
199
+   GUnixFDList *fd_list = NULL;
200
+   GVariant *fd_handle = NULL;
201
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/midi.h Added
144
 
1
@@ -0,0 +1,142 @@
2
+/* Spa V4l2 dbus
3
+ *
4
+ * Copyright © 2022 Pauli Virtanen
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+#ifndef SPA_BT_MIDI_H_
26
+#define SPA_BT_MIDI_H_
27
+
28
+#include <stddef.h>
29
+#include <stdint.h>
30
+#include <stdbool.h>
31
+
32
+#include <gio/gio.h>
33
+
34
+#include <spa/utils/defs.h>
35
+#include <spa/support/log.h>
36
+
37
+#define BLUEZ_SERVICE          "org.bluez"
38
+#define BLUEZ_ADAPTER_INTERFACE        BLUEZ_SERVICE ".Adapter1"
39
+#define BLUEZ_DEVICE_INTERFACE     BLUEZ_SERVICE ".Device1"
40
+#define BLUEZ_GATT_MANAGER_INTERFACE   BLUEZ_SERVICE ".GattManager1"
41
+#define BLUEZ_GATT_PROFILE_INTERFACE   BLUEZ_SERVICE ".GattProfile1"
42
+#define BLUEZ_GATT_SERVICE_INTERFACE   BLUEZ_SERVICE ".GattService1"
43
+#define BLUEZ_GATT_CHR_INTERFACE   BLUEZ_SERVICE ".GattCharacteristic1"
44
+#define BLUEZ_GATT_DSC_INTERFACE   BLUEZ_SERVICE ".GattDescriptor1"
45
+
46
+#define BT_MIDI_SERVICE_UUID       "03b80e5a-ede8-4b33-a751-6ce34ec4c700"
47
+#define BT_MIDI_CHR_UUID       "7772e5db-3868-4112-a1a9-f2669d106bf3"
48
+#define BT_GATT_CHARACTERISTIC_USER_DESCRIPTION_UUID   "00002901-0000-1000-8000-00805f9b34fb"
49
+
50
+#define MIDI_BUF_SIZE      8192
51
+#define MIDI_MAX_MTU       8192
52
+
53
+#define MIDI_CLOCK_PERIOD_MSEC 0x2000
54
+#define MIDI_CLOCK_PERIOD_NSEC (MIDI_CLOCK_PERIOD_MSEC * SPA_NSEC_PER_MSEC)
55
+
56
+struct spa_bt_midi_server
57
+{
58
+   const char *chr_path;
59
+};
60
+
61
+struct spa_bt_midi_parser {
62
+   unsigned int size;
63
+   unsigned int sysex:1;
64
+   uint8_t bufMIDI_BUF_SIZE;
65
+};
66
+
67
+struct spa_bt_midi_writer {
68
+   unsigned int size;
69
+   unsigned int mtu;
70
+   unsigned int pos;
71
+   uint8_t running_status;
72
+   uint64_t running_time_msec;
73
+   unsigned int flush:1;
74
+   uint8_t bufMIDI_MAX_MTU;
75
+};
76
+
77
+struct spa_bt_midi_server_cb
78
+{
79
+   int (*acquire_notify)(void *user_data, int fd, uint16_t mtu);
80
+   int (*acquire_write)(void *user_data, int fd, uint16_t mtu);
81
+   int (*release)(void *user_data);
82
+   const char *(*get_description)(void *user_data);
83
+};
84
+
85
+static inline void spa_bt_midi_parser_init(struct spa_bt_midi_parser *parser)
86
+{
87
+   parser->size = 0;
88
+   parser->sysex = 0;
89
+}
90
+
91
+static inline void spa_bt_midi_parser_dup(struct spa_bt_midi_parser *src, struct spa_bt_midi_parser *dst, bool only_time)
92
+{
93
+   dst->size = src->size;
94
+   dst->sysex = src->sysex;
95
+   if (!only_time)
96
+       memcpy(dst->buf, src->buf, src->size);
97
+}
98
+
99
+/**
100
+ * Parse a single BLE MIDI data packet to normalized MIDI events.
101
+ */
102
+int spa_bt_midi_parser_parse(struct spa_bt_midi_parser *parser,
103
+       const uint8_t *src, size_t src_size,
104
+       bool only_time,
105
+       void (*event)(void *user_data, uint16_t time, uint8_t *event, size_t event_size),
106
+       void *user_data);
107
+
108
+static inline void spa_bt_midi_writer_init(struct spa_bt_midi_writer *writer, unsigned int mtu)
109
+{
110
+   writer->size = 0;
111
+   writer->mtu = SPA_MIN(mtu, (unsigned int)MIDI_MAX_MTU);
112
+   writer->pos = 0;
113
+   writer->running_status = 0;
114
+   writer->running_time_msec = 0;
115
+   writer->flush = 0;
116
+}
117
+
118
+/**
119
+ * Add a new event to midi writer buffer.
120
+ *
121
+ * spa_bt_midi_writer_init(&writer, mtu);
122
+ * for (time, event, size) in midi events {
123
+ *     do {
124
+ *         res = spa_bt_midi_writer_write(&writer, time, event, size);
125
+ *         if (res < 0) {
126
+ *             fail with error
127
+ *         } else if (res) {
128
+ *             send_packet(writer->buf, writer->size);
129
+ *         }
130
+ *     } while (res);
131
+ * }
132
+ * if (writer.size > 0)
133
+ *     send_packet(writer->buf, writer->size);
134
+ */
135
+int spa_bt_midi_writer_write(struct spa_bt_midi_writer *writer,
136
+       uint64_t time, const uint8_t *event, size_t event_size);
137
+
138
+struct spa_bt_midi_server *spa_bt_midi_server_new(const struct spa_bt_midi_server_cb *cb,
139
+       GDBusConnection *conn, struct spa_log *log, void *user_data);
140
+void spa_bt_midi_server_released(struct spa_bt_midi_server *server, bool write);
141
+void spa_bt_midi_server_destroy(struct spa_bt_midi_server *server);
142
+
143
+#endif
144
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/org.bluez.xml Added
73
 
1
@@ -0,0 +1,71 @@
2
+<node>
3
+  <interface name="org.bluez.Adapter1">
4
+    <method name="RegisterApplication">
5
+      <arg direction="in" type="o" name="path"/>
6
+      <arg direction="in" type="a{sv}" name="options"/>
7
+    </method>
8
+  </interface>
9
+
10
+  <interface name="org.bluez.Device1">
11
+    <property name="Adapter" type="o" access="read"/>
12
+    <property name="Connected" type="b" access="read"/>
13
+    <property name="ServicesResolved" type="b" access="read"/>
14
+    <property name="Name" type="s" access="read"/>
15
+    <property name="Alias" type="s" access="read"/>
16
+    <property name="Address" type="s" access="read"/>
17
+    <property name="Icon" type="s" access="read"/>
18
+    <property name="Class" type="u" access="read"/>
19
+    <property name="Appearance" type="q" access="read"/>
20
+  </interface>
21
+
22
+  <interface name="org.bluez.GattManager1">
23
+    <method name="RegisterApplication">
24
+      <arg direction="in" type="o" name="path"/>
25
+      <arg direction="in" type="a{sv}" name="options"/>
26
+    </method>
27
+  </interface>
28
+
29
+  <interface name="org.bluez.GattProfile1">
30
+    <method name="Release">
31
+    </method>
32
+    <property name="UUIDs" type="as" access="read"/>
33
+  </interface>
34
+
35
+  <interface name="org.bluez.GattService1">
36
+    <property name="UUID" type="s" access="read"/>
37
+    <property name="Primary" type="b" access="read"/>
38
+    <property name="Device" type="o" access="read"/>
39
+  </interface>
40
+
41
+  <interface name="org.bluez.GattCharacteristic1">
42
+    <method name="ReadValue">
43
+      <arg direction="in" type="a{sv}" name="options"/>
44
+      <arg direction="out" type="ay" name="value"/>
45
+    </method>
46
+    <method name="AcquireNotify">
47
+      <arg direction="in" type="a{sv}" name="options"/>
48
+      <arg direction="out" type="h" name="fd"/>
49
+      <arg direction="out" type="q" name="mtu"/>
50
+    </method>
51
+    <method name="AcquireWrite">
52
+      <arg direction="in" type="a{sv}" name="options"/>
53
+      <arg direction="out" type="h" name="fd"/>
54
+      <arg direction="out" type="q" name="mtu"/>
55
+    </method>
56
+    <property name="UUID" type="s" access="read"/>
57
+    <property name="Service" type="o" access="read"/>
58
+    <property name="WriteAcquired" type="b" access="read"/>
59
+    <property name="NotifyAcquired" type="b" access="read"/>
60
+    <property name="Flags" type="as" access="read"/>
61
+  </interface>
62
+
63
+  <interface name="org.bluez.GattDescriptor1">
64
+    <method name="ReadValue">
65
+      <arg direction="in" type="a{sv}" name="options"/>
66
+      <arg direction="out" type="ay" name="value"/>
67
+    </method>
68
+    <property name="UUID" type="s" access="read"/>
69
+    <property name="Characteristic" type="o" access="read"/>
70
+    <property name="Flags" type="as" access="read"/>
71
+  </interface>
72
+</node>
73
pipewire-0.3.64.tar.gz/spa/plugins/bluez5/plugin.c -> pipewire-0.3.65.tar.gz/spa/plugins/bluez5/plugin.c Changed
23
 
1
@@ -35,6 +35,8 @@
2
 extern const struct spa_handle_factory spa_sco_source_factory;
3
 extern const struct spa_handle_factory spa_a2dp_sink_factory;
4
 extern const struct spa_handle_factory spa_a2dp_source_factory;
5
+extern const struct spa_handle_factory spa_bluez5_midi_enum_factory;
6
+extern const struct spa_handle_factory spa_bluez5_midi_node_factory;
7
 
8
 SPA_EXPORT
9
 int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
10
@@ -67,6 +69,12 @@
11
    case 7:
12
        *factory = &spa_a2dp_source_factory;
13
        break;
14
+   case 8:
15
+       *factory = &spa_bluez5_midi_enum_factory;
16
+       break;
17
+   case 9:
18
+       *factory = &spa_bluez5_midi_node_factory;
19
+       break;
20
    default:
21
        return 0;
22
    }
23
pipewire-0.3.65.tar.gz/spa/plugins/bluez5/test-midi.c Added
201
 
1
@@ -0,0 +1,299 @@
2
+#include <spa/utils/defs.h>
3
+
4
+#include "midi.h"
5
+
6
+#define TIME_HI(v) (0x80 | ((v >> 7) & 0x3f))
7
+#define TIME_LO(v) (0x80 | (v & 0x7f))
8
+
9
+struct event {
10
+   uint16_t time_msec;
11
+   size_t size;
12
+   const uint8_t *data;
13
+};
14
+
15
+struct packet {
16
+   size_t size;
17
+   const uint8_t *data;
18
+};
19
+
20
+struct test_info {
21
+   const struct packet *packets;
22
+   const struct event *events;
23
+   unsigned int i;
24
+};
25
+
26
+static const struct packet midi_1_packets = {
27
+   {
28
+       .size = 27,
29
+       .data = (uint8_t) {
30
+           TIME_HI(0x1234),
31
+           /* event 1 */
32
+           TIME_LO(0x1234), 0xa0, 0x01, 0x02,
33
+           /* event 2: running status */
34
+           0x03, 0x04,
35
+           /* event 3: running status with timestamp */
36
+           TIME_LO(0x1235), 0x05, 0x06,
37
+           /* event 4 */
38
+           TIME_LO(0x1236), 0xf8,
39
+           /* event 5: sysex */
40
+           TIME_LO(0x1237), 0xf0, 0x0a, 0x0b, 0x0c,
41
+           /* event 6: realtime event inside sysex */
42
+           TIME_LO(0x1238), 0xff,
43
+           /* event 5 continues */
44
+           0x0d, 0x0e, TIME_LO(0x1239), 0xf7,
45
+           /* event 6: sysex */
46
+           TIME_LO(0x1240), 0xf0, 0x10, 0x11,
47
+           /* packet end in middle of sysex */
48
+       },
49
+   },
50
+   {
51
+       .size = 7,
52
+       .data = (uint8_t) {
53
+           TIME_HI(0x1241),
54
+           /* event 6: continued from previous packet */
55
+           0x12, TIME_LO(0x1241), 0xf7,
56
+           /* event 7 */
57
+           TIME_LO(0x1242), 0xf1, 0x13,
58
+       }
59
+   },
60
+   {0}
61
+};
62
+
63
+static const struct event midi_1_events = {
64
+   { 0x1234, 3, (uint8_t) { 0xa0, 0x01, 0x02 } },
65
+   { 0x1234, 3, (uint8_t) { 0xa0, 0x03, 0x04 } },
66
+   { 0x1235, 3, (uint8_t) { 0xa0, 0x05, 0x06 } },
67
+   { 0x1236, 1, (uint8_t) { 0xf8 } },
68
+   /* realtime event inside sysex come before it */
69
+   { 0x1238, 1, (uint8_t) { 0xff } },
70
+   /* sysex timestamp indicates the end time; sysex contains the end marker */
71
+   { 0x1239, 7, (uint8_t) { 0xf0, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0xf7 } },
72
+   { 0x1241, 5, (uint8_t) { 0xf0, 0x10, 0x11, 0x12, 0xf7 } },
73
+   { 0x1242, 2, (uint8_t) { 0xf1, 0x13 } },
74
+   {0}
75
+};
76
+
77
+static const struct packet midi_1_packets_mtu14 = {
78
+   {
79
+       .size = 11,
80
+       .data = (uint8_t) {
81
+           TIME_HI(0x1234),
82
+           TIME_LO(0x1234), 0xa0, 0x01, 0x02,
83
+           0x03, 0x04,
84
+           /* output Apple-style BLE; running status only for coincident time */
85
+           TIME_LO(0x1235), 0xa0, 0x05, 0x06,
86
+       },
87
+   },
88
+   {
89
+       .size = 11,
90
+       .data = (uint8_t) {
91
+           TIME_HI(0x1236),
92
+           TIME_LO(0x1236), 0xf8,
93
+           TIME_LO(0x1238), 0xff,
94
+           TIME_LO(0x1239), 0xf0, 0x0a, 0x0b, 0x0c, 0x0d,
95
+       },
96
+   },
97
+   {
98
+       .size = 11,
99
+       .data = (uint8_t) {
100
+           TIME_HI(0x1239),
101
+           0x0e, TIME_LO(0x1239), 0xf7,
102
+           TIME_LO(0x1241), 0xf0, 0x10, 0x11, 0x12, TIME_LO(0x1241), 0xf7
103
+       },
104
+   },
105
+   {
106
+       .size = 4,
107
+       .data = (uint8_t) {
108
+           TIME_HI(0x1242),
109
+           TIME_LO(0x1242), 0xf1, 0x13
110
+       },
111
+   },
112
+   {0}
113
+};
114
+
115
+static const struct packet midi_2_packets = {
116
+   {
117
+       .size = 9,
118
+       .data = (uint8_t) {
119
+           TIME_HI(0x1234),
120
+           /* event 1 */
121
+           TIME_LO(0x1234), 0xa0, 0x01, 0x02,
122
+           /* event 2: timestamp low bits rollover */
123
+           TIME_LO(0x12b3), 0xa0, 0x03, 0x04,
124
+       },
125
+   },
126
+   {
127
+       .size = 5,
128
+       .data = (uint8_t) {
129
+           TIME_HI(0x18b3),
130
+           /* event 3: timestamp high bits jump */
131
+           TIME_LO(0x18b3), 0xa0, 0x05, 0x06,
132
+       },
133
+   },
134
+   {0}
135
+};
136
+
137
+static const struct event midi_2_events = {
138
+   { 0x1234, 3, (uint8_t) { 0xa0, 0x01, 0x02 } },
139
+   { 0x12b3, 3, (uint8_t) { 0xa0, 0x03, 0x04 } },
140
+   { 0x18b3, 3, (uint8_t) { 0xa0, 0x05, 0x06 } },
141
+   {0}
142
+};
143
+
144
+static const struct packet midi_2_packets_mtu11 = {
145
+   /* Small MTU: only room for one event per packet */
146
+   {
147
+       .size = 5,
148
+       .data = (uint8_t) {
149
+           TIME_HI(0x1234), TIME_LO(0x1234), 0xa0, 0x01, 0x02,
150
+       },
151
+   },
152
+   {
153
+       .size = 5,
154
+       .data = (uint8_t) {
155
+           TIME_HI(0x12b3), TIME_LO(0x12b3), 0xa0, 0x03, 0x04,
156
+       },
157
+   },
158
+   {
159
+       .size = 5,
160
+       .data = (uint8_t) {
161
+           TIME_HI(0x18b3), TIME_LO(0x18b3), 0xa0, 0x05, 0x06,
162
+       },
163
+   },
164
+   {0}
165
+};
166
+
167
+
168
+static void check_event(void *user_data, uint16_t time, uint8_t *event, size_t event_size)
169
+{
170
+   struct test_info *info = user_data;
171
+   const struct event *ev = &info->eventsinfo->i;
172
+
173
+   spa_assert_se(ev->size > 0);
174
+   spa_assert_se(ev->time_msec == time);
175
+   spa_assert_se(ev->size == event_size);
176
+   spa_assert_se(memcmp(event, ev->data, ev->size) == 0);
177
+
178
+   ++info->i;
179
+}
180
+
181
+static void check_parser(struct test_info *info)
182
+{
183
+   struct spa_bt_midi_parser parser;
184
+   int res;
185
+   int i;
186
+
187
+   info->i = 0;
188
+
189
+   spa_bt_midi_parser_init(&parser);
190
+   for (i = 0; info->packetsi.size > 0; ++i) {
191
+       res = spa_bt_midi_parser_parse(&parser,
192
+               info->packetsi.data, info->packetsi.size,
193
+               false, check_event, info);
194
+       spa_assert_se(res == 0);
195
+   }
196
+   spa_assert_se(info->eventsinfo->i.size == 0);
197
+}
198
+
199
+static void check_writer(struct test_info *info, unsigned int mtu)
200
+{
201
pipewire-0.3.64.tar.gz/spa/plugins/jack/jack-device.c -> pipewire-0.3.65.tar.gz/spa/plugins/jack/jack-device.c Changed
18
 
1
@@ -44,6 +44,7 @@
2
 #include <spa/pod/filter.h>
3
 #include <spa/pod/parser.h>
4
 #include <spa/debug/pod.h>
5
+#include <spa/debug/log.h>
6
 
7
 #include "jack-client.h"
8
 
9
@@ -337,7 +338,7 @@
10
                SPA_TYPE_OBJECT_ParamProfile, NULL,
11
                SPA_PARAM_PROFILE_index, SPA_POD_Int(&idx))) < 0) {
12
            spa_log_warn(this->log, "can't parse profile");
13
-           spa_debug_pod(0, NULL, param);
14
+           spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, param);
15
            return res;
16
        }
17
        activate_profile(this, idx);
18
pipewire-0.3.64.tar.gz/spa/plugins/libcamera/libcamera-device.cpp -> pipewire-0.3.65.tar.gz/spa/plugins/libcamera/libcamera-device.cpp Changed
10
 
1
@@ -44,7 +44,7 @@
2
 #include <spa/pod/builder.h>
3
 #include <spa/monitor/device.h>
4
 #include <spa/monitor/utils.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/param/param.h>
7
 
8
 #include "libcamera.h"
9
 #include "libcamera-manager.hpp"
10
pipewire-0.3.64.tar.gz/spa/plugins/libcamera/libcamera-source.cpp -> pipewire-0.3.65.tar.gz/spa/plugins/libcamera/libcamera-source.cpp Changed
23
 
1
@@ -49,8 +49,8 @@
2
 #include <spa/node/keys.h>
3
 #include <spa/param/video/format-utils.h>
4
 #include <spa/param/param.h>
5
+#include <spa/control/control.h>
6
 #include <spa/pod/filter.h>
7
-#include <spa/debug/pod.h>
8
 
9
 #include <libcamera/camera.h>
10
 #include <libcamera/stream.h>
11
@@ -676,7 +676,10 @@
12
                info.media_subtype == port->current_format->media_subtype &&
13
                info.info.raw.format == port->current_format->info.raw.format &&
14
                info.info.raw.size.width == port->current_format->info.raw.size.width &&
15
-               info.info.raw.size.height == port->current_format->info.raw.size.height)
16
+               info.info.raw.size.height == port->current_format->info.raw.size.height &&
17
+               info.info.raw.flags == port->current_format->info.raw.flags &&
18
+               (!(info.info.raw.flags & SPA_VIDEO_FLAG_MODIFIER) ||
19
+                (info.info.raw.modifier == port->current_format->info.raw.modifier)))
20
                return 0;
21
            break;
22
        case SPA_MEDIA_SUBTYPE_mjpg:
23
pipewire-0.3.64.tar.gz/spa/plugins/meson.build -> pipewire-0.3.65.tar.gz/spa/plugins/meson.build Changed
10
 
1
@@ -16,7 +16,7 @@
2
 if get_option('audiotestsrc').allowed()
3
   subdir('audiotestsrc')
4
 endif
5
-if bluez_dep.found()
6
+if bluez_deps_found
7
   subdir('bluez5')
8
 endif
9
 if avcodec_dep.found()
10
pipewire-0.3.64.tar.gz/spa/plugins/support/cpu-arm.c -> pipewire-0.3.65.tar.gz/spa/plugins/support/cpu-arm.c Changed
50
 
1
@@ -49,37 +49,14 @@
2
    return strndup(colon, end - colon);
3
 }
4
 
5
-static char *get_cpuinfo(void)
6
-{
7
-   char *cpuinfo;
8
-   int n, fd;
9
-
10
-   cpuinfo = malloc(MAX_BUFFER);
11
-
12
-   if ((fd = open("/proc/cpuinfo", O_RDONLY | O_CLOEXEC, 0)) < 0) {
13
-       free(cpuinfo);
14
-       return NULL;
15
-   }
16
-
17
-   if ((n = read(fd, cpuinfo, MAX_BUFFER-1)) < 0) {
18
-       free(cpuinfo);
19
-       close(fd);
20
-       return NULL;
21
-   }
22
-   cpuinfon = 0;
23
-   close(fd);
24
-
25
-   return cpuinfo;
26
-}
27
-
28
 static int
29
 arm_init(struct impl *impl)
30
 {
31
    uint32_t flags = 0;
32
-   char *cpuinfo, *line;
33
+   char *cpuinfo, *line, bufferMAX_BUFFER;
34
    int arch;
35
 
36
-   if (!(cpuinfo = get_cpuinfo())) {
37
+   if (!(cpuinfo = spa_cpu_read_file("/proc/cpuinfo", buffer, sizeof(buffer)))) {
38
        spa_log_warn(impl->log, "%p: Can't read cpuinfo", impl);
39
        return 1;
40
    }
41
@@ -117,8 +94,6 @@
42
        free(line);
43
    }
44
 
45
-   free(cpuinfo);
46
-
47
    impl->flags = flags;
48
 
49
    return 0;
50
pipewire-0.3.64.tar.gz/spa/plugins/support/cpu.c -> pipewire-0.3.65.tar.gz/spa/plugins/support/cpu.c Changed
19
 
1
@@ -59,7 +59,7 @@
2
    uint32_t vm_type;
3
 };
4
 
5
-static char *read_file(const char *name, char *buffer, size_t len)
6
+char *spa_cpu_read_file(const char *name, char *buffer, size_t len)
7
 {
8
    int n, fd;
9
 
10
@@ -175,7 +175,7 @@
11
    SPA_FOR_EACH_ELEMENT_VAR(dmi_vendors, dv) {
12
        char buffer256, *s;
13
 
14
-       if ((s = read_file(*dv, buffer, sizeof(buffer))) == NULL)
15
+       if ((s = spa_cpu_read_file(*dv, buffer, sizeof(buffer))) == NULL)
16
            continue;
17
 
18
        SPA_FOR_EACH_ELEMENT_VAR(dmi_vendor_table, t) {
19
pipewire-0.3.64.tar.gz/spa/plugins/v4l2/v4l2-device.c -> pipewire-0.3.65.tar.gz/spa/plugins/v4l2/v4l2-device.c Changed
10
 
1
@@ -39,7 +39,7 @@
2
 #include <spa/pod/builder.h>
3
 #include <spa/monitor/device.h>
4
 #include <spa/monitor/utils.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/param/param.h>
7
 
8
 #include "v4l2.h"
9
 
10
pipewire-0.3.64.tar.gz/spa/plugins/v4l2/v4l2-source.c -> pipewire-0.3.65.tar.gz/spa/plugins/v4l2/v4l2-source.c Changed
10
 
1
@@ -45,7 +45,7 @@
2
 #include <spa/param/param.h>
3
 #include <spa/param/latency-utils.h>
4
 #include <spa/pod/filter.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/control/control.h>
7
 
8
 #include "v4l2.h"
9
 
10
pipewire-0.3.64.tar.gz/spa/plugins/videoconvert/videoadapter.c -> pipewire-0.3.65.tar.gz/spa/plugins/videoconvert/videoadapter.c Changed
38
 
1
@@ -42,6 +42,7 @@
2
 #include <spa/param/latency-utils.h>
3
 #include <spa/debug/format.h>
4
 #include <spa/debug/pod.h>
5
+#include <spa/debug/log.h>
6
 
7
 #undef SPA_LOG_TOPIC_DEFAULT
8
 #define SPA_LOG_TOPIC_DEFAULT log_topic
9
@@ -299,7 +300,7 @@
10
 
11
    if (filter) {
12
        spa_log_error(this->log, "with this filter:");
13
-       spa_debug_pod(2, NULL, filter);
14
+       spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 2, NULL, filter);
15
    } else {
16
        spa_log_error(this->log, "there was no filter");
17
    }
18
@@ -317,7 +318,7 @@
19
            break;
20
        }
21
        spa_log_error(this->log, "unmatched %s %d:", debug, count);
22
-       spa_debug_pod(2, NULL, param);
23
+       spa_debug_log_pod(this->log, SPA_LOG_LEVEL_DEBUG, 2, NULL, param);
24
        count++;
25
    }
26
    if (count == 0)
27
@@ -442,8 +443,8 @@
28
    int res;
29
 
30
    spa_log_debug(this->log, "%p: configure format:", this);
31
-   if (format && spa_log_level_enabled(this->log, SPA_LOG_LEVEL_DEBUG))
32
-       spa_debug_format(0, NULL, format);
33
+   if (format)
34
+       spa_debug_log_format(this->log, SPA_LOG_LEVEL_DEBUG, 0, NULL, format);
35
 
36
    if ((res = spa_node_port_set_param(this->follower,
37
                       this->direction, 0,
38
pipewire-0.3.64.tar.gz/src/daemon/client-rt.conf.in -> pipewire-0.3.65.tar.gz/src/daemon/client-rt.conf.in Changed
25
 
1
@@ -92,3 +92,23 @@
2
     #channelmix.hilbert-taps = 0
3
     #dither.noise = 0
4
 }
5
+
6
+alsa.properties = {
7
+    #alsa.format = 0
8
+    #alsa.rate = 0
9
+    #alsa.channels = 0
10
+    #alsa.period-bytes = 0
11
+    #alsa.buffer-bytes = 0
12
+    #alsa.volume-method = cubic        # linear, cubic
13
+}
14
+
15
+# client specific properties
16
+alsa.rules = 
17
+    {   matches =  { application.process.binary = "resolve" } 
18
+        actions = {
19
+            update-props = {
20
+       alsa.buffer-bytes = 131072
21
+            }
22
+        }
23
+    }
24
+
25
pipewire-0.3.64.tar.gz/src/daemon/jack.conf.in -> pipewire-0.3.65.tar.gz/src/daemon/jack.conf.in Changed
53
 
1
@@ -70,7 +70,7 @@
2
      #node.lock-quantum  = true
3
      #node.force-quantum = 0
4
      #jack.show-monitor  = true
5
-     #jack.merge-monitor = false
6
+     #jack.merge-monitor = true
7
      #jack.short-name    = false
8
      #jack.filter-name   = false
9
      #jack.filter-char   = " "
10
@@ -89,8 +89,7 @@
11
 
12
 # client specific properties
13
 jack.rules = 
14
-    {
15
-        matches = 
16
+    {   matches = 
17
             {
18
                 # all keys must match the value. ~ starts regex.
19
                 #client.name                = "Carla"
20
@@ -104,18 +103,14 @@
21
             }
22
         }
23
     }
24
-    { matches = 
25
-            { application.process.binary = "jack_bufsize" }
26
-        
27
+    {   matches =  { application.process.binary = "jack_bufsize" } 
28
         actions = {
29
             update-props = {
30
                 jack.global-buffer-size = true   # quantum set globally using metadata
31
             }
32
         }
33
     }
34
-    { matches = 
35
-            { application.process.binary = "qsynth" }
36
-        
37
+    {   matches =  { application.process.binary = "qsynth" } 
38
         actions = {
39
             update-props = {
40
                 node.pause-on-idle = false  # makes audio fade out when idle
41
@@ -123,4 +118,11 @@
42
             }
43
         }
44
     }
45
+    {   matches =  { client.name = "Mixxx" } 
46
+        actions = {
47
+            update-props = {
48
+                jack.merge-monitor = false
49
+            }
50
+        }
51
+    }
52
 
53
pipewire-0.3.64.tar.gz/src/gst/gstpipewireformat.c -> pipewire-0.3.65.tar.gz/src/gst/gstpipewireformat.c Changed
23
 
1
@@ -59,6 +59,8 @@
2
   { "video/x-h264", SPA_MEDIA_TYPE_video, SPA_MEDIA_SUBTYPE_h264 },
3
   { "audio/x-mulaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
4
   { "audio/x-alaw", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_raw },
5
+  { "audio/mpeg", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_mp3 },
6
+  { "audio/x-flac", SPA_MEDIA_TYPE_audio, SPA_MEDIA_SUBTYPE_flac },
7
   { NULL, }
8
 };
9
 
10
@@ -532,6 +534,12 @@
11
   } else if (strcmp(d->type->name, "audio/x-alaw") == 0) {
12
         spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
13
         spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ALAW);
14
+  } else if (strcmp(d->type->name, "audio/mpeg") == 0) {
15
+        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
16
+        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ENCODED);
17
+  } else if (strcmp(d->type->name, "audio/x-flac") == 0) {
18
+        spa_pod_builder_prop (&d->b, SPA_FORMAT_AUDIO_format, 0);
19
+        spa_pod_builder_id (&d->b, SPA_AUDIO_FORMAT_ENCODED);
20
   }
21
 
22
 #if 0
23
pipewire-0.3.64.tar.gz/src/gst/gstpipewirepool.c -> pipewire-0.3.65.tar.gz/src/gst/gstpipewirepool.c Changed
21
 
1
@@ -89,16 +89,19 @@
2
 
3
     GST_LOG_OBJECT (pool, "wrap buffer %d %d", d->mapoffset, d->maxsize);
4
     if (d->type == SPA_DATA_MemFd) {
5
+      GST_LOG_OBJECT (pool, "memory type MemFd");
6
       gmem = gst_fd_allocator_alloc (pool->fd_allocator, dup(d->fd),
7
                 d->mapoffset + d->maxsize, GST_FD_MEMORY_FLAG_NONE);
8
       gst_memory_resize (gmem, d->mapoffset, d->maxsize);
9
     }
10
     else if(d->type == SPA_DATA_DmaBuf) {
11
+      GST_LOG_OBJECT (pool, "memory type DmaBuf");
12
       gmem = gst_fd_allocator_alloc (pool->dmabuf_allocator, dup(d->fd),
13
                 d->mapoffset + d->maxsize, GST_FD_MEMORY_FLAG_NONE);
14
       gst_memory_resize (gmem, d->mapoffset, d->maxsize);
15
     }
16
     else if (d->type == SPA_DATA_MemPtr) {
17
+      GST_LOG_OBJECT (pool, "memory type MemPtr");
18
       gmem = gst_memory_new_wrapped (0, d->data, d->maxsize, 0,
19
                                      d->maxsize, NULL, NULL);
20
     }
21
pipewire-0.3.64.tar.gz/src/gst/gstpipewiresink.c -> pipewire-0.3.65.tar.gz/src/gst/gstpipewiresink.c Changed
16
 
1
@@ -346,6 +346,14 @@
2
     gst_structure_fixate_field_string (structure, "format", "S16LE");
3
     gst_structure_fixate_field_nearest_int (structure, "channels", 2);
4
     gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
5
+  } else if (gst_structure_has_name (structure, "audio/mpeg")) {
6
+    gst_structure_fixate_field_string (structure, "format", "Encoded");
7
+    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
8
+    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
9
+  } else if (gst_structure_has_name (structure, "audio/x-flac")) {
10
+    gst_structure_fixate_field_string (structure, "format", "Encoded");
11
+    gst_structure_fixate_field_nearest_int (structure, "channels", 2);
12
+    gst_structure_fixate_field_nearest_int (structure, "rate", 44100);
13
   }
14
 
15
   caps = GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
16
pipewire-0.3.64.tar.gz/src/gst/gstpipewiresrc.c -> pipewire-0.3.65.tar.gz/src/gst/gstpipewiresrc.c Changed
37
 
1
@@ -428,6 +428,9 @@
2
   /* we operate in time */
3
   gst_base_src_set_format (GST_BASE_SRC (src), GST_FORMAT_TIME);
4
 
5
+  /* we're a live source, unless explicitly requested not to be */
6
+  gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
7
+
8
   GST_OBJECT_FLAG_SET (src, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
9
 
10
   src->always_copy = DEFAULT_ALWAYS_COPY;
11
@@ -670,7 +673,7 @@
12
 
13
   GST_OBJECT_LOCK (pwsrc);
14
   var = pw_properties_get (props, PW_KEY_STREAM_IS_LIVE);
15
-  is_live = pwsrc->is_live = var ? pw_properties_parse_bool(var) : FALSE;
16
+  is_live = pwsrc->is_live = var ? pw_properties_parse_bool(var) : TRUE;
17
 
18
   var = pw_properties_get (props, PW_KEY_STREAM_LATENCY_MIN);
19
   pwsrc->min_latency = var ? (GstClockTime) atoi (var) : 0;
20
@@ -964,14 +967,14 @@
21
     uint32_t buffers = CLAMP (16, pwsrc->min_buffers, pwsrc->max_buffers);
22
     int buffertypes;
23
 
24
+    buffertypes = (1<<SPA_DATA_DmaBuf);
25
     if (spa_pod_find_prop (param, NULL, SPA_FORMAT_VIDEO_modifier)) {
26
-      buffertypes = (1<<SPA_DATA_DmaBuf);
27
       gst_caps_features_remove (gst_caps_get_features (pwsrc->caps, 0),
28
           GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY);
29
       gst_caps_features_add (gst_caps_get_features (pwsrc->caps, 0),
30
           GST_CAPS_FEATURE_MEMORY_DMABUF);
31
     } else {
32
-      buffertypes = ((1<<SPA_DATA_MemFd) | (1<<SPA_DATA_MemPtr));
33
+      buffertypes |= ((1<<SPA_DATA_MemFd) | (1<<SPA_DATA_MemPtr));
34
     }
35
 
36
     GST_DEBUG_OBJECT (pwsrc, "we got format %" GST_PTR_FORMAT, pwsrc->caps);
37
pipewire-0.3.64.tar.gz/src/modules/meson.build -> pipewire-0.3.65.tar.gz/src/modules/meson.build Changed
25
 
1
@@ -8,6 +8,7 @@
2
   'module-avb.c',
3
   'module-client-device.c',
4
   'module-client-node.c',
5
+  'module-combine-stream.c',
6
   'module-echo-cancel.c',
7
   'module-example-sink.c',
8
   'module-example-source.c',
9
@@ -135,6 +136,15 @@
10
   'module-echo-cancel.c',
11
 
12
 
13
+pipewire_module_combine_stream = shared_library('pipewire-module-combine-stream',
14
+   'module-combine-stream.c' ,
15
+  include_directories : configinc,
16
+  install : false,
17
+  install_dir : modules_install_dir,
18
+  install_rpath: modules_install_dir,
19
+  dependencies : spa_dep, dl_lib, pipewire_dep,
20
+)
21
+
22
 pipewire_module_echo_cancel = shared_library('pipewire-module-echo-cancel',
23
   pipewire_module_echo_cancel_sources,
24
   include_directories : configinc,
25
pipewire-0.3.64.tar.gz/src/modules/module-access.c -> pipewire-0.3.65.tar.gz/src/modules/module-access.c Changed
9
 
1
@@ -44,7 +44,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/impl.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "flatpak-utils.h"
8
 
9
pipewire-0.3.64.tar.gz/src/modules/module-adapter/adapter.c -> pipewire-0.3.65.tar.gz/src/modules/module-adapter/adapter.c Changed
77
 
1
@@ -42,11 +42,9 @@
2
 #include <spa/param/audio/format-utils.h>
3
 #include <spa/param/format-utils.h>
4
 #include <spa/debug/types.h>
5
-#include <spa/debug/pod.h>
6
 #include <spa/utils/json-pod.h>
7
 
8
 #include "pipewire/pipewire.h"
9
-#include "pipewire/private.h"
10
 
11
 #include "modules/spa/spa-node.h"
12
 
13
@@ -93,9 +91,9 @@
14
    const struct pw_properties *old;
15
    enum pw_direction direction;
16
    struct pw_properties *new;
17
-   const char *str, *path, *desc, *nick, *name, *node_name, *media_class, *prop_port_names;
18
+   const char *str, *path, *desc, *nick, *name, *node_name, *media_class, *prop_port_names, *override_device_prefix;
19
    char position8, *prefix;
20
-   bool is_monitor, is_device, is_duplex, is_virtual, is_control = false;
21
+   bool is_monitor, is_device, is_duplex, is_virtual, is_control = false, no_device_port_prefix;
22
 
23
    direction = pw_impl_port_get_direction(port);
24
 
25
@@ -123,6 +121,8 @@
26
 
27
    new = pw_properties_new(NULL, NULL);
28
 
29
+   override_device_prefix = pw_properties_get(n->props, PW_KEY_NODE_DEVICE_PORT_NAME_PREFIX);
30
+
31
    if (is_control)
32
        prefix = direction == PW_DIRECTION_INPUT ?
33
            "control" : "notify";
34
@@ -134,7 +134,10 @@
35
            "input" : "capture";
36
    else if (is_device)
37
        prefix = direction == PW_DIRECTION_INPUT ?
38
-           "playback" : is_monitor ? "monitor" : "capture";
39
+           override_device_prefix != NULL ?
40
+               strdup(override_device_prefix) : "playback"
41
+               : is_monitor ? "monitor" : override_device_prefix != NULL ?
42
+                   strdup(override_device_prefix) : "capture";
43
    else
44
        prefix = direction == PW_DIRECTION_INPUT ?
45
            "input" : is_monitor ? "monitor" : "output";
46
@@ -161,9 +164,14 @@
47
 
48
    pw_properties_setf(new, PW_KEY_OBJECT_PATH, "%s:%s_%d",
49
            path ? path : node_name, prefix, pw_impl_port_get_id(port));
50
+   
51
+   no_device_port_prefix = is_device && !is_monitor 
52
+       && override_device_prefix != NULL && strlen(override_device_prefix) == 0;
53
 
54
    if (is_control)
55
        pw_properties_setf(new, PW_KEY_PORT_NAME, "%s", prefix);
56
+   else if (no_device_port_prefix)
57
+       pw_properties_setf(new, PW_KEY_PORT_NAME, "%s", str);
58
    else
59
        pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, str);
60
 
61
@@ -192,8 +200,13 @@
62
            if (spa_json_get_string(&it1, v, sizeof(v)) <= 0)
63
                break;
64
 
65
-       if (i == pw_impl_port_get_id(port) + 1)
66
-           pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, v);
67
+       if (i == pw_impl_port_get_id(port) + 1 && strlen(v) > 0) {
68
+           if (no_device_port_prefix) {
69
+               pw_properties_setf(new, PW_KEY_PORT_NAME, "%s", v);
70
+           } else {
71
+               pw_properties_setf(new, PW_KEY_PORT_NAME, "%s_%s", prefix, v);
72
+           }
73
+       }
74
    }
75
 
76
    pw_impl_port_update_properties(port, &new->dict);
77
pipewire-0.3.64.tar.gz/src/modules/module-avb.c -> pipewire-0.3.65.tar.gz/src/modules/module-avb.c Changed
9
 
1
@@ -37,7 +37,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/impl.h>
5
-#include <pipewire/private.h>
6
 #include <pipewire/i18n.h>
7
 
8
 #include "module-avb/avb.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-avb/avb.c -> pipewire-0.3.65.tar.gz/src/modules/module-avb/avb.c Changed
10
 
1
@@ -75,8 +75,6 @@
2
        goto error_free;
3
    }
4
 
5
-   impl->work_queue = pw_context_get_work_queue(context);
6
-
7
    spa_list_init(&impl->servers);
8
 
9
    avdecc_server_new(impl, &props->dict);
10
pipewire-0.3.64.tar.gz/src/modules/module-avb/internal.h -> pipewire-0.3.65.tar.gz/src/modules/module-avb/internal.h Changed
9
 
1
@@ -45,7 +45,6 @@
2
    unsigned do_disconnect:1;
3
 
4
    struct pw_properties *props;
5
-   struct pw_work_queue *work_queue;
6
 
7
    struct spa_list servers;
8
 };
9
pipewire-0.3.64.tar.gz/src/modules/module-avb/maap.c -> pipewire-0.3.65.tar.gz/src/modules/module-avb/maap.c Changed
9
 
1
@@ -27,7 +27,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/conf.h>
6
 
7
 #include "utils.h"
8
 #include "maap.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-client-node/client-node.c -> pipewire-0.3.65.tar.gz/src/modules/module-client-node/client-node.c Changed
10
 
1
@@ -806,7 +806,7 @@
2
            endptr = SPA_PTROFF(endptr, SPA_ROUND_UP_N(buffersi->metasj.size, 8), void);
3
        }
4
        for (j = 0; j < buffersi->n_datas; j++) {
5
-           struct spa_data *d = buffersi->datas;
6
+           struct spa_data *d = &buffersi->datasj;
7
            if (d->type == SPA_DATA_MemPtr) {
8
                if ((m = pw_mempool_find_ptr(impl->context->pool, d->data)) == NULL ||
9
                    m != mem)
10
pipewire-0.3.65.tar.gz/src/modules/module-combine-stream.c Added
201
 
1
@@ -0,0 +1,1063 @@
2
+/* PipeWire
3
+ *
4
+ * Copyright © 2023 Wim Taymans
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a
7
+ * copy of this software and associated documentation files (the "Software"),
8
+ * to deal in the Software without restriction, including without limitation
9
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+ * and/or sell copies of the Software, and to permit persons to whom the
11
+ * Software is furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice (including the next
14
+ * paragraph) shall be included in all copies or substantial portions of the
15
+ * Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23
+ * DEALINGS IN THE SOFTWARE.
24
+ */
25
+
26
+#include <string.h>
27
+#include <stdio.h>
28
+#include <errno.h>
29
+#include <sys/types.h>
30
+#include <sys/stat.h>
31
+#include <fcntl.h>
32
+#include <unistd.h>
33
+#include <stdlib.h>
34
+#include <signal.h>
35
+#include <limits.h>
36
+#include <math.h>
37
+
38
+#include "config.h"
39
+
40
+#include <spa/utils/result.h>
41
+#include <spa/utils/string.h>
42
+#include <spa/utils/json.h>
43
+#include <spa/utils/ringbuffer.h>
44
+#include <spa/debug/types.h>
45
+#include <spa/pod/builder.h>
46
+#include <spa/param/audio/format-utils.h>
47
+#include <spa/param/audio/raw.h>
48
+
49
+#include <pipewire/impl.h>
50
+#include <pipewire/i18n.h>
51
+
52
+/** \page page_module_combine_stream PipeWire Module: Combine Stream
53
+ *
54
+ * The combine stream can make:
55
+ *
56
+ * - a new virtual sink that forwards audio to other sinks
57
+ * - a new virtual source that combines audio from other sources
58
+ *
59
+ * ## Module Options
60
+ *
61
+ * - `node.name`: a unique name for the stream
62
+ * - `node.description`: a human readable name for the stream
63
+ * - `combine.mode` = capture | playback | sink | source, default sink
64
+ * - `combine.props = {}`: properties to be passed to the sink/source
65
+ * - `stream.props = {}`: properties to be passed to the streams
66
+ *
67
+ * ## General options
68
+ *
69
+ * Options with well-known behavior.
70
+ *
71
+ * - \ref PW_KEY_REMOTE_NAME
72
+ * - \ref PW_KEY_AUDIO_CHANNELS
73
+ * - \ref SPA_KEY_AUDIO_POSITION
74
+ * - \ref PW_KEY_MEDIA_NAME
75
+ * - \ref PW_KEY_NODE_LATENCY
76
+ * - \ref PW_KEY_NODE_NAME
77
+ * - \ref PW_KEY_NODE_DESCRIPTION
78
+ * - \ref PW_KEY_NODE_GROUP
79
+ * - \ref PW_KEY_NODE_VIRTUAL
80
+ * - \ref PW_KEY_MEDIA_CLASS
81
+ *
82
+ * ## Stream options
83
+ *
84
+ * - `audio.position`: Set the stream channel map. By default this is the same channel
85
+ *                     map as the combine stream.
86
+ * - `combine.audio.position`: map the combine audio positions to the stream positions.
87
+ *                     combine input channels are mapped one-by-one to stream output channels.
88
+ *
89
+ * ## Example configuration
90
+ *
91
+ *\code{.unparsed}
92
+ * context.modules = 
93
+ * {   name = libpipewire-module-combine-stream
94
+ *     args = {
95
+ *         combine.mode = sink
96
+ *         node.name = "combine_sink"
97
+ *         node.description = "My Combine Sink"
98
+ *         combine.props = {
99
+ *             audio.position =  FL FR 
100
+ *         }
101
+ *         stream.props = {
102
+ *         }
103
+ *         stream.rules = 
104
+ *             {
105
+ *                 matches = 
106
+ *                     # any of the items in matches needs to match, if one does,
107
+ *                     # actions are emited.
108
+ *                     {
109
+ *                         # all keys must match the value. ~ in value starts regex.
110
+ *                         #node.name = "~alsa_input.*"
111
+ *                         media.class = "Audio/Sink"
112
+ *                     }
113
+ *                 
114
+ *                 actions = {
115
+ *                     create-stream = {
116
+ *                         #combine.audio.position =  FL FR 
117
+ *                         #audio.position =  FL FR 
118
+ *                     }
119
+ *                 }
120
+ *             }
121
+ *         
122
+ *     }
123
+ * }
124
+ * 
125
+ *\endcode
126
+ *
127
+ * Below is an example configuration that makes a 5.1 virtual audio sink
128
+ * from 3 separate stereo sinks.
129
+ *
130
+ *\code{.unparsed}
131
+ * context.modules = 
132
+ * {   name = libpipewire-module-combine-stream
133
+ *     args = {
134
+ *         combine.mode = sink
135
+ *         node.name = "combine_sink_5_1"
136
+ *         node.description = "My 5.1 Combine Sink"
137
+ *         combine.props = {
138
+ *             audio.position =  FL FR FC LFE SL SR 
139
+ *         }
140
+ *         stream.props = {
141
+ *                 stream.dont-remix = true      # link matching channels without remixing
142
+ *         }
143
+ *         stream.rules = 
144
+ *             {   matches = 
145
+ *                     {   media.class = "Audio/Sink"
146
+ *                         node.name = "alsa_output.usb-Topping_E30-00.analog-stereo"
147
+ *                     } 
148
+ *                 actions = { create-stream = {
149
+ *                         combine.audio.position =  FL FR 
150
+ *                         audio.position =  FL FR 
151
+ *                 } } }
152
+ *             {   matches = 
153
+ *                     {   media.class = "Audio/Sink"
154
+ *                         node.name = "alsa_output.usb-BEHRINGER_UMC404HD_192k-00.pro-output-0"
155
+ *                     } 
156
+ *                 actions = { create-stream = {
157
+ *                         combine.audio.position =  FC LFE 
158
+ *                         audio.position =  AUX0 AUX1 
159
+ *                 } } }
160
+ *             {   matches = 
161
+ *                     {   media.class = "Audio/Sink"
162
+ *                         node.name = "alsa_output.pci-0000_00_1b.0.analog-stereo"
163
+ *                     } 
164
+ *                 actions = { create-stream = {
165
+ *                         combine.audio.position =  SL SR 
166
+ *                         audio.position =  FL FR 
167
+ *                 } } }
168
+ *         
169
+ *     }
170
+ * }
171
+ * 
172
+ *\endcode
173
+ *
174
+ * Below is an example configuration that makes a 4.0 virtual audio source
175
+ * from 2 separate stereo sources.
176
+ *
177
+ *\code{.unparsed}
178
+ * context.modules = 
179
+ * {   name = libpipewire-module-combine-stream
180
+ *     args = {
181
+ *         combine.mode = source
182
+ *         node.name = "combine_source_4_0"
183
+ *         node.description = "My 4.0 Combine Source"
184
+ *         combine.props = {
185
+ *             audio.position =  FL FR SL SR 
186
+ *         }
187
+ *         stream.props = {
188
+ *                 stream.dont-remix = true
189
+ *         }
190
+ *         stream.rules = 
191
+ *             {   matches = 
192
+ *                     {   media.class = "Audio/Source"
193
+ *                         node.name = "alsa_input.usb-046d_HD_Pro_Webcam_C920_09D53E1F-02.analog-stereo"
194
+ *                     } 
195
+ *                 actions = { create-stream = {
196
+ *                         audio.position =  FL FR 
197
+ *                         combine.audio.position =  FL FR 
198
+ *                 } } }
199
+ *             {   matches = 
200
+ *                     {   media.class = "Audio/Source"
201
pipewire-0.3.64.tar.gz/src/modules/module-echo-cancel.c -> pipewire-0.3.65.tar.gz/src/modules/module-echo-cancel.c Changed
191
 
1
@@ -38,10 +38,10 @@
2
 #include <sys/stat.h>
3
 #include <unistd.h>
4
 
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/param/audio/format-utils.h>
8
 #include <spa/param/audio/raw.h>
9
-#include <spa/param/profiler.h>
10
+#include <spa/param/latency-utils.h>
11
 #include <spa/pod/builder.h>
12
 #include <spa/pod/dynamic.h>
13
 #include <spa/support/plugin.h>
14
@@ -53,7 +53,6 @@
15
 #include <spa/support/plugin-loader.h>
16
 #include <spa/interfaces/audio/aec.h>
17
 
18
-#include <pipewire/private.h>
19
 #include <pipewire/impl.h>
20
 #include <pipewire/pipewire.h>
21
 
22
@@ -76,6 +75,8 @@
23
  * - `library.name = <str>`: the echo cancellation library  Currently supported:
24
  * `aec/libspa-aec-webrtc`. Leave unset to use the default method (`aec/libspa-aec-webrtc`).
25
  * - `aec.args = <str>`: arguments to pass to the echo cancellation method
26
+ * - `monitor.mode`: Instead of making a sink, make a stream that captures from
27
+ *                   the monitor ports of the default sink.
28
  *
29
  * ## General options
30
  *
31
@@ -101,6 +102,7 @@
32
  *      args = {
33
  *          # library.name  = aec/libspa-aec-webrtc
34
  *          # node.latency = 1024/48000
35
+ *          # monitor.mode = false
36
  *          capture.props = {
37
  *             node.name = "Echo Cancellation Capture"
38
  *          }
39
@@ -177,10 +179,12 @@
40
    struct pw_properties *capture_props;
41
    struct pw_stream *capture;
42
    struct spa_hook capture_listener;
43
+   struct spa_audio_info_raw capture_info;
44
 
45
    struct pw_properties *source_props;
46
    struct pw_stream *source;
47
    struct spa_hook source_listener;
48
+   struct spa_audio_info_raw source_info;
49
 
50
    void *rec_bufferSPA_AUDIO_MAX_CHANNELS;
51
    uint32_t rec_ringsize;
52
@@ -189,6 +193,7 @@
53
    struct pw_properties *playback_props;
54
    struct pw_stream *playback;
55
    struct spa_hook playback_listener;
56
+   struct spa_audio_info_raw playback_info;
57
 
58
    struct pw_properties *sink_props;
59
    struct pw_stream *sink;
60
@@ -197,6 +202,7 @@
61
    uint32_t play_ringsize;
62
    struct spa_ringbuffer play_ring;
63
    struct spa_ringbuffer play_delayed_ring;
64
+   struct spa_audio_info_raw sink_info;
65
 
66
    void *out_bufferSPA_AUDIO_MAX_CHANNELS;
67
    uint32_t out_ringsize;
68
@@ -826,7 +832,7 @@
69
    spa_pod_dynamic_builder_init(&b, NULL, 0, 4096);
70
 
71
    offsetsn_params++ = b.b.state.offset;
72
-   spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->info);
73
+   spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->capture_info);
74
 
75
    int nbr_of_external_props = spa_audio_aec_enum_props(impl->aec, 0, NULL);
76
    if (nbr_of_external_props > 0) {
77
@@ -837,9 +843,8 @@
78
        get_props_param(impl, &b.b);
79
    }
80
 
81
-   for (i = 0; i < n_params; i++) {
82
+   for (i = 0; i < n_params; i++)
83
        paramsi = spa_pod_builder_deref(&b.b, offsetsi);
84
-   }
85
 
86
    if ((res = pw_stream_connect(impl->capture,
87
            PW_DIRECTION_INPUT,
88
@@ -852,6 +857,12 @@
89
        return res;
90
    }
91
 
92
+   offsets0 = b.b.state.offset;
93
+   spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->source_info);
94
+
95
+   for (i = 0; i < n_params; i++)
96
+       paramsi = spa_pod_builder_deref(&b.b, offsetsi);
97
+
98
    if ((res = pw_stream_connect(impl->source,
99
            PW_DIRECTION_OUTPUT,
100
            PW_ID_ANY,
101
@@ -862,6 +873,12 @@
102
        return res;
103
    }
104
 
105
+   offsets0 = b.b.state.offset;
106
+   spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->sink_info);
107
+
108
+   for (i = 0; i < n_params; i++)
109
+       paramsi = spa_pod_builder_deref(&b.b, offsetsi);
110
+
111
    if ((res = pw_stream_connect(impl->sink,
112
            PW_DIRECTION_INPUT,
113
            PW_ID_ANY,
114
@@ -873,6 +890,12 @@
115
        return res;
116
    }
117
 
118
+   offsets0 = b.b.state.offset;
119
+   spa_format_audio_raw_build(&b.b, SPA_PARAM_EnumFormat, &impl->playback_info);
120
+
121
+   for (i = 0; i < n_params; i++)
122
+       paramsi = spa_pod_builder_deref(&b.b, offsetsi);
123
+
124
    if (impl->playback != NULL && (res = pw_stream_connect(impl->playback,
125
            PW_DIRECTION_OUTPUT,
126
            PW_ID_ANY,
127
@@ -1104,6 +1127,11 @@
128
 
129
    parse_audio_info(props, &impl->info);
130
 
131
+   impl->capture_info = impl->info;
132
+   impl->source_info = impl->info;
133
+   impl->sink_info = impl->info;
134
+   impl->playback_info = impl->info;
135
+
136
    if ((str = pw_properties_get(props, "capture.props")) != NULL)
137
        pw_properties_update_string(impl->capture_props, str, strlen(str));
138
    if ((str = pw_properties_get(props, "source.props")) != NULL)
139
@@ -1157,17 +1185,21 @@
140
    if ((path = pw_properties_get(props, "library.name")) == NULL)
141
        path = "aec/libspa-aec-webrtc";
142
 
143
-   struct spa_dict_item info_items = {
144
-       { SPA_KEY_LIBRARY_NAME, path },
145
-   };
146
-   struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
147
+   const struct spa_support *support;
148
+   uint32_t n_support;
149
 
150
-   impl->loader = spa_support_find(context->support, context->n_support, SPA_TYPE_INTERFACE_PluginLoader);
151
+   support = pw_context_get_support(context, &n_support);
152
+   impl->loader = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_PluginLoader);
153
    if (impl->loader == NULL) {
154
        pw_log_error("a plugin loader is needed");
155
        return -EINVAL;
156
    }
157
 
158
+   struct spa_dict_item info_items = {
159
+       { SPA_KEY_LIBRARY_NAME, path },
160
+   };
161
+   struct spa_dict info = SPA_DICT_INIT_ARRAY(info_items);
162
+
163
    handle = spa_plugin_loader_load(impl->loader, SPA_NAME_AEC, &info);
164
    if (handle == NULL) {
165
        pw_log_error("aec plugin %s not available library.name %s", SPA_NAME_AEC, path);
166
@@ -1257,6 +1289,24 @@
167
    copy_props(impl, props, SPA_KEY_AUDIO_POSITION);
168
    copy_props(impl, props, "resample.prefill");
169
 
170
+   if ((str = pw_properties_get(impl->capture_props, SPA_KEY_AUDIO_POSITION)) != NULL)
171
+       parse_position(&impl->capture_info, str, strlen(str));
172
+   if ((str = pw_properties_get(impl->source_props, SPA_KEY_AUDIO_POSITION)) != NULL)
173
+       parse_position(&impl->source_info, str, strlen(str));
174
+   if ((str = pw_properties_get(impl->sink_props, SPA_KEY_AUDIO_POSITION)) != NULL)
175
+       parse_position(&impl->sink_info, str, strlen(str));
176
+   if ((str = pw_properties_get(impl->playback_props, SPA_KEY_AUDIO_POSITION)) != NULL)
177
+       parse_position(&impl->playback_info, str, strlen(str));
178
+
179
+   if (impl->capture_info.channels != impl->info.channels)
180
+       impl->capture_info = impl->info;
181
+   if (impl->source_info.channels != impl->info.channels)
182
+       impl->source_info = impl->info;
183
+   if (impl->sink_info.channels != impl->info.channels)
184
+       impl->sink_info = impl->info;
185
+   if (impl->playback_info.channels != impl->info.channels)
186
+       impl->playback_info = impl->info;
187
+
188
    impl->max_buffer_size = pw_properties_get_uint32(props,"buffer.max_size", MAX_BUFSIZE_MS);
189
 
190
    if ((str = pw_properties_get(props, "buffer.play_delay")) != NULL) {
191
pipewire-0.3.64.tar.gz/src/modules/module-example-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-example-sink.c Changed
93
 
1
@@ -40,7 +40,7 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/utils/ringbuffer.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/pod/builder.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/audio/raw.h>
10
@@ -126,7 +126,6 @@
11
    struct pw_properties *props;
12
 
13
    struct pw_impl_module *module;
14
-   struct pw_work_queue *work;
15
 
16
    struct spa_hook module_listener;
17
 
18
@@ -141,23 +140,8 @@
19
    uint32_t frame_size;
20
 
21
    unsigned int do_disconnect:1;
22
-   unsigned int unloading:1;
23
 };
24
 
25
-static void do_unload_module(void *obj, void *data, int res, uint32_t id)
26
-{
27
-   struct impl *impl = data;
28
-   pw_impl_module_destroy(impl->module);
29
-}
30
-
31
-static void unload_module(struct impl *impl)
32
-{
33
-   if (!impl->unloading) {
34
-       impl->unloading = true;
35
-       pw_work_queue_add(impl->work, impl, 0, do_unload_module, impl);
36
-   }
37
-}
38
-
39
 static void stream_destroy(void *d)
40
 {
41
    struct impl *impl = d;
42
@@ -172,7 +156,7 @@
43
    switch (state) {
44
    case PW_STREAM_STATE_ERROR:
45
    case PW_STREAM_STATE_UNCONNECTED:
46
-       unload_module(impl);
47
+       pw_impl_module_schedule_destroy(impl->module);
48
        break;
49
    case PW_STREAM_STATE_PAUSED:
50
    case PW_STREAM_STATE_STREAMING:
51
@@ -257,7 +241,7 @@
52
            id, seq, res, spa_strerror(res), message);
53
 
54
    if (id == PW_ID_CORE && res == -EPIPE)
55
-       unload_module(impl);
56
+       pw_impl_module_schedule_destroy(impl->module);
57
 }
58
 
59
 static const struct pw_core_events core_events = {
60
@@ -270,7 +254,7 @@
61
    struct impl *impl = d;
62
    spa_hook_remove(&impl->core_listener);
63
    impl->core = NULL;
64
-   unload_module(impl);
65
+   pw_impl_module_schedule_destroy(impl->module);
66
 }
67
 
68
 static const struct pw_proxy_events core_proxy_events = {
69
@@ -287,15 +271,12 @@
70
    pw_properties_free(impl->stream_props);
71
    pw_properties_free(impl->props);
72
 
73
-   if (impl->work)
74
-       pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
75
    free(impl);
76
 }
77
 
78
 static void module_destroy(void *data)
79
 {
80
    struct impl *impl = data;
81
-   impl->unloading = true;
82
    spa_hook_remove(&impl->module_listener);
83
    impl_destroy(impl);
84
 }
85
@@ -444,7 +425,6 @@
86
 
87
    impl->module = module;
88
    impl->context = context;
89
-   impl->work = pw_context_get_work_queue(context);
90
 
91
    if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
92
        pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
93
pipewire-0.3.64.tar.gz/src/modules/module-example-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-example-source.c Changed
83
 
1
@@ -40,7 +40,7 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/utils/ringbuffer.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/pod/builder.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/audio/raw.h>
10
@@ -126,7 +126,6 @@
11
    struct pw_properties *props;
12
 
13
    struct pw_impl_module *module;
14
-   struct pw_work_queue *work;
15
 
16
    struct spa_hook module_listener;
17
 
18
@@ -144,20 +143,6 @@
19
    unsigned int unloading:1;
20
 };
21
 
22
-static void do_unload_module(void *obj, void *data, int res, uint32_t id)
23
-{
24
-   struct impl *impl = data;
25
-   pw_impl_module_destroy(impl->module);
26
-}
27
-
28
-static void unload_module(struct impl *impl)
29
-{
30
-   if (!impl->unloading) {
31
-       impl->unloading = true;
32
-       pw_work_queue_add(impl->work, impl, 0, do_unload_module, impl);
33
-   }
34
-}
35
-
36
 static void stream_destroy(void *d)
37
 {
38
    struct impl *impl = d;
39
@@ -172,7 +157,7 @@
40
    switch (state) {
41
    case PW_STREAM_STATE_ERROR:
42
    case PW_STREAM_STATE_UNCONNECTED:
43
-       unload_module(impl);
44
+       pw_impl_module_schedule_destroy(impl->module);
45
        break;
46
    case PW_STREAM_STATE_PAUSED:
47
    case PW_STREAM_STATE_STREAMING:
48
@@ -261,7 +246,7 @@
49
            id, seq, res, spa_strerror(res), message);
50
 
51
    if (id == PW_ID_CORE && res == -EPIPE)
52
-       unload_module(impl);
53
+       pw_impl_module_schedule_destroy(impl->module);
54
 }
55
 
56
 static const struct pw_core_events core_events = {
57
@@ -274,7 +259,7 @@
58
    struct impl *impl = d;
59
    spa_hook_remove(&impl->core_listener);
60
    impl->core = NULL;
61
-   unload_module(impl);
62
+   pw_impl_module_schedule_destroy(impl->module);
63
 }
64
 
65
 static const struct pw_proxy_events core_proxy_events = {
66
@@ -291,8 +276,6 @@
67
    pw_properties_free(impl->stream_props);
68
    pw_properties_free(impl->props);
69
 
70
-   if (impl->work)
71
-       pw_work_queue_cancel(impl->work, impl, SPA_ID_INVALID);
72
    free(impl);
73
 }
74
 
75
@@ -448,7 +431,6 @@
76
 
77
    impl->module = module;
78
    impl->context = context;
79
-   impl->work = pw_context_get_work_queue(context);
80
 
81
    if (pw_properties_get(props, PW_KEY_NODE_VIRTUAL) == NULL)
82
        pw_properties_set(props, PW_KEY_NODE_VIRTUAL, "true");
83
pipewire-0.3.64.tar.gz/src/modules/module-filter-chain.c -> pipewire-0.3.65.tar.gz/src/modules/module-filter-chain.c Changed
35
 
1
@@ -39,12 +39,11 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/support/cpu.h>
5
-#include <spa/param/profiler.h>
6
+#include <spa/param/latency-utils.h>
7
 #include <spa/pod/dynamic.h>
8
-#include <spa/debug/pod.h>
9
+#include <spa/debug/types.h>
10
 
11
 #include <pipewire/utils.h>
12
-#include <pipewire/private.h>
13
 #include <pipewire/impl.h>
14
 #include <pipewire/extensions/profiler.h>
15
 
16
@@ -2337,6 +2336,18 @@
17
    parse_audio_info(impl->capture_props, &impl->capture_info);
18
    parse_audio_info(impl->playback_props, &impl->playback_info);
19
 
20
+   if (impl->capture_info.rate && !impl->playback_info.rate)
21
+       impl->playback_info.rate = impl->capture_info.rate;
22
+   else if (impl->playback_info.rate && !impl->capture_info.rate)
23
+       impl->capture_info.rate = !impl->playback_info.rate;
24
+   else if (impl->capture_info.rate != impl->playback_info.rate) {
25
+       pw_log_warn("Both capture and playback rate are set, but"
26
+           " they are different. Using the highest of two. This behaviour"
27
+           " is deprecated, please use equal rates in the module config");
28
+       impl->playback_info.rate = impl->capture_info.rate =
29
+           SPA_MAX(impl->playback_info.rate, impl->capture_info.rate);
30
+   }
31
+
32
    if ((str = pw_properties_get(props, PW_KEY_NODE_NAME)) == NULL) {
33
        pw_properties_setf(props, PW_KEY_NODE_NAME,
34
                "filter-chain-%u-%u", pid, id);
35
pipewire-0.3.64.tar.gz/src/modules/module-filter-chain/builtin_plugin.c -> pipewire-0.3.65.tar.gz/src/modules/module-filter-chain/builtin_plugin.c Changed
201
 
1
@@ -44,6 +44,8 @@
2
 #include "convolver.h"
3
 #include "dsp-ops.h"
4
 
5
+#define MAX_RATES  32u
6
+
7
 static struct dsp_ops *dsp_ops;
8
 
9
 struct builtin {
10
@@ -439,22 +441,12 @@
11
    struct convolver *conv;
12
 };
13
 
14
-static float *read_samples(const char *filename, float gain, int delay, int offset,
15
-       int length, int channel, long unsigned *rate, int *n_samples)
16
-{
17
-   float *samples;
18
 #ifdef HAVE_SNDFILE
19
-   SF_INFO info;
20
-   SNDFILE *f;
21
+static float *read_samples_from_sf(SNDFILE *f, SF_INFO info, float gain, int delay,
22
+       int offset, int length, int channel, long unsigned *rate, int *n_samples) {
23
+   float *samples;
24
    int i, n;
25
 
26
-   spa_zero(info);
27
-   f = sf_open(filename, SFM_READ, &info) ;
28
-   if (f == NULL) {
29
-       pw_log_error("can't open %s", filename);
30
-       return NULL;
31
-   }
32
-
33
    if (length <= 0)
34
        length = info.frames;
35
    else
36
@@ -467,13 +459,12 @@
37
        return NULL;
38
 
39
    samples = calloc(n * info.channels, sizeof(float));
40
-        if (samples == NULL)
41
+   if (samples == NULL)
42
        return NULL;
43
 
44
    if (offset > 0)
45
        sf_seek(f, offset, SEEK_SET);
46
    sf_readf_float(f, samples + (delay * info.channels), length);
47
-   sf_close(f);
48
 
49
    channel = channel % info.channels;
50
 
51
@@ -483,10 +474,47 @@
52
    *n_samples = n;
53
    *rate = info.samplerate;
54
    return samples;
55
+}
56
+#endif
57
+
58
+static float *read_closest(char **filenames, float gain, int delay, int offset,
59
+       int length, int channel, long unsigned *rate, int *n_samples)
60
+{
61
+#ifdef HAVE_SNDFILE
62
+   SF_INFO infosMAX_RATES;
63
+   SNDFILE *fsMAX_RATES;
64
+
65
+   spa_zero(infos);
66
+   spa_zero(fs);
67
+
68
+   int diff = INT_MAX;
69
+   uint32_t best = 0, i;
70
+
71
+   for (i = 0; i < MAX_RATES && filenamesi && filenamesi0; i++) {
72
+       fsi = sf_open(filenamesi, SFM_READ, &infosi);
73
+       if (!fsi)
74
+           continue;
75
+
76
+       if (labs((long)infosi.samplerate - (long)*rate) < diff) {
77
+           best = i;
78
+           diff = labs((long)infosi.samplerate - (long)*rate);
79
+           pw_log_debug("new closest match: %d", infosi.samplerate);
80
+       }
81
+   }
82
+
83
+   pw_log_debug("loading %s", filenamesbest);
84
+   float *samples = read_samples_from_sf(fsbest, infosbest, gain, delay,
85
+       offset, length, channel, rate, n_samples);
86
+
87
+   for (i = 0; i < MAX_RATES; i++)
88
+       if (fsi)
89
+           sf_close(fsi);
90
+
91
+   return samples;
92
 #else
93
    pw_log_error("compiled without sndfile support, can't load samples: "
94
            "using dirac impulse");
95
-   samples = calloc(1, sizeof(float));
96
+   float *samples = calloc(1, sizeof(float));
97
    samples0 = gain;
98
    *n_samples = 1;
99
    return samples;
100
@@ -597,6 +625,11 @@
101
    resample_free(&r);
102
 
103
    *n_samples = total_out;
104
+
105
+   float gain = (float)in_rate / (float)out_rate;
106
+   for (uint32_t i = 0; i < total_out; i++)
107
+       out_samplesi = out_samplesi * gain;
108
+
109
    return out_samples;
110
 
111
 error:
112
@@ -611,11 +644,12 @@
113
 {
114
    struct convolver_impl *impl;
115
    float *samples;
116
-   int offset = 0, length = 0, channel = index, n_samples;
117
-   struct spa_json it2;
118
+   int offset = 0, length = 0, channel = index, n_samples, len;
119
+   uint32_t i = 0;
120
+   struct spa_json it3;
121
    const char *val;
122
-   char key256;
123
-   char filenamePATH_MAX = "";
124
+   char key256, v256;
125
+   char *filenamesMAX_RATES = { 0 };
126
    int blocksize = 0, tailsize = 0;
127
    int delay = 0;
128
    int resample_quality = RESAMPLE_DEFAULT_QUALITY;
129
@@ -656,10 +690,24 @@
130
            }
131
        }
132
        else if (spa_streq(key, "filename")) {
133
-           if (spa_json_get_string(&it1, filename, sizeof(filename)) <= 0) {
134
-               pw_log_error("convolver:filename requires a string");
135
+           if ((len = spa_json_next(&it1, &val)) <= 0) {
136
+               pw_log_error("convolver:filename requires a string or an array");
137
                return NULL;
138
            }
139
+           if (spa_json_is_array(val, len)) {
140
+               spa_json_enter(&it1, &it2);
141
+               while (spa_json_get_string(&it2, v, sizeof(v)) > 0 &&
142
+                   i < SPA_N_ELEMENTS(filenames)) {
143
+                       filenamesi = strdup(v);
144
+                       i++;
145
+               }
146
+           }
147
+           else if (spa_json_parse_stringn(val, len, v, sizeof(v)) <= 0) {
148
+               pw_log_error("convolver:filename requires a string or an array");
149
+               return NULL;
150
+           } else {
151
+               filenamesi = strdup(v);
152
+           }
153
        }
154
        else if (spa_streq(key, "offset")) {
155
            if (spa_json_get_int(&it1, &offset) <= 0) {
156
@@ -688,7 +736,7 @@
157
        else if (spa_json_next(&it1, &val) < 0)
158
            break;
159
    }
160
-   if (!filename0) {
161
+   if (filenames0 == NULL) {
162
        pw_log_error("convolver:filename was not given");
163
        return NULL;
164
    }
165
@@ -698,17 +746,17 @@
166
    if (offset < 0)
167
        offset = 0;
168
 
169
-   if (spa_streq(filename, "/hilbert")) {
170
-       samples = create_hilbert(filename, gain, delay, offset,
171
+   if (spa_streq(filenames0, "/hilbert")) {
172
+       samples = create_hilbert(filenames0, gain, delay, offset,
173
                length, &n_samples);
174
-   } else if (spa_streq(filename, "/dirac")) {
175
-       samples = create_dirac(filename, gain, delay, offset,
176
+   } else if (spa_streq(filenames0, "/dirac")) {
177
+       samples = create_dirac(filenames0, gain, delay, offset,
178
                length, &n_samples);
179
    } else {
180
        rate = SampleRate;
181
-       samples = read_samples(filename, gain, delay, offset,
182
+       samples = read_closest(filenames, gain, delay, offset,
183
                length, channel, &rate, &n_samples);
184
-       if (rate != SampleRate)
185
+       if (samples != NULL && rate != SampleRate)
186
            samples = resample_buffer(samples, &n_samples,
187
                    rate, SampleRate, resample_quality);
188
    }
189
@@ -717,13 +765,17 @@
190
        return NULL;
191
    }
192
 
193
+   for (i = 0; i < MAX_RATES; i++)
194
+       if (filenamesi)
195
+           free(filenamesi);
196
+
197
    if (blocksize <= 0)
198
        blocksize = SPA_CLAMP(n_samples, 64, 256);
199
    if (tailsize <= 0)
200
        tailsize = SPA_CLAMP(4096, blocksize, 32768);
201
pipewire-0.3.64.tar.gz/src/modules/module-filter-chain/dsp-ops-avx.c -> pipewire-0.3.65.tar.gz/src/modules/module-filter-chain/dsp-ops-avx.c Changed
10
 
1
@@ -59,7 +59,7 @@
2
            _mm256_store_ps(&rn+24, in3);
3
        }
4
    } else {
5
-       for (n = 0; n < unrolled; n += 16) {
6
+       for (n = 0; n < unrolled; n += 32) {
7
            in0 = _mm256_loadu_ps(&an+ 0);
8
            in1 = _mm256_loadu_ps(&an+ 8);
9
            in2 = _mm256_loadu_ps(&an+16);
10
pipewire-0.3.64.tar.gz/src/modules/module-loopback.c -> pipewire-0.3.65.tar.gz/src/modules/module-loopback.c Changed
14
 
1
@@ -36,10 +36,9 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/utils/ringbuffer.h>
5
-#include <spa/param/profiler.h>
6
-#include <spa/debug/pod.h>
7
+#include <spa/param/latency-utils.h>
8
+#include <spa/debug/types.h>
9
 
10
-#include <pipewire/private.h>
11
 #include <pipewire/impl.h>
12
 #include <pipewire/extensions/profiler.h>
13
 
14
pipewire-0.3.64.tar.gz/src/modules/module-pipe-tunnel.c -> pipewire-0.3.65.tar.gz/src/modules/module-pipe-tunnel.c Changed
26
 
1
@@ -42,7 +42,7 @@
2
 #include <spa/utils/json.h>
3
 #include <spa/utils/ringbuffer.h>
4
 #include <spa/utils/dll.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/pod/builder.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/latency-utils.h>
10
@@ -50,7 +50,6 @@
11
 
12
 #include <pipewire/impl.h>
13
 #include <pipewire/i18n.h>
14
-#include <pipewire/private.h>
15
 
16
 /** \page page_module_pipe_tunnel PipeWire Module: Unix Pipe Tunnel
17
  *
18
@@ -665,6 +664,7 @@
19
    copy_props(impl, props, PW_KEY_NODE_VIRTUAL);
20
    copy_props(impl, props, PW_KEY_MEDIA_CLASS);
21
    copy_props(impl, props, PW_KEY_TARGET_OBJECT);
22
+   copy_props(impl, props, "pipe.filename");
23
 
24
    parse_audio_info(impl->stream_props, &impl->info);
25
 
26
pipewire-0.3.64.tar.gz/src/modules/module-portal.c -> pipewire-0.3.65.tar.gz/src/modules/module-portal.c Changed
17
 
1
@@ -36,6 +36,7 @@
2
 #include <dbus/dbus.h>
3
 
4
 #include <spa/utils/string.h>
5
+#include <spa/utils/result.h>
6
 #include <spa/support/dbus.h>
7
 
8
 #include "pipewire/context.h"
9
@@ -43,7 +44,6 @@
10
 #include "pipewire/log.h"
11
 #include "pipewire/module.h"
12
 #include "pipewire/utils.h"
13
-#include "pipewire/private.h"
14
 
15
 /** \page page_module_portal PipeWire Module: Portal
16
  *
17
pipewire-0.3.64.tar.gz/src/modules/module-profiler.c -> pipewire-0.3.65.tar.gz/src/modules/module-profiler.c Changed
9
 
1
@@ -35,7 +35,6 @@
2
 #include <spa/utils/result.h>
3
 #include <spa/utils/ringbuffer.h>
4
 #include <spa/param/profiler.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include <pipewire/private.h>
8
 #include <pipewire/impl.h>
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-native.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-native.c Changed
28
 
1
@@ -1287,11 +1287,10 @@
2
 {
3
    const char *name = NULL;
4
 
5
-   if (props)
6
+   name = getenv("PIPEWIRE_CORE");
7
+   if (name == NULL && props != NULL)
8
        name = spa_dict_lookup(props, PW_KEY_CORE_NAME);
9
    if (name == NULL)
10
-       name = getenv("PIPEWIRE_CORE");
11
-   if (name == NULL)
12
        name = PW_DEFAULT_REMOTE;
13
    return name;
14
 }
15
@@ -1466,10 +1465,9 @@
16
 {
17
    const char *val = NULL;
18
 
19
-   if (props)
20
+   val = getenv("PIPEWIRE_DAEMON");
21
+   if (val == NULL && props != NULL)
22
        val = spa_dict_lookup(props, PW_KEY_CORE_DAEMON);
23
-   if (val == NULL)
24
-       val = getenv("PIPEWIRE_DAEMON");
25
    if (val && pw_properties_parse_bool(val))
26
        return 1;
27
    return 0;
28
pipewire-0.3.64.tar.gz/src/modules/module-protocol-native/local-socket.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-native/local-socket.c Changed
18
 
1
@@ -49,13 +49,12 @@
2
 static const char *
3
 get_remote(const struct spa_dict *props)
4
 {
5
-   const char *name = NULL;
6
+   const char *name;
7
 
8
-   if (props)
9
+   name = getenv("PIPEWIRE_REMOTE");
10
+   if ((name == NULL || name0 == '\0') && props)
11
        name = spa_dict_lookup(props, PW_KEY_REMOTE_NAME);
12
    if (name == NULL || name0 == '\0')
13
-       name = getenv("PIPEWIRE_REMOTE");
14
-   if (name == NULL || name0 == '\0')
15
        name = PW_DEFAULT_REMOTE;
16
    return name;
17
 }
18
pipewire-0.3.64.tar.gz/src/modules/module-protocol-native/v0/protocol-native.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-native/v0/protocol-native.c Changed
10
 
1
@@ -27,7 +27,7 @@
2
 
3
 #include "spa/pod/parser.h"
4
 #include "spa/pod/builder.h"
5
-#include "spa/debug/pod.h"
6
+#include "spa/debug/types.h"
7
 #include "spa/utils/string.h"
8
 
9
 #include "pipewire/pipewire.h"
10
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/format.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/format.c Changed
52
 
1
@@ -189,16 +189,31 @@
2
 {
3
    switch (ss->format) {
4
    case SPA_AUDIO_FORMAT_U8:
5
+   case SPA_AUDIO_FORMAT_U8P:
6
+   case SPA_AUDIO_FORMAT_S8:
7
+   case SPA_AUDIO_FORMAT_S8P:
8
    case SPA_AUDIO_FORMAT_ULAW:
9
    case SPA_AUDIO_FORMAT_ALAW:
10
        return ss->channels;
11
    case SPA_AUDIO_FORMAT_S16_LE:
12
    case SPA_AUDIO_FORMAT_S16_BE:
13
    case SPA_AUDIO_FORMAT_S16P:
14
+   case SPA_AUDIO_FORMAT_U16_LE:
15
+   case SPA_AUDIO_FORMAT_U16_BE:
16
        return 2 * ss->channels;
17
    case SPA_AUDIO_FORMAT_S24_LE:
18
    case SPA_AUDIO_FORMAT_S24_BE:
19
    case SPA_AUDIO_FORMAT_S24P:
20
+   case SPA_AUDIO_FORMAT_U24_LE:
21
+   case SPA_AUDIO_FORMAT_U24_BE:
22
+   case SPA_AUDIO_FORMAT_S20_LE:
23
+   case SPA_AUDIO_FORMAT_S20_BE:
24
+   case SPA_AUDIO_FORMAT_U20_LE:
25
+   case SPA_AUDIO_FORMAT_U20_BE:
26
+   case SPA_AUDIO_FORMAT_S18_LE:
27
+   case SPA_AUDIO_FORMAT_S18_BE:
28
+   case SPA_AUDIO_FORMAT_U18_LE:
29
+   case SPA_AUDIO_FORMAT_U18_BE:
30
        return 3 * ss->channels;
31
    case SPA_AUDIO_FORMAT_F32_LE:
32
    case SPA_AUDIO_FORMAT_F32_BE:
33
@@ -206,10 +221,18 @@
34
    case SPA_AUDIO_FORMAT_S32_LE:
35
    case SPA_AUDIO_FORMAT_S32_BE:
36
    case SPA_AUDIO_FORMAT_S32P:
37
+   case SPA_AUDIO_FORMAT_U32_LE:
38
+   case SPA_AUDIO_FORMAT_U32_BE:
39
    case SPA_AUDIO_FORMAT_S24_32_LE:
40
    case SPA_AUDIO_FORMAT_S24_32_BE:
41
    case SPA_AUDIO_FORMAT_S24_32P:
42
+   case SPA_AUDIO_FORMAT_U24_32_LE:
43
+   case SPA_AUDIO_FORMAT_U24_32_BE:
44
        return 4 * ss->channels;
45
+   case SPA_AUDIO_FORMAT_F64_LE:
46
+   case SPA_AUDIO_FORMAT_F64_BE:
47
+   case SPA_AUDIO_FORMAT_F64P:
48
+       return 8 * ss->channels;
49
    default:
50
        return 0;
51
    }
52
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-combine-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-combine-sink.c Changed
201
 
1
@@ -24,6 +24,7 @@
2
  */
3
 
4
 #include <spa/param/audio/format-utils.h>
5
+#include <spa/utils/json.h>
6
 
7
 #include <pipewire/pipewire.h>
8
 #include <pipewire/utils.h>
9
@@ -49,130 +50,38 @@
10
                "slaves=<sinks to combine> "
11
                "rate=<sample rate> "
12
                "channels=<number of channels> "
13
-               "channel_map=<channel map> " },
14
+               "channel_map=<channel map> "
15
+               "remix=<remix channels> " },
16
    { PW_KEY_MODULE_VERSION, PACKAGE_VERSION },
17
 };
18
 
19
 struct module_combine_sink_data;
20
 
21
-/* This goes to the stream event listener to be able to identify the stream on
22
- * which the event occurred and to have a link to the module data */
23
-struct combine_stream {
24
-   struct pw_stream *stream;
25
-   struct spa_hook stream_listener;
26
-   struct module_combine_sink_data *data;
27
-   bool cleanup;
28
-   bool started;
29
-};
30
-
31
 struct module_combine_sink_data {
32
    struct module *module;
33
 
34
    struct pw_core *core;
35
-   struct pw_manager *manager;
36
-
37
-   struct pw_stream *sink;
38
-
39
    struct spa_hook core_listener;
40
+   struct pw_manager *manager;
41
    struct spa_hook manager_listener;
42
-   struct spa_hook sink_listener;
43
+
44
+   struct pw_impl_module *mod;
45
+   struct spa_hook mod_listener;
46
 
47
    char *sink_name;
48
    char **sink_names;
49
-   struct combine_stream streamsMAX_SINKS;
50
+   struct pw_properties *combine_props;
51
 
52
-   struct spa_source *cleanup;
53
    struct spa_source *sinks_timeout;
54
 
55
    struct spa_audio_info_raw info;
56
 
57
    unsigned int sinks_pending;
58
-   unsigned int source_started:1;
59
+   unsigned int remix:1;
60
    unsigned int load_emitted:1;
61
    unsigned int start_error:1;
62
 };
63
 
64
-/* Core connection: mainly to unload the module if the connection errors out */
65
-static void on_core_error(void *data, uint32_t id, int seq, int res, const char *message)
66
-{
67
-   struct module_combine_sink_data *d = data;
68
-   struct module *module = d->module;
69
-
70
-   pw_log_error("error id:%u seq:%d res:%d (%s): %s",
71
-           id, seq, res, spa_strerror(res), message);
72
-
73
-   if (id == PW_ID_CORE && res == -EPIPE)
74
-       module_schedule_unload(module);
75
-}
76
-
77
-static const struct pw_core_events core_events = {
78
-   PW_VERSION_CORE_EVENTS,
79
-   .error = on_core_error,
80
-};
81
-
82
-/* Input stream: the "combine sink" */
83
-static void capture_process(void *d)
84
-{
85
-   struct module_combine_sink_data *data = d;
86
-   struct pw_buffer *in;
87
-   int i;
88
-
89
-   if ((in = pw_stream_dequeue_buffer(data->sink)) == NULL) {
90
-       pw_log_warn("out of capture buffers: %m");
91
-       return;
92
-   }
93
-
94
-   for (i = 0; i < MAX_SINKS; i++) {
95
-       struct pw_buffer *out;
96
-       uint32_t j;
97
-
98
-       if (data->streamsi.stream == NULL || data->streamsi.cleanup)
99
-           continue;
100
-
101
-       if ((out = pw_stream_dequeue_buffer(data->streamsi.stream)) == NULL) {
102
-           pw_log_warn("out of playback buffers: %m");
103
-           continue;
104
-       }
105
-
106
-       if (in->buffer->n_datas != out->buffer->n_datas) {
107
-           pw_log_error("incompatible buffer planes");
108
-           continue;
109
-       }
110
-
111
-       for (j = 0; j < out->buffer->n_datas; j++) {
112
-           struct spa_data *ds, *dd;
113
-           uint32_t outsize = 0;
114
-           int32_t stride = 0;
115
-
116
-           dd = &out->buffer->datasj;
117
-
118
-           if (j < in->buffer->n_datas) {
119
-               uint32_t offs, size;
120
-
121
-               ds = &in->buffer->datasj;
122
-
123
-               offs = SPA_MIN(ds->chunk->offset, ds->maxsize);
124
-               size = SPA_MIN(ds->chunk->size, ds->maxsize - offs);
125
-
126
-               memcpy(dd->data,
127
-                   SPA_PTROFF(ds->data, offs, void), size);
128
-
129
-               outsize = SPA_MAX(outsize, size);
130
-               stride = SPA_MAX(stride, ds->chunk->stride);
131
-           } else {
132
-               memset(dd->data, 0, outsize);
133
-           }
134
-           dd->chunk->offset = 0;
135
-           dd->chunk->size = outsize;
136
-           dd->chunk->stride = stride;
137
-       }
138
-
139
-       pw_stream_queue_buffer(data->streamsi.stream, out);
140
-   }
141
-
142
-   pw_stream_queue_buffer(data->sink, in);
143
-}
144
-
145
 static void check_initialized(struct module_combine_sink_data *data)
146
 {
147
    struct module *module = data->module;
148
@@ -184,174 +93,38 @@
149
        pw_log_debug("module load error");
150
        data->load_emitted = true;
151
        module_emit_loaded(module, -EIO);
152
-   } else if (data->sinks_pending == 0 && data->source_started) {
153
+   } else if (data->sinks_pending == 0) {
154
        pw_log_debug("module loaded");
155
        data->load_emitted = true;
156
        module_emit_loaded(module, 0);
157
    }
158
 }
159
 
160
-static void on_in_stream_state_changed(void *d, enum pw_stream_state old,
161
-       enum pw_stream_state state, const char *error)
162
-{
163
-   struct module_combine_sink_data *data = d;
164
-   struct module *module = data->module;
165
-   uint32_t i;
166
-
167
-   if (!data->source_started && state != PW_STREAM_STATE_CONNECTING) {
168
-       /* Input stream appears on server */
169
-       data->source_started = true;
170
-       if (state < PW_STREAM_STATE_PAUSED)
171
-           data->start_error = true;
172
-       check_initialized(data);
173
-   }
174
-
175
-   switch (state) {
176
-   case PW_STREAM_STATE_PAUSED:
177
-       pw_stream_flush(data->sink, false);
178
-       for (i = 0; i < MAX_SINKS; i++) {
179
-           struct combine_stream *s = &data->streamsi;
180
-           if (s->stream == NULL || s->cleanup)
181
-               continue;
182
-           pw_stream_flush(s->stream, false);
183
-       }
184
-       break;
185
-   case PW_STREAM_STATE_UNCONNECTED:
186
-       pw_log_info("stream disconnected, unloading");
187
-       module_schedule_unload(module);
188
-       break;
189
-   default:
190
-       break;
191
-   }
192
-}
193
-
194
-static const struct pw_stream_events in_stream_events = {
195
-   PW_VERSION_STREAM_EVENTS,
196
-   .state_changed = on_in_stream_state_changed,
197
-   .process = capture_process
198
-};
199
-
200
-/* Output streams: one per sink we have combined output to */
201
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-echo-cancel.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-echo-cancel.c Changed
9
 
1
@@ -27,7 +27,6 @@
2
 #include <spa/utils/hook.h>
3
 #include <spa/utils/json.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-ladspa-sink.c Changed
15
 
1
@@ -22,11 +22,11 @@
2
  * DEALINGS IN THE SOFTWARE.
3
  */
4
 
5
-#include <spa/param/audio/format-utils.h>
6
 #include <spa/utils/hook.h>
7
 #include <spa/utils/json.h>
8
+#include <spa/param/audio/format-utils.h>
9
+
10
 #include <pipewire/pipewire.h>
11
-#include <pipewire/private.h>
12
 
13
 #include "../defs.h"
14
 #include "../module.h"
15
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-ladspa-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-ladspa-source.c Changed
15
 
1
@@ -22,11 +22,11 @@
2
  * DEALINGS IN THE SOFTWARE.
3
  */
4
 
5
-#include <spa/param/audio/format-utils.h>
6
 #include <spa/utils/hook.h>
7
 #include <spa/utils/json.h>
8
+#include <spa/param/audio/format-utils.h>
9
+
10
 #include <pipewire/pipewire.h>
11
-#include <pipewire/private.h>
12
 
13
 #include "../defs.h"
14
 #include "../module.h"
15
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-loopback.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-loopback.c Changed
9
 
1
@@ -27,7 +27,6 @@
2
 #include <spa/utils/hook.h>
3
 #include <spa/utils/json.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-sink.c Changed
33
 
1
@@ -28,7 +28,6 @@
2
 #include <unistd.h>
3
 
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 #include <spa/param/audio/format-utils.h>
7
 #include <spa/utils/hook.h>
8
 
9
@@ -96,8 +95,9 @@
10
            fprintf(f, " ,");
11
        }
12
    }
13
+   fprintf(f, " \"stream.props\": {");
14
    pw_properties_serialize_dict(f, &data->capture_props->dict, 0);
15
-   fprintf(f, " }");
16
+   fprintf(f, " } }");
17
    fclose(f);
18
 
19
    data->mod = pw_context_load_module(module->impl->context,
20
@@ -181,6 +181,12 @@
21
        filename = strdup(str);
22
        pw_properties_set(props, "file", NULL);
23
    }
24
+   if ((str = pw_properties_get(capture_props, PW_KEY_DEVICE_ICON_NAME)) == NULL)
25
+       pw_properties_set(capture_props, PW_KEY_DEVICE_ICON_NAME,
26
+               "audio-card");
27
+   if ((str = pw_properties_get(capture_props, PW_KEY_NODE_NAME)) == NULL)
28
+       pw_properties_set(capture_props, PW_KEY_NODE_NAME,
29
+               "fifo_output");
30
 
31
    d->module = module;
32
    d->capture_props = capture_props;
33
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-pipe-source.c Changed
33
 
1
@@ -28,7 +28,6 @@
2
 #include <unistd.h>
3
 
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 #include <spa/param/audio/format-utils.h>
7
 #include <spa/utils/hook.h>
8
 
9
@@ -96,8 +95,9 @@
10
            fprintf(f, " ,");
11
        }
12
    }
13
+   fprintf(f, " \"stream.props\": {");
14
    pw_properties_serialize_dict(f, &data->playback_props->dict, 0);
15
-   fprintf(f, " }");
16
+   fprintf(f, " } }");
17
    fclose(f);
18
 
19
    data->mod = pw_context_load_module(module->impl->context,
20
@@ -181,6 +181,12 @@
21
        filename = strdup(str);
22
        pw_properties_set(props, "file", NULL);
23
    }
24
+   if ((str = pw_properties_get(playback_props, PW_KEY_DEVICE_ICON_NAME)) == NULL)
25
+       pw_properties_set(playback_props, PW_KEY_DEVICE_ICON_NAME,
26
+               "audio-input-microphone");
27
+   if ((str = pw_properties_get(playback_props, PW_KEY_NODE_NAME)) == NULL)
28
+       pw_properties_set(playback_props, PW_KEY_NODE_NAME,
29
+               "fifo_input");
30
 
31
    d->module = module;
32
    d->playback_props = playback_props;
33
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-raop-discover.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-raop-discover.c Changed
9
 
1
@@ -24,7 +24,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-remap-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-remap-sink.c Changed
9
 
1
@@ -26,7 +26,6 @@
2
 #include <spa/utils/hook.h>
3
 #include <spa/utils/json.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-remap-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-remap-source.c Changed
9
 
1
@@ -26,7 +26,6 @@
2
 #include <spa/utils/hook.h>
3
 #include <spa/utils/json.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink-input.c Changed
9
 
1
@@ -25,7 +25,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-sink.c Changed
9
 
1
@@ -25,7 +25,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-roc-source.c Changed
9
 
1
@@ -25,7 +25,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-rtp-recv.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-rtp-recv.c Changed
9
 
1
@@ -24,7 +24,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-rtp-send.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-rtp-send.c Changed
9
 
1
@@ -24,7 +24,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-tunnel-sink.c Changed
9
 
1
@@ -27,7 +27,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 #include <pipewire/i18n.h>
7
 
8
 #include "../defs.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-tunnel-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-tunnel-source.c Changed
9
 
1
@@ -27,7 +27,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 #include <pipewire/i18n.h>
7
 
8
 #include "../defs.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/modules/module-zeroconf-discover.c Changed
9
 
1
@@ -24,7 +24,6 @@
2
 
3
 #include <spa/utils/hook.h>
4
 #include <pipewire/pipewire.h>
5
-#include <pipewire/private.h>
6
 
7
 #include "../defs.h"
8
 #include "../module.h"
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/pulse-server.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/pulse-server.c Changed
75
 
1
@@ -34,7 +34,6 @@
2
 #include <pipewire/log.h>
3
 
4
 #include "log.h"
5
-#define spa_debug pw_log_debug
6
 
7
 #include <spa/support/cpu.h>
8
 #include <spa/utils/result.h>
9
@@ -50,7 +49,6 @@
10
 #include <spa/utils/json.h>
11
 
12
 #include <pipewire/pipewire.h>
13
-#include <pipewire/private.h>
14
 #include <pipewire/extensions/metadata.h>
15
 
16
 #include "pulse-server.h"
17
@@ -3746,6 +3744,13 @@
18
    return 0;
19
 }
20
 
21
+static bool validate_device_info(struct device_info *dev_info)
22
+{
23
+   return sample_spec_valid(&dev_info->ss) &&
24
+          channel_map_valid(&dev_info->map) &&
25
+          volume_valid(&dev_info->volume_info.volume);
26
+}
27
+
28
 static int fill_sink_info(struct client *client, struct message *m,
29
        struct pw_manager_object *o)
30
 {
31
@@ -3796,9 +3801,7 @@
32
 
33
    collect_device_info(o, card, &dev_info, false, &impl->defs);
34
 
35
-   if (!sample_spec_valid(&dev_info.ss) ||
36
-       !channel_map_valid(&dev_info.map) ||
37
-       !volume_valid(&dev_info.volume_info.volume)) {
38
+   if (!validate_device_info(&dev_info)) {
39
        pw_log_warn("%d: sink not ready: sample:%d map:%d volume:%d",
40
                o->id, sample_spec_valid(&dev_info.ss),
41
                channel_map_valid(&dev_info.map),
42
@@ -4011,9 +4014,7 @@
43
 
44
    collect_device_info(o, card, &dev_info, is_monitor, &impl->defs);
45
 
46
-   if (!sample_spec_valid(&dev_info.ss) ||
47
-       !channel_map_valid(&dev_info.map) ||
48
-       !volume_valid(&dev_info.volume_info.volume)) {
49
+   if (!validate_device_info(&dev_info)) {
50
        pw_log_warn("%d: source not ready: sample:%d map:%d volume:%d",
51
                o->id, sample_spec_valid(&dev_info.ss),
52
                channel_map_valid(&dev_info.map),
53
@@ -4154,9 +4155,7 @@
54
 
55
    collect_device_info(o, NULL, &dev_info, false, &impl->defs);
56
 
57
-   if (!sample_spec_valid(&dev_info.ss) ||
58
-       !channel_map_valid(&dev_info.map) ||
59
-       !volume_valid(&dev_info.volume_info.volume))
60
+   if (!validate_device_info(&dev_info))
61
        return -ENOENT;
62
 
63
    peer_index = get_temporary_move_target(client, o);
64
@@ -4237,9 +4236,7 @@
65
 
66
    collect_device_info(o, NULL, &dev_info, false, &impl->defs);
67
 
68
-   if (!sample_spec_valid(&dev_info.ss) ||
69
-       !channel_map_valid(&dev_info.map) ||
70
-       !volume_valid(&dev_info.volume_info.volume))
71
+   if (!validate_device_info(&dev_info))
72
        return -ENOENT;
73
 
74
    peer_index = get_temporary_move_target(client, o);
75
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/remap.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/remap.c Changed
8
 
1
@@ -53,5 +53,6 @@
2
    { PW_KEY_APP_PROCESS_MACHINE_ID, "application.process.machine_id" },
3
    { PW_KEY_APP_PROCESS_SESSION_ID, "application.process.session_id" },
4
    { PW_KEY_MEDIA_ROLE, "media.role", media_role_map },
5
+   { "pipe.filename", "device.string" },
6
    { NULL, NULL },
7
 };
8
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/stream.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/stream.c Changed
9
 
1
@@ -31,7 +31,6 @@
2
 #include <pipewire/log.h>
3
 #include <pipewire/loop.h>
4
 #include <pipewire/map.h>
5
-#include <pipewire/private.h>
6
 #include <pipewire/properties.h>
7
 #include <pipewire/stream.h>
8
 #include <pipewire/work-queue.h>
9
pipewire-0.3.64.tar.gz/src/modules/module-protocol-pulse/utils.c -> pipewire-0.3.65.tar.gz/src/modules/module-protocol-pulse/utils.c Changed
15
 
1
@@ -171,11 +171,10 @@
2
    const char *name = NULL;
3
    const struct pw_properties *props = pw_context_get_properties(context);
4
 
5
-   if (props)
6
+   name = getenv("PIPEWIRE_REMOTE");
7
+   if ((name == NULL || name0 == '\0') && props != NULL)
8
        name = pw_properties_get(props, PW_KEY_REMOTE_NAME);
9
    if (name == NULL || name0 == '\0')
10
-       name = getenv("PIPEWIRE_REMOTE");
11
-   if (name == NULL || name0 == '\0')
12
        name = PW_DEFAULT_REMOTE;
13
    return name;
14
 }
15
pipewire-0.3.64.tar.gz/src/modules/module-pulse-tunnel.c -> pipewire-0.3.65.tar.gz/src/modules/module-pulse-tunnel.c Changed
10
 
1
@@ -41,7 +41,7 @@
2
 #include <spa/utils/json.h>
3
 #include <spa/utils/ringbuffer.h>
4
 #include <spa/utils/dll.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/pod/builder.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/latency-utils.h>
10
pipewire-0.3.64.tar.gz/src/modules/module-raop-discover.c -> pipewire-0.3.65.tar.gz/src/modules/module-raop-discover.c Changed
9
 
1
@@ -37,7 +37,6 @@
2
 #include <spa/utils/json.h>
3
 
4
 #include <pipewire/impl.h>
5
-#include <pipewire/private.h>
6
 #include <pipewire/i18n.h>
7
 
8
 #include <avahi-client/lookup.h>
9
pipewire-0.3.64.tar.gz/src/modules/module-raop-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-raop-sink.c Changed
18
 
1
@@ -50,7 +50,7 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/utils/ringbuffer.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/pod/builder.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/audio/raw.h>
10
@@ -58,7 +58,6 @@
11
 
12
 #include <pipewire/impl.h>
13
 #include <pipewire/i18n.h>
14
-#include <pipewire/private.h>
15
 
16
 #include "module-raop/rtsp-client.h"
17
 
18
pipewire-0.3.64.tar.gz/src/modules/module-roc-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-roc-sink.c Changed
24
 
1
@@ -29,10 +29,9 @@
2
 
3
 #include "config.h"
4
 
5
-#include <pipewire/pipewire.h>
6
-#include <pipewire/private.h>
7
-#include <spa/param/audio/format-utils.h>
8
 #include <spa/utils/hook.h>
9
+#include <spa/utils/result.h>
10
+#include <spa/param/audio/format-utils.h>
11
 
12
 #include <roc/config.h>
13
 #include <roc/log.h>
14
@@ -40,6 +39,9 @@
15
 #include <roc/log.h>
16
 #include <roc/sender.h>
17
 
18
+#include <pipewire/pipewire.h>
19
+#include <pipewire/impl.h>
20
+
21
 #include "module-roc/common.h"
22
 
23
 /** \page page_module_roc_sink PipeWire Module: ROC sink
24
pipewire-0.3.64.tar.gz/src/modules/module-roc-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-roc-source.c Changed
24
 
1
@@ -29,10 +29,9 @@
2
 
3
 #include "config.h"
4
 
5
-#include <pipewire/pipewire.h>
6
-#include <pipewire/private.h>
7
-#include <spa/param/audio/format-utils.h>
8
 #include <spa/utils/hook.h>
9
+#include <spa/utils/result.h>
10
+#include <spa/param/audio/format-utils.h>
11
 
12
 #include <roc/config.h>
13
 #include <roc/log.h>
14
@@ -40,6 +39,9 @@
15
 #include <roc/log.h>
16
 #include <roc/receiver.h>
17
 
18
+#include <pipewire/pipewire.h>
19
+#include <pipewire/impl.h>
20
+
21
 #include "module-roc/common.h"
22
 
23
 /** \page page_module_roc_source PipeWire Module: ROC source
24
pipewire-0.3.64.tar.gz/src/modules/module-rt.c -> pipewire-0.3.65.tar.gz/src/modules/module-rt.c Changed
201
 
1
@@ -133,7 +133,8 @@
2
 
3
 #define IS_VALID_NICE_LEVEL(l) ((l)>=-20 && (l)<=19)
4
 
5
-#define DEFAULT_NICE_LEVEL      20
6
+#define DEFAULT_NICE_LEVEL 20
7
+#define DEFAULT_RT_PRIO_MIN    11
8
 #define DEFAULT_RT_PRIO        88
9
 #define DEFAULT_RT_TIME_SOFT   -1
10
 #define DEFAULT_RT_TIME_HARD   -1
11
@@ -550,42 +551,82 @@
12
    .destroy = module_destroy,
13
 };
14
 
15
+static int get_rt_priority_range(int *out_min, int *out_max)
16
+{
17
+   int min, max;
18
+
19
+   if ((min = sched_get_priority_min(REALTIME_POLICY)) < 0)
20
+       return -errno;
21
+   if ((max = sched_get_priority_max(REALTIME_POLICY)) < 0)
22
+       return -errno;
23
+
24
+   if (out_min)
25
+       *out_min = min;
26
+   if (out_max)
27
+       *out_max = max;
28
+
29
+   return 0;
30
+}
31
 /**
32
  * Check if the current user has permissions to use realtime scheduling at the
33
  * specified priority.
34
  */
35
-static bool check_realtime_privileges(rlim_t priority)
36
+static bool check_realtime_privileges(struct impl *impl)
37
 {
38
-   int err, old_policy, new_policy = REALTIME_POLICY;
39
+   rlim_t priority = impl->rt_prio;
40
+   int err, old_policy, new_policy, min, max;
41
    struct sched_param old_sched_params;
42
    struct sched_param new_sched_params;
43
+   int try = 0;
44
+
45
+   while (try++ < 2) {
46
+       /* We could check `RLIMIT_RTPRIO`, but the BSDs generally don't have
47
+        * that available, and there are also other ways to use realtime
48
+        * scheduling without that rlimit being set such as `CAP_SYS_NICE` or
49
+        * running as root. Instead of checking a bunch of preconditions, we
50
+        * just try if setting realtime scheduling works or not. */
51
+       if ((err = pthread_getschedparam(pthread_self(), &old_policy, &old_sched_params)) != 0) {
52
+           pw_log_warn("Failed to check RLIMIT_RTPRIO: %s", strerror(err));
53
+           return false;
54
+       }
55
+       if ((err = get_rt_priority_range(&min, &max)) < 0) {
56
+           pw_log_warn("Failed to get priority range: %s", strerror(err));
57
+           return false;
58
+       }
59
+       if (try == 2) {
60
+           struct rlimit rlim;
61
+           /* second try, try to clamp to RLIMIT_RTPRIO */
62
+           if (getrlimit(RLIMIT_RTPRIO, &rlim) == 0 && max > (int)rlim.rlim_max) {
63
+               pw_log_info("Clamp rtprio %d to %d", (int)priority, (int)rlim.rlim_max);
64
+               max = (int)rlim.rlim_max;
65
+           }
66
+           else
67
+               break;
68
+       }
69
+       if (max < DEFAULT_RT_PRIO_MIN) {
70
+           pw_log_info("Priority max (%d) must be at least %d", max, DEFAULT_RT_PRIO_MIN);
71
+           return false;
72
+       }
73
 
74
-   /* We could check `RLIMIT_RTPRIO`, but the BSDs generally don't have
75
-    * that available, and there are also other ways to use realtime
76
-    * scheduling without that rlimit being set such as `CAP_SYS_NICE` or
77
-    * running as root. Instead of checking a bunch of preconditions, we
78
-    * just try if setting realtime scheduling works or not. */
79
-   if ((err = pthread_getschedparam(pthread_self(),&old_policy,&old_sched_params)) != 0) {
80
-       pw_log_warn("Failed to check RLIMIT_RTPRIO: %s", strerror(err));
81
-       return false;
82
-   }
83
-
84
-   /* If the current scheduling policy has `SCHED_RESET_ON_FORK` set, then
85
-    * this also needs to be set here or `pthread_setschedparam()` will return
86
-    * an error code. Similarly, if it is not set, then we don't want to set
87
-    * it here as it would irreversible change the current thread's
88
-    * scheduling policy. */
89
-   spa_zero(new_sched_params);
90
-   new_sched_params.sched_priority = priority;
91
-   if ((old_policy & PW_SCHED_RESET_ON_FORK) != 0)
92
-       new_policy |= PW_SCHED_RESET_ON_FORK;
93
-
94
-   if (pthread_setschedparam(pthread_self(), new_policy, &new_sched_params) == 0) {
95
-       pthread_setschedparam(pthread_self(), old_policy, &old_sched_params);
96
-       return true;
97
-   } else {
98
-       return false;
99
+       /* If the current scheduling policy has `SCHED_RESET_ON_FORK` set, then
100
+        * this also needs to be set here or `pthread_setschedparam()` will return
101
+        * an error code. Similarly, if it is not set, then we don't want to set
102
+        * it here as it would irreversible change the current thread's
103
+        * scheduling policy. */
104
+       spa_zero(new_sched_params);
105
+       new_sched_params.sched_priority = SPA_CLAMP((int)priority, min, max);
106
+       new_policy = REALTIME_POLICY;
107
+       if ((old_policy & PW_SCHED_RESET_ON_FORK) != 0)
108
+           new_policy |= PW_SCHED_RESET_ON_FORK;
109
+
110
+       if (pthread_setschedparam(pthread_self(), new_policy, &new_sched_params) == 0) {
111
+           impl->rt_prio = new_sched_params.sched_priority;
112
+           pthread_setschedparam(pthread_self(), old_policy, &old_sched_params);
113
+           return true;
114
+       }
115
    }
116
+   pw_log_info("Can't set rt prio to %d: %m (try increasing rlimits)", (int)priority);
117
+   return false;
118
 }
119
 
120
 static int sched_set_nice(int nice_level)
121
@@ -657,16 +698,19 @@
122
    return res;
123
 }
124
 
125
-static int impl_acquire_rt_sched(struct spa_thread *thread, int priority)
126
+static int acquire_rt_sched(struct spa_thread *thread, int priority)
127
 {
128
-   int err;
129
+   int err, min, max;
130
    struct sched_param sp;
131
    pthread_t pt = (pthread_t)thread;
132
 
133
-   if (priority < sched_get_priority_min(REALTIME_POLICY) ||
134
-       priority > sched_get_priority_max(REALTIME_POLICY)) {
135
-       pw_log_warn("invalid priority %d for policy %d", priority, REALTIME_POLICY);
136
-       return -EINVAL;
137
+   if ((err = get_rt_priority_range(&min, &max)) < 0)
138
+       return err;
139
+
140
+   if (priority < min || priority > max) {
141
+       pw_log_info("clamping priority %d to range %d - %d for policy %d",
142
+               priority, min, max, REALTIME_POLICY);
143
+       priority = SPA_CLAMP(priority, min, max);
144
    }
145
 
146
    spa_zero(sp);
147
@@ -769,23 +813,30 @@
148
    return pthread_join(pt, retval);
149
 }
150
 
151
+
152
+static int get_rtkit_priority_range(struct impl *impl, int *min, int *max)
153
+{
154
+   if (min)
155
+       *min = 1;
156
+   if (max) {
157
+       if ((*max = pw_rtkit_get_max_realtime_priority(impl)) < 0)
158
+           return *max;
159
+       if (*max < 1)
160
+           *max = 1;
161
+   }
162
+   return 0;
163
+}
164
+
165
 static int impl_get_rt_range(void *object, const struct spa_dict *props,
166
        int *min, int *max)
167
 {
168
    struct impl *impl = object;
169
-   if (impl->use_rtkit) {
170
-       if (min)
171
-           *min = 1;
172
-       if (max)
173
-           *max = pw_rtkit_get_max_realtime_priority(impl);
174
-   } else {
175
-       if (min)
176
-           *min = sched_get_priority_min(REALTIME_POLICY);
177
-       if (max)
178
-           *max = sched_get_priority_max(REALTIME_POLICY);
179
-   }
180
-
181
-   return 0;
182
+   int res;
183
+   if (impl->use_rtkit)
184
+       res = get_rtkit_priority_range(impl, min, max);
185
+   else
186
+       res = get_rt_priority_range(min, max);
187
+   return res;
188
 }
189
 
190
 static pid_t impl_gettid(struct impl *impl, pthread_t pt)
191
@@ -807,7 +858,7 @@
192
 {
193
    struct impl *impl = object;
194
    struct sched_param sp;
195
-   int err, rtprio_limit;
196
+   int err;
197
    pthread_t pt = (pthread_t)thread;
198
    pid_t pid;
199
 
200
@@ -817,11 +868,17 @@
201
pipewire-0.3.64.tar.gz/src/modules/module-rtp-sink.c -> pipewire-0.3.65.tar.gz/src/modules/module-rtp-sink.c Changed
135
 
1
@@ -35,14 +35,15 @@
2
 #include <net/if.h>
3
 #include <ctype.h>
4
 
5
-#include <spa/param/audio/format-utils.h>
6
 #include <spa/utils/hook.h>
7
+#include <spa/utils/result.h>
8
 #include <spa/utils/ringbuffer.h>
9
 #include <spa/utils/json.h>
10
-#include <spa/debug/pod.h>
11
+#include <spa/param/audio/format-utils.h>
12
+#include <spa/debug/types.h>
13
 
14
 #include <pipewire/pipewire.h>
15
-#include <pipewire/private.h>
16
+#include <pipewire/impl.h>
17
 
18
 #include <module-rtp/sap.h>
19
 #include <module-rtp/rtp.h>
20
@@ -66,6 +67,8 @@
21
  * - `net.mtu = <int>`: MTU to use, default 1280
22
  * - `net.ttl = <int>`: TTL to use, default 1
23
  * - `net.loop = <bool>`: loopback multicast, default false
24
+ * - `sess.min-ptime = <int>`: minimum packet time in milliseconds, default 2
25
+ * - `sess.max-ptime = <int>`: maximum packet time in milliseconds, default 20
26
  * - `sess.name = <str>`: a session name
27
  * - `stream.props = {}`: properties to be passed to the stream
28
  *
29
@@ -100,6 +103,8 @@
30
  *         #net.mtu = 1280
31
  *         #net.ttl = 1
32
  *         #net.loop = false
33
+ *         #sess.min-ptime = 2
34
+ *         #sess.max-ptime = 20
35
  *         #sess.name = "PipeWire RTP stream"
36
  *         #audio.format = "S16BE"
37
  *         #audio.rate = 48000
38
@@ -154,6 +159,8 @@
39
        "net.ttl=<desired TTL, default:"SPA_STRINGIFY(DEFAULT_TTL)"> "          \
40
        "net.loop=<desired loopback, default:"SPA_STRINGIFY(DEFAULT_LOOP)"> "       \
41
        "sess.name=<a name for the session> "                       \
42
+       "sess.min-ptime=<minimum packet time in milliseconds, default:2> "      \
43
+       "sess.max-ptime=<maximum packet time in milliseconds, default:20> "     \
44
        "audio.format=<format, default:"DEFAULT_FORMAT"> "              \
45
        "audio.rate=<sample rate, default:"SPA_STRINGIFY(DEFAULT_RATE)"> "      \
46
        "audio.channels=<number of channels, default:"SPA_STRINGIFY(DEFAULT_CHANNELS)"> "\
47
@@ -215,6 +222,7 @@
48
    bool mcast_loop;
49
    uint32_t min_ptime;
50
    uint32_t max_ptime;
51
+   uint32_t pbytes;
52
 
53
    struct sockaddr_storage src_addr;
54
    socklen_t src_len;
55
@@ -275,7 +283,7 @@
56
 
57
    avail = spa_ringbuffer_get_read_index(&impl->ring, &index);
58
 
59
-   tosend = SPA_ROUND_DOWN(impl->mtu, impl->frame_size);
60
+   tosend = impl->pbytes;
61
 
62
    if (avail < tosend)
63
        return;
64
@@ -442,6 +450,7 @@
65
        goto error;
66
    }
67
    if (is_multicast((struct sockaddr*)dst, dst_len)) {
68
+       val = loop;
69
        if (setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, &val, sizeof(val)) < 0)
70
            pw_log_warn("setsockopt(IP_MULTICAST_LOOP) failed: %m");
71
 
72
@@ -480,7 +489,7 @@
73
 
74
    if (pw_properties_get(props, PW_KEY_NODE_LATENCY) == NULL) {
75
        pw_properties_setf(props, PW_KEY_NODE_LATENCY,
76
-               "%d/%d", impl->mtu / impl->frame_size,
77
+               "%d/%d", impl->pbytes / impl->frame_size,
78
                impl->info.rate);
79
    }
80
    pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%d", impl->info.rate);
81
@@ -578,16 +587,20 @@
82
            "c=IN %s %s%s\n"
83
            "t=%u 0\n"
84
            "a=recvonly\n"
85
+           "a=tool:PipeWire %s\n"
86
            "m=audio %u RTP/AVP %i\n"
87
            "a=rtpmap:%i %s/%u/%u\n"
88
-           "a=type:broadcast\n",
89
+           "a=type:broadcast\n"
90
+           "a=ptime:%d\n",
91
            user_name, impl->ntp, af, src_addr,
92
            impl->session_name,
93
            af, dst_addr, dst_ttl,
94
            impl->ntp,
95
+           pw_get_library_version(),
96
            impl->port, impl->payload,
97
            impl->payload, impl->format_info->mime,
98
-           impl->info.rate, impl->info.channels);
99
+           impl->info.rate, impl->info.channels,
100
+           (impl->pbytes / impl->frame_size) * 1000 / impl->info.rate);
101
 
102
    iov3.iov_base = buffer;
103
    iov3.iov_len = strlen(buffer);
104
@@ -780,7 +793,7 @@
105
    struct impl *impl;
106
    struct pw_properties *props = NULL, *stream_props = NULL;
107
    uint32_t id = pw_global_get_id(pw_impl_module_get_global(module));
108
-   uint32_t pid = getpid(), port;
109
+   uint32_t pid = getpid(), port, min_bytes, max_bytes;
110
    char addr64;
111
    const char *str;
112
    int res = 0;
113
@@ -897,6 +910,12 @@
114
    impl->min_ptime = pw_properties_get_uint32(props, "sess.min-ptime", DEFAULT_MIN_PTIME);
115
    impl->max_ptime = pw_properties_get_uint32(props, "sess.max-ptime", DEFAULT_MAX_PTIME);
116
 
117
+   min_bytes = (impl->min_ptime * impl->info.rate / 1000) * impl->frame_size;
118
+   max_bytes = (impl->max_ptime * impl->info.rate / 1000) * impl->frame_size;
119
+
120
+   impl->pbytes = SPA_ROUND_DOWN(impl->mtu, impl->frame_size);
121
+   impl->pbytes = SPA_CLAMP(impl->pbytes, min_bytes, max_bytes);
122
+
123
    if ((str = pw_properties_get(props, "sess.name")) == NULL)
124
        pw_properties_setf(props, "sess.name", "PipeWire RTP Stream on %s",
125
                pw_get_host_name());
126
@@ -911,6 +930,8 @@
127
    pw_properties_setf(stream_props, "rtp.destination.port", "%u", impl->port);
128
    pw_properties_setf(stream_props, "rtp.mtu", "%u", impl->mtu);
129
    pw_properties_setf(stream_props, "rtp.ttl", "%u", impl->ttl);
130
+   pw_properties_setf(stream_props, "rtp.ptime", "%u",
131
+           (impl->pbytes / impl->frame_size) * 1000 / impl->info.rate);
132
 
133
    impl->core = pw_context_get_object(impl->module_context, PW_TYPE_INTERFACE_Core);
134
    if (impl->core == NULL) {
135
pipewire-0.3.64.tar.gz/src/modules/module-rtp-source.c -> pipewire-0.3.65.tar.gz/src/modules/module-rtp-source.c Changed
201
 
1
@@ -34,14 +34,15 @@
2
 #include <net/if.h>
3
 #include <ctype.h>
4
 
5
-#include <spa/param/audio/format-utils.h>
6
 #include <spa/utils/hook.h>
7
+#include <spa/utils/result.h>
8
 #include <spa/utils/ringbuffer.h>
9
 #include <spa/utils/dll.h>
10
+#include <spa/param/audio/format-utils.h>
11
 #include <spa/debug/mem.h>
12
 
13
 #include <pipewire/pipewire.h>
14
-#include <pipewire/private.h>
15
+#include <pipewire/impl.h>
16
 
17
 #include <module-rtp/sap.h>
18
 #include <module-rtp/rtp.h>
19
@@ -77,19 +78,38 @@
20
  * ## Example configuration
21
  *\code{.unparsed}
22
  * context.modules = 
23
- *  {   name = libpipewire-module-rtp-source
24
- *      args = {
25
- *          #sap.ip = 224.0.0.56
26
- *          #sap.port = 9875
27
- *          #local.ifname = eth0
28
- *          sess.latency.msec = 100
29
- *          stream.props = {
30
- *             node.name = "rtp-source"
31
- *             #media.class = "Audio/Source"
32
- *          }
33
- *      }
34
- *  }
35
- *
36
+ * {   name = libpipewire-module-rtp-source
37
+ *     args = {
38
+ *         #sap.ip = 224.0.0.56
39
+ *         #sap.port = 9875
40
+ *         #local.ifname = eth0
41
+ *         sess.latency.msec = 100
42
+ *         stream.props = {
43
+ *            #media.class = "Audio/Source"
44
+ *            #node.name = "rtp-source"
45
+ *         }
46
+ *         stream.rules = 
47
+ *             {   matches = 
48
+ *                     # any of the items in matches needs to match, if one does,
49
+ *                     # actions are emited.
50
+ *                     {   # all keys must match the value. ~ in value starts regex.
51
+ *                         #rtp.origin = "wim 3883629975 0 IN IP4 0.0.0.0"
52
+ *                         #rtp.payload = "127"
53
+ *                         #rtp.fmt = "L16/48000/2"
54
+ *                         #rtp.session = "PipeWire RTP Stream on fedora"
55
+ *                     }
56
+ *                 
57
+ *                 actions = {
58
+ *                     create-stream = {
59
+ *                         #sess.latency.msec = 100
60
+ *                         #target.object = ""
61
+ *                     }
62
+ *                 }
63
+ *             }
64
+ *         
65
+ *     }
66
+ * }
67
+ * 
68
  *\endcode
69
  *
70
  * \since 0.3.60
71
@@ -100,24 +120,25 @@
72
 PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
73
 #define PW_LOG_TOPIC_DEFAULT mod_topic
74
 
75
-#define SAP_MIME_TYPE      "application/sdp"
76
+#define SAP_MIME_TYPE          "application/sdp"
77
 
78
-#define ERROR_MSEC     2
79
-#define MAX_SESSIONS       16
80
-#define CLEANUP_INTERVAL_SEC   20
81
+#define ERROR_MSEC         2
82
+#define MAX_SESSIONS           16
83
 
84
-#define DEFAULT_SAP_IP     "224.0.0.56"
85
-#define DEFAULT_SAP_PORT   9875
86
-#define DEFAULT_SESS_LATENCY   100
87
+#define DEFAULT_CLEANUP_INTERVAL_SEC   90
88
+#define DEFAULT_SAP_IP         "224.0.0.56"
89
+#define DEFAULT_SAP_PORT       9875
90
+#define DEFAULT_SESS_LATENCY       100
91
 
92
-#define BUFFER_SIZE        (1u<<22)
93
-#define BUFFER_MASK        (BUFFER_SIZE-1)
94
+#define BUFFER_SIZE            (1u<<22)
95
+#define BUFFER_MASK            (BUFFER_SIZE-1)
96
 
97
 #define USAGE  "sap.ip=<SAP IP address to listen on, default "DEFAULT_SAP_IP"> "               \
98
        "sap.port=<SAP port to listen on, default "SPA_STRINGIFY(DEFAULT_SAP_PORT)"> "          \
99
        "local.ifname=<local interface name to use> "                           \
100
        "sess.latency.msec=<target network latency, default "SPA_STRINGIFY(DEFAULT_SESS_LATENCY)"> "    \
101
-       "stream.props= { key=value ... }"
102
+       "stream.props= { key=value ... } "                              \
103
+       "stream.rules=<rules> "
104
 
105
 static const struct spa_dict_item module_info = {
106
    { PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
107
@@ -150,6 +171,7 @@
108
    char *sap_ip;
109
    int sap_port;
110
    int sess_latency_msec;
111
+   uint32_t cleanup_interval;
112
 
113
    struct spa_list sessions;
114
    uint32_t n_sessions;
115
@@ -217,8 +239,10 @@
116
    struct spa_io_rate_match *rate_match;
117
    struct spa_dll dll;
118
    uint32_t target_buffer;
119
+   uint32_t last_packet_size;
120
    float max_error;
121
    unsigned buffering:1;
122
+   unsigned first:1;
123
 };
124
 
125
 static void stream_destroy(void *d)
126
@@ -233,8 +257,8 @@
127
    struct session *sess = data;
128
    struct pw_buffer *buf;
129
    struct spa_data *d;
130
-   uint32_t index;
131
-        int32_t avail, wanted;
132
+   uint32_t index, target_buffer;
133
+   int32_t avail, wanted;
134
 
135
    if ((buf = pw_stream_dequeue_buffer(sess->stream)) == NULL) {
136
        pw_log_debug("Out of stream buffers: %m");
137
@@ -248,27 +272,39 @@
138
 
139
    avail = spa_ringbuffer_get_read_index(&sess->ring, &index);
140
 
141
-        if (avail < wanted || sess->buffering) {
142
-                memset(d0.data, 0, wanted);
143
+   target_buffer = sess->target_buffer + sess->last_packet_size / 2;
144
+
145
+   if (avail < wanted || sess->buffering) {
146
+       memset(d0.data, 0, wanted);
147
        if (!sess->buffering && sess->have_sync) {
148
-           pw_log_info("underrun %u/%u < %u, buffering...",
149
-                   avail, sess->target_buffer, wanted);
150
+           pw_log_debug("underrun %u/%u < %u, buffering...",
151
+                   avail, target_buffer, wanted);
152
            sess->buffering = true;
153
        }
154
-        } else {
155
+   } else {
156
        float error, corr;
157
-       if (avail > (int32_t)BUFFER_SIZE) {
158
-           index += avail - sess->target_buffer;
159
-           avail = sess->target_buffer;
160
-           pw_log_warn("overrun %u > %u", avail, BUFFER_SIZE);
161
+       if (avail > (int32_t)SPA_MIN(target_buffer * 8, BUFFER_SIZE)) {
162
+           pw_log_warn("overrun %u > %u", avail, target_buffer * 8);
163
+           index += avail - target_buffer;
164
+           avail = target_buffer;
165
        } else {
166
-           error = (float)sess->target_buffer - (float)avail;
167
+           if (sess->first) {
168
+               if ((uint32_t)avail > target_buffer) {
169
+                   uint32_t skip = avail - target_buffer;
170
+                   pw_log_debug("first: avail:%d skip:%u target:%u",
171
+                           avail, skip, target_buffer);
172
+                   index += skip;
173
+                   avail = target_buffer;
174
+               }
175
+               sess->first = false;
176
+           }
177
+           error = (float)target_buffer - (float)avail;
178
            error = SPA_CLAMP(error, -sess->max_error, sess->max_error);
179
 
180
            corr = spa_dll_update(&sess->dll, error);
181
 
182
            pw_log_debug("avail:%u target:%u error:%f corr:%f", avail,
183
-                   sess->target_buffer, error, corr);
184
+                   target_buffer, error, corr);
185
 
186
            if (sess->rate_match) {
187
                SPA_FLAG_SET(sess->rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE);
188
@@ -278,16 +314,16 @@
189
        spa_ringbuffer_read_data(&sess->ring,
190
                sess->buffer,
191
                BUFFER_SIZE,
192
-                                index & BUFFER_MASK,
193
-                                d0.data, wanted);
194
+               index & BUFFER_MASK,
195
+               d0.data, wanted);
196
 
197
-                index += wanted;
198
-                spa_ringbuffer_read_update(&sess->ring, index);
199
-        }
200
-        d0.chunk->size = wanted;
201
pipewire-0.3.64.tar.gz/src/modules/module-x11-bell.c -> pipewire-0.3.65.tar.gz/src/modules/module-x11-bell.c Changed
9
 
1
@@ -46,7 +46,6 @@
2
 
3
 #include <pipewire/pipewire.h>
4
 #include <pipewire/impl.h>
5
-#include <pipewire/private.h>
6
 
7
 /** \page page_module_x11_bell PipeWire Module: X11 Bell
8
  *
9
pipewire-0.3.64.tar.gz/src/modules/module-zeroconf-discover.c -> pipewire-0.3.65.tar.gz/src/modules/module-zeroconf-discover.c Changed
12
 
1
@@ -35,9 +35,9 @@
2
 #include <spa/utils/result.h>
3
 #include <spa/utils/string.h>
4
 #include <spa/utils/json.h>
5
+#include <spa/param/audio/format-utils.h>
6
 
7
 #include <pipewire/impl.h>
8
-#include <pipewire/private.h>
9
 #include <pipewire/i18n.h>
10
 
11
 #include <avahi-client/lookup.h>
12
pipewire-0.3.64.tar.gz/src/pipewire/buffers.c -> pipewire-0.3.65.tar.gz/src/pipewire/buffers.c Changed
12
 
1
@@ -27,10 +27,6 @@
2
 #include <spa/param/param.h>
3
 #include <spa/buffer/alloc.h>
4
 
5
-#include <spa/debug/node.h>
6
-#include <spa/debug/pod.h>
7
-#include <spa/debug/format.h>
8
-
9
 #include "pipewire/keys.h"
10
 #include "pipewire/private.h"
11
 
12
pipewire-0.3.64.tar.gz/src/pipewire/conf.c -> pipewire-0.3.65.tar.gz/src/pipewire/conf.c Changed
80
 
1
@@ -361,7 +361,7 @@
2
 }
3
 
4
 SPA_EXPORT
5
-int pw_conf_save_state(const char *prefix, const char *name, struct pw_properties *conf)
6
+int pw_conf_save_state(const char *prefix, const char *name, const struct pw_properties *conf)
7
 {
8
    char pathPATH_MAX;
9
    char *tmp_name;
10
@@ -1013,12 +1013,6 @@
11
    return res == 0 ? data.count : res;
12
 }
13
 
14
-struct match {
15
-   const struct spa_dict *props;
16
-   int (*matched) (void *data, const char *location, const char *action,
17
-           const char *val, size_t len);
18
-   void *data;
19
-};
20
 
21
 /*
22
  * {
23
@@ -1080,7 +1074,7 @@
24
 }
25
 
26
 /**
27
- * rules = 
28
+ * 
29
  *     {
30
  *         matches = 
31
  *             # any of the items in matches needs to match, if one does,
32
@@ -1099,11 +1093,13 @@
33
  *     }
34
  * 
35
  */
36
-static int match_rules(void *data, const char *location, const char *section,
37
-       const char *str, size_t len)
38
+SPA_EXPORT
39
+int pw_conf_match_rules(const char *str, size_t len, const char *location,
40
+       const struct spa_dict *props,
41
+       int (*callback) (void *data, const char *location, const char *action,
42
+           const char *str, size_t len),
43
+       void *data)
44
 {
45
-   struct match *match = data;
46
-   const struct spa_dict *props = match->props;
47
    const char *val;
48
    struct spa_json it4, actions;
49
 
50
@@ -1142,13 +1138,28 @@
51
            if (spa_json_is_container(val, len))
52
                len = spa_json_container_len(&actions, val, len);
53
 
54
-           if ((res = match->matched(match->data, location, key, val, len)) < 0)
55
+           if ((res = callback(data, location, key, val, len)) < 0)
56
                return res;
57
        }
58
    }
59
    return 0;
60
 }
61
 
62
+struct match {
63
+   const struct spa_dict *props;
64
+   int (*matched) (void *data, const char *location, const char *action,
65
+           const char *val, size_t len);
66
+   void *data;
67
+};
68
+
69
+static int match_rules(void *data, const char *location, const char *section,
70
+       const char *str, size_t len)
71
+{
72
+   struct match *match = data;
73
+   return pw_conf_match_rules(str, len, location,
74
+       match->props, match->matched, match->data);
75
+}
76
+
77
 SPA_EXPORT
78
 int pw_context_conf_section_match_rules(struct pw_context *context, const char *section,
79
        const struct spa_dict *props,
80
pipewire-0.3.64.tar.gz/src/pipewire/conf.h -> pipewire-0.3.65.tar.gz/src/pipewire/conf.h Changed
13
 
1
@@ -38,6 +38,11 @@
2
 int pw_conf_load_state(const char *prefix, const char *name, struct pw_properties *conf);
3
 int pw_conf_save_state(const char *prefix, const char *name, const struct pw_properties *conf);
4
 
5
+int pw_conf_match_rules(const char *str, size_t len, const char *location,
6
+       const struct spa_dict *props,
7
+       int (*callback) (void *data, const char *location, const char *action,
8
+           const char *str, size_t len),
9
+       void *data);
10
 
11
 /**
12
  * \}
13
pipewire-0.3.64.tar.gz/src/pipewire/context.c -> pipewire-0.3.65.tar.gz/src/pipewire/context.c Changed
9
 
1
@@ -38,7 +38,6 @@
2
 #include <spa/node/utils.h>
3
 #include <spa/utils/names.h>
4
 #include <spa/utils/string.h>
5
-#include <spa/debug/format.h>
6
 #include <spa/debug/types.h>
7
 
8
 #include <pipewire/impl.h>
9
pipewire-0.3.64.tar.gz/src/pipewire/filter.c -> pipewire-0.3.65.tar.gz/src/pipewire/filter.c Changed
11
 
1
@@ -36,9 +36,7 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/pod/filter.h>
4
 #include <spa/pod/dynamic.h>
5
-#include <spa/debug/format.h>
6
 #include <spa/debug/types.h>
7
-#include <spa/debug/pod.h>
8
 
9
 #include "pipewire/pipewire.h"
10
 #include "pipewire/filter.h"
11
pipewire-0.3.64.tar.gz/src/pipewire/impl-link.c -> pipewire-0.3.65.tar.gz/src/pipewire/impl-link.c Changed
17
 
1
@@ -31,14 +31,11 @@
2
 #include <spa/pod/parser.h>
3
 #include <spa/pod/compare.h>
4
 #include <spa/param/param.h>
5
+#include <spa/debug/types.h>
6
 
7
 #include "pipewire/impl-link.h"
8
 #include "pipewire/private.h"
9
 
10
-#include <spa/debug/node.h>
11
-#include <spa/debug/pod.h>
12
-#include <spa/debug/format.h>
13
-
14
 PW_LOG_TOPIC_EXTERN(log_link);
15
 #define PW_LOG_TOPIC_DEFAULT log_link
16
 
17
pipewire-0.3.64.tar.gz/src/pipewire/impl-module.h -> pipewire-0.3.65.tar.gz/src/pipewire/impl-module.h Changed
11
 
1
@@ -106,6 +106,9 @@
2
 /** Destroy a module */
3
 void pw_impl_module_destroy(struct pw_impl_module *module);
4
 
5
+/** Schedule a destroy later on the main thread */
6
+void pw_impl_module_schedule_destroy(struct pw_impl_module *module);
7
+
8
 /**
9
  * \}
10
  */
11
pipewire-0.3.64.tar.gz/src/pipewire/impl-node.h -> pipewire-0.3.65.tar.gz/src/pipewire/impl-node.h Changed
12
 
1
@@ -175,6 +175,10 @@
2
 
3
 /** Check if a node is active, Since 0.3.39 */
4
 int pw_impl_node_send_command(struct pw_impl_node *node, const struct spa_command *command);
5
+
6
+/** Set a param on the node, Since 0.3.65 */
7
+int pw_impl_node_set_param(struct pw_impl_node *node,
8
+       uint32_t id, uint32_t flags, const struct spa_pod *param);
9
 /**
10
  * \}
11
  */
12
pipewire-0.3.64.tar.gz/src/pipewire/keys.h -> pipewire-0.3.65.tar.gz/src/pipewire/keys.h Changed
39
 
1
@@ -29,6 +29,7 @@
2
 extern "C" {
3
 #endif
4
 
5
+#include <pipewire/utils.h>
6
 /**
7
  * \defgroup pw_keys Key Names
8
  *
9
@@ -197,6 +198,9 @@
10
                                  *   but it will be triggered explicitly. */
11
 #define PW_KEY_NODE_CHANNELNAMES       "node.channel-names"        /**< names of node's
12
                                    *   channels (unrelated to positions) */
13
+#define PW_KEY_NODE_DEVICE_PORT_NAME_PREFIX            "node.device-port-name-prefix"      /** override
14
+                                   *       port name prefix for device ports, like capture and playback
15
+                                   *       or disable the prefix completely if an empty string is provided */
16
 
17
 /** Port keys */
18
 #define PW_KEY_PORT_ID         "port.id"       /**< port id */
19
@@ -334,14 +338,14 @@
20
 #define PW_KEY_VIDEO_FORMAT        "video.format"      /**< a video format */
21
 #define PW_KEY_VIDEO_SIZE      "video.size"        /**< a video size as "<width>x<height" */
22
 
23
-#ifdef PW_ENABLE_DEPRECATED
24
-#define PW_KEY_PRIORITY_MASTER     "priority.master"   /**< deprecated */
25
-#define PW_KEY_NODE_TARGET     "node.target"       /**< deprecated since 0.3.64, use target.object. */
26
-#endif /* PW_ENABLE_DEPRECATED */
27
-
28
 #define PW_KEY_TARGET_OBJECT       "target.object"     /**< a target object to link to. This can be
29
                                  * and object name or object.serial */
30
 
31
+#ifndef PW_REMOVE_DEPRECATED
32
+#define PW_KEY_PRIORITY_MASTER     PW_DEPRECATED("priority.master")    /**< deprecated, use priority.driver */
33
+#define PW_KEY_NODE_TARGET     PW_DEPRECATED("node.target")        /**< deprecated since 0.3.64, use target.object. */
34
+#endif /* PW_REMOVE_DEPRECATED */
35
+
36
 /** \}
37
  */
38
 
39
pipewire-0.3.64.tar.gz/src/pipewire/log.c -> pipewire-0.3.65.tar.gz/src/pipewire/log.c Changed
197
 
1
@@ -232,187 +232,21 @@
2
  * realtime threads
3
  */
4
 
5
-struct log_ctx {
6
-   enum spa_log_level level;
7
-   const char *file;
8
-   int line;
9
-   const char *func;
10
-};
11
-
12
-#define _log(_c,fmt,...) pw_log_log(_c->level, _c->file, _c->line, _c->func,   \
13
-       "%*s" fmt, indent, "", ## __VA_ARGS__)
14
-
15
-static inline int
16
-log_pod_value(struct log_ctx *ctx, int indent, const struct spa_type_info *info,
17
-       uint32_t type, void *body, uint32_t size)
18
-{
19
-   switch (type) {
20
-   case SPA_TYPE_Bool:
21
-       _log(ctx, "Bool %s", (*(int32_t *) body) ? "true" : "false");
22
-       break;
23
-   case SPA_TYPE_Id:
24
-       _log(ctx, "Id %-8d (%s)", *(int32_t *) body,
25
-              spa_debug_type_find_name(info, *(int32_t *) body));
26
-       break;
27
-   case SPA_TYPE_Int:
28
-       _log(ctx, "Int %d", *(int32_t *) body);
29
-       break;
30
-   case SPA_TYPE_Long:
31
-       _log(ctx, "Long %" PRIi64 "", *(int64_t *) body);
32
-       break;
33
-   case SPA_TYPE_Float:
34
-       _log(ctx, "Float %f", *(float *) body);
35
-       break;
36
-   case SPA_TYPE_Double:
37
-       _log(ctx, "Double %f", *(double *) body);
38
-       break;
39
-   case SPA_TYPE_String:
40
-       _log(ctx, "String \"%s\"", (char *) body);
41
-       break;
42
-   case SPA_TYPE_Fd:
43
-       _log(ctx, "Fd %d", *(int *) body);
44
-       break;
45
-   case SPA_TYPE_Pointer:
46
-   {
47
-       struct spa_pod_pointer_body *b = (struct spa_pod_pointer_body *)body;
48
-       _log(ctx, "Pointer %s %p",
49
-              spa_debug_type_find_name(SPA_TYPE_ROOT, b->type), b->value);
50
-       break;
51
-   }
52
-   case SPA_TYPE_Rectangle:
53
-   {
54
-       struct spa_rectangle *r = (struct spa_rectangle *)body;
55
-       _log(ctx, "Rectangle %dx%d", r->width, r->height);
56
-       break;
57
-   }
58
-   case SPA_TYPE_Fraction:
59
-   {
60
-       struct spa_fraction *f = (struct spa_fraction *)body;
61
-       _log(ctx, "Fraction %d/%d", f->num, f->denom);
62
-       break;
63
-   }
64
-   case SPA_TYPE_Bitmap:
65
-       _log(ctx, "Bitmap");
66
-       break;
67
-   case SPA_TYPE_Array:
68
-   {
69
-       struct spa_pod_array_body *b = (struct spa_pod_array_body *)body;
70
-       void *p;
71
-       const struct spa_type_info *ti = spa_debug_type_find(SPA_TYPE_ROOT, b->child.type);
72
-
73
-       _log(ctx, "Array: child.size %d, child.type %s", b->child.size,
74
-               ti ? ti->name : "unknown");
75
-
76
-       SPA_POD_ARRAY_BODY_FOREACH(b, size, p)
77
-           log_pod_value(ctx, indent + 2, info, b->child.type, p, b->child.size);
78
-       break;
79
-   }
80
-   case SPA_TYPE_Choice:
81
-   {
82
-       struct spa_pod_choice_body *b = (struct spa_pod_choice_body *)body;
83
-       void *p;
84
-       const struct spa_type_info *ti = spa_debug_type_find(spa_type_choice, b->type);
85
-
86
-       _log(ctx, "Choice: type %s, flags %08x %d %d",
87
-              ti ? ti->name : "unknown", b->flags, size, b->child.size);
88
-
89
-       SPA_POD_CHOICE_BODY_FOREACH(b, size, p)
90
-           log_pod_value(ctx, indent + 2, info, b->child.type, p, b->child.size);
91
-       break;
92
-   }
93
-   case SPA_TYPE_Struct:
94
-   {
95
-       struct spa_pod *b = (struct spa_pod *)body, *p;
96
-       _log(ctx, "Struct: size %d", size);
97
-       SPA_POD_FOREACH(b, size, p)
98
-           log_pod_value(ctx, indent + 2, info, p->type, SPA_POD_BODY(p), p->size);
99
-       break;
100
-   }
101
-   case SPA_TYPE_Object:
102
-   {
103
-       struct spa_pod_object_body *b = (struct spa_pod_object_body *)body;
104
-       struct spa_pod_prop *p;
105
-       const struct spa_type_info *ti, *ii;
106
-
107
-       ti = spa_debug_type_find(info, b->type);
108
-       ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
109
-       ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
110
-
111
-       _log(ctx, "Object: size %d, type %s (%d), id %s (%d)", size,
112
-              ti ? ti->name : "unknown", b->type, ii ? ii->name : "unknown", b->id);
113
-
114
-       info = ti ? ti->values : info;
115
-
116
-       indent += 2;
117
-       SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
118
-           ii = spa_debug_type_find(info, p->key);
119
-
120
-           _log(ctx, "Prop: key %s (%d), flags %08x",
121
-                   ii ? ii->name : "unknown", p->key, p->flags);
122
-
123
-           log_pod_value(ctx, indent + 2, ii ? ii->values : NULL,
124
-                   p->value.type,
125
-                   SPA_POD_CONTENTS(struct spa_pod_prop, p),
126
-                   p->value.size);
127
-       }
128
-       indent -= 2;
129
-       break;
130
-   }
131
-   case SPA_TYPE_Sequence:
132
-   {
133
-       struct spa_pod_sequence_body *b = (struct spa_pod_sequence_body *)body;
134
-       const struct spa_type_info *ti, *ii;
135
-       struct spa_pod_control *c;
136
-
137
-       ti = spa_debug_type_find(info, b->unit);
138
-
139
-       _log(ctx, "%*s" "Sequence: size %d, unit %s", indent, "", size,
140
-              ti ? ti->name : "unknown");
141
-
142
-       indent +=2;
143
-       SPA_POD_SEQUENCE_BODY_FOREACH(b, size, c) {
144
-           ii = spa_debug_type_find(spa_type_control, c->type);
145
-
146
-           _log(ctx, "Control: offset %d, type %s",
147
-                   c->offset, ii ? ii->name : "unknown");
148
-
149
-           log_pod_value(ctx, indent + 2, ii ? ii->values : NULL,
150
-                   c->value.type,
151
-                   SPA_POD_CONTENTS(struct spa_pod_control, c),
152
-                   c->value.size);
153
-       }
154
-       indent -=2;
155
-       break;
156
-   }
157
-   case SPA_TYPE_Bytes:
158
-       _log(ctx, "Bytes");
159
-       break;
160
-   case SPA_TYPE_None:
161
-       _log(ctx, "None");
162
-       break;
163
-   default:
164
-       _log(ctx, "unhandled POD type %d", type);
165
-       break;
166
-   }
167
-   return 0;
168
-}
169
+#include <spa/debug/pod.h>
170
+#include <spa/debug/log.h>
171
 
172
 void pw_log_log_object(enum spa_log_level level,
173
-      const char *file,
174
-      int line,
175
-      const char *func,
176
-      uint32_t flags, const void *object)
177
+   const struct spa_log_topic *topic, const char *file,
178
+   int line, const char *func, uint32_t flags, const void *object)
179
 {
180
-   struct log_ctx ctx = { level, file, 0, func, };
181
+   struct spa_debug_log_ctx ctx = SPA_LOGF_DEBUG_INIT(global_log, level,
182
+           topic, file, line, func );
183
    if (flags & PW_LOG_OBJECT_POD) {
184
        const struct spa_pod *pod = object;
185
        if (pod == NULL) {
186
-           pw_log_log(level, file, line, func, "NULL");
187
+           pw_log_logt(level, topic, file, line, func, "NULL");
188
        } else {
189
-           log_pod_value(&ctx, 0, SPA_TYPE_ROOT,
190
-               SPA_POD_TYPE(pod),
191
-               SPA_POD_BODY(pod),
192
-               SPA_POD_BODY_SIZE(pod));
193
+           spa_debugc_pod(&ctx.ctx, 0, SPA_TYPE_ROOT, pod);
194
        }
195
    }
196
 }
197
pipewire-0.3.64.tar.gz/src/pipewire/pipewire.h -> pipewire-0.3.65.tar.gz/src/pipewire/pipewire.h Changed
9
 
1
@@ -33,6 +33,7 @@
2
 
3
 #include <pipewire/array.h>
4
 #include <pipewire/client.h>
5
+#include <pipewire/conf.h>
6
 #include <pipewire/context.h>
7
 #include <pipewire/device.h>
8
 #include <pipewire/buffers.h>
9
pipewire-0.3.64.tar.gz/src/pipewire/private.h -> pipewire-0.3.65.tar.gz/src/pipewire/private.h Changed
58
 
1
@@ -45,10 +45,6 @@
2
 };
3
 #endif
4
 
5
-#ifndef spa_debug
6
-#define spa_debug(...) pw_log_trace(__VA_ARGS__)
7
-#endif
8
-
9
 #define MAX_RATES              32u
10
 #define CLOCK_MIN_QUANTUM          4u
11
 #define CLOCK_MAX_QUANTUM          65536u
12
@@ -1249,8 +1245,6 @@
13
 /** Change the state of the node */
14
 int pw_impl_node_set_state(struct pw_impl_node *node, enum pw_node_state state);
15
 
16
-int pw_impl_node_set_param(struct pw_impl_node *node,
17
-       uint32_t id, uint32_t flags, const struct spa_pod *param);
18
 
19
 int pw_impl_node_update_ports(struct pw_impl_node *node);
20
 
21
@@ -1282,17 +1276,19 @@
22
 void pw_impl_client_unref(struct pw_impl_client *client);
23
 
24
 #define PW_LOG_OBJECT_POD  (1<<0)
25
-void pw_log_log_object(enum spa_log_level level, const char *file, int line,
26
-      const char *func, uint32_t flags, const void *object);
27
+void pw_log_log_object(enum spa_log_level level, const struct spa_log_topic *topic,
28
+       const char *file, int line, const char *func, uint32_t flags,
29
+       const void *object);
30
 
31
-#define pw_log_object(lev,fl,obj)                      \
32
-({                                     \
33
-   if (SPA_UNLIKELY(pw_log_level_enabled (lev)))               \
34
-       pw_log_log_object(lev,__FILE__,__LINE__,__func__,(fl),(obj));   \
35
+#define pw_log_object(lev,t,fl,obj)                \
36
+({                             \
37
+   if (SPA_UNLIKELY(pw_log_topic_enabled(lev,t)))      \
38
+       pw_log_log_object(lev,t,__FILE__,__LINE__,  \
39
+               __func__,(fl),(obj));       \
40
 })
41
 
42
-#define pw_log_pod(lev,pod) pw_log_object(lev,PW_LOG_OBJECT_POD,pod)
43
-#define pw_log_format(lev,pod) pw_log_object(lev,PW_LOG_OBJECT_POD,pod)
44
+#define pw_log_pod(lev,pod) pw_log_object(lev,PW_LOG_TOPIC_DEFAULT,PW_LOG_OBJECT_POD,pod)
45
+#define pw_log_format(lev,pod) pw_log_object(lev,PW_LOG_TOPIC_DEFAULT,PW_LOG_OBJECT_POD,pod)
46
 
47
 bool pw_log_is_default(void);
48
 
49
@@ -1303,8 +1299,6 @@
50
 int pw_settings_expose(struct pw_context *context);
51
 void pw_settings_clean(struct pw_context *context);
52
 
53
-void pw_impl_module_schedule_destroy(struct pw_impl_module *module);
54
-
55
 pthread_attr_t *pw_thread_fill_attr(const struct spa_dict *props, pthread_attr_t *attr);
56
 
57
 /** \endcond */
58
pipewire-0.3.64.tar.gz/src/pipewire/stream.c -> pipewire-0.3.65.tar.gz/src/pipewire/stream.c Changed
76
 
1
@@ -30,14 +30,13 @@
2
 
3
 #include <spa/buffer/alloc.h>
4
 #include <spa/param/props.h>
5
+#include <spa/param/format-utils.h>
6
 #include <spa/node/io.h>
7
 #include <spa/node/utils.h>
8
 #include <spa/utils/ringbuffer.h>
9
 #include <spa/pod/filter.h>
10
 #include <spa/pod/dynamic.h>
11
-#include <spa/debug/format.h>
12
 #include <spa/debug/types.h>
13
-#include <spa/debug/pod.h>
14
 
15
 #define PW_ENABLE_DEPRECATED
16
 
17
@@ -637,8 +636,10 @@
18
        if (stream->state == PW_STREAM_STATE_PAUSED) {
19
            pw_log_debug("%p: start %d", stream, impl->direction);
20
 
21
-           if (impl->direction == SPA_DIRECTION_INPUT)
22
-               impl->io->status = SPA_STATUS_NEED_DATA;
23
+           if (impl->direction == SPA_DIRECTION_INPUT) {
24
+               if (impl->io != NULL)
25
+                   impl->io->status = SPA_STATUS_NEED_DATA;
26
+           }
27
            else if (!impl->process_rt && !impl->driving) {
28
                copy_position(impl, impl->queued.incount);
29
                call_process(impl);
30
@@ -998,6 +999,9 @@
31
    struct spa_io_buffers *io = impl->io;
32
    struct buffer *b;
33
 
34
+   if (io == NULL)
35
+       return -EIO;
36
+
37
    pw_log_trace_fp("%p: process in status:%d id:%d ticks:%"PRIu64" delay:%"PRIi64,
38
            stream, io->status, io->buffer_id, impl->time.ticks, impl->time.delay);
39
 
40
@@ -1038,6 +1042,9 @@
41
    int res;
42
    bool ask_more;
43
 
44
+   if (io == NULL)
45
+       return -EIO;
46
+
47
 again:
48
    pw_log_trace_fp("%p: process out status:%d id:%d", stream,
49
            io->status, io->buffer_id);
50
@@ -1397,7 +1404,8 @@
51
        return;
52
    if (impl->draining && impl->drained) {
53
        impl->draining = false;
54
-       impl->io->status = SPA_STATUS_NEED_DATA;
55
+       if (impl->io != NULL)
56
+           impl->io->status = SPA_STATUS_NEED_DATA;
57
        call_drained(impl);
58
    }
59
 }
60
@@ -1891,11 +1899,12 @@
61
    impl->disconnecting = false;
62
    stream_set_state(stream, PW_STREAM_STATE_CONNECTING, NULL);
63
 
64
-   if (target_id != PW_ID_ANY)
65
+   if ((str = getenv("PIPEWIRE_NODE")) != NULL)
66
+       pw_properties_set(stream->properties, PW_KEY_TARGET_OBJECT, str);
67
+   else if (target_id != PW_ID_ANY)
68
        /* XXX this is deprecated but still used by the portal and its apps */
69
        pw_properties_setf(stream->properties, PW_KEY_NODE_TARGET, "%d", target_id);
70
-   else if ((str = getenv("PIPEWIRE_NODE")) != NULL)
71
-       pw_properties_set(stream->properties, PW_KEY_TARGET_OBJECT, str);
72
+
73
    if ((flags & PW_STREAM_FLAG_AUTOCONNECT) &&
74
        pw_properties_get(stream->properties, PW_KEY_NODE_AUTOCONNECT) == NULL) {
75
        str = getenv("PIPEWIRE_AUTOCONNECT");
76
pipewire-0.3.64.tar.gz/src/pipewire/utils.h -> pipewire-0.3.65.tar.gz/src/pipewire/utils.h Changed
14
 
1
@@ -94,6 +94,12 @@
2
 
3
 void* pw_reallocarray(void *ptr, size_t nmemb, size_t size);
4
 
5
+#ifdef PW_ENABLE_DEPRECATED
6
+#define PW_DEPRECATED(v)        (v)
7
+#else
8
+#define PW_DEPRECATED(v)   ({ __typeof__(v) _v SPA_DEPRECATED = (v); (void)_v; (v); })
9
+#endif /* PW_ENABLE_DEPRECATED */
10
+
11
 /**
12
  * \}
13
  */
14
pipewire-0.3.64.tar.gz/src/tools/meson.build -> pipewire-0.3.65.tar.gz/src/tools/meson.build Changed
39
 
1
@@ -32,9 +32,18 @@
2
 endif
3
 
4
 build_pw_cat = false
5
+build_pw_cat_with_ffmpeg = false
6
+pwcat_deps =  sndfile_dep 
7
+
8
 if get_option('pw-cat').allowed() and sndfile_dep.found()
9
   build_pw_cat = true
10
 
11
+  if pw_cat_ffmpeg.allowed() and avcodec_dep.found() and avformat_dep.found()
12
+    pwcat_deps += avcodec_dep
13
+    pwcat_deps += avformat_dep
14
+    build_pw_cat_with_ffmpeg = true
15
+  endif
16
+
17
   pwcat_sources = 
18
     'pw-cat.c',
19
     'midifile.c',
20
@@ -52,7 +61,7 @@
21
   executable('pw-cat',
22
     pwcat_sources,
23
     install: true,
24
-    dependencies : sndfile_dep, pipewire_dep, mathlib,
25
+    dependencies : pwcat_deps, pipewire_dep, mathlib,
26
   )
27
 
28
   foreach alias : pwcat_aliases
29
@@ -64,6 +73,9 @@
30
   error('pw-cat is enabled but required dependency `sndfile` was not found.')
31
 endif
32
 summary({'Build pw-cat tool': build_pw_cat}, bool_yn: true, section: 'pw-cat/pw-play/pw-dump tool')
33
+if build_pw_cat
34
+  summary({'Build pw-cat with FFmpeg integration': build_pw_cat_with_ffmpeg}, bool_yn: true, section: 'pw-cat/pw-play/pw-dump tool')
35
+endif
36
 
37
 if dbus_dep.found()
38
   executable('pw-reserve',
39
pipewire-0.3.64.tar.gz/src/tools/pw-cat.c -> pipewire-0.3.65.tar.gz/src/tools/pw-cat.c Changed
201
 
1
@@ -46,12 +46,18 @@
2
 #include <spa/utils/string.h>
3
 #include <spa/utils/json.h>
4
 #include <spa/debug/types.h>
5
-#include <spa/debug/pod.h>
6
 
7
 #include <pipewire/pipewire.h>
8
 #include <pipewire/i18n.h>
9
 #include <pipewire/extensions/metadata.h>
10
 
11
+#include "config.h"
12
+
13
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
14
+#include <libavformat/avformat.h>
15
+#include <libavcodec/avcodec.h>
16
+#endif
17
+
18
 #include "midifile.h"
19
 #include "dsffile.h"
20
 
21
@@ -109,6 +115,9 @@
22
 #define TYPE_PCM   0
23
 #define TYPE_MIDI  1
24
 #define TYPE_DSD   2
25
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
26
+#define TYPE_ENCODED    3
27
+#endif
28
    int data_type;
29
    const char *remote_name;
30
    const char *media_type;
31
@@ -123,6 +132,7 @@
32
    const char *filename;
33
    SNDFILE *file;
34
 
35
+   unsigned int bitrate;
36
    unsigned int rate;
37
    int channels;
38
    struct channelmap channelmap;
39
@@ -151,6 +161,14 @@
40
        struct dsf_file_info info;
41
        struct dsf_layout layout;
42
    } dsf;
43
+
44
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
45
+   FILE *encoded_file;
46
+   AVFormatContext *fmt_context;
47
+   AVStream *astream;
48
+   AVCodecContext *ctx;
49
+   enum AVSampleFormat sfmt;
50
+#endif
51
 };
52
 
53
 #define STR_FMTS "(ulaw|alaw|u8|s8|s16|s32|f32|f64)"
54
@@ -233,6 +251,117 @@
55
    return (int)rn;
56
 }
57
 
58
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
59
+static int encoded_playback_fill(struct data *d, void *dest, unsigned int n_frames)
60
+{
61
+   int ret, size = 0;
62
+   uint8_t buffer16384 = { 0 };
63
+
64
+   ret = fread(buffer, 1, 16384, d->encoded_file);
65
+   if (ret > 0) {
66
+       memcpy(dest, buffer, ret);
67
+       size = ret;
68
+   }
69
+
70
+   return (int)size;
71
+}
72
+
73
+static int avcodec_ctx_to_info(struct data *data, AVCodecContext *ctx, struct spa_audio_info *info)
74
+{
75
+   int32_t profile;
76
+
77
+   switch (ctx->codec_id) {
78
+   case AV_CODEC_ID_VORBIS:
79
+       info->media_subtype = SPA_MEDIA_SUBTYPE_vorbis;
80
+       info->info.vorbis.rate = data->rate;
81
+       info->info.vorbis.channels = data->channels;
82
+       break;
83
+   case AV_CODEC_ID_MP3:
84
+       info->media_subtype = SPA_MEDIA_SUBTYPE_mp3;
85
+       info->info.mp3.rate = data->rate;
86
+       info->info.mp3.channels = data->channels;
87
+       break;
88
+   case AV_CODEC_ID_AAC:
89
+       info->media_subtype = SPA_MEDIA_SUBTYPE_aac;
90
+       info->info.aac.rate = data->rate;
91
+       info->info.aac.channels = data->channels;
92
+       info->info.aac.bitrate = data->bitrate;
93
+       info->info.aac.stream_format = SPA_AUDIO_AAC_STREAM_FORMAT_RAW;
94
+       break;
95
+   case AV_CODEC_ID_WMAV1:
96
+   case AV_CODEC_ID_WMAV2:
97
+   case AV_CODEC_ID_WMAPRO:
98
+   case AV_CODEC_ID_WMAVOICE:
99
+   case AV_CODEC_ID_WMALOSSLESS:
100
+       info->media_subtype = SPA_MEDIA_SUBTYPE_wma;
101
+       switch (ctx->codec_tag) {
102
+       /* TODO see if these hex constants can be replaced by named constants from FFmpeg */
103
+       case 0x161:
104
+           profile = SPA_AUDIO_WMA_PROFILE_WMA9;
105
+           break;
106
+       case 0x162:
107
+           profile = SPA_AUDIO_WMA_PROFILE_WMA9_PRO;
108
+           break;
109
+       case 0x163:
110
+           profile = SPA_AUDIO_WMA_PROFILE_WMA9_LOSSLESS;
111
+           break;
112
+       case 0x166:
113
+           profile = SPA_AUDIO_WMA_PROFILE_WMA10;
114
+           break;
115
+       case 0x167:
116
+           profile = SPA_AUDIO_WMA_PROFILE_WMA10_LOSSLESS;
117
+           break;
118
+       default:
119
+           fprintf(stderr, "error: invalid WMA profile\n");
120
+           return -EINVAL;
121
+       }
122
+       info->info.wma.rate = data->rate;
123
+       info->info.wma.channels = data->channels;
124
+       info->info.wma.bitrate = data->bitrate;
125
+       info->info.wma.block_align = ctx->block_align;
126
+       info->info.wma.profile = profile;
127
+       break;
128
+   case AV_CODEC_ID_FLAC:
129
+       info->media_subtype = SPA_MEDIA_SUBTYPE_flac;
130
+       info->info.flac.rate = data->rate;
131
+       info->info.flac.channels = data->channels;
132
+       break;
133
+   case AV_CODEC_ID_ALAC:
134
+       info->media_subtype = SPA_MEDIA_SUBTYPE_alac;
135
+       info->info.alac.rate = data->rate;
136
+       info->info.alac.channels = data->channels;
137
+       break;
138
+   case AV_CODEC_ID_APE:
139
+       info->media_subtype = SPA_MEDIA_SUBTYPE_ape;
140
+       info->info.ape.rate = data->rate;
141
+       info->info.ape.channels = data->channels;
142
+       break;
143
+   case AV_CODEC_ID_RA_144:
144
+   case AV_CODEC_ID_RA_288:
145
+       info->media_subtype = SPA_MEDIA_SUBTYPE_ra;
146
+       info->info.ra.rate = data->rate;
147
+       info->info.ra.channels = data->channels;
148
+       break;
149
+   case AV_CODEC_ID_AMR_NB:
150
+       info->media_subtype = SPA_MEDIA_SUBTYPE_amr;
151
+       info->info.amr.rate = data->rate;
152
+       info->info.amr.channels = data->channels;
153
+       info->info.amr.band_mode = SPA_AUDIO_AMR_BAND_MODE_NB;
154
+       break;
155
+   case AV_CODEC_ID_AMR_WB:
156
+       info->media_subtype = SPA_MEDIA_SUBTYPE_amr;
157
+       info->info.amr.rate = data->rate;
158
+       info->info.amr.channels = data->channels;
159
+       info->info.amr.band_mode = SPA_AUDIO_AMR_BAND_MODE_WB;
160
+       break;
161
+   default:
162
+       fprintf(stderr, "Unsupported encoded media subtype\n");
163
+       return -EINVAL;
164
+   }
165
+   return 0;
166
+}
167
+#endif
168
+
169
 static inline fill_fn
170
 playback_fill_fn(uint32_t fmt)
171
 {
172
@@ -265,6 +394,10 @@
173
        if (sizeof(double) != 8)
174
            return NULL;
175
        return sf_playback_fill_f64;
176
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
177
+   case SPA_AUDIO_FORMAT_ENCODED:
178
+       return encoded_playback_fill;
179
+#endif
180
    default:
181
        break;
182
    }
183
@@ -650,10 +783,34 @@
184
        return;
185
 
186
    if (data->mode == mode_playback) {
187
-
188
        n_frames = d->maxsize / data->stride;
189
        n_frames = SPA_MIN(n_frames, (int)b->requested);
190
 
191
+#ifdef HAVE_PW_CAT_FFMPEG_INTEGRATION
192
+       n_fill_frames = data->fill(data, p, n_frames);
193
+
194
+       if (n_fill_frames > 0 || n_frames == 0) {
195
+           d->chunk->offset = 0;
196
+           if (data->data_type == TYPE_ENCODED) {
197
+               d->chunk->stride = 0;
198
+               // encoded_playback_fill returns number of bytes
199
+               // read and not number of frames like other
200
+               // functions for raw audio.
201
pipewire-0.3.64.tar.gz/src/tools/pw-cli.c -> pipewire-0.3.65.tar.gz/src/tools/pw-cli.c Changed
145
 
1
@@ -271,7 +271,8 @@
2
    }
3
 
4
    id = pw_map_insert_new(&data->vars, module);
5
-   printf("%d = @module:%d\n", id, pw_global_get_id(pw_impl_module_get_global(module)));
6
+   if (data->interactive)
7
+       printf("%d = @module:%d\n", id, pw_global_get_id(pw_impl_module_get_global(module)));
8
 
9
    return true;
10
 }
11
@@ -796,7 +797,7 @@
12
 {
13
    struct proxy_data *pd = data;
14
    struct remote_data *rd = pd->rd;
15
-   if (pd->info)
16
+   if (pd->info && rd->data->monitoring)
17
        printf("remote %d core %d changed\n", rd->id, info->id);
18
    pd->info = pw_core_info_update(pd->info, info);
19
    if (pd->global == NULL)
20
@@ -817,7 +818,7 @@
21
 {
22
    struct proxy_data *pd = data;
23
    struct remote_data *rd = pd->rd;
24
-   if (pd->info)
25
+   if (pd->info && rd->data->monitoring)
26
        printf("remote %d module %d changed\n", rd->id, info->id);
27
    pd->info = pw_module_info_update(pd->info, info);
28
    if (pd->global == NULL)
29
@@ -837,7 +838,7 @@
30
 {
31
    struct proxy_data *pd = data;
32
    struct remote_data *rd = pd->rd;
33
-   if (pd->info)
34
+   if (pd->info && rd->data->monitoring)
35
        printf("remote %d node %d changed\n", rd->id, info->id);
36
    pd->info = pw_node_info_update(pd->info, info);
37
    if (pd->global == NULL)
38
@@ -872,7 +873,7 @@
39
 {
40
    struct proxy_data *pd = data;
41
    struct remote_data *rd = pd->rd;
42
-   if (pd->info)
43
+   if (pd->info && rd->data->monitoring)
44
        printf("remote %d port %d changed\n", rd->id, info->id);
45
    pd->info = pw_port_info_update(pd->info, info);
46
    if (pd->global == NULL)
47
@@ -893,7 +894,7 @@
48
 {
49
    struct proxy_data *pd = data;
50
    struct remote_data *rd = pd->rd;
51
-   if (pd->info)
52
+   if (pd->info && rd->data->monitoring)
53
        printf("remote %d factory %d changed\n", rd->id, info->id);
54
    pd->info = pw_factory_info_update(pd->info, info);
55
    if (pd->global == NULL)
56
@@ -913,7 +914,7 @@
57
 {
58
    struct proxy_data *pd = data;
59
    struct remote_data *rd = pd->rd;
60
-   if (pd->info)
61
+   if (pd->info && rd->data->monitoring)
62
        printf("remote %d client %d changed\n", rd->id, info->id);
63
    pd->info = pw_client_info_update(pd->info, info);
64
    if (pd->global == NULL)
65
@@ -954,7 +955,7 @@
66
 {
67
    struct proxy_data *pd = data;
68
    struct remote_data *rd = pd->rd;
69
-   if (pd->info)
70
+   if (pd->info && rd->data->monitoring)
71
        printf("remote %d link %d changed\n", rd->id, info->id);
72
    pd->info = pw_link_info_update(pd->info, info);
73
    if (pd->global == NULL)
74
@@ -975,7 +976,7 @@
75
 {
76
    struct proxy_data *pd = data;
77
    struct remote_data *rd = pd->rd;
78
-   if (pd->info)
79
+   if (pd->info && rd->data->monitoring)
80
        printf("remote %d device %d changed\n", rd->id, info->id);
81
    pd->info = pw_device_info_update(pd->info, info);
82
    if (pd->global == NULL)
83
@@ -1422,7 +1423,8 @@
84
    pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
85
 
86
    id = pw_map_insert_new(&data->vars, proxy);
87
-   printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
88
+   if (rd->data->interactive)
89
+       printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
90
 
91
    return true;
92
 }
93
@@ -1461,7 +1463,8 @@
94
         pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
95
 
96
    id = pw_map_insert_new(&data->vars, proxy);
97
-   printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
98
+   if (rd->data->interactive)
99
+       printf("%d = @proxy:%d\n", id, pw_proxy_get_id(proxy));
100
 
101
    return true;
102
 }
103
@@ -1541,7 +1544,8 @@
104
    pw_proxy_add_listener(proxy, &pd->proxy_listener, &proxy_events, pd);
105
 
106
    id = pw_map_insert_new(&data->vars, proxy);
107
-   printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
108
+   if (rd->data->interactive)
109
+       printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
110
 }
111
 
112
 static bool do_create_link(struct data *data, const char *cmd, char *args, char **error)
113
@@ -1657,7 +1661,8 @@
114
    proxy = pw_core_export(rd->core, PW_TYPE_INTERFACE_Node, NULL, node, 0);
115
 
116
    id = pw_map_insert_new(&data->vars, proxy);
117
-   printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
118
+   if (rd->data->interactive)
119
+       printf("%d = @proxy:%d\n", id, pw_proxy_get_id((struct pw_proxy*)proxy));
120
 
121
    return true;
122
 
123
@@ -1810,8 +1815,9 @@
124
    }
125
 
126
    p = strtol(a2, NULL, 0);
127
-   printf("setting permissions: "PW_PERMISSION_FORMAT"\n",
128
-           PW_PERMISSION_ARGS(p));
129
+   if (rd->data->interactive)
130
+       printf("setting permissions: "PW_PERMISSION_FORMAT"\n",
131
+               PW_PERMISSION_ARGS(p));
132
 
133
    permissions0 = PW_PERMISSION_INIT(atoi(a1), p);
134
    pw_client_update_permissions((struct pw_client*)global->proxy,
135
@@ -2231,7 +2237,8 @@
136
        "  -h, --help                            Show this help\n"
137
        "      --version                         Show version\n"
138
        "  -d, --daemon                          Start as daemon (Default false)\n"
139
-       "  -r, --remote                          Remote daemon name\n\n"),
140
+       "  -r, --remote                          Remote daemon name\n"
141
+       "  -m, --monitor                         Monitor activity\n\n"),
142
        name);
143
 
144
    do_help(data, "help", "", NULL);
145
pipewire-0.3.64.tar.gz/src/tools/pw-dot.c -> pipewire-0.3.65.tar.gz/src/tools/pw-dot.c Changed
10
 
1
@@ -35,8 +35,6 @@
2
 #include <spa/utils/result.h>
3
 #include <spa/utils/string.h>
4
 #include <spa/utils/json.h>
5
-#include <spa/debug/pod.h>
6
-#include <spa/debug/format.h>
7
 #include <spa/debug/types.h>
8
 
9
 #include <pipewire/pipewire.h>
10
pipewire-0.3.64.tar.gz/src/tools/pw-profiler.c -> pipewire-0.3.65.tar.gz/src/tools/pw-profiler.c Changed
10
 
1
@@ -30,7 +30,7 @@
2
 #include <spa/utils/result.h>
3
 #include <spa/utils/string.h>
4
 #include <spa/pod/parser.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 
8
 #include <pipewire/impl.h>
9
 #include <pipewire/extensions/profiler.h>
10
pipewire-0.3.64.tar.gz/src/tools/pw-top.c -> pipewire-0.3.65.tar.gz/src/tools/pw-top.c Changed
10
 
1
@@ -31,7 +31,7 @@
2
 #include <spa/utils/result.h>
3
 #include <spa/utils/string.h>
4
 #include <spa/pod/parser.h>
5
-#include <spa/debug/pod.h>
6
+#include <spa/debug/types.h>
7
 #include <spa/param/format-utils.h>
8
 #include <spa/param/audio/format-utils.h>
9
 #include <spa/param/video/format-utils.h>
10