From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 03/12] avradio/rds: Keep track of program_id
Date: Tue, 11 Jul 2023 23:19:01 +0200
Message-ID: <20230711211910.1257355-3-michael@niedermayer.cc> (raw)
In-Reply-To: <20230711211910.1257355-1-michael@niedermayer.cc>
This allows detecting more damaged blocks
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
libavradio/rds.c | 16 ++++++++++++++++
libavradio/sdr.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/libavradio/rds.c b/libavradio/rds.c
index 2cb7942bbd..dc7124cab3 100644
--- a/libavradio/rds.c
+++ b/libavradio/rds.c
@@ -85,7 +85,13 @@ static int check_rds_block(Station *station, uint16_t group[4], const float diff
int ret = burst_len(syndrom);
group[block] ^= (syndrom << i) >> 10;
+ if (block == 0 && station->program_id[0]) {
+ if (group[0] == station->program_id[0]) {
return ret;
+ } else if (group[0] == station->program_id[1]) {
+ return ret;
+ } else if (ret) {
+ return 20; //PI change is uncommon, so dont accept this in a damaged block, PI is repeated alot so we can wait for a clean block
}
}
@@ -108,6 +114,16 @@ static int decode_rds_group(SDRContext *sdr, SDRStream *sst, uint16_t group[4])
int tp = group[1] & 0x400;
int pty= (group[1] >> 5) & 0x1F;
+ if (station->program_id[0] && station->program_id[0] != pi)
+ av_log(sdr->avfmt, AV_LOG_INFO, "PI changed to %X\n", pi);
+
+ if (station->program_id[1] == pi) {
+ FFSWAP(int, station->program_id[1], station->program_id[0]);
+ } else if (station->program_id[0] != pi) {
+ station->program_id[1] = pi;
+ return 0; // skip first packet with new PI, likely its just damaged
+ }
+
switch(a) {
case 0:
AV_WB16(station->name + 2*(group[1]&3), group[3]);
diff --git a/libavradio/sdr.h b/libavradio/sdr.h
index 212358fad9..b83264ae0d 100644
--- a/libavradio/sdr.h
+++ b/libavradio/sdr.h
@@ -74,6 +74,7 @@ typedef struct Station {
char name[9];
char radiotext[65];
char programm_type_name[9];
+ int program_id[2];
enum Modulation modulation;
double frequency;
int nb_frequency; ///< number of detections which are used to compute the frequency
--
2.31.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-07-11 21:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-11 21:18 [FFmpeg-devel] [PATCH 01/12] avradio/sdrdemux: Fix use of uninitialized memory Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 02/12] avradio/rds: Implement burst error decoder Michael Niedermayer
2023-07-11 21:19 ` Michael Niedermayer [this message]
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 04/12] avradio/sdr: Move rds_ring to Station Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 05/12] avradio/rds: move phase 2 window to main context Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 06/12] avradio/sdr: Warnings cleanup Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 07/12] avradio/rds: warnings cleanup Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 08/12] avradio/sdr: Move IFFT and block size to main context Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 09/12] avradio/sdr: Move per stream arraies " Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 10/12] avradio/sdr: Move tx contexts out of stream so its not duplicated Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 11/12] avradio/sdr: Pass AVStream instead of int to demodulate Michael Niedermayer
2023-07-11 21:19 ` [FFmpeg-devel] [PATCH 12/12] avradio/sdr: Process RDS of all stations not just the current one Michael Niedermayer
2023-07-12 23:26 ` [FFmpeg-devel] [PATCH 01/12] avradio/sdrdemux: Fix use of uninitialized memory Michael Niedermayer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230711211910.1257355-3-michael@niedermayer.cc \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git