[PATCH] rtl_fm null squelch

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Wilson Waters osmocom-sdr-mail at alintech.com.au
Fri Nov 13 06:21:31 UTC 2015


Hi all,

I've created a simple little change for rtl_fm which outputs values of 0 
(instead of nothing) when the output is squelched. Use the command 
option "-E nullsquelch" to enable.

This is useful when live streaming output to icecast or similar which 
requires a constant stream of data (such as 
http://rtl-sdr.com/forum/viewtopic.php?f=7&t=141 or 
http://www.windytan.com/2013/07/squelch-it-out.html).

Hopefully someone can merge this into the git repo, otherwise just patch 
and build yourself.

Cheers,
Wilson

-- 
*Wilson Waters* | Software Engineer
*Alintech*
e: wilson.waters at alintech.com.au
w: www.alintech.com.au
-------------- next part --------------
diff --git a/src/rtl_fm.c b/src/rtl_fm.c
index e89e42d..4c314f7 100644
--- a/src/rtl_fm.c
+++ b/src/rtl_fm.c
@@ -131,7 +131,7 @@ struct demod_state
        int      downsample;    /* min 1, max 256 */
        int      post_downsample;
        int      output_scale;
-       int      squelch_level, conseq_squelch, squelch_hits, terminate_on_squelch;
+       int      squelch_level, conseq_squelch, squelch_hits, terminate_on_squelch, null_squelch;
        int      downsample_passes;
        int      comp_fir_size;
        int      custom_atan;
@@ -205,6 +205,7 @@ void usage(void)
                "\t    deemp:  enable de-emphasis filter\n"
                "\t    direct: enable direct sampling\n"
                "\t    offset: enable offset tuning\n"
+               "\t    nullsquelch: output null padding when squelched\n"
                "\tfilename ('-' means stdout)\n"
                "\t    omitting the filename also uses stdout\n\n"
                "Experimental options:\n"
@@ -812,6 +813,7 @@ static void *dongle_thread_fn(void *arg)

 static void *demod_thread_fn(void *arg)
 {
+       int i;
        struct demod_state *d = arg;
        struct output_state *o = d->output_target;
        while (!do_exit) {
@@ -825,7 +827,9 @@ static void *demod_thread_fn(void *arg)
                if (d->squelch_level && d->squelch_hits > d->conseq_squelch) {
                        d->squelch_hits = d->conseq_squelch + 1;  /* hair trigger */
                        safe_cond_signal(&controller.hop, &controller.hop_m);
-                       continue;
+                       if (!d->null_squelch) {
+                               continue;
+                       }
                }
                pthread_rwlock_wrlock(&o->rw);
                memcpy(o->result, d->result, 2*d->result_len);
@@ -1106,6 +1110,8 @@ int main(int argc, char **argv)
                                dongle.direct_sampling = 1;}
                        if (strcmp("offset",  optarg) == 0) {
                                dongle.offset_tuning = 1;}
+                       if (strcmp("nullsquelch",  optarg) == 0) {
+                               demod.null_squelch = 1;}
                        break;
                case 'F':
                        demod.downsample_passes = 1;  /* truthy placeholder */


More information about the osmocom-sdr mailing list