|
a/mpd2src/mpd2sc.cpp |
|
b/mpd2src/mpd2sc.cpp |
|
... |
|
... |
464 |
}
|
464 |
}
|
465 |
|
465 |
|
466 |
static char *thisprog;
|
466 |
static char *thisprog;
|
467 |
static char usage [] =
|
467 |
static char usage [] =
|
468 |
" -h, --help, show this help message and exit.\n"
|
468 |
" -h, --help, show this help message and exit.\n"
|
469 |
" -A, --audio, [44100:16:2:0/1] audio params only if they can't be obtained\n"
|
469 |
" -A, --audio, [44100:16:2:0/1] freq:bits:chans:swap.\n"
|
|
|
470 |
" swap==1 if the input is little-endian. Set this only if the data can't be\n"
|
470 |
" from the file. Conflicting values will cause error."
|
471 |
" obtained from the file. Conflicting values will cause an error. \n"
|
471 |
" -a, --adapter, [adapter] index of network adapter to use.\n"
|
472 |
" -a, --adapter, [adapter] index of network adapter to use.\n"
|
472 |
" -c, --channel, [0..65535] sender channel.\n"
|
473 |
" -c, --channel, [0..65535] sender channel.\n"
|
473 |
" -d, --disabled, [disabled] start up disabled.\n"
|
474 |
" -d, --disabled, [disabled] start up disabled.\n"
|
474 |
" -f, --file, [file] file name to read and send.\n"
|
475 |
" -f, --file, [file] file name to read and send.\n"
|
475 |
" Use xx.wav for an actual wav,\n"
|
476 |
" Use xx.wav for an actual wav,\n"
|
|
... |
|
... |
520 |
int main(int argc, char **argv)
|
521 |
int main(int argc, char **argv)
|
521 |
{
|
522 |
{
|
522 |
thisprog = argv[0];
|
523 |
thisprog = argv[0];
|
523 |
int ret;
|
524 |
int ret;
|
524 |
(void)op_flags;
|
525 |
(void)op_flags;
|
525 |
string audioparams, sfile, sname("Openhome WavSender"), sudn("12345678");
|
526 |
string audioparams, sfile, sname("Openhome WavSender"), sudn("12345678");
|
526 |
unsigned int adaptidx(0), channel(0), ttl(1), latency(100);
|
527 |
unsigned int adaptidx(0), channel(0), ttl(1), latency(100);
|
527 |
while ((ret = getopt_long(argc, argv, "A:a:c:df:l:mn:pt:u:",
|
528 |
while ((ret = getopt_long(argc, argv, "A:a:c:df:l:mn:pt:u:",
|
528 |
long_options, NULL)) != -1) {
|
529 |
long_options, NULL)) != -1) {
|
529 |
switch (ret) {
|
530 |
switch (ret) {
|
530 |
case 'A': audioparams = optarg;op_flags |= OPT_A; break;
|
531 |
case 'A': audioparams = optarg;op_flags |= OPT_A; break;
|
531 |
case 'a': adaptidx = atoi(optarg);op_flags |= OPT_a; break;
|
532 |
case 'a': adaptidx = atoi(optarg);op_flags |= OPT_a; break;
|
532 |
case 'c': channel = atoi(optarg);op_flags |= OPT_c; break;
|
533 |
case 'c': channel = atoi(optarg);op_flags |= OPT_c; break;
|
533 |
case 'd': op_flags |= OPT_d; break;
|
534 |
case 'd': op_flags |= OPT_d; break;
|
|
... |
|
... |
543 |
Usage();
|
544 |
Usage();
|
544 |
}
|
545 |
}
|
545 |
}
|
546 |
}
|
546 |
if (optind != argc )
|
547 |
if (optind != argc )
|
547 |
Usage();
|
548 |
Usage();
|
548 |
|
549 |
if (sfile.empty())
|
|
|
550 |
Usage();
|
|
|
551 |
|
549 |
InitialisationParams* initParams = InitialisationParams::Create();
|
552 |
InitialisationParams* initParams = InitialisationParams::Create();
|
550 |
|
553 |
|
551 |
Library* lib = new Library(initParams);
|
554 |
Library* lib = new Library(initParams);
|
552 |
|
555 |
|
553 |
std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
|
556 |
std::vector<NetworkAdapter*>* subnetList = lib->CreateSubnetList();
|
|
... |
|
... |
569 |
lib->SetCurrentSubnet(subnet);
|
572 |
lib->SetCurrentSubnet(subnet);
|
570 |
|
573 |
|
571 |
LOGDEB("using subnet " << (subnet&0xff) << "." << ((subnet>>8)&0xff) << "."
|
574 |
LOGDEB("using subnet " << (subnet&0xff) << "." << ((subnet>>8)&0xff) << "."
|
572 |
<< ((subnet>>16)&0xff) << "." << ((subnet>>24)&0xff) << endl);
|
575 |
<< ((subnet>>16)&0xff) << "." << ((subnet>>24)&0xff) << endl);
|
573 |
|
576 |
|
574 |
if (sfile.empty()) {
|
|
|
575 |
LOGERR("No input file specified\n");
|
|
|
576 |
return (1);
|
|
|
577 |
}
|
|
|
578 |
Brhz file(sfile.c_str());
|
577 |
Brhz file(sfile.c_str());
|
579 |
|
578 |
|
580 |
Brhz udn(sudn.c_str());
|
579 |
Brhz udn(sudn.c_str());
|
581 |
Brhz name(sname.c_str());
|
580 |
Brhz name(sname.c_str());
|
582 |
TBool multicast = op_flags & OPT_m;
|
581 |
TBool multicast = op_flags & OPT_m;
|