PipeWire  0.3.45
dsd.h
Go to the documentation of this file.
1 /* Simple Plugin API
2  *
3  * Copyright © 2021 Wim Taymans
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef SPA_AUDIO_DSD_H
26 #define SPA_AUDIO_DSD_H
27 
28 #include <stdint.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <spa/param/param.h>
35 #include <spa/param/audio/raw.h>
36 
43 #define SPA_AUDIO_DSD_FLAG_NONE (0) /*< no valid flag */
44 
45 /* DSD bits are transferred in a buffer grouped in bytes with the bitorder
46  * defined by \a bitorder.
47  *
48  * Channels are placed in separate planes (interleave = 0) or interleaved
49  * using the interleave value. A negative interleave value means that the
50  * bytes need to be reversed in the group.
51  *
52  * Planar (interleave = 0):
53  * plane1: l1 l2 l3 l4 l5 ...
54  * plane2: r1 r2 r3 r4 r5 ...
55  *
56  * Interleaved 4:
57  * plane1: l1 l2 l3 l4 r1 r2 r3 r4 l5 l6 l7 l8 r5 r6 r7 r8 l9 ...
58  *
59  * Interleaved 2:
60  * plane1: l1 l2 r1 r2 l3 l4 r3 r4 ...
61  */
62 struct spa_audio_info_dsd {
63  enum spa_param_bitorder bitorder; /*< the order of the bits */
64  uint32_t flags; /*< extra flags */
65  int32_t interleave; /*< interleave bytes */
66  uint32_t rate; /*< sample rate (in bytes per second) */
67  uint32_t channels; /*< channels */
68  uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
69 };
70 
71 #define SPA_AUDIO_INFO_DSD_INIT(...) (struct spa_audio_info_dsd) { __VA_ARGS__ }
72 
77 #ifdef __cplusplus
78 } /* extern "C" */
79 #endif
80 
81 #endif /* SPA_AUDIO_DSD_H */
spa/param/audio/raw.h
spa_param_bitorder
Definition: param.h:208
#define SPA_AUDIO_MAX_CHANNELS
Definition: raw.h:49
spa/param/param.h
Definition: dsd.h:68
uint32_t position[SPA_AUDIO_MAX_CHANNELS]
Definition: dsd.h:74
uint32_t channels
Definition: dsd.h:73
enum spa_param_bitorder bitorder
Definition: dsd.h:69
uint32_t rate
Definition: dsd.h:72
int32_t interleave
Definition: dsd.h:71
uint32_t flags
Definition: dsd.h:70