From 19e6439b76affdf79acd9de61629383692c52099 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Mon, 29 Jul 2019 22:42:28 +0200 Subject: [PATCH 1/2] stream_dvb: Adapt to VDR channel config format. While they accept the frequency field with MHz for DVB-S, for DVB-C and DVB-T, it may be in Hz, kHz or MHz. The official rule is to multiply whatever is in the channels.conf by 1000 until a value > 1000000 is reached to get correct units for tuning. --- stream/stream_dvb.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 20ed3337c4098..28feb4d78f73e 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -356,9 +356,14 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log, mod[0] = '\0'; // It's a VDR-style config line. parse_vdr_par_string(vdr_par_str, ptr); - // Units in VDR-style config files are divided by 1000. - ptr->freq *= 1000UL; - ptr->srate *= 1000UL; + // Frequency in VDR-style config files is in MHz for DVB-S, + // and may be in MHz, kHz or Hz for DVB-C and DVB-T. + // General rule to get useful units is to multiply by 1000 until value is larger than 1000000. + while (ptr->freq < 1000000UL) { + ptr->freq *= 1000UL; + } + // Symbol rate in VDR-style config files is divided by 1000. + ptr->srate *= 1000UL; switch (delsys) { case SYS_DVBT: case SYS_DVBT2: From 26bf635a3015fcd5b92ad98f2af935ac2bbca71f Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Mon, 29 Jul 2019 22:44:55 +0200 Subject: [PATCH 2/2] stream_dvb: Increase timeout of streaming read. It seems some DVB-T2 cards take longer to push out data. --- stream/stream_dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 28feb4d78f73e..6f36d0ef688b3 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -747,7 +747,7 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size) tries --; pfds[0].fd = fd; pfds[0].events = POLLIN | POLLPRI; - if (poll(pfds, 1, 500) <= 0) { + if (poll(pfds, 1, 2000) <= 0) { MP_ERR(stream, "dvb_streaming_read, failed with " "errno %d when reading %d bytes\n", errno, size - pos); errno = 0;