diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-25 15:41:19 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2020-03-25 15:41:19 +0100 |
commit | 968cfd27e659b42a0ca2b3c15265c8999086b45a (patch) | |
tree | 82f1cf8f9aaa0e2418ac11efc0a2244d86cef1f0 | |
parent | e9e1b673a111366ad9071933f3469891a735243a (diff) | |
download | ODR-SourceCompanion-968cfd27e659b42a0ca2b3c15265c8999086b45a.tar.gz ODR-SourceCompanion-968cfd27e659b42a0ca2b3c15265c8999086b45a.tar.bz2 ODR-SourceCompanion-968cfd27e659b42a0ca2b3c15265c8999086b45a.zip |
Rename ZMQ_ENCODER_XYZ constants
-rw-r--r-- | src/Outputs.cpp | 10 | ||||
-rw-r--r-- | src/Outputs.h | 8 | ||||
-rw-r--r-- | src/common.h | 6 | ||||
-rw-r--r-- | src/utils.h | 30 |
4 files changed, 12 insertions, 42 deletions
diff --git a/src/Outputs.cpp b/src/Outputs.cpp index 90fe62a..44dc865 100644 --- a/src/Outputs.cpp +++ b/src/Outputs.cpp @@ -91,7 +91,7 @@ void ZMQ::connect(const char *uri, const char *keyfile) m_sock.connect(uri); } -void ZMQ::set_encoder_type(encoder_selection_t& enc, int bitrate) +void ZMQ::set_encoder_type(codec_selection_t& enc, int bitrate) { m_encoder = enc; m_bitrate = bitrate; @@ -107,11 +107,11 @@ bool ZMQ::write_frame(const uint8_t *buf, size_t len) try { switch (m_encoder) { - case encoder_selection_t::fdk_dabplus: - zmq_frame_header->encoder = ZMQ_ENCODER_FDK; + case codec_selection_t::dabplus: + zmq_frame_header->encoder = ZMQ_ENCODER_AACPLUS; break; - case encoder_selection_t::toolame_dab: - zmq_frame_header->encoder = ZMQ_ENCODER_TOOLAME; + case codec_selection_t::mpeg_layer_2: + zmq_frame_header->encoder = ZMQ_ENCODER_MPEG_L2; break; } diff --git a/src/Outputs.h b/src/Outputs.h index 53ee2ec..a419925 100644 --- a/src/Outputs.h +++ b/src/Outputs.h @@ -91,8 +91,8 @@ struct zmq_frame_header_t /* Data follows this header */ } __attribute__ ((packed)); -#define ZMQ_ENCODER_FDK 1 -#define ZMQ_ENCODER_TOOLAME 2 +#define ZMQ_ENCODER_AACPLUS 1 +#define ZMQ_ENCODER_MPEG_L2 2 #define ZMQ_HEADER_SIZE sizeof(struct zmq_frame_header_t) @@ -110,7 +110,7 @@ class ZMQ: public Base { virtual ~ZMQ() override; void connect(const char *uri, const char *keyfile); - void set_encoder_type(encoder_selection_t& enc, int bitrate); + void set_encoder_type(codec_selection_t& enc, int bitrate); virtual bool write_frame(const uint8_t *buf, size_t len) override; @@ -120,7 +120,7 @@ class ZMQ: public Base { int m_bitrate = 0; char m_secretkey[CURVE_KEYLEN+1]; - encoder_selection_t m_encoder = encoder_selection_t::fdk_dabplus; + codec_selection_t m_encoder = codec_selection_t::dabplus; using vec_u8 = std::vector<uint8_t>; vec_u8 m_framebuf; }; diff --git a/src/common.h b/src/common.h index 774a4a0..12fd68a 100644 --- a/src/common.h +++ b/src/common.h @@ -25,8 +25,8 @@ #define NUM_SAMPLES_PER_CALL 10 // 10 samples @ 32kHz = 3.125ms //! Enumeration of encoders we can use -enum class encoder_selection_t { - fdk_dabplus, - toolame_dab +enum class codec_selection_t { + dabplus, + mpeg_layer_2 }; diff --git a/src/utils.h b/src/utils.h index 83b3e4d..4ad3a7e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -17,36 +17,6 @@ */ const char* level(int channel, int peak); -/*! This defines the on-wire representation of a ZMQ message header. - * It must be compatible with the definition in ODR-DabMux. - * - * 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)); - -#define ZMQ_ENCODER_FDK 1 -#define ZMQ_ENCODER_TOOLAME 2 - -#define ZMQ_HEADER_SIZE sizeof(struct zmq_frame_header_t) - -/* The expected frame size incl data of the given frame */ -#define ZMQ_FRAME_SIZE(f) (sizeof(struct zmq_frame_header_t) + f->datasize) - -#define ZMQ_FRAME_DATA(f) ( ((uint8_t*)f)+sizeof(struct zmq_frame_header_t) ) - - size_t strlen_utf8(const char *s); #endif |