Asking upper buffer tree nodes for the sample rate and the channels
count should never fail, because the writer only asks if there is
already some output data to process.
So, replace the tests by assertions, change the return value
of get_btr_value() to void and fix up all callers accordingly.
This simplifies the code a bit.
int32_t val;
if (bytes == 0) /* no data available */
return;
int32_t val;
if (bytes == 0) /* no data available */
return;
- ret = get_btr_sample_rate(btrn, &val);
- if (ret < 0)
- goto err;
+ get_btr_sample_rate(btrn, &val);
- ret = get_btr_channels(btrn, &val);
- if (ret < 0)
- goto err;
+ get_btr_channels(btrn, &val);
pad->channels = val;
PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels,
pad->sample_rate);
pad->channels = val;
PARA_INFO_LOG("%d channel(s), %dHz\n", pad->channels,
pad->sample_rate);
return;
if (powd->fd < 0) {
int32_t rate, ch;
return;
if (powd->fd < 0) {
int32_t rate, ch;
- ret = get_btr_sample_rate(btrn, &rate);
- if (ret < 0)
- goto out;
- ret = get_btr_channels(btrn, &ch);
- if (ret < 0)
- goto out;
+ get_btr_sample_rate(btrn, &rate);
+ get_btr_channels(btrn, &ch);
ret = oss_init(wn, rate, ch);
if (ret < 0)
goto out;
ret = oss_init(wn, rate, ch);
if (ret < 0)
goto out;
if (AudioUnitInitialize(powd->audio_unit))
goto e1;
powd->play = 0;
if (AudioUnitInitialize(powd->audio_unit))
goto e1;
powd->play = 0;
- ret = get_btr_sample_rate(btrn, &val);
- if (ret < 0)
- goto e1;
+ get_btr_sample_rate(btrn, &val);
- ret = get_btr_channels(btrn, &val);
- if (ret < 0)
- goto e1;
+ get_btr_channels(btrn, &val);
powd->channels = val;
/*
* Choose PCM format. We tell the Output Unit what format we're going
powd->channels = val;
/*
* Choose PCM format. We tell the Output Unit what format we're going
-static int get_btr_value(struct btr_node *btrn, const char *key, int32_t *result)
+static void get_btr_value(struct btr_node *btrn, const char *cmd,
+ int32_t *result)
- int ret = btr_exec_up(btrn, key, &buf);
+ int ret = btr_exec_up(btrn, cmd, &buf);
- if (ret < 0)
- return ret;
ret = para_atoi32(buf, result);
ret = para_atoi32(buf, result);
}
/*
* Ask parent btr nodes for the sample rate of the current stream.
*/
}
/*
* Ask parent btr nodes for the sample rate of the current stream.
*/
-int get_btr_sample_rate(struct btr_node *btrn, int32_t *result)
+void get_btr_sample_rate(struct btr_node *btrn, int32_t *result)
- return get_btr_value(btrn, "sample_rate", result);
+ get_btr_value(btrn, "sample_rate", result);
}
/*
* Ask parent btr nodes for the channel count of the current stream.
*/
}
/*
* Ask parent btr nodes for the channel count of the current stream.
*/
-int get_btr_channels(struct btr_node *btrn, int32_t *result)
+void get_btr_channels(struct btr_node *btrn, int32_t *result)
- return get_btr_value(btrn, "channels", result);
+ get_btr_value(btrn, "channels", result);
* Licensed under the GPL v2. For licencing details see COPYING.
*/
* Licensed under the GPL v2. For licencing details see COPYING.
*/
-/** \file write_common.h Exported symbols from write_common.c */
+/** \file write_common.h Exported symbols from write_common.c. */
void writer_init(void);
void *check_writer_arg(const char *wa, int *writer_num);
void writer_init(void);
void *check_writer_arg(const char *wa, int *writer_num);
void register_writer_node(struct writer_node *wn, struct btr_node *parent);
int setup_writer_node(const char *arg, struct btr_node *parent,
struct writer_node *wn);
void register_writer_node(struct writer_node *wn, struct btr_node *parent);
int setup_writer_node(const char *arg, struct btr_node *parent,
struct writer_node *wn);
-int get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
-int get_btr_channels(struct btr_node *btrn, int32_t *result);
+void get_btr_sample_rate(struct btr_node *btrn, int32_t *result);
+void get_btr_channels(struct btr_node *btrn, int32_t *result);