summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Freyermuth <o.freyermuth@googlemail.com>2014-12-31 02:42:29 +0100
committerwm4 <wm4@nowhere>2015-01-06 19:52:27 +0100
commit641cba9e3d97093abaa0637c146df8c356804587 (patch)
tree8de8da243d31c49f3fdbc7dd99f0ec63ffe294f1
parent7fe5d8c78e32bd7f609d410c3b769060630553fb (diff)
downloadmpv-641cba9e3d97093abaa0637c146df8c356804587.tar.bz2
mpv-641cba9e3d97093abaa0637c146df8c356804587.tar.xz
stream_dvb: Handle VDR-config location-field as DISEQc-field.
In mplayer-style channels-config, we had a LNB-field used for that. In old VDR times, the location-field was also containing DISEQc information, now it does that only indirectly (location => LNB => vdr knows from lnb-config). We only accept it as this if the field is fully numeric.
-rw-r--r--stream/stream_dvb.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c
index 08491beed5..bfae3570df 100644
--- a/stream/stream_dvb.c
+++ b/stream/stream_dvb.c
@@ -150,13 +150,14 @@ static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, i
int fields, cnt, pcnt, k;
int has8192, has0;
dvb_channel_t *ptr, *tmp, chn;
- char tmp_lcr[256], tmp_hier[256], inv[256], bw[256], cr[256], mod[256], transm[256], gi[256], vpid_str[256], apid_str[256], vdr_par_str[256];
+ char tmp_lcr[256], tmp_hier[256], inv[256], bw[256], cr[256], mod[256], transm[256], gi[256], vpid_str[256], apid_str[256],
+ vdr_par_str[256], vdr_loc_str[256];
const char *cbl_conf = "%d:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n";
const char *sat_conf = "%d:%c:%d:%d:%255[^:]:%255[^:]\n";
const char *ter_conf = "%d:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]:%255[^:]\n";
const char *atsc_conf = "%d:%255[^:]:%255[^:]:%255[^:]\n";
- const char *vdr_conf = "%d:%255[^:]:%*255[^:]:%d:%255[^:]:%255[^:]:%*255[^:]:%*255[^:]:%*d:%*d:%*d:%*d\n%n";
+ const char *vdr_conf = "%d:%255[^:]:%255[^:]:%d:%255[^:]:%255[^:]:%*255[^:]:%*255[^:]:%*d:%*d:%*d:%*d\n%n";
mp_verbose(log, "CONFIG_READ FILE: %s, type: %d\n", filename, type);
if((f=fopen(filename, "r"))==NULL)
@@ -204,7 +205,8 @@ static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, i
continue;
}
k++;
- vpid_str[0] = apid_str[0] = vdr_par_str[0] = 0;
+ vpid_str[0] = apid_str[0] = 0;
+ vdr_loc_str[0] = vdr_par_str[0] = 0;
ptr->pids_cnt = 0;
ptr->freq = 0;
ptr->is_dvb_s2 = false;
@@ -214,7 +216,7 @@ static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, i
// Check if VDR-type channels.conf-line - then full line is consumed by the scan.
int num_chars = 0;
fields = sscanf(&line[k], vdr_conf,
- &ptr->freq, vdr_par_str, &ptr->srate, vpid_str, apid_str, &num_chars);
+ &ptr->freq, vdr_par_str, vdr_loc_str, &ptr->srate, vpid_str, apid_str, &num_chars);
if (num_chars == strlen(&line[k])) {
// It's a VDR-style config line.
@@ -226,8 +228,26 @@ static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, i
ptr->tone = -1;
ptr->inv = INVERSION_AUTO;
ptr->cr = FEC_AUTO;
- mp_verbose(log, "SAT, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, POL: %c, S2: %s, StreamID: %d",
- list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->is_dvb_s2 ? "yes" : "no", ptr->stream_id);
+
+ if (vdr_loc_str[0]) {
+ // In older vdr config format, this field contained the DISEQc information.
+ // If it is numeric, assume that's it.
+ int diseqc_info = 0;
+ int valid_digits = 0;
+ if (sscanf(vdr_loc_str, "%d%n", &diseqc_info, &valid_digits) == 1) {
+ if (valid_digits == strlen(vdr_loc_str)) {
+ ptr->diseqc = diseqc_info;
+ if((ptr->diseqc > 4) || (ptr->diseqc < 0))
+ continue;
+ if(ptr->diseqc > 0)
+ ptr->diseqc--;
+ }
+ }
+ }
+
+ mp_verbose(log, "SAT, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, POL: %c, DISEQC: %d, S2: %s, StreamID: %d",
+ list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->diseqc,
+ ptr->is_dvb_s2 ? "yes" : "no", ptr->stream_id);
} else {
mp_verbose(log, "VDR, NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d",
list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate);