X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=write_common.c;h=9af8d682075ccf91de2bff3ff7625ab7d9f0a598;hp=14ce819515010e84635e5f313f58a78071487f0f;hb=b71a84c94992821c4bd70f80a2fdb3d4e9a39a62;hpb=d0f36435b0f81368a778fda33f3a7df86830f5ac diff --git a/write_common.c b/write_common.c index 14ce8195..9af8d682 100644 --- a/write_common.c +++ b/write_common.c @@ -304,3 +304,31 @@ void print_writer_helps(int detailed) ggo_print_help(&w->help, detailed); } } + +static int get_btr_value(struct btr_node *btrn, const char *key, int32_t *result) +{ + char *buf = NULL; + int ret = btr_exec_up(btrn, key, &buf); + + if (ret < 0) + return ret; + ret = para_atoi32(buf, result); + free(buf); + return ret; +} + +/* + * Ask parent btr nodes for the samplerate of the current stream. + */ +int get_btr_samplerate(struct btr_node *btrn, int32_t *result) +{ + return get_btr_value(btrn, "samplerate", result); +} + +/* + * Ask parent btr nodes for the channel count of the current stream. + */ +int get_btr_channels(struct btr_node *btrn, int32_t *result) +{ + return get_btr_value(btrn, "channels", result); +}