From e904129b79dffb0ac2c661b164157064d03b9095 Mon Sep 17 00:00:00 2001 From: Oliver Freyermuth Date: Tue, 19 Jan 2016 00:18:08 +0100 Subject: stream_dvb: support frontends with multiple delivery systems. Most common case would be DVB-C / DVB-T combination cards. Cards with multiple delivery systems are only supported starting from DVBv5 API (Kernel 2.6.38). In this case, we loop over all delivery systems and just treat them as different cards would be treated: They all get their own TUNER-type, channel-list parsing etc. --- stream/stream_dvb.c | 104 ++++++++++++++++++++++++++++------------------------ 1 file changed, 56 insertions(+), 48 deletions(-) (limited to 'stream/stream_dvb.c') diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 8bc6c4e200..b5ac6ea17a 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -1046,78 +1046,86 @@ dvb_state_t *dvb_get_state(stream_t *stream) continue; } - type = dvb_get_tuner_type(fd, log); + mp_verbose(log, "Opened device %s, FD: %d\n", filename, fd); + int* tuner_types = NULL; + int num_tuner_types = dvb_get_tuner_types(fd, log, &tuner_types); close(fd); - if (type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL && - type != TUNER_ATSC) { + mp_verbose(log, "Frontend device %s offers %d supported delivery systems.\n", + filename, num_tuner_types); + for (int num_tuner_type=0; num_tuner_typecfg_file && priv->cfg_file[0]) + void *talloc_ctx = talloc_new(NULL); + char *conf_file = NULL; + if (priv->cfg_file && priv->cfg_file[0]) conf_file = priv->cfg_file; - else { + else { switch (type) { case TUNER_TER: - conf_file = mp_find_config_file(talloc_ctx, global, - "channels.conf.ter"); - break; + conf_file = mp_find_config_file(talloc_ctx, global, + "channels.conf.ter"); + break; case TUNER_CBL: - conf_file = mp_find_config_file(talloc_ctx, global, - "channels.conf.cbl"); - break; + conf_file = mp_find_config_file(talloc_ctx, global, + "channels.conf.cbl"); + break; case TUNER_SAT: - conf_file = mp_find_config_file(talloc_ctx, global, - "channels.conf.sat"); - break; + conf_file = mp_find_config_file(talloc_ctx, global, + "channels.conf.sat"); + break; case TUNER_ATSC: - conf_file = mp_find_config_file(talloc_ctx, global, - "channels.conf.atsc"); - break; + conf_file = mp_find_config_file(talloc_ctx, global, + "channels.conf.atsc"); + break; } if (conf_file) { - mp_verbose(log, "Ignoring other channels.conf files.\n"); + mp_verbose(log, "Ignoring other channels.conf files.\n"); } else { - conf_file = mp_find_config_file(talloc_ctx, global, - "channels.conf"); + conf_file = mp_find_config_file(talloc_ctx, global, + "channels.conf"); } - } + } - list = dvb_get_channels(log, priv->cfg_full_transponder, conf_file, - type); - talloc_free(talloc_ctx); + list = dvb_get_channels(log, priv->cfg_full_transponder, conf_file, + type); + talloc_free(talloc_ctx); - if (list == NULL) + if (list == NULL) continue; - size = sizeof(dvb_card_config_t) * (state->count + 1); - tmp = realloc(state->cards, size); + size = sizeof(dvb_card_config_t) * (state->count + 1); + tmp = realloc(state->cards, size); - if (tmp == NULL) { - fprintf(stderr, "DVB_CONFIG, can't realloc %d bytes, skipping\n", - size); + if (tmp == NULL) { + mp_err(log, "DVB_CONFIG, can't realloc %d bytes, skipping\n", + size); continue; - } - cards = tmp; + } + cards = tmp; - name = malloc(20); - if (name == NULL) { - fprintf(stderr, "DVB_CONFIG, can't realloc 20 bytes, skipping\n"); + name = malloc(20); + if (name == NULL) { + mp_err(log, "DVB_CONFIG, can't realloc 20 bytes, skipping\n"); continue; - } + } - state->cards = cards; - state->cards[state->count].devno = i; - state->cards[state->count].list = list; - state->cards[state->count].type = type; - snprintf(name, 20, "DVB-%c card n. %d", - type == TUNER_TER ? 'T' : (type == TUNER_CBL ? 'C' : 'S'), - state->count + 1); - state->cards[state->count].name = name; - state->count++; + state->cards = cards; + state->cards[state->count].devno = i; + state->cards[state->count].list = list; + state->cards[state->count].type = type; + snprintf(name, 20, "DVB-%c card n. %d", + type == TUNER_TER ? 'T' : (type == TUNER_CBL ? 'C' : 'S'), + state->count + 1); + state->cards[state->count].name = name; + state->count++; + } + talloc_free(tuner_types); } if (state->count == 0) { -- cgit v1.2.3