summaryrefslogtreecommitdiffstats
path: root/stream/stream_dvb.c
diff options
context:
space:
mode:
authorOliver Freyermuth <o.freyermuth@googlemail.com>2016-01-19 00:18:08 +0100
committerwm4 <wm4@nowhere>2016-01-21 00:34:02 +0100
commite904129b79dffb0ac2c661b164157064d03b9095 (patch)
tree760c40d71b2c58302a62581730922ceb52775507 /stream/stream_dvb.c
parentc406f83d375718c7b2798a08a7225df4a915292e (diff)
downloadmpv-e904129b79dffb0ac2c661b164157064d03b9095.tar.bz2
mpv-e904129b79dffb0ac2c661b164157064d03b9095.tar.xz
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.
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) {