[FFmpeg-devel] [PATCH 06/14] avradio/rds: Implement clearing radio text
Michael Niedermayer
michael at niedermayer.cc
Thu Jul 13 02:36:58 EEST 2023
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavradio/rds.c | 9 +++++++--
libavradio/sdr.h | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavradio/rds.c b/libavradio/rds.c
index 55b24a0d9e..e121c9db8e 100644
--- a/libavradio/rds.c
+++ b/libavradio/rds.c
@@ -130,14 +130,19 @@ static int decode_rds_group(SDRContext *sdr, Station *station, uint16_t group[4]
case 0:
AV_WB16(station->name + 2*(group[1]&3), group[3]);
break;
- case 2:
+ case 2:{
+ int new_ab_flag = group[1] & 16;
+ if (new_ab_flag != station->rt_ab_flag) {
+ memset(station->radiotext, 0, sizeof(station->radiotext));
+ station->rt_ab_flag = new_ab_flag;
+ }
if (b) {
AV_WB16(station->radiotext + 2*(group[1]&15) , group[3]);
} else {
AV_WB16(station->radiotext + 4*(group[1]&15) , group[2]);
AV_WB16(station->radiotext + 4*(group[1]&15) + 2, group[3]);
}
- break;
+ break;}
case 10:
if (b==0) {
AV_WB16(station->programm_type_name + 4*(group[1]&1) , group[2]);
diff --git a/libavradio/sdr.h b/libavradio/sdr.h
index 29ac4a2963..4b3e14da02 100644
--- a/libavradio/sdr.h
+++ b/libavradio/sdr.h
@@ -75,6 +75,8 @@ typedef struct Station {
char radiotext[65];
char programm_type_name[9];
int program_id[2];
+ uint8_t rt_ab_flag;
+
enum Modulation modulation;
double frequency;
int nb_frequency; ///< number of detections which are used to compute the frequency
--
2.31.1
More information about the ffmpeg-devel
mailing list