diff options
author | Oliver Freyermuth <o.freyermuth@googlemail.com> | 2023-08-30 16:07:05 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2023-09-03 13:08:58 +0200 |
commit | 420f92629b6dfdcebec96f0ad96b9ccab4da51d4 (patch) | |
tree | b6743dce4be7fd5cdab8511fa99f6ae0cd1b7198 /stream | |
parent | 7021d095b198d15fd4de4d9bc2ec6b12c0b8c2e3 (diff) | |
download | mpv-420f92629b6dfdcebec96f0ad96b9ccab4da51d4.tar.bz2 mpv-420f92629b6dfdcebec96f0ad96b9ccab4da51d4.tar.xz |
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.
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_dvb.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index e04bb73d06..aae9c9fd7a 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -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: |