[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test7-25-g41a0dc1
Lennart Poettering
gitmailer-noreply at 0pointer.de
Mon Sep 7 11:11:44 PDT 2009
This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.
The master branch has been updated
from 812be327836c93492ad389333bcc037566141eb8 (commit)
- Log -----------------------------------------------------------------
41a0dc1 volume: if pa_cvolume_set_{balance|fade}() is called with invalid fade/balance value log, but don't assert
d000dd6 volume: when passing NULL as channel map to pa_cvolume_scale_mask() handle this the same way as pa_cvolume_scale()
9755bfa volume: drop some redundant but expensive validity checks
cc6c4fe volume: add a couple of validity checks for pa_volume_t arguments
3bbc5e6 volume: fix definition of PA_VOLUME_MAX and introduce PA_VOLUME_INVALID and use it wherever applicable
5cf0c1e introspect: rearrange order of functions a bit
e6a666d libpulse: introduce PA_BYTES_SNPRINT_MAX and make use of it wherever applicable
-----------------------------------------------------------------------
Summary of changes:
src/pulse/context.h | 1 -
src/pulse/introspect.h | 12 +++++-----
src/pulse/sample.h | 7 +++++
src/pulse/scache.c | 4 +-
src/pulse/scache.h | 4 +-
src/pulse/stream.h | 2 +-
src/pulse/volume.c | 52 +++++++++++++++++++++++++-----------------
src/pulse/volume.h | 9 +++++--
src/pulsecore/cli-command.c | 12 +++++-----
src/pulsecore/core-scache.c | 4 +-
src/pulsecore/memblock.c | 2 +-
src/utils/pactl.c | 4 +-
12 files changed, 66 insertions(+), 47 deletions(-)
-----------------------------------------------------------------------
commit e6a666d8d5fffbc9847b51b35349b88d74970079
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Sep 6 22:33:04 2009 +0200
libpulse: introduce PA_BYTES_SNPRINT_MAX and make use of it wherever applicable
diff --git a/src/pulse/context.h b/src/pulse/context.h
index cd12931..670b23e 100644
--- a/src/pulse/context.h
+++ b/src/pulse/context.h
@@ -267,7 +267,6 @@ pa_time_event* pa_context_rttime_new(pa_context *c, pa_usec_t usec, pa_time_even
for mainloop->time_restart). \since 0.9.16 */
void pa_context_rttime_restart(pa_context *c, pa_time_event *e, pa_usec_t usec);
-
PA_C_DECL_END
#endif
diff --git a/src/pulse/sample.h b/src/pulse/sample.h
index 53d7dea..7a4a55a 100644
--- a/src/pulse/sample.h
+++ b/src/pulse/sample.h
@@ -302,6 +302,13 @@ pa_sample_format_t pa_parse_sample_format(const char *format) PA_GCC_PURE;
/** Pretty print a sample type specification to a string */
char* pa_sample_spec_snprint(char *s, size_t l, const pa_sample_spec *spec);
+/** Maximum required string length for pa_bytes_snprint(). Please note
+ * that this value can change with any release without warning and
+ * without being considered API or ABI breakage. You should not use
+ * this definition anywhere where it might become part of an
+ * ABI. \since 0.9.16 */
+#define PA_BYTES_SNPRINT_MAX 11
+
/** Pretty print a byte size value. (i.e. "2.5 MiB") */
char* pa_bytes_snprint(char *s, size_t l, unsigned v);
diff --git a/src/pulse/stream.h b/src/pulse/stream.h
index 8a08421..21dd0a8 100644
--- a/src/pulse/stream.h
+++ b/src/pulse/stream.h
@@ -319,7 +319,7 @@ typedef struct pa_stream pa_stream;
typedef void (*pa_stream_success_cb_t) (pa_stream*s, int success, void *userdata);
/** A generic request callback */
-typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t bytes, void *userdata);
+typedef void (*pa_stream_request_cb_t)(pa_stream *p, size_t nbytes, void *userdata);
/** A generic notification callback */
typedef void (*pa_stream_notify_cb_t)(pa_stream *p, void *userdata);
diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c
index 3c94960..143db3b 100644
--- a/src/pulsecore/cli-command.c
+++ b/src/pulsecore/cli-command.c
@@ -328,7 +328,7 @@ static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf
static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) {
char ss[PA_SAMPLE_SPEC_SNPRINT_MAX];
char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
- char s[256];
+ char bytes[PA_BYTES_SNPRINT_MAX];
const pa_mempool_stat *stat;
unsigned k;
pa_sink *def_sink;
@@ -352,22 +352,22 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b
pa_strbuf_printf(buf, "Memory blocks currently allocated: %u, size: %s.\n",
(unsigned) pa_atomic_load(&stat->n_allocated),
- pa_bytes_snprint(s, sizeof(s), (unsigned) pa_atomic_load(&stat->allocated_size)));
+ pa_bytes_snprint(bytes, sizeof(bytes), (unsigned) pa_atomic_load(&stat->allocated_size)));
pa_strbuf_printf(buf, "Memory blocks allocated during the whole lifetime: %u, size: %s.\n",
(unsigned) pa_atomic_load(&stat->n_accumulated),
- pa_bytes_snprint(s, sizeof(s), (unsigned) pa_atomic_load(&stat->accumulated_size)));
+ pa_bytes_snprint(bytes, sizeof(bytes), (unsigned) pa_atomic_load(&stat->accumulated_size)));
pa_strbuf_printf(buf, "Memory blocks imported from other processes: %u, size: %s.\n",
(unsigned) pa_atomic_load(&stat->n_imported),
- pa_bytes_snprint(s, sizeof(s), (unsigned) pa_atomic_load(&stat->imported_size)));
+ pa_bytes_snprint(bytes, sizeof(bytes), (unsigned) pa_atomic_load(&stat->imported_size)));
pa_strbuf_printf(buf, "Memory blocks exported to other processes: %u, size: %s.\n",
(unsigned) pa_atomic_load(&stat->n_exported),
- pa_bytes_snprint(s, sizeof(s), (unsigned) pa_atomic_load(&stat->exported_size)));
+ pa_bytes_snprint(bytes, sizeof(bytes), (unsigned) pa_atomic_load(&stat->exported_size)));
pa_strbuf_printf(buf, "Total sample cache size: %s.\n",
- pa_bytes_snprint(s, sizeof(s), (unsigned) pa_scache_total_size(c)));
+ pa_bytes_snprint(bytes, sizeof(bytes), (unsigned) pa_scache_total_size(c)));
pa_strbuf_printf(buf, "Default sample spec: %s\n",
pa_sample_spec_snprint(ss, sizeof(ss), &c->default_sample_spec));
diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 441b397..0e40d12 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -694,7 +694,7 @@ static void memblock_replace_import(pa_memblock *b) {
pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) {
pa_mempool *p;
- char t1[64], t2[64];
+ char t1[PA_BYTES_SNPRINT_MAX], t2[PA_BYTES_SNPRINT_MAX];
p = pa_xnew(pa_mempool, 1);
diff --git a/src/utils/pactl.c b/src/utils/pactl.c
index b8f4ea7..141ab5b 100644
--- a/src/utils/pactl.c
+++ b/src/utils/pactl.c
@@ -130,7 +130,7 @@ static void complete_action(void) {
}
static void stat_callback(pa_context *c, const pa_stat_info *i, void *userdata) {
- char s[128];
+ char s[PA_BYTES_SNPRINT_MAX];
if (!i) {
pa_log(_("Failed to get statistics: %s"), pa_strerror(pa_context_errno(c)));
quit(1);
@@ -598,7 +598,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu
}
static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int is_last, void *userdata) {
- char t[32], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
+ char t[PA_BYTES_SNPRINT_MAX], s[PA_SAMPLE_SPEC_SNPRINT_MAX], cv[PA_CVOLUME_SNPRINT_MAX], cvdb[PA_SW_CVOLUME_SNPRINT_DB_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
char *pl;
if (is_last < 0) {
commit 5cf0c1e544a5fce97d514c793256b2e301277136
Author: Lennart Poettering <lennart at poettering.net>
Date: Sun Sep 6 23:14:15 2009 +0200
introspect: rearrange order of functions a bit
diff --git a/src/pulse/introspect.h b/src/pulse/introspect.h
index ee98210..68cfc87 100644
--- a/src/pulse/introspect.h
+++ b/src/pulse/introspect.h
@@ -331,6 +331,12 @@ pa_operation* pa_context_set_source_mute_by_index(pa_context *c, uint32_t idx, i
/** Set the mute switch of a source device specified by its name */
pa_operation* pa_context_set_source_mute_by_name(pa_context *c, const char *name, int mute, pa_context_success_cb_t cb, void *userdata);
+/** Suspend/Resume a source. \since 0.9.7 */
+pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
+
+/** Suspend/Resume a source. If idx is PA_INVALID_INDEX all sources will be suspended. \since 0.9.7 */
+pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
+
/** Change the profile of a source. \since 0.9.16 */
pa_operation* pa_context_set_source_port_by_index(pa_context *c, uint32_t idx, const char*port, pa_context_success_cb_t cb, void *userdata);
@@ -557,12 +563,6 @@ pa_operation* pa_context_move_source_output_by_name(pa_context *c, uint32_t idx,
/** Move the specified source output to a different source. \since 0.9.5 */
pa_operation* pa_context_move_source_output_by_index(pa_context *c, uint32_t idx, uint32_t source_idx, pa_context_success_cb_t cb, void* userdata);
-/** Suspend/Resume a source. \since 0.9.7 */
-pa_operation* pa_context_suspend_source_by_name(pa_context *c, const char *source_name, int suspend, pa_context_success_cb_t cb, void* userdata);
-
-/** Suspend/Resume a source. If idx is PA_INVALID_INDEX all sources will be suspended. \since 0.9.7 */
-pa_operation* pa_context_suspend_source_by_index(pa_context *c, uint32_t idx, int suspend, pa_context_success_cb_t cb, void* userdata);
-
/** Kill a source output. */
pa_operation* pa_context_kill_source_output(pa_context *c, uint32_t idx, pa_context_success_cb_t cb, void *userdata);
commit 3bbc5e6a4d0211d8cedd2fe6698c2e2c07d1c4b9
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Sep 7 19:53:39 2009 +0200
volume: fix definition of PA_VOLUME_MAX and introduce PA_VOLUME_INVALID and use it wherever applicable
diff --git a/src/pulse/scache.c b/src/pulse/scache.c
index 77f60d7..43dc529 100644
--- a/src/pulse/scache.c
+++ b/src/pulse/scache.c
@@ -187,7 +187,7 @@ pa_operation *pa_context_play_sample(pa_context *c, const char *name, const char
pa_tagstruct_putu32(t, PA_INVALID_INDEX);
pa_tagstruct_puts(t, dev);
- if (volume == (pa_volume_t) -1 && c->version < 15)
+ if (volume == PA_VOLUME_INVALID && c->version < 15)
volume = PA_VOLUME_NORM;
pa_tagstruct_putu32(t, volume);
@@ -228,7 +228,7 @@ pa_operation *pa_context_play_sample_with_proplist(pa_context *c, const char *na
pa_tagstruct_putu32(t, PA_INVALID_INDEX);
pa_tagstruct_puts(t, dev);
- if (volume == (pa_volume_t) -1 && c->version < 15)
+ if (volume == PA_VOLUME_INVALID && c->version < 15)
volume = PA_VOLUME_NORM;
pa_tagstruct_putu32(t, volume);
diff --git a/src/pulse/scache.h b/src/pulse/scache.h
index cd579d2..31cf7b0 100644
--- a/src/pulse/scache.h
+++ b/src/pulse/scache.h
@@ -101,7 +101,7 @@ pa_operation* pa_context_play_sample(
pa_context *c /**< Context */,
const char *name /**< Name of the sample to play */,
const char *dev /**< Sink to play this sample on */,
- pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here (pa_volume_t) -1 which will leave the decision about the volume to the server side which is a good idea. */ ,
+ pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ ,
pa_context_success_cb_t cb /**< Call this function after successfully starting playback, or NULL */,
void *userdata /**< Userdata to pass to the callback */);
@@ -113,7 +113,7 @@ pa_operation* pa_context_play_sample_with_proplist(
pa_context *c /**< Context */,
const char *name /**< Name of the sample to play */,
const char *dev /**< Sink to play this sample on */,
- pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here (pa_volume_t) -1 which will leave the decision about the volume to the server side which is a good idea. */ ,
+ pa_volume_t volume /**< Volume to play this sample with. Starting with 0.9.15 you may pass here PA_VOLUME_INVALID which will leave the decision about the volume to the server side which is a good idea. */ ,
pa_proplist *proplist /**< Property list for this sound. The property list of the cached entry will be merged into this property list */,
pa_context_play_sample_cb_t cb /**< Call this function after successfully starting playback, or NULL */,
void *userdata /**< Userdata to pass to the callback */);
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 234c3f7..4991e5c 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -64,7 +64,7 @@ pa_cvolume* pa_cvolume_init(pa_cvolume *a) {
a->channels = 0;
for (c = 0; c < PA_CHANNELS_MAX; c++)
- a->values[c] = (pa_volume_t) -1;
+ a->values[c] = PA_VOLUME_INVALID;
return a;
}
@@ -307,7 +307,7 @@ char *pa_volume_snprint(char *s, size_t l, pa_volume_t v) {
pa_init_i18n();
- if (v == (pa_volume_t) -1) {
+ if (v == PA_VOLUME_INVALID) {
pa_snprintf(s, l, _("(invalid)"));
return s;
}
@@ -357,7 +357,7 @@ char *pa_sw_volume_snprint_dB(char *s, size_t l, pa_volume_t v) {
pa_init_i18n();
- if (v == (pa_volume_t) -1) {
+ if (v == PA_VOLUME_INVALID) {
pa_snprintf(s, l, _("(invalid)"));
return s;
}
@@ -459,7 +459,7 @@ int pa_cvolume_valid(const pa_cvolume *v) {
return 0;
for (c = 0; c < v->channels; c++)
- if (v->values[c] == (pa_volume_t) -1)
+ if (v->values[c] == PA_VOLUME_INVALID)
return 0;
return 1;
@@ -679,7 +679,7 @@ pa_cvolume* pa_cvolume_scale(pa_cvolume *v, pa_volume_t max) {
pa_assert(v);
pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
- pa_return_val_if_fail(max != (pa_volume_t) -1, NULL);
+ pa_return_val_if_fail(max != PA_VOLUME_INVALID, NULL);
t = pa_cvolume_max(v);
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 543b0af..c964020 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -106,11 +106,14 @@ typedef uint32_t pa_volume_t;
/** Normal volume (100%, 0 dB) */
#define PA_VOLUME_NORM ((pa_volume_t) 0x10000U)
-/** Muted volume (0%, -inf dB) */
+/** Muted (minimal valid) volume (0%, -inf dB) */
#define PA_VOLUME_MUTED ((pa_volume_t) 0U)
-/** Maximum volume we can store. \since 0.9.15 */
-#define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX)
+/** Maximum valid volume we can store. \since 0.9.15 */
+#define PA_VOLUME_MAX ((pa_volume_t) UINT32_MAX-1)
+
+/** Special 'invalid' volume. \since 0.9.16 */
+#define PA_VOLUME_INVALID ((pa_volume_t) UINT32_MAX)
/** A structure encapsulating a per-channel volume */
typedef struct pa_cvolume {
diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c
index fde12ec..1fb81d0 100644
--- a/src/pulsecore/core-scache.c
+++ b/src/pulsecore/core-scache.c
@@ -335,12 +335,12 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t
pass_volume = TRUE;
- if (e->volume_is_set && volume != (pa_volume_t) -1) {
+ if (e->volume_is_set && volume != PA_VOLUME_INVALID) {
pa_cvolume_set(&r, e->sample_spec.channels, volume);
pa_sw_cvolume_multiply(&r, &r, &e->volume);
} else if (e->volume_is_set)
r = e->volume;
- else if (volume != (pa_volume_t) -1)
+ else if (volume != PA_VOLUME_INVALID)
pa_cvolume_set(&r, e->sample_spec.channels, volume);
else
pass_volume = FALSE;
commit cc6c4fe91f916451bbea9073619c11a6b122b684
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Sep 7 19:59:18 2009 +0200
volume: add a couple of validity checks for pa_volume_t arguments
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 4991e5c..1bbb07f 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -201,6 +201,9 @@ pa_volume_t pa_cvolume_min_mask(const pa_cvolume *a, const pa_channel_map *cm, p
pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) {
+ pa_return_val_if_fail(a != PA_VOLUME_INVALID, PA_VOLUME_INVALID);
+ pa_return_val_if_fail(b != PA_VOLUME_INVALID, PA_VOLUME_INVALID);
+
/* cbrt((a/PA_VOLUME_NORM)^3*(b/PA_VOLUME_NORM)^3)*PA_VOLUME_NORM = a*b/PA_VOLUME_NORM */
return (pa_volume_t) (((uint64_t) a * (uint64_t) b + (uint64_t) PA_VOLUME_NORM / 2ULL) / (uint64_t) PA_VOLUME_NORM);
@@ -208,6 +211,9 @@ pa_volume_t pa_sw_volume_multiply(pa_volume_t a, pa_volume_t b) {
pa_volume_t pa_sw_volume_divide(pa_volume_t a, pa_volume_t b) {
+ pa_return_val_if_fail(a != PA_VOLUME_INVALID, PA_VOLUME_INVALID);
+ pa_return_val_if_fail(b != PA_VOLUME_INVALID, PA_VOLUME_INVALID);
+
if (b <= PA_VOLUME_MUTED)
return 0;
@@ -232,6 +238,8 @@ pa_volume_t pa_sw_volume_from_dB(double dB) {
double pa_sw_volume_to_dB(pa_volume_t v) {
+ pa_return_val_if_fail(v != PA_VOLUME_INVALID, PA_DECIBEL_MININFTY);
+
if (v <= PA_VOLUME_MUTED)
return PA_DECIBEL_MININFTY;
@@ -259,6 +267,8 @@ pa_volume_t pa_sw_volume_from_linear(double v) {
double pa_sw_volume_to_linear(pa_volume_t v) {
double f;
+ pa_return_val_if_fail(v != PA_VOLUME_INVALID, 0.0);
+
if (v <= PA_VOLUME_MUTED)
return 0.0;
@@ -374,6 +384,7 @@ int pa_cvolume_channels_equal_to(const pa_cvolume *a, pa_volume_t v) {
pa_assert(a);
pa_return_val_if_fail(pa_cvolume_valid(a), 0);
+ pa_return_val_if_fail(v != PA_VOLUME_INVALID, 0);
for (c = 0; c < a->channels; c++)
if (a->values[c] != v)
@@ -407,6 +418,7 @@ pa_cvolume *pa_sw_cvolume_multiply_scalar(pa_cvolume *dest, const pa_cvolume *a,
pa_assert(a);
pa_return_val_if_fail(pa_cvolume_valid(a), NULL);
+ pa_return_val_if_fail(b != PA_VOLUME_INVALID, NULL);
for (i = 0; i < a->channels; i++)
dest->values[i] = pa_sw_volume_multiply(a->values[i], b);
@@ -441,6 +453,7 @@ pa_cvolume *pa_sw_cvolume_divide_scalar(pa_cvolume *dest, const pa_cvolume *a, p
pa_assert(a);
pa_return_val_if_fail(pa_cvolume_valid(a), NULL);
+ pa_return_val_if_fail(b != PA_VOLUME_INVALID, NULL);
for (i = 0; i < a->channels; i++)
dest->values[i] = pa_sw_volume_divide(a->values[i], b);
@@ -827,6 +840,7 @@ pa_cvolume* pa_cvolume_set_position(
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(cv, map), NULL);
pa_return_val_if_fail(t < PA_CHANNEL_POSITION_MAX, NULL);
+ pa_return_val_if_fail(v != PA_VOLUME_INVALID, NULL);
for (c = 0; c < map->channels; c++)
if (map->map[c] == t) {
@@ -883,6 +897,7 @@ pa_cvolume* pa_cvolume_inc(pa_cvolume *v, pa_volume_t inc) {
pa_assert(v);
pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
+ pa_return_val_if_fail(inc != PA_VOLUME_INVALID, NULL);
m = pa_cvolume_max(v);
@@ -900,6 +915,7 @@ pa_cvolume* pa_cvolume_dec(pa_cvolume *v, pa_volume_t dec) {
pa_assert(v);
pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
+ pa_return_val_if_fail(dec != PA_VOLUME_INVALID, NULL);
m = pa_cvolume_max(v);
commit 9755bfa58af0c27b478d5d8cc56013527a6f660b
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Sep 7 20:00:02 2009 +0200
volume: drop some redundant but expensive validity checks
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 1bbb07f..1b26cc7 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -510,8 +510,6 @@ pa_cvolume *pa_cvolume_remap(pa_cvolume *v, const pa_channel_map *from, const pa
pa_assert(from);
pa_assert(to);
- pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
- pa_return_val_if_fail(pa_channel_map_valid(from), NULL);
pa_return_val_if_fail(pa_channel_map_valid(to), NULL);
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, from), NULL);
@@ -613,8 +611,6 @@ float pa_cvolume_get_balance(const pa_cvolume *v, const pa_channel_map *map) {
pa_assert(v);
pa_assert(map);
- pa_return_val_if_fail(pa_cvolume_valid(v), 0.0f);
- pa_return_val_if_fail(pa_channel_map_valid(map), 0.0f);
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, map), 0.0f);
if (!pa_channel_map_can_balance(map))
@@ -711,8 +707,8 @@ pa_cvolume* pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, pa_channel_map
pa_assert(v);
- pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
pa_return_val_if_fail(max != (pa_volume_t) -1, NULL);
+ pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, cm), NULL);
t = pa_cvolume_max_mask(v, cm, mask);
@@ -763,8 +759,6 @@ float pa_cvolume_get_fade(const pa_cvolume *v, const pa_channel_map *map) {
pa_assert(v);
pa_assert(map);
- pa_return_val_if_fail(pa_cvolume_valid(v), 0.0f);
- pa_return_val_if_fail(pa_channel_map_valid(map), 0.0f);
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, map), 0.0f);
if (!pa_channel_map_can_fade(map))
commit d000dd6f4b976894558613f69bdad2974cce7d1e
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Sep 7 20:00:58 2009 +0200
volume: when passing NULL as channel map to pa_cvolume_scale_mask() handle this the same way as pa_cvolume_scale()
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 1b26cc7..8a28b33 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -707,7 +707,11 @@ pa_cvolume* pa_cvolume_scale_mask(pa_cvolume *v, pa_volume_t max, pa_channel_map
pa_assert(v);
- pa_return_val_if_fail(max != (pa_volume_t) -1, NULL);
+ pa_return_val_if_fail(max != PA_VOLUME_INVALID, NULL);
+
+ if (!cm)
+ return pa_cvolume_scale(v, max);
+
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, cm), NULL);
t = pa_cvolume_max_mask(v, cm, mask);
commit 41a0dc1e9987ae00b605fd88bf887becbdf097d5
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Sep 7 20:08:07 2009 +0200
volume: if pa_cvolume_set_{balance|fade}() is called with invalid fade/balance value log, but don't assert
diff --git a/src/pulse/volume.c b/src/pulse/volume.c
index 8a28b33..47bccad 100644
--- a/src/pulse/volume.c
+++ b/src/pulse/volume.c
@@ -642,12 +642,10 @@ pa_cvolume* pa_cvolume_set_balance(pa_cvolume *v, const pa_channel_map *map, flo
pa_assert(map);
pa_assert(v);
- pa_assert(new_balance >= -1.0f);
- pa_assert(new_balance <= 1.0f);
- pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
- pa_return_val_if_fail(pa_channel_map_valid(map), NULL);
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, map), NULL);
+ pa_return_val_if_fail(new_balance >= -1.0f, NULL);
+ pa_return_val_if_fail(new_balance <= 1.0f, NULL);
if (!pa_channel_map_can_balance(map))
return v;
@@ -785,12 +783,10 @@ pa_cvolume* pa_cvolume_set_fade(pa_cvolume *v, const pa_channel_map *map, float
pa_assert(map);
pa_assert(v);
- pa_assert(new_fade >= -1.0f);
- pa_assert(new_fade <= 1.0f);
- pa_return_val_if_fail(pa_cvolume_valid(v), NULL);
- pa_return_val_if_fail(pa_channel_map_valid(map), NULL);
pa_return_val_if_fail(pa_cvolume_compatible_with_channel_map(v, map), NULL);
+ pa_return_val_if_fail(new_fade >= -1.0f, NULL);
+ pa_return_val_if_fail(new_fade <= 1.0f, NULL);
if (!pa_channel_map_can_fade(map))
return v;
--
hooks/post-receive
PulseAudio Sound Server
More information about the pulseaudio-commits
mailing list