stream/dvbin: detect ZAP channel configs looking like VDR configs

While ZAP config files should contain strings in most fields,
their field number in the DVB-T / ISDBT case matches the number of fields
for VDR config files, and some channel list writers (namely, dvbv5-scan)
may insert "0" in unused string fields.
To disentangle such config files from real VDR config files,
add a check for the "INVERSION_" field which should always be filled.
This commit is contained in:
Oliver Freyermuth 2023-08-30 16:07:05 +02:00 committed by sfan5
parent 7021d095b1
commit 420f92629b
1 changed files with 13 additions and 1 deletions

View File

@ -351,7 +351,18 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log,
vpid_str, apid_str, tpid_str, &ptr->service_id,
&num_chars);
if (num_chars == strlen(&line[k])) {
bool is_vdr_conf = (num_chars == strlen(&line[k]));
mp_verbose(log, "This does look like a VDR style channel config file.\n");
// Special case: DVB-T style ZAP config also has 13 columns.
// Most columns should have non-numeric content, but some channel list generators insert 0
// if a value is not used. However, INVERSION_* should always set after frequency.
if (is_vdr_conf && !strncmp(vdr_par_str, "INVERSION_", 10)) {
is_vdr_conf = false;
mp_verbose(log, "Found INVERSION field after frequency, assuming ZAP style channel config file.\n");
}
if (is_vdr_conf) {
// Modulation parsed here, not via old xine-parsing path.
mod[0] = '\0';
// It's a VDR-style config line.
@ -435,6 +446,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log,
break;
}
} else {
// ZAP style channel config file.
switch (delsys) {
case SYS_DVBT:
case SYS_DVBT2: