aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 15:12:24 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-04-25 15:12:24 +0200
commit8f13b3f2580f182f51d9ad131da1deafdcd5e91a (patch)
tree57e308cc985a0d96a20c37d48b1c3a2dd4ad245d /src
parent8fadb4940c9fcbde6a00b2b78badfcb1269382ba (diff)
downloadODR-AudioEnc-8f13b3f2580f182f51d9ad131da1deafdcd5e91a.tar.gz
ODR-AudioEnc-8f13b3f2580f182f51d9ad131da1deafdcd5e91a.tar.bz2
ODR-AudioEnc-8f13b3f2580f182f51d9ad131da1deafdcd5e91a.zip
use new message format for file encoder too
Diffstat (limited to 'src')
-rw-r--r--src/dabplus-enc-file-zmq.c19
-rw-r--r--src/utils.h4
2 files changed, 18 insertions, 5 deletions
diff --git a/src/dabplus-enc-file-zmq.c b/src/dabplus-enc-file-zmq.c
index 106e110..1bfae12 100644
--- a/src/dabplus-enc-file-zmq.c
+++ b/src/dabplus-enc-file-zmq.c
@@ -412,9 +412,12 @@ int main(int argc, char *argv[]) {
return 0;
}
- int loops = 0;
int outbuf_size = subchannel_index*120;
- uint8_t outbuf[20480];
+ uint8_t zmqframebuf[2048];
+ struct zmq_frame_header_t *zmq_frame_header =
+ (struct zmq_frame_header_t*)zmqframebuf;
+
+ uint8_t outbuf[2048];
if(outbuf_size % 5 != 0) {
fprintf(stderr, "(outbuf_size mod 5) = %d\n", outbuf_size % 5);
@@ -554,7 +557,17 @@ int main(int argc, char *argv[]) {
}
if (zmq_sock) {
- send_error = zmq_send(zmq_sock, outbuf, outbuf_size, ZMQ_DONTWAIT);
+ zmq_frame_header->version = 1;
+ zmq_frame_header->encoder = ZMQ_ENCODER_FDK;
+ zmq_frame_header->datasize = outbuf_size;
+ zmq_frame_header->audiolevel_left = peak_left;
+ zmq_frame_header->audiolevel_right = peak_right;
+
+ memcpy(ZMQ_FRAME_DATA(zmq_frame_header),
+ outbuf, outbuf_size);
+
+ send_error = zmq_send(zmq_sock, zmqframebuf,
+ ZMQ_FRAME_SIZE(zmq_frame_header), ZMQ_DONTWAIT);
if (send_error < 0) {
fprintf(stderr, "ZeroMQ send failed! %s\n", zmq_strerror(errno));
send_error_count ++;
diff --git a/src/utils.h b/src/utils.h
index aa8dc8a..a5aaf8c 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -37,9 +37,9 @@ struct zmq_frame_header_t
#define ZMQ_ENCODER_FDK 1
/* 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_SIZE(f) (sizeof(struct zmq_frame_header_t) + f->datasize)
-#define ZMQ_FRAME_DATA(f) ( ((uint8_t*)f)+sizeof(zmq_frame_header_t) )
+#define ZMQ_FRAME_DATA(f) ( ((uint8_t*)f)+sizeof(struct zmq_frame_header_t) )
#endif