summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream/stream_dvb.c')
-rw-r--r--stream/stream_dvb.c104
1 files changed, 56 insertions, 48 deletions
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_type<num_tuner_types; num_tuner_type++) {
+ type = tuner_types[num_tuner_type];
+ if (type != TUNER_SAT && type != TUNER_TER && type != TUNER_CBL &&
+ type != TUNER_ATSC) {
mp_verbose(log, "DVB_CONFIG, can't detect tuner type of "
"card %d, skipping\n", i);
continue;
- }
+ }
- void *talloc_ctx = talloc_new(NULL);
- char *conf_file = NULL;
- if (priv->cfg_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) {