#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#define INITIALIZE_TIMERS(num) struct timeval iTimer[num]
#define UPDATE_TIMER(num) gettimeofday(&iTimer[num], NULL)
#define CONV_TO_MS(num) (((double)iTimer[num].tv_sec*1000.0) + ((double)iTimer[num].tv_usec/1000.0))
int main(int argc, char* argv[])
{
FILE *fp;
fp = fopen("es1.aac","r");
if(fp==NULL){
printf("Could not open ES fiel\n");
return -1;
}
char * buff;
buff = (char *) malloc(1<<20);
int rdcnt = fread (buff, sizeof(char), (1<<20), fp);
fclose(fp);
printf("ES file rdcnt = %d\n" , rdcnt );
if(rdcnt<=0)
return -1;
int fds;
char *myfifo = "./es_fifo.aac";
pipe(fds);
int ret = mkfifo(myfifo,0666);
if (ret == -1)
printf("Could not create fifo\n");
fds=open(myfifo,O_WRONLY | O_CREAT | O_TRUNC );
const int T_Step = 10;//ms
const int Samplerate = 32000;//kbps
const int PackSize = T_Step/1000.0 * Samplerate / 8;
INITIALIZE_TIMERS(2);
UPDATE_TIMER(0);// reference time
int TimeStep=0;
while(1)
//for(int ii=0;ii<100;ii++)
{
int TotalWrCnt=0;
while(TotalWrCnt<rdcnt){
printf("writing to fifo...");
int wrcnt = 0;
if(rdcnt - TotalWrCnt > PackSize)
wrcnt = write(fds, buff + TotalWrCnt, PackSize);
else
wrcnt = write(fds, buff + TotalWrCnt, rdcnt - TotalWrCnt);
printf("wrcnt = %d Total WrCnt = %d \n", wrcnt,TotalWrCnt);
if(wrcnt!=-1){
TotalWrCnt += wrcnt;
printf("wrcnt = %d TotalWrCnt = %d \n", wrcnt,TotalWrCnt);
}
UPDATE_TIMER(1);
while(CONV_TO_MS(1)-CONV_TO_MS(0) - TimeStep < T_Step){
usleep(1000);
UPDATE_TIMER(1);
}
//printf("\n");
TimeStep = TimeStep + T_Step;
}
}
close(fds);
unlink(myfifo);
return 0;
}
./es_fserver
cvlc file://$PWD/es_fifo.aac
wrcnt = write(fds, buff + TotalWrCnt, PackSize);
a@a-pc:~/Desktop/dab/MyTest/Radio_ES_Logs$ ./es_fserver
ES file rdcnt = 246780
--
You received this message because you are subscribed to the Google Groups "mmbtools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crc-mmbtools+unsubscribe@googlegroups.com.
rm ./AudioOut.wavI have a configuration file for odr-dabmux that reads from ZMQ and writes on ZMQ by throttle "simul://" uncommented.
mkfifo ./AudioOut.wav
cvlc -I dummy ./es1.aac --sout "#transcode{vcodec=none,acodec=s16l,ab=128,channels=2,samplerate=48000}:duplicate{dst=file{dst=./AudioOut.wav,no-overwrite},dst=display}"
odr-dabmux 1prog_zizo.mux
odr-audioenc -l -i ./AudioOut.wav -f wav -r 48000 -c 2 -b 64 -o tcp://localhost:9000 &
odr-dabmod mod-zifo.ini
a@a-pc:~/Desktop/dab/MyTest/Radio_ES_Logs$ odr-dabmux 1prog_zizo.mux
Welcome to ODR-DabMux v1.2.1, compiled at May 22 2017, 13:37:39
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Her Majesty the Queen in Right of Canada
(Communications Research Centre Canada) All rights reserved.
Copyright (C) 2016 Matthias P. Braendli
http://opendigitalradio.org
Input URLs supported:
prbs udp file zmq
Inputs format supported:
raw mpeg packet epm
Output URLs supported:
file fifo udp tcp simul
ERROR Could not set real-time priority for thread:1
ODR-DabMux v1.2.1 starting up
ZMQ socket tcp://*:9100
No announcements defined in ensemble
because No such node (announcements)
No announcements defined in service srv-p1
WARN Service short label undefined, truncating label Prog1
WARN Component short label undefined, truncating label Prog1
WARN Primary component comp-p1 has label set. Since V2.1.1 of the specification, only secondary components are allowed to have labels.
--- Multiplex configuration ---
Ensemble
id: 0x4fff (20479)
ecc: 0xec (236)
label: mmbtools
short label: mmbtools
(0xff00)
mode: 1
lto: 4.5 hours
intl. table. 1
No announcement clusters defined
Linkage Sets
--- Subchannels list ---
Subchannel sub-p1
input
URI: tcp://*:9000
type: audio
id: 0x18 (24)
bitrate: 64
protection: EEP 3-A
option: 0
level: 2
SAD: 0
size (CU): 48
--- Services list ---
Service srv-p1
label: Prog1
short label: Prog1
(0xff00)
id: 0x33 (51)
pty: 0x0 (0)
language: 0x0 (0)
announcements: 0x0
clusters:
--- Components list ---
Component comp-p1
service id: 0x33 (51)
subchannel id: 0x18 (24)
label: Prog1
short label: Prog1
(0xff00)
service component type: 0x3f (63)
No app type defined
--- Output list ---
Output 0
URI: zmq: tcp://
Output 1
URI: simul://
Start loop
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
inputZMQ sub-p1 input pre-buffering complete
WARN inputZMQ sub-p1 input empty, re-enabling pre-buffering
Max number of ETI frames reached: 2000
exiting...
...done
a@a-pc:~/Desktop/dab/MyTest/Radio_ES_Logs$ ^C