From 7fe5d8c78e32bd7f609d410c3b769060630553fb Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Wed, 31 Dec 2014 02:20:14 +0100 Subject: dvb: Extend understanding of VDR channel config: stream_id, inversion. Now also "stream ID" (for DVB-S2) and "inversion" are understood. The parameter-string can also provide information on FEC, rolloff etc. For DVB-S, "auto" which mpv uses by default should be fine, I can also confirm it works. For non-DVB-S cards, it might be useful to also parse this information in case of a vdr-channel list. As I have no such hardware and thus would have to do it blindly, I added a FIXME. Mostly complete vdr-channels.conf format documentation is at http://www.vdr-wiki.de/wiki/index.php/Channels.conf (german only). --- stream/dvb_tune.c | 9 ++++----- stream/dvb_tune.h | 2 +- stream/dvbin.h | 1 + stream/stream_dvb.c | 30 +++++++++++++++++++++++++++--- 4 files changed, 33 insertions(+), 9 deletions(-) (limited to 'stream') diff --git a/stream/dvb_tune.c b/stream/dvb_tune.c index 67e210c038..673109152a 100644 --- a/stream/dvb_tune.c +++ b/stream/dvb_tune.c @@ -324,8 +324,8 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo) } static int tune_it(dvb_priv_t *priv, int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone, - bool is_dvb_s2, fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate, - fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, + bool is_dvb_s2, int stream_id, fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, + fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth, fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) { int hi_lo = 0, dfd; @@ -424,7 +424,6 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, int fd_sec, unsigned int f delsys = SYS_DVBS2; } fe_rolloff_t rolloff = ROLLOFF_AUTO; - int stream_id = NO_STREAM_ID_FILTER; struct dtv_property p[] = { { .cmd = DTV_DELIVERY_SYSTEM, .u.data = delsys }, @@ -495,7 +494,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, int fd_sec, unsigned int f int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone, - bool is_dvb_s2, fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, + bool is_dvb_s2, int stream_id, fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout) { @@ -503,7 +502,7 @@ int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int to MP_INFO(priv, "dvb_tune Freq: %lu\n", (long unsigned int) freq); - ris = tune_it(priv, priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, is_dvb_s2, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout); + ris = tune_it(priv, priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, is_dvb_s2, stream_id, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout); if(ris != 0) MP_INFO(priv, "dvb_tune, TUNING FAILED\n"); diff --git a/stream/dvb_tune.h b/stream/dvb_tune.h index 87b85b11ff..2d2f4e6589 100644 --- a/stream/dvb_tune.h +++ b/stream/dvb_tune.h @@ -30,7 +30,7 @@ int dvb_set_ts_filt(dvb_priv_t *priv, int fd, uint16_t pid, dmx_pes_type_t pesty int dvb_demux_stop(int fd); int dvb_demux_start(int fd); int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, - int tone, bool is_dvb_s2, fe_spectral_inversion_t specInv, + int tone, bool is_dvb_s2, int stream_id, fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval, fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate, fe_code_rate_t LP_CodeRate, diff --git a/stream/dvbin.h b/stream/dvbin.h index d4df55119a..0b2cc27537 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -64,6 +64,7 @@ typedef struct { char pol; int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt; bool is_dvb_s2; + int stream_id; fe_spectral_inversion_t inv; fe_modulation_t mod; fe_transmit_mode_t trans; diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index d20d8463fd..08491beed5 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -89,6 +89,8 @@ const struct m_sub_options stream_dvb_conf = { }; static void parse_vdr_par_string(const char* vdr_par_str, dvb_channel_t* ptr) { + //FIXME: There is more information in this parameter string, especially related + // to non-DVB-S reception. if (vdr_par_str[0]) { const char* vdr_par = &vdr_par_str[0]; while (vdr_par && *vdr_par) { @@ -110,6 +112,25 @@ static void parse_vdr_par_string(const char* vdr_par_str, dvb_channel_t* ptr) { } vdr_par++; break; + case 'P': + vdr_par++; + char *endptr = NULL; + errno = 0; + int n = strtol(vdr_par, &endptr, 10); + if (!errno && endptr != vdr_par) { + ptr->stream_id = n; + vdr_par = endptr; + } + break; + case 'I': + vdr_par++; + if (*vdr_par == '1') { + ptr->inv = INVERSION_ON; + } else { + ptr->inv = INVERSION_OFF; + } + vdr_par++; + break; default: vdr_par++; } @@ -187,6 +208,8 @@ static dvb_channels_list *dvb_get_channels(struct mp_log *log, char *filename, i ptr->pids_cnt = 0; ptr->freq = 0; ptr->is_dvb_s2 = false; + ptr->stream_id = NO_STREAM_ID_FILTER; + ptr->inv = INVERSION_AUTO; // Check if VDR-type channels.conf-line - then full line is consumed by the scan. int num_chars = 0; @@ -203,8 +226,8 @@ 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", - list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->is_dvb_s2 ? "yes" : "no"); + 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); } 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); @@ -567,7 +590,8 @@ int dvb_set_channel(stream_t *stream, int card, int n) if(channel->freq != priv->last_freq) if (! dvb_tune(priv, channel->freq, channel->pol, channel->srate, channel->diseqc, channel->tone, - channel->is_dvb_s2, channel->inv, channel->mod, channel->gi, channel->trans, channel->bw, channel->cr, channel->cr_lp, channel->hier, priv->cfg_timeout)) + channel->is_dvb_s2, channel->stream_id, channel->inv, channel->mod, channel->gi, + channel->trans, channel->bw, channel->cr, channel->cr_lp, channel->hier, priv->cfg_timeout)) return 0; priv->last_freq = channel->freq; -- cgit v1.2.3