gqrx-sdr / gqrx

Software defined radio receiver powered by GNU Radio and Qt.
http://gqrx.dk
GNU General Public License v3.0
3.11k stars 545 forks source link

Incorrect RDS flags #1360

Closed KubaPro010 closed 3 months ago

KubaPro010 commented 4 months ago

Both on FM stereo and mono the RDS flags are wrong, it should be the value 9 (0b1001 indicating stereo and dynamic pty) however in gqrx the flags say Music Mono stPTY which is not correct as it should be Music Stereo, RDS Spy does say the correct flags so something is wrong here (for the future: i wont debug)

vladisslav2011 commented 4 months ago

Confirmed. Thanks. Possible fix: https://github.com/gqrx-sdr/gqrx/pull/1361

KubaPro010 commented 4 months ago

The fix looks correct, i did make a python RDS encoder and somewhat decoder (librds), the decoder part looks like this:

match segment:
                case 0:
                    det.di_dpty = is_di
                case 1:
                    det.di_compressed = is_di
                case 2:
                    det.di_artificial_head = is_di
                case 3:
                    det.di_stereo = is_di

where is_di is the di bit and match is just a switch alternative in python

and here's the encoder part:

( basic.b | int(ta) << 4 | int(ms) << 3 | ( ( di >> (3-segment) ) << 2) | segment ) & 0xFFFF,

Specifically ( ( di >> (3-segment) ) << 2)