0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 12:32:05 +01:00

unregister ert and rtp

This commit is contained in:
2026-01-01 17:19:17 +01:00
parent fd2824d18b
commit 748ca29c48
2 changed files with 19 additions and 0 deletions

View File

@@ -34,6 +34,13 @@ local function init_ert()
end
end
local function unregister_ert()
if _Ert_oda_id ~= nil then
unregister_oda(_Ert_oda_id)
_Ert_oda_id = nil
end
end
function set_rds_ert(ert)
if #ert == 0 then
set_userdata_offset(USERDATA_ERT_OFFSET, 128, "")
@@ -61,6 +68,8 @@ function set_rds_ert(ert)
set_userdata_offset(USERDATA_ERT_OFFSET+257, 1, string.char(segments))
_Ert_state = 0
else set_userdata_offset(USERDATA_ERT_OFFSET+258, 1, string.char(1)) end
if _Ert_oda_id == nil then init_ert() end
end
function get_rds_ert()

View File

@@ -79,6 +79,16 @@ function get_rds_rtplus_tags(ertp)
return string.byte(get_userdata_offset(ertp and (USERDATA_RTP_OFFSET+8) or (USERDATA_RTP_OFFSET+1), 6), 1, 6)
end
local function unregister_rtp(ertp)
if ertp and _Ertp_oda_id ~= nil then
unregister_oda(_Ertp_oda_id)
_Ertp_oda_id = nil
elseif _Rtp_oda_id ~= nil then
unregister_oda(_Rtp_oda_id)
_Rtp_oda_id = nil
end
end
local _old_on_state_rtp = on_state
function on_state()
if get_rds_rtp_meta(false) then init_rtp() end