mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-23 08:56:47 -05:00
parent
4dcd0dacc9
commit
72d70b0f48
9 changed files with 34 additions and 18 deletions
|
|
@ -176,8 +176,8 @@ struct spa_fraction {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#define SPA_STRINGIFY_1(x...) #x
|
||||
#define SPA_STRINGIFY(x...) SPA_STRINGIFY_1(x)
|
||||
#define SPA_STRINGIFY_1(...) #__VA_ARGS__
|
||||
#define SPA_STRINGIFY(...) SPA_STRINGIFY_1(__VA_ARGS__)
|
||||
|
||||
#define spa_return_if_fail(expr) \
|
||||
do { \
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ struct spa_callbacks {
|
|||
void *data;
|
||||
};
|
||||
|
||||
/** Check if a callback \c has method \m of version \v */
|
||||
#define SPA_CALLBACK_CHECK(c,m,v) ((c) && ((v) == 0 || (c)->version > (v)-1) && (c)->m)
|
||||
|
||||
#define SPA_CALLBACKS_INIT(_funcs,_data) (struct spa_callbacks){ _funcs, _data, }
|
||||
|
||||
struct spa_interface {
|
||||
|
|
@ -133,14 +136,14 @@ spa_hook_list_join(struct spa_hook_list *list,
|
|||
#define spa_callbacks_call(callbacks,type,method,vers,...) \
|
||||
({ \
|
||||
const type *_f = (const type *) (callbacks)->funcs; \
|
||||
if (SPA_LIKELY(_f && _f->version >= (vers) && _f->method)) \
|
||||
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
|
||||
_f->method((callbacks)->data, ## __VA_ARGS__); \
|
||||
})
|
||||
|
||||
#define spa_callbacks_call_res(callbacks,type,res,method,vers,...) \
|
||||
({ \
|
||||
const type *_f = (const type *) (callbacks)->funcs; \
|
||||
if (SPA_LIKELY(_f && _f->version >= (vers) && _f->method)) \
|
||||
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) \
|
||||
res = _f->method((callbacks)->data, ## __VA_ARGS__); \
|
||||
res; \
|
||||
})
|
||||
|
|
@ -171,7 +174,7 @@ spa_hook_list_join(struct spa_hook_list *list,
|
|||
spa_list_cursor_start(cursor, s, link); \
|
||||
spa_list_for_each_cursor(ci, cursor, &list->list, link) { \
|
||||
const type *_f = (const type *)ci->cb.funcs; \
|
||||
if (SPA_LIKELY(_f && _f->version >= (vers) && _f->method)) { \
|
||||
if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers))) { \
|
||||
_f->method(ci->cb.data, ## __VA_ARGS__); \
|
||||
count++; \
|
||||
if (once) \
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ static void sanitize_map(snd_pcm_chmap_t* map)
|
|||
uint32_t i, j, pos;
|
||||
|
||||
for (i = 0; i < map->channels; i++) {
|
||||
if (map->pos[i] < 0 || map->pos[i] > SND_CHMAP_LAST)
|
||||
if (map->pos[i] > SND_CHMAP_LAST)
|
||||
map->pos[i] = SND_CHMAP_UNKNOWN;
|
||||
|
||||
p = 1LL << map->pos[i];
|
||||
|
|
|
|||
|
|
@ -1045,12 +1045,15 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
{
|
||||
a2dp_sbc_t *config = this->transport->configuration;
|
||||
struct spa_audio_info_raw info = { 0, };
|
||||
int res;
|
||||
|
||||
info.format = SPA_AUDIO_FORMAT_S16;
|
||||
if ((info.rate = a2dp_sbc_get_frequency(config)) < 0)
|
||||
if ((res = a2dp_sbc_get_frequency(config)) < 0)
|
||||
return -EIO;
|
||||
if ((info.channels = a2dp_sbc_get_channels(config)) < 0)
|
||||
info.rate = res;
|
||||
if ((res = a2dp_sbc_get_channels(config)) < 0)
|
||||
return -EIO;
|
||||
info.channels = res;
|
||||
|
||||
switch (info.channels) {
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -702,12 +702,15 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
{
|
||||
a2dp_sbc_t *config = this->transport->configuration;
|
||||
struct spa_audio_info_raw info = { 0, };
|
||||
int res;
|
||||
|
||||
info.format = SPA_AUDIO_FORMAT_S16;
|
||||
if ((info.rate = a2dp_sbc_get_frequency(config)) < 0)
|
||||
if ((res = a2dp_sbc_get_frequency(config)) < 0)
|
||||
return -EIO;
|
||||
if ((info.channels = a2dp_sbc_get_channels(config)) < 0)
|
||||
info.rate = res;
|
||||
if ((res = a2dp_sbc_get_channels(config)) < 0)
|
||||
return -EIO;
|
||||
info.channels = res;
|
||||
|
||||
switch (info.channels) {
|
||||
case 1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue