Skip to content

Commit

Permalink
remove merge markers and extra code left from merging changes from up…
Browse files Browse the repository at this point in the history
…stream
  • Loading branch information
fventuri committed Mar 29, 2022
1 parent 8d8eb5b commit 1e3f689
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 156 deletions.
2 changes: 1 addition & 1 deletion src/main-rtlsdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int parse_args(state_t *st, int argc, char *argv[])
st->mode = NRSC5_MODE_FM;
st->gain = -1;
st->bias_tee = 0;
st->direct_sampling = 0;
st->direct_sampling = -1;
st->ppm_error = INT_MIN;

while ((opt = getopt_long(argc, argv, "r:w:o:d:p:g:ql:vH:TD:", long_opts, NULL)) != -1)
Expand Down
155 changes: 0 additions & 155 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -428,162 +428,7 @@ void *input_main(void *arg)
return NULL;
}

<<<<<<< HEAD
void log_lock(void *udata, int lock)
=======
static void help(const char *progname)
{
fprintf(stderr, "Usage: %s [-v] [-q] [--am] [-l log-level] [-d device-index] [-H rtltcp-host] [-p ppm-error] [-g gain] [-r iq-input] [-w iq-output] [-o wav-output] [-T] [-D direct-sampling-mode] [--dump-hdc hdc-output] [--dump-aas-files directory] frequency program\n", progname);
}

static int parse_args(state_t *st, int argc, char *argv[])
{
static const struct option long_opts[] = {
{ "dump-aas-files", required_argument, NULL, 1 },
{ "dump-hdc", required_argument, NULL, 2 },
{ "am", no_argument, NULL, 3 },
{ 0 }
};
const char *version = NULL;
char *output_name = NULL, *audio_name = NULL, *hdc_name = NULL;
char *endptr;
int opt;

st->mode = NRSC5_MODE_FM;
st->gain = -1;
st->bias_tee = 0;
st->direct_sampling = -1;
st->ppm_error = INT_MIN;

while ((opt = getopt_long(argc, argv, "r:w:o:d:p:g:ql:vH:TD:", long_opts, NULL)) != -1)
{
switch (opt)
{
case 1:
st->aas_files_path = strdup(optarg);
break;
case 2:
hdc_name = optarg;
break;
case 3:
st->mode = NRSC5_MODE_AM;
break;
case 'r':
st->input_name = strdup(optarg);
break;
case 'w':
output_name = optarg;
break;
case 'o':
audio_name = optarg;
break;
case 'd':
st->device_index = strtoul(optarg, NULL, 10);
break;
case 'p':
st->ppm_error = strtol(optarg, NULL, 10);
break;
case 'g':
st->gain = strtof(optarg, &endptr);
if (*endptr != 0)
{
log_fatal("Invalid gain.");
return -1;
}
break;
case 'q':
log_set_quiet(1);
break;
case 'l':
log_set_level(atoi(optarg));
break;
case 'v':
nrsc5_get_version(&version);
printf("nrsc5 revision %s\n", version);
return 1;
case 'H':
st->rtltcp_host = strdup(optarg);
break;
case 'T':
st->bias_tee = 1;
break;
case 'D':
st->direct_sampling = atoi(optarg);
break;
default:
help(argv[0]);
return 1;
}
}

if (optind + (!st->input_name + 1) != argc)
{
help(argv[0]);
return 1;
}

if (!st->input_name)
{
st->freq = strtof(argv[optind++], &endptr);
if (*endptr != 0)
{
log_fatal("Invalid frequency.");
return -1;
}

// compatibility with previous versions
if (st->freq < 10000.0f)
st->freq *= 1e6f;
}

st->program = strtoul(argv[optind++], &endptr, 0);
if (*endptr != 0)
{
log_fatal("Invalid program.");
return -1;
}

if (audio_name)
st->dev = open_ao_wav(audio_name);
else
st->dev = open_ao_live();

if (st->dev == NULL)
{
log_fatal("Unable to open audio device.");
return 1;
}

if (output_name)
{
if (strcmp(output_name, "-") == 0)
st->iq_file = stdout;
else
st->iq_file = fopen(output_name, "wb");
if (st->iq_file == NULL)
{
log_fatal("Unable to open IQ output.");
return 1;
}
}

if (hdc_name)
{
if (strcmp(hdc_name, "-") == 0)
st->hdc_file = stdout;
else
st->hdc_file = fopen(hdc_name, "wb");
if (st->hdc_file == NULL)
{
log_fatal("Unable to open HDC output.");
return 1;
}
}

return 0;
}

static void log_lock(void *udata, int lock)
{
pthread_mutex_t *mutex = udata;
if (lock)
Expand Down

0 comments on commit 1e3f689

Please sign in to comment.