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

RDS: fix flags decoding #1361

Merged
merged 1 commit into from
Aug 17, 2024
Merged

Conversation

vladisslav2011
Copy link
Contributor

@vladisslav2011 vladisslav2011 commented Jul 3, 2024

Change d0...d3 order to d3...d0 to match the standard.
Change decoding of Mono/Stereo flag to match the standard.
Change decoding of stPTY flag to match the standard.
rds0
rds1
Fixes #1360

@argilo
Copy link
Member

argilo commented Aug 8, 2024

Thanks for the fix, and sorry for the delay in reviewing it.

parser_impl.cc is copied from https://github.com/bastibl/gr-rds, so it would make sense to apply the fix there as well. (In case you don't have time to open a pull request there, let me know and I can do it.)

The mono/stereo issue was fixed in gr-rds here: bastibl/gr-rds#66, but it looks like the segment_address handling is wrong.

@@ -103,16 +103,16 @@ void parser_impl::decode_type0(unsigned int *group, bool B) {
/* see page 41, table 9 of the standard */
switch (segment_address) {
case 0:
mono_stereo=decoder_control_bit;
static_pty=!decoder_control_bit;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it may make sense to leave this bit as is, and change the display (in dockrds.cpp) instead. That way there won't be an API change in the PMT message format, which could potentially break applications that depend on gr-rds.

Suggested change
static_pty=!decoder_control_bit;
static_pty=decoder_control_bit;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm.
I've tried to preserve compatibility by keeping PMT message characters meaning unchanged.
This bit means "dynamic PTY" when set, but the corresponding PMT message character means "static PTY". That's why it is inverted here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the corresponding PMT message character means "static PTY"

I suppose that may have been the intention, since the variable is named static_pty. But it could also be that the choice of variable name was a mistake, and it should have been named dynamic_pty.

I think the less confusing choice would be to copy the DI bits into the PMT message verbatim (as they are currently) and rename the variable.

In any case, it's gr-rds's API so we should probably see what @bastibl would prefer to do upstream.

Change d0...d3 order to d3...d0 to match the standard.
Change decoding of Mono/Stereo flag to match the standard.
Change decoding of stPTY flag to match the standard.
@argilo
Copy link
Member

argilo commented Aug 12, 2024

The changes look good.

I have proposed the fix upstream in bastibl/gr-rds#78 and will give @bastibl a bit of time to look it over before merging this.

@argilo
Copy link
Member

argilo commented Aug 17, 2024

It's been a while and I haven't heard back on the upstream PR, so I'll merge this and we can re-synchronize with gr-rds if needed.

@argilo argilo merged commit 25fdbb5 into gqrx-sdr:master Aug 17, 2024
16 of 17 checks passed
@argilo
Copy link
Member

argilo commented Aug 31, 2024

The upstream PR was accepted. Thanks for having a look @bastibl!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect RDS flags
2 participants