module-protocol-pulse: Factor out some common code

Factor out some of the common code that will be required for zeroconf
support next.
This commit is contained in:
Sanchayan Maity 2021-06-11 18:15:51 +05:30 committed by Wim Taymans
parent bd6f63fecd
commit e66125ede0
4 changed files with 137 additions and 68 deletions

View file

@ -22,6 +22,8 @@
* DEALINGS IN THE SOFTWARE.
*/
#include "volume.h"
static inline bool volume_valid(const struct volume *vol)
{
if (vol->channels == 0 || vol->channels > CHANNELS_MAX)
@ -53,27 +55,6 @@ static inline int volume_compare(struct volume *vol, struct volume *other)
return 0;
}
struct volume_info {
struct volume volume;
struct channel_map map;
bool mute;
float level;
float base;
uint32_t steps;
#define VOLUME_HW_VOLUME (1<<0)
#define VOLUME_HW_MUTE (1<<1)
uint32_t flags;
};
#define VOLUME_INFO_INIT (struct volume_info) { \
.volume = VOLUME_INIT, \
.mute = false, \
.level = 1.0, \
.base = 1.0, \
.steps = 256, \
}
static int volume_parse_param(const struct spa_pod *param, struct volume_info *info, bool monitor)
{
struct spa_pod_object *obj = (struct spa_pod_object *) param;