From e79bbb00757cb6e7a415aa613d52253b12ca26a8 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 25 Apr 2014 11:00:29 +0200 Subject: Add support for new zmq frame format --- src/dabInputZmq.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/dabInputZmq.h') diff --git a/src/dabInputZmq.h b/src/dabInputZmq.h index b74b1e8..3ef7233 100644 --- a/src/dabInputZmq.h +++ b/src/dabInputZmq.h @@ -51,6 +51,7 @@ #include #include +#include #include "zmq.hpp" #include "dabInput.h" #include "StatsServer.h" @@ -127,6 +128,33 @@ struct dab_input_zmq_config_t std::string curve_encoder_keyfile; }; +#define ZMQ_ENCODER_FDK 1 +#define ZMQ_ENCODER_TOOLAME 2 + +/* This defines the on-wire representation of a ZMQ message header. + * + * The data follows right after this header */ +struct zmq_frame_header_t +{ + uint16_t version; // we support version=1 now + uint16_t encoder; // see ZMQ_ENCODER_XYZ + + /* length of the 'data' field */ + uint32_t datasize; + + /* Audio level, peak, linear PCM */ + int16_t audiolevel_left; + int16_t audiolevel_right; + + /* Data follows this header */ +} __attribute__ ((packed)); + +/* The expected frame size incl data of the given frame */ +#define ZMQ_FRAME_SIZE(f) (sizeof(zmq_frame_header_t) + f->datasize) + +#define ZMQ_FRAME_DATA(f) ( ((uint8_t*)f)+sizeof(zmq_frame_header_t) ) + + class DabInputZmqBase : public DabInputBase, public RemoteControllable { public: DabInputZmqBase(const std::string name, @@ -191,7 +219,7 @@ class DabInputZmqBase : public DabInputBase, public RemoteControllable { bool m_enable_input; /* stores elements of type char[] */ - std::list m_frame_buffer; + std::list m_frame_buffer; dab_input_zmq_config_t m_config; -- cgit v1.2.3