summaryrefslogtreecommitdiff
path: root/gr-uhd/lib/gr_uhd_common.h
diff options
context:
space:
mode:
authorJosh Blum2013-05-20 10:44:23 -0700
committerJosh Blum2013-06-25 14:13:57 -0700
commitb5319db68383c1e502badc1f3d9af6e63ef79871 (patch)
tree36b66fbf026114ea84051f1502807ddff8b107c3 /gr-uhd/lib/gr_uhd_common.h
parentdc76615c93acd3e1b1f8c72f76afa8a241385444 (diff)
downloadgnuradio-b5319db68383c1e502badc1f3d9af6e63ef79871.tar.gz
gnuradio-b5319db68383c1e502badc1f3d9af6e63ef79871.tar.bz2
gnuradio-b5319db68383c1e502badc1f3d9af6e63ef79871.zip
uhd: default num channels when empty
Diffstat (limited to 'gr-uhd/lib/gr_uhd_common.h')
-rw-r--r--gr-uhd/lib/gr_uhd_common.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/gr-uhd/lib/gr_uhd_common.h b/gr-uhd/lib/gr_uhd_common.h
index f2433b288..2582cd68d 100644
--- a/gr-uhd/lib/gr_uhd_common.h
+++ b/gr-uhd/lib/gr_uhd_common.h
@@ -39,4 +39,19 @@ static inline void gr_uhd_check_abi(void){
#endif
}
+/*!
+ * The stream args ensure function sanitizes random user input.
+ * We may extend this to handle more things in the future,
+ * but ATM it ensures that the channels are initialized.
+ */
+static inline uhd::stream_args_t stream_args_ensure(const uhd::stream_args_t &args)
+{
+ uhd::stream_args_t sanitized = args;
+ if (sanitized.channels.empty())
+ {
+ sanitized.channels.push_back(0);
+ }
+ return sanitized;
+}
+
#endif /* INCLUDED_GR_UHD_COMMON_H */