Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtl_tcp dithering support #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/rtl_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ void usage(void)
"\t[-b number of buffers (default: 15, set by library)]\n"
"\t[-n max number of linked list buffers to keep (default: 500)]\n"
"\t[-d device index (default: 0)]\n"
"\t[-P ppm_error (default: 0)]\n");
"\t[-P ppm_error (default: 0)]\n"
"\t[-N no dithering (default: use dithering)]\n");
exit(1);
}

Expand Down Expand Up @@ -371,6 +372,7 @@ int main(int argc, char **argv)
int gain = 0;
int ppm_error = 0;
int custom_ppm = 0;
int dithering = 1;
struct llist *curelem,*prev;
pthread_attr_t attr;
void *status;
Expand All @@ -388,7 +390,7 @@ int main(int argc, char **argv)
struct sigaction sigact, sigign;
#endif

while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:")) != -1) {
while ((opt = getopt(argc, argv, "a:p:f:g:s:b:n:d:P:N")) != -1) {
switch (opt) {
case 'd':
dev_index = verbose_device_search(optarg);
Expand Down Expand Up @@ -419,6 +421,9 @@ int main(int argc, char **argv)
ppm_error = atoi(optarg);
custom_ppm = 1;
break;
case 'N':
dithering = 0;
break;
default:
usage();
break;
Expand Down Expand Up @@ -455,6 +460,17 @@ int main(int argc, char **argv)
SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
#endif

/* Enable/disable dithering */
if (!dithering) {
fprintf(stderr, "Disabling dithering... ");
r = rtlsdr_set_dithering(dev, dithering);
if (r) {
fprintf(stderr, "failure\n");
} else {
fprintf(stderr, "success\n");
}
}

/* Set the tuner error */
if (!custom_ppm) {
verbose_ppm_eeprom(dev, &ppm_error);
Expand Down