diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-08-15 21:44:38 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-08-15 21:44:38 +0200 |
commit | ff8cafb83fbfa2b16851a807c546e33032080ccc (patch) | |
tree | 446b7e004d371669a6c7ffc075ca6c8ba910731c /src | |
parent | ca7dd07261de50576590fea227c8fbf345282e1f (diff) | |
download | dabmux-ff8cafb83fbfa2b16851a807c546e33032080ccc.tar.gz dabmux-ff8cafb83fbfa2b16851a807c546e33032080ccc.tar.bz2 dabmux-ff8cafb83fbfa2b16851a807c546e33032080ccc.zip |
Add support for new ZMQ frame for MPEG input
Diffstat (limited to 'src')
-rw-r--r-- | src/dabInputZmq.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp index 94bbedc..49ba0f6 100644 --- a/src/dabInputZmq.cpp +++ b/src/dabInputZmq.cpp @@ -360,9 +360,25 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize) m_name << ": " << err.what(); } - char* data = (char*)msg.data(); + /* This is the old 'one superframe per ZMQ message' format */ + uint8_t* data = (uint8_t*)msg.data(); + size_t datalen = msg.size(); - if (msg.size() == framesize) + /* Look for the new zmq_frame_header_t format */ + zmq_frame_header_t* frame = (zmq_frame_header_t*)msg.data(); + + if (msg.size() == ZMQ_FRAME_SIZE(frame) && + frame->version == 1 && + frame->encoder == ZMQ_ENCODER_TOOLAME) { + datalen = frame->datasize; + data = ZMQ_FRAME_DATA(frame); + + global_stats->notifyPeakLevels(m_name, frame->audiolevel_left, + frame->audiolevel_right); + } + + + if (datalen) { if (m_frame_buffer.size() > m_config.buffer_size) { etiLog.level(warn) << |