diff --git a/demod/mod/dfm09mod.c b/demod/mod/dfm09mod.c index b2200e2..77f845f 100644 --- a/demod/mod/dfm09mod.c +++ b/demod/mod/dfm09mod.c @@ -856,6 +856,7 @@ int main(int argc, char **argv) { int option_dc = 0; int option_bin = 0; int option_json = 0; // JSON blob output (for auto_rx) + int option_pcmraw = 0; int wavloaded = 0; int sel_wavch = 0; // audio channel: left int spike = 0; @@ -974,10 +975,26 @@ int main(int argc, char **argv) { option_min = 1; } else if (strcmp(*argv, "--dbg") == 0) { gpx.option.dbg = 1; } + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } wavloaded = 1; @@ -1005,14 +1022,23 @@ int main(int argc, char **argv) { if (!option_bin) { - //if (option_iq) sel_wavch = 0; - pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { + + if (option_iq == 0 && option_pcmraw) { fclose(fp); - fprintf(stderr, "error: wav header\n"); + fprintf(stderr, "error: raw data not IQ\n"); return -1; } + if (option_iq) sel_wavch = 0; + + pcm.sel_ch = sel_wavch; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } + } // dfm: BT=1?, h=2.4? symlen = 2; diff --git a/demod/mod/lms6Xmod.c b/demod/mod/lms6Xmod.c index 97cb061..6f9fc59 100644 --- a/demod/mod/lms6Xmod.c +++ b/demod/mod/lms6Xmod.c @@ -928,6 +928,7 @@ int main(int argc, char **argv) { int option_iq = 0; int option_lp = 0; int option_dc = 0; + int option_pcmraw = 0; int wavloaded = 0; int sel_wavch = 0; // audio channel: left int gpsweek = 0; @@ -1059,10 +1060,26 @@ int main(int argc, char **argv) { gpx->option.ecc = 1; gpx->option.vit = 1; } + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } wavloaded = 1; @@ -1086,14 +1103,21 @@ int main(int argc, char **argv) { gpx->week = gpsweek; + if (option_iq == 0 && option_pcmraw) { + fclose(fp); + fprintf(stderr, "error: raw data not IQ\n"); + return -1; + } if (option_iq) sel_wavch = 0; pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { - fclose(fp); - fprintf(stderr, "error: wav header\n"); - return -1; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } } symlen = 1; diff --git a/demod/mod/m10mod.c b/demod/mod/m10mod.c index b7ecc94..98cdedd 100644 --- a/demod/mod/m10mod.c +++ b/demod/mod/m10mod.c @@ -896,6 +896,7 @@ int main(int argc, char **argv) { int option_iq = 0; int option_lp = 0; int option_dc = 0; + int option_pcmraw = 0; int wavloaded = 0; int sel_wavch = 0; // audio channel: left int spike = 0; @@ -1001,10 +1002,26 @@ int main(int argc, char **argv) { option_min = 1; } else if (strcmp(*argv, "--json") == 0) { gpx.option.jsn = 1; } + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } wavloaded = 1; @@ -1023,13 +1040,22 @@ int main(int argc, char **argv) { // init gpx - pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { + if (option_iq == 0 && option_pcmraw) { fclose(fp); - fprintf(stderr, "error: wav header\n"); + fprintf(stderr, "error: raw data not IQ\n"); return -1; } + if (option_iq) sel_wavch = 0; + + pcm.sel_ch = sel_wavch; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } + } // m10: BT>1?, h=1.2 ? symlen = 2; diff --git a/demod/mod/meisei100mod.c b/demod/mod/meisei100mod.c index ae2a7aa..be996dd 100644 --- a/demod/mod/meisei100mod.c +++ b/demod/mod/meisei100mod.c @@ -212,6 +212,7 @@ int main(int argc, char **argv) { int option_iq = 0; int option_lp = 0; int option_dc = 0; + int option_pcmraw = 0; int sel_wavch = 0; int wavloaded = 0; @@ -307,6 +308,7 @@ int main(int argc, char **argv) { } else return -1; } + else if ( (strcmp(*argv, "--ch2") == 0) ) { sel_wavch = 1; } // right channel (default: 0=left) else if ( (strcmp(*argv, "--ths") == 0) ) { ++argv; if (*argv) { @@ -345,12 +347,28 @@ int main(int argc, char **argv) { option_jsn = 1; option_ecc = 1; } + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { if (option1 == 1 && option2 == 1) goto help_out; if (!option_raw && option1 == 0 && option2 == 0) option2 = 1; fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } wavloaded = 1; @@ -360,13 +378,22 @@ int main(int argc, char **argv) { if (!wavloaded) fp = stdin; - pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { + if (option_iq == 0 && option_pcmraw) { fclose(fp); - fprintf(stderr, "error: wav header\n"); + fprintf(stderr, "error: raw data not IQ\n"); return -1; } + if (option_iq) sel_wavch = 0; + + pcm.sel_ch = sel_wavch; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } + } symlen = 1; diff --git a/demod/mod/rs41mod.c b/demod/mod/rs41mod.c index 430e1ee..02e5bff 100644 --- a/demod/mod/rs41mod.c +++ b/demod/mod/rs41mod.c @@ -1537,6 +1537,7 @@ int main(int argc, char *argv[]) { int option_lp = 0; int option_dc = 0; int option_bin = 0; + int option_pcmraw = 0; int wavloaded = 0; int sel_wavch = 0; // audio channel: left int rawhex = 0, xorhex = 0; @@ -1653,10 +1654,26 @@ int main(int argc, char *argv[]) { } else if (strcmp(*argv, "--rawhex") == 0) { rawhex = 2; } // raw hex input else if (strcmp(*argv, "--xorhex") == 0) { rawhex = 2; xorhex = 1; } // raw xor input + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } wavloaded = 1; @@ -1680,14 +1697,21 @@ int main(int argc, char *argv[]) { if (!option_bin) { + if (option_iq == 0 && option_pcmraw) { + fclose(fp); + fprintf(stderr, "error: raw data not IQ\n"); + return -1; + } if (option_iq) sel_wavch = 0; pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { - fclose(fp); - fprintf(stderr, "error: wav header\n"); - return -1; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } } // rs41: BT=0.5, h=0.8,1.0 ? diff --git a/demod/mod/rs92mod.c b/demod/mod/rs92mod.c index 1a4bafb..a6ec8ff 100644 --- a/demod/mod/rs92mod.c +++ b/demod/mod/rs92mod.c @@ -1235,6 +1235,7 @@ int main(int argc, char *argv[]) { int option_iq = 0; int option_lp = 0; int option_dc = 0; + int option_pcmraw = 0; int sel_wavch = 0; // audio channel: left int spike = 0; int fileloaded = 0; @@ -1418,10 +1419,26 @@ int main(int argc, char *argv[]) { option_min = 1; } else if (strcmp(*argv, "--ngp") == 0) { gpx.option.ngp = 1; } // RS92-NGP, RS92-D: 1680 MHz + else if (strcmp(*argv, "-") == 0) { + int sample_rate = 0, bits_sample = 0, channels = 0; + ++argv; + if (*argv) sample_rate = atoi(*argv); else return -1; + ++argv; + if (*argv) bits_sample = atoi(*argv); else return -1; + channels = 2; + if (sample_rate < 1 || (bits_sample != 8 && bits_sample != 16 && bits_sample != 32)) { + fprintf(stderr, "- \n"); + return -1; + } + pcm.sr = sample_rate; + pcm.bps = bits_sample; + pcm.nch = channels; + option_pcmraw = 1; + } else { fp = fopen(*argv, "rb"); if (fp == NULL) { - fprintf(stderr, "%s konnte nicht geoeffnet werden\n", *argv); + fprintf(stderr, "error: open %s\n", *argv); return -1; } fileloaded = 1; @@ -1461,13 +1478,22 @@ int main(int argc, char *argv[]) { // init gpx memcpy(gpx.frame, rs92_header_bytes, sizeof(rs92_header_bytes)); // 6 header bytes - pcm.sel_ch = sel_wavch; - k = read_wav_header(&pcm, fp); - if ( k < 0 ) { + if (option_iq == 0 && option_pcmraw) { fclose(fp); - fprintf(stderr, "error: wav header\n"); + fprintf(stderr, "error: raw data not IQ\n"); return -1; } + if (option_iq) sel_wavch = 0; + + pcm.sel_ch = sel_wavch; + if (option_pcmraw == 0) { + k = read_wav_header(&pcm, fp); + if ( k < 0 ) { + fclose(fp); + fprintf(stderr, "error: wav header\n"); + return -1; + } + } // rs92-sgp: BT=0.5, h=1.0 ? symlen = 2;