aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAlex Chronopoulos <[email protected]>2019-04-23 12:27:14 +0300
committerGitHub <[email protected]>2019-04-23 12:27:14 +0300
commit162625ac918bce496e78fedca9932b5fd2d07bcd (patch)
tree96c38adb5c0fc62fa62a706a80ccf37abcd21b0e /tools
parent241e3c7b8a6ce76ad9e075ee5761cd4d0906bc16 (diff)
downloadcubeb-162625ac918bce496e78fedca9932b5fd2d07bcd.tar.gz
cubeb-162625ac918bce496e78fedca9932b5fd2d07bcd.zip
test: add option to get the posotion of a stream (#504)
* test: add option to get the posotion of a stream * Correct the errom message
Diffstat (limited to 'tools')
-rw-r--r--tools/cubeb-test.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/cubeb-test.cpp b/tools/cubeb-test.cpp
index 1c1d941..fab9ab8 100644
--- a/tools/cubeb-test.cpp
+++ b/tools/cubeb-test.cpp
@@ -51,6 +51,7 @@ public:
bool destroy_stream() const;
bool destroy();
bool activate_log(cubeb_log_level log_level) const;
+ uint64_t get_stream_position() const;
long user_data_cb(cubeb_stream* stm, void* user, const void* input_buffer,
void* output_buffer, long nframes);
@@ -151,6 +152,16 @@ bool cubeb_client::stop_stream() const {
return true;
}
+uint64_t cubeb_client::get_stream_position() const {
+ uint64_t pos = 0;
+ int rv = cubeb_stream_get_position(stream, &pos);
+ if (rv != CUBEB_OK) {
+ fprintf(stderr, "Could not get the position the stream\n");
+ return 0;
+ }
+ return pos;
+}
+
bool cubeb_client::destroy_stream() const {
cubeb_stream_destroy(stream);
return true;
@@ -257,6 +268,7 @@ void print_help() {
"2: change log level to verbose\n"
"p: start a initialized stream\n"
"s: stop a started stream\n"
+ "c: get stream position (client thread)\n"
"i: change device type to input\n"
"o: change device type to output\n"
"a: change device type to input and output\n"
@@ -318,6 +330,9 @@ bool choose_action(const cubeb_client& cl, operation_data * op, char c) {
} else {
fprintf(stderr, "stop_stream failed\n");
}
+ } else if (c == 'c') {
+ uint64_t pos = cl.get_stream_position();
+ fprintf(stderr, "stream position %lu\n", pos);
} else if (c == 'i') {
op->collection_device_type = CUBEB_DEVICE_TYPE_INPUT;
fprintf(stderr, "collection device type changed to INPUT\n");