From 181e9c6d5d11cb1e5d36a2777eeb233ad8ed00e5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 9 Oct 2008 18:15:23 +0200 Subject: big pile of updates to match more what happened with libcanberra --- src/common.h | 80 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 25 deletions(-) (limited to 'src/common.h') diff --git a/src/common.h b/src/common.h index 9d01c44..a89c55f 100644 --- a/src/common.h +++ b/src/common.h @@ -1,12 +1,32 @@ #ifndef foosydneycommonh #define foosydneycommonh +/*** + This file is part of libsydney. + + Copyright 2007-2008 Lennart Poettering + + libsydney is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 2.1 of the + License, or (at your option) any later version. + + libsydney is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with libsydney. If not, see + . +***/ + +#include + #include "sydney.h" #include "mutex.h" #include "macro.h" -#define _META_NAMES_MAX 9 - typedef struct sa_pcm_attrs { sa_pcm_format_t format; unsigned rate; @@ -15,18 +35,24 @@ typedef struct sa_pcm_attrs { } pcm_attrs_t; struct sa_stream { - sa_mode_t mode; + sa_mutex *mutex; + + sa_mode_t mode; /* immutable -- this means accessing this doesn't require locking */ - pcm_attrs_t pcm_attrs; - size_t pcm_sample_size; - size_t pcm_frame_size; + pcm_attrs_t pcm_attrs; /* immutable, except for .rate */ + size_t pcm_sample_size; /* immutable */ + size_t pcm_frame_size; /* immutable */ - char *codec; + char *codec; /* immutable */ + + sa_state_t state; -/* size_t read_lower_watermark; */ -/* size_t read_upper_watermark; */ -/* size_t write_lower_watermark; */ -/* size_t write_upper_watermark; */ + sa_proplist *props; + + size_t read_latency; + size_t read_process_time; + size_t write_latency; + size_t write_process_time; sa_xrun_mode_t xrun_mode; sa_bool_t ni_enabled; @@ -34,35 +60,39 @@ struct sa_stream { sa_event_callback_t event_callback; - char *device; char *driver; + char *device; int32_t *read_volume; int32_t *write_volume; + sa_event_callback_t callback; void *user_data; - sa_state_t state; - sa_adjust_t adjust_rate; sa_adjust_t adjust_nchannels; sa_adjust_t adjust_pcm_format; -/* sa_adjust_t adjust_watermarks; */ - sa_error_t error; - sa_notify_t notify; + /* Current event data */ sa_event_t event; + int error; + sa_notify_t notify; + void *notify_data; + size_t notify_data_nbytes; - void *driver_data; /* driver specific data */ - - void *meta_data[_META_NAMES_MAX]; - size_t meta_data_size[_META_NAMES_MAX]; - - sa_mutex *mutex; - - sa_event_callback_t callback; + void *private; /* driver specific data */ +#ifdef HAVE_DSO + void *private_dso; +#endif }; size_t sa_get_pcm_sample_size(sa_pcm_format_t f); +float volume_to_dB(int32_t v); +float volume_to_linear(int32_t v); +int32_t volume_from_dB(float dB); +int32_t volume_from_linear(float f); + +sa_bool_t sa_stream_frame_aligned(sa_stream *s, int64_t nbytes); + #endif -- cgit