summaryrefslogtreecommitdiffstats
path: root/alsa-dabplus-zmq.c
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-07 13:41:20 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-03-07 13:41:20 +0100
commit26ebea0262f0664c4cd90664da52f4d9f6a9c8bc (patch)
treecd0c874ba1395b4ae7b003f4b48a231383f1080f /alsa-dabplus-zmq.c
parent5e9fe473ba528f336dd86ce9d3d7d3e40410db54 (diff)
downloadODR-AudioEnc-26ebea0262f0664c4cd90664da52f4d9f6a9c8bc.tar.gz
ODR-AudioEnc-26ebea0262f0664c4cd90664da52f4d9f6a9c8bc.tar.bz2
ODR-AudioEnc-26ebea0262f0664c4cd90664da52f4d9f6a9c8bc.zip
alsa input improvements, not working
Diffstat (limited to 'alsa-dabplus-zmq.c')
-rw-r--r--alsa-dabplus-zmq.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/alsa-dabplus-zmq.c b/alsa-dabplus-zmq.c
index b1b301d..efe66c1 100644
--- a/alsa-dabplus-zmq.c
+++ b/alsa-dabplus-zmq.c
@@ -399,30 +399,33 @@ int main(int argc, char *argv[]) {
int in_size, in_elem_size;
int out_identifier = OUT_BITSTREAM_DATA;
int out_size, out_elem_size;
- int read=0, i;
+ int i;
int send_error;
void *in_ptr, *out_ptr;
AACENC_ERROR err;
- read = alsa_read(input_buf, info.frameLength);
- if (read != info.frameLength) {
+ int readframes = alsa_read(input_buf, info.frameLength);
+ if (readframes != info.frameLength) {
fprintf(stderr, "Unable to read enough data from input!\n");
break;
}
- for (i = 0; i < read/2; i++) {
+ readframes*=2;
+#if 1
+ for (i = 0; i < readframes; i++) {
const uint8_t* in = &input_buf[2*i];
convert_buf[i] = in[0] | (in[1] << 8);
}
+#endif
- if (read <= 0) {
+ if (readframes <= 0) {
in_args.numInSamples = -1;
} else {
- in_ptr = convert_buf;
- in_size = read;
+ in_ptr = input_buf;
+ in_size = readframes*2;
in_elem_size = 2;
- in_args.numInSamples = read/2;
+ in_args.numInSamples = readframes;
in_buf.numBufs = 1;
in_buf.bufs = &in_ptr;
in_buf.bufferIdentifiers = &in_identifier;