mirror of https://github.com/mpv-player/mpv
dvbin: revise many log lines
This commit is contained in:
parent
e8e1466426
commit
d7683ec4ac
|
@ -77,23 +77,21 @@ unsigned int dvb_get_tuner_delsys_mask(int fe_fd, struct mp_log *log)
|
||||||
struct dtv_property prop[1];
|
struct dtv_property prop[1];
|
||||||
struct dtv_properties cmdseq = {.num = 1, .props = prop};
|
struct dtv_properties cmdseq = {.num = 1, .props = prop};
|
||||||
|
|
||||||
mp_verbose(log, "Querying tuner frontend type via DVBv5 API for frontend FD %d\n",
|
|
||||||
fe_fd);
|
|
||||||
prop[0].cmd = DTV_ENUM_DELSYS;
|
prop[0].cmd = DTV_ENUM_DELSYS;
|
||||||
if (ioctl(fe_fd, FE_GET_PROPERTY, &cmdseq) < 0) {
|
if (ioctl(fe_fd, FE_GET_PROPERTY, &cmdseq) < 0) {
|
||||||
mp_err(log, "DVBv5: FE_GET_PROPERTY(DTV_ENUM_DELSYS) error: %d, FD: %d\n\n", errno, fe_fd);
|
mp_err(log, "DVBv5: FE_GET_PROPERTY(DTV_ENUM_DELSYS) error: %d\n", errno);
|
||||||
return ret_mask;
|
return ret_mask;
|
||||||
}
|
}
|
||||||
unsigned int i, delsys_count = prop[0].u.buffer.len;
|
unsigned int i, delsys_count = prop[0].u.buffer.len;
|
||||||
mp_verbose(log, "DVBv5: Number of supported delivery systems: %d\n", delsys_count);
|
|
||||||
if (delsys_count == 0) {
|
if (delsys_count == 0) {
|
||||||
mp_err(log, "DVBv5: Frontend FD %d returned no delivery systems!\n", fe_fd);
|
mp_err(log, "DVBv5: Frontend returned no delivery systems!\n");
|
||||||
return ret_mask;
|
return ret_mask;
|
||||||
}
|
}
|
||||||
|
mp_verbose(log, "DVBv5: Number of supported delivery systems: %d\n", delsys_count);
|
||||||
for (i = 0; i < delsys_count; i++) {
|
for (i = 0; i < delsys_count; i++) {
|
||||||
delsys = (unsigned int)prop[0].u.buffer.data[i];
|
delsys = (unsigned int)prop[0].u.buffer.data[i];
|
||||||
DELSYS_SET(ret_mask, delsys);
|
DELSYS_SET(ret_mask, delsys);
|
||||||
mp_verbose(log, "DVBv5: Tuner frontend type seems to be %s\n", get_dvb_delsys(delsys));
|
mp_verbose(log, " %s\n", get_dvb_delsys(delsys));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret_mask;
|
return ret_mask;
|
||||||
|
@ -109,30 +107,27 @@ int dvb_open_devices(dvb_priv_t *priv, unsigned int adapter,
|
||||||
snprintf(frontend_dev, sizeof(frontend_dev), "/dev/dvb/adapter%u/frontend%u", adapter, frontend);
|
snprintf(frontend_dev, sizeof(frontend_dev), "/dev/dvb/adapter%u/frontend%u", adapter, frontend);
|
||||||
snprintf(dvr_dev, sizeof(dvr_dev), "/dev/dvb/adapter%u/dvr0", adapter);
|
snprintf(dvr_dev, sizeof(dvr_dev), "/dev/dvb/adapter%u/dvr0", adapter);
|
||||||
snprintf(demux_dev, sizeof(demux_dev), "/dev/dvb/adapter%u/demux0", adapter);
|
snprintf(demux_dev, sizeof(demux_dev), "/dev/dvb/adapter%u/demux0", adapter);
|
||||||
MP_VERBOSE(priv, "DVB_OPEN_DEVICES: frontend: %s\n", frontend_dev);
|
MP_VERBOSE(priv, "Opening frontend device %s\n", frontend_dev);
|
||||||
state->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
state->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||||
if (state->fe_fd < 0) {
|
if (state->fe_fd < 0) {
|
||||||
MP_ERR(priv, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n",
|
MP_ERR(priv, "Error opening frontend device: %d\n", errno);
|
||||||
frontend_dev, errno);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
state->demux_fds_cnt = 0;
|
state->demux_fds_cnt = 0;
|
||||||
MP_VERBOSE(priv, "DVB_OPEN_DEVICES(%d)\n", demux_cnt);
|
MP_VERBOSE(priv, "Opening %d demuxers\n", demux_cnt);
|
||||||
for (i = 0; i < demux_cnt; i++) {
|
for (i = 0; i < demux_cnt; i++) {
|
||||||
state->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
state->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||||
if (state->demux_fds[i] < 0) {
|
if (state->demux_fds[i] < 0) {
|
||||||
MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno);
|
MP_ERR(priv, "Error opening demux0: %d\n", errno);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
MP_VERBOSE(priv, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev,
|
|
||||||
state->demux_fds[i], state->demux_fds_cnt);
|
|
||||||
state->demux_fds_cnt++;
|
state->demux_fds_cnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state->dvr_fd = open(dvr_dev, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
state->dvr_fd = open(dvr_dev, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
|
||||||
if (state->dvr_fd < 0) {
|
if (state->dvr_fd < 0) {
|
||||||
MP_ERR(priv, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno);
|
MP_ERR(priv, "Error opening dvr device %s: %d\n", dvr_dev, errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +144,9 @@ int dvb_fix_demuxes(dvb_priv_t *priv, unsigned int cnt)
|
||||||
|
|
||||||
snprintf(demux_dev, sizeof(demux_dev), "/dev/dvb/adapter%d/demux0",
|
snprintf(demux_dev, sizeof(demux_dev), "/dev/dvb/adapter%d/demux0",
|
||||||
state->adapters[state->cur_adapter].devno);
|
state->adapters[state->cur_adapter].devno);
|
||||||
MP_VERBOSE(priv, "FIX %d -> %d\n", state->demux_fds_cnt, cnt);
|
MP_VERBOSE(priv, "Changing demuxer count %d -> %d\n", state->demux_fds_cnt, cnt);
|
||||||
if (state->demux_fds_cnt >= cnt) {
|
if (state->demux_fds_cnt >= cnt) {
|
||||||
for (i = state->demux_fds_cnt - 1; i >= (int)cnt; i--) {
|
for (i = state->demux_fds_cnt - 1; i >= (int)cnt; i--) {
|
||||||
MP_VERBOSE(priv, "FIX, CLOSE fd(%d): %d\n", i, state->demux_fds[i]);
|
|
||||||
close(state->demux_fds[i]);
|
close(state->demux_fds[i]);
|
||||||
}
|
}
|
||||||
state->demux_fds_cnt = cnt;
|
state->demux_fds_cnt = cnt;
|
||||||
|
@ -160,9 +154,8 @@ int dvb_fix_demuxes(dvb_priv_t *priv, unsigned int cnt)
|
||||||
for (i = state->demux_fds_cnt; i < cnt; i++) {
|
for (i = state->demux_fds_cnt; i < cnt; i++) {
|
||||||
state->demux_fds[i] = open(demux_dev,
|
state->demux_fds[i] = open(demux_dev,
|
||||||
O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
O_RDWR | O_NONBLOCK | O_CLOEXEC);
|
||||||
MP_VERBOSE(priv, "FIX, OPEN fd(%d): %d\n", i, state->demux_fds[i]);
|
|
||||||
if (state->demux_fds[i] < 0) {
|
if (state->demux_fds[i] < 0) {
|
||||||
MP_ERR(priv, "ERROR OPENING DEMUX 0: %d\n", errno);
|
MP_ERR(priv, "Error opening demux0: %d\n", errno);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
state->demux_fds_cnt++;
|
state->demux_fds_cnt++;
|
||||||
|
@ -187,19 +180,17 @@ int dvb_set_ts_filt(dvb_priv_t *priv, int fd, uint16_t pid,
|
||||||
{
|
{
|
||||||
int buffersize = 256 * 1024;
|
int buffersize = 256 * 1024;
|
||||||
if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0)
|
if (ioctl(fd, DMX_SET_BUFFER_SIZE, buffersize) < 0)
|
||||||
MP_ERR(priv, "ERROR IN DMX_SET_BUFFER_SIZE %i for fd %d: ERRNO: %d\n",
|
MP_ERR(priv, "Error in DMX_SET_BUFFER_SIZE %i: errno=%d\n",
|
||||||
pid, fd, errno);
|
pid, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) {
|
if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0) {
|
||||||
MP_ERR(priv, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d\n",
|
MP_ERR(priv, "Error in DMX_SET_PES_FILTER %i: errno=%d\n",
|
||||||
pid, fd, errno);
|
pid, errno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_VERBOSE(priv, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n",
|
|
||||||
pid, fd, i, errno);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,12 +212,12 @@ int dvb_get_pmt_pid(dvb_priv_t *priv, int devno, int service_id)
|
||||||
|
|
||||||
int pat_fd;
|
int pat_fd;
|
||||||
if ((pat_fd = open(demux_dev, O_RDWR)) < 0) {
|
if ((pat_fd = open(demux_dev, O_RDWR)) < 0) {
|
||||||
MP_ERR(priv, "Opening PAT DEMUX failed, error: %d", errno);
|
MP_ERR(priv, "Opening PAT demux failed: %d", errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ioctl(pat_fd, DMX_SET_FILTER, &fparams) < 0) {
|
if (ioctl(pat_fd, DMX_SET_FILTER, &fparams) < 0) {
|
||||||
MP_ERR(priv, "ioctl DMX_SET_FILTER failed, error: %d", errno);
|
MP_ERR(priv, "ioctl DMX_SET_FILTER failed: %d", errno);
|
||||||
close(pat_fd);
|
close(pat_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -245,7 +236,7 @@ int dvb_get_pmt_pid(dvb_priv_t *priv, int devno, int service_id)
|
||||||
sizeof(buft))) < 0) && errno == EOVERFLOW)
|
sizeof(buft))) < 0) && errno == EOVERFLOW)
|
||||||
bytes_read = read(pat_fd, bufptr, sizeof(buft));
|
bytes_read = read(pat_fd, bufptr, sizeof(buft));
|
||||||
if (bytes_read < 0) {
|
if (bytes_read < 0) {
|
||||||
MP_ERR(priv, "PAT: read_sections: read error: %d", errno);
|
MP_ERR(priv, "PAT: read error: %d", errno);
|
||||||
close(pat_fd);
|
close(pat_fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -394,16 +385,14 @@ static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo)
|
||||||
static int dvbv5_tune(dvb_priv_t *priv, int fd_frontend,
|
static int dvbv5_tune(dvb_priv_t *priv, int fd_frontend,
|
||||||
unsigned int delsys, struct dtv_properties* cmdseq)
|
unsigned int delsys, struct dtv_properties* cmdseq)
|
||||||
{
|
{
|
||||||
MP_VERBOSE(priv, "Tuning via S2API, channel is %s.\n",
|
|
||||||
get_dvb_delsys(delsys));
|
|
||||||
MP_VERBOSE(priv, "Dumping raw tuning commands and values:\n");
|
MP_VERBOSE(priv, "Dumping raw tuning commands and values:\n");
|
||||||
for (int i = 0; i < cmdseq->num; ++i) {
|
for (int i = 0; i < cmdseq->num; ++i) {
|
||||||
MP_VERBOSE(priv, "%02d: 0x%x(%d) => 0x%x(%d)\n",
|
MP_VERBOSE(priv, " %02d: 0x%x(%d) => 0x%x(%d)\n",
|
||||||
i, cmdseq->props[i].cmd, cmdseq->props[i].cmd,
|
i, cmdseq->props[i].cmd, cmdseq->props[i].cmd,
|
||||||
cmdseq->props[i].u.data, cmdseq->props[i].u.data);
|
cmdseq->props[i].u.data, cmdseq->props[i].u.data);
|
||||||
}
|
}
|
||||||
if (ioctl(fd_frontend, FE_SET_PROPERTY, cmdseq) < 0) {
|
if (ioctl(fd_frontend, FE_SET_PROPERTY, cmdseq) < 0) {
|
||||||
MP_ERR(priv, "ERROR tuning channel\n");
|
MP_ERR(priv, "Error tuning channel\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -424,7 +413,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys,
|
||||||
int hi_lo = 0, bandwidth_hz = 0;
|
int hi_lo = 0, bandwidth_hz = 0;
|
||||||
dvb_state_t* state = priv->state;
|
dvb_state_t* state = priv->state;
|
||||||
|
|
||||||
MP_VERBOSE(priv, "TUNE_IT, fd_frontend %d, %s freq %lu, srate %lu, "
|
MP_VERBOSE(priv, "tune_it: fd_frontend %d, %s freq %lu, srate %lu, "
|
||||||
"pol %c, diseqc %u\n", fd_frontend,
|
"pol %c, diseqc %u\n", fd_frontend,
|
||||||
get_dvb_delsys(delsys),
|
get_dvb_delsys(delsys),
|
||||||
(long unsigned int)freq, (long unsigned int)srate,
|
(long unsigned int)freq, (long unsigned int)srate,
|
||||||
|
@ -516,7 +505,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys,
|
||||||
get_dvb_delsys(delsys), freq, modulation);
|
get_dvb_delsys(delsys), freq, modulation);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
MP_VERBOSE(priv, "Unknown FE type. Aborting\n");
|
MP_VERBOSE(priv, "Unknown FE type, aborting.\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +523,7 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys,
|
||||||
.props = p_clear
|
.props = p_clear
|
||||||
};
|
};
|
||||||
if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear) < 0) {
|
if (ioctl(fd_frontend, FE_SET_PROPERTY, &cmdseq_clear) < 0) {
|
||||||
MP_ERR(priv, "FE_SET_PROPERTY DTV_CLEAR failed\n");
|
MP_ERR(priv, "DTV_CLEAR failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tune. */
|
/* Tune. */
|
||||||
|
@ -634,12 +623,12 @@ static int tune_it(dvb_priv_t *priv, int fd_frontend, unsigned int delsys,
|
||||||
|
|
||||||
int tune_status = check_status(priv, fd_frontend, timeout);
|
int tune_status = check_status(priv, fd_frontend, timeout);
|
||||||
if (tune_status != 0) {
|
if (tune_status != 0) {
|
||||||
MP_ERR(priv, "ERROR locking to channel\n");
|
MP_ERR(priv, "Error locking to channel\n");
|
||||||
}
|
}
|
||||||
return tune_status;
|
return tune_status;
|
||||||
|
|
||||||
error_tune:
|
error_tune:
|
||||||
MP_ERR(priv, "ERROR tuning channel\n");
|
MP_ERR(priv, "Error tuning channel\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,7 +641,7 @@ int dvb_tune(dvb_priv_t *priv, unsigned int delsys,
|
||||||
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier,
|
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier,
|
||||||
int timeout)
|
int timeout)
|
||||||
{
|
{
|
||||||
MP_INFO(priv, "dvb_tune %s Freq: %lu\n",
|
MP_INFO(priv, "Tuning to %s frequency %lu Hz\n",
|
||||||
get_dvb_delsys(delsys), (long unsigned int) freq);
|
get_dvb_delsys(delsys), (long unsigned int) freq);
|
||||||
|
|
||||||
dvb_state_t* state = priv->state;
|
dvb_state_t* state = priv->state;
|
||||||
|
@ -663,7 +652,7 @@ int dvb_tune(dvb_priv_t *priv, unsigned int delsys,
|
||||||
bandWidth, LP_CodeRate, hier, timeout);
|
bandWidth, LP_CodeRate, hier, timeout);
|
||||||
|
|
||||||
if (ris != 0)
|
if (ris != 0)
|
||||||
MP_INFO(priv, "dvb_tune, TUNING FAILED\n");
|
MP_INFO(priv, "Tuning failed\n");
|
||||||
|
|
||||||
return ris == 0;
|
return ris == 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,10 +277,10 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log,
|
||||||
const char *vdr_conf =
|
const char *vdr_conf =
|
||||||
"%d:%255[^:]:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%*255[^:]:%d:%*d:%*d:%*d\n%n";
|
"%d:%255[^:]:%255[^:]:%d:%255[^:]:%255[^:]:%255[^:]:%*255[^:]:%d:%*d:%*d:%*d\n%n";
|
||||||
|
|
||||||
mp_verbose(log, "CONFIG_READ FILE: %s, type: %s\n",
|
mp_verbose(log, "Reading config file %s for type %s\n",
|
||||||
filename, get_dvb_delsys(delsys));
|
filename, get_dvb_delsys(delsys));
|
||||||
if ((f = fopen(filename, "r")) == NULL) {
|
if ((f = fopen(filename, "r")) == NULL) {
|
||||||
mp_fatal(log, "CAN'T READ CONFIG FILE %s\n", filename);
|
mp_fatal(log, "Can't open file %s\n", filename);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -619,7 +619,7 @@ static dvb_channels_list_t *dvb_get_channels(struct mp_log *log,
|
||||||
}
|
}
|
||||||
if (!DELSYS_IS_SET(delsys_mask, delsys))
|
if (!DELSYS_IS_SET(delsys_mask, delsys))
|
||||||
continue; /* Skip channel. */
|
continue; /* Skip channel. */
|
||||||
mp_verbose(log, "Switched to delivery system for ATSC: %s (guessed from modulation).\n",
|
mp_verbose(log, "Switched to delivery system for ATSC: %s (guessed from modulation)\n",
|
||||||
get_dvb_delsys(delsys));
|
get_dvb_delsys(delsys));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -720,7 +720,7 @@ static int dvb_streaming_read(stream_t *stream, void *buffer, int size)
|
||||||
pfds[0].fd = fd;
|
pfds[0].fd = fd;
|
||||||
pfds[0].events = POLLIN | POLLPRI;
|
pfds[0].events = POLLIN | POLLPRI;
|
||||||
if (poll(pfds, 1, 2000) <= 0) {
|
if (poll(pfds, 1, 2000) <= 0) {
|
||||||
MP_ERR(stream, "dvb_streaming_read, failed with "
|
MP_ERR(stream, "dvb_streaming_read: failed with "
|
||||||
"errno %d when reading %d bytes\n", errno, size - pos);
|
"errno %d when reading %d bytes\n", errno, size - pos);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -728,11 +728,11 @@ static int dvb_streaming_read(stream_t *stream, void *buffer, int size)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pos += rk;
|
pos += rk;
|
||||||
MP_TRACE(stream, "ret (%d) bytes\n", pos);
|
MP_TRACE(stream, "got %d bytes\n", pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pos)
|
if (!pos)
|
||||||
MP_ERR(stream, "dvb_streaming_read, return 0 bytes\n");
|
MP_ERR(stream, "dvb_streaming_read: returning 0 bytes\n");
|
||||||
|
|
||||||
// Check if config parameters have been updated.
|
// Check if config parameters have been updated.
|
||||||
dvb_update_config(stream);
|
dvb_update_config(stream);
|
||||||
|
@ -750,19 +750,10 @@ int dvb_set_channel(stream_t *stream, unsigned int adapter, unsigned int n)
|
||||||
int devno;
|
int devno;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (adapter >= state->adapters_count) {
|
assert(adapter < state->adapters_count);
|
||||||
MP_ERR(stream, "dvb_set_channel: INVALID internal ADAPTER NUMBER: %d vs %d, abort\n",
|
|
||||||
adapter, state->adapters_count);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
devno = state->adapters[adapter].devno;
|
devno = state->adapters[adapter].devno;
|
||||||
new_list = state->adapters[adapter].list;
|
new_list = state->adapters[adapter].list;
|
||||||
if (n > new_list->NUM_CHANNELS) {
|
assert(n < new_list->NUM_CHANNELS);
|
||||||
MP_ERR(stream, "dvb_set_channel: INVALID CHANNEL NUMBER: %d, for "
|
|
||||||
"adapter %d, abort\n", n, devno);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
channel = &(new_list->channels[n]);
|
channel = &(new_list->channels[n]);
|
||||||
|
|
||||||
if (state->is_on) { //the fds are already open and we have to stop the demuxers
|
if (state->is_on) { //the fds are already open and we have to stop the demuxers
|
||||||
|
@ -776,8 +767,8 @@ int dvb_set_channel(stream_t *stream, unsigned int adapter, unsigned int n)
|
||||||
state->cur_frontend != channel->frontend) {
|
state->cur_frontend != channel->frontend) {
|
||||||
dvbin_close(stream);
|
dvbin_close(stream);
|
||||||
if (!dvb_open_devices(priv, devno, channel->frontend, channel->pids_cnt)) {
|
if (!dvb_open_devices(priv, devno, channel->frontend, channel->pids_cnt)) {
|
||||||
MP_ERR(stream, "DVB_SET_CHANNEL, COULDN'T OPEN DEVICES OF "
|
MP_ERR(stream, "dvb_set_channel: couldn't open devices of adapter "
|
||||||
"ADAPTER: %d, EXIT\n", devno);
|
"%d\n", devno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -788,16 +779,16 @@ int dvb_set_channel(stream_t *stream, unsigned int adapter, unsigned int n)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!dvb_open_devices(priv, devno, channel->frontend, channel->pids_cnt)) {
|
if (!dvb_open_devices(priv, devno, channel->frontend, channel->pids_cnt)) {
|
||||||
MP_ERR(stream, "DVB_SET_CHANNEL2, COULDN'T OPEN DEVICES OF "
|
MP_ERR(stream, "dvb_set_channel: couldn't open devices of adapter "
|
||||||
"ADAPTER: %d, EXIT\n", devno);
|
"%d\n", devno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state->retry = 5;
|
state->retry = 5;
|
||||||
new_list->current = n;
|
new_list->current = n;
|
||||||
MP_VERBOSE(stream, "DVB_SET_CHANNEL: new channel name=%s, adapter: %d, "
|
MP_VERBOSE(stream, "dvb_set_channel: new channel name=\"%s\", adapter: %d, "
|
||||||
"channel %d\n", channel->name, devno, n);
|
"channel: %d\n", channel->name, devno, n);
|
||||||
|
|
||||||
if (channel->freq != state->last_freq) {
|
if (channel->freq != state->last_freq) {
|
||||||
if (!dvb_tune(priv, channel->delsys, channel->freq,
|
if (!dvb_tune(priv, channel->delsys, channel->freq,
|
||||||
|
@ -819,12 +810,11 @@ int dvb_set_channel(stream_t *stream, unsigned int adapter, unsigned int n)
|
||||||
If it has not yet beem resolved, do it now. */
|
If it has not yet beem resolved, do it now. */
|
||||||
for (i = 0; i < channel->pids_cnt; i++) {
|
for (i = 0; i < channel->pids_cnt; i++) {
|
||||||
if (channel->pids[i] == -1) {
|
if (channel->pids[i] == -1) {
|
||||||
MP_VERBOSE(stream, "DVB_SET_CHANNEL: PMT-PID for service %d "
|
MP_VERBOSE(stream, "dvb_set_channel: PMT-PID for service %d "
|
||||||
"not resolved yet, parsing PAT...\n",
|
"not resolved yet, parsing PAT...\n",
|
||||||
channel->service_id);
|
channel->service_id);
|
||||||
int pmt_pid = dvb_get_pmt_pid(priv, adapter, channel->service_id);
|
int pmt_pid = dvb_get_pmt_pid(priv, adapter, channel->service_id);
|
||||||
MP_VERBOSE(stream, "DVB_SET_CHANNEL: Found PMT-PID: %d\n",
|
MP_VERBOSE(stream, "found PMT-PID: %d\n", pmt_pid);
|
||||||
pmt_pid);
|
|
||||||
channel->pids[i] = pmt_pid;
|
channel->pids[i] = pmt_pid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -834,8 +824,8 @@ int dvb_set_channel(stream_t *stream, unsigned int adapter, unsigned int n)
|
||||||
for (i = 0; i < channel->pids_cnt; i++) {
|
for (i = 0; i < channel->pids_cnt; i++) {
|
||||||
if (channel->pids[i] == -1) {
|
if (channel->pids[i] == -1) {
|
||||||
// In case PMT was not resolved, skip it here.
|
// In case PMT was not resolved, skip it here.
|
||||||
MP_ERR(stream, "DVB_SET_CHANNEL: PMT-PID not found, "
|
MP_ERR(stream, "dvb_set_channel: PMT-PID not found, "
|
||||||
"teletext-decoding may fail.\n");
|
"teletext decoding may fail.\n");
|
||||||
} else {
|
} else {
|
||||||
if (!dvb_set_ts_filt(priv, state->demux_fds[i], channel->pids[i],
|
if (!dvb_set_ts_filt(priv, state->demux_fds[i], channel->pids[i],
|
||||||
DMX_PES_OTHER))
|
DMX_PES_OTHER))
|
||||||
|
@ -884,8 +874,6 @@ void dvbin_close(stream_t *stream)
|
||||||
|
|
||||||
for (int i = state->demux_fds_cnt - 1; i >= 0; i--) {
|
for (int i = state->demux_fds_cnt - 1; i >= 0; i--) {
|
||||||
state->demux_fds_cnt--;
|
state->demux_fds_cnt--;
|
||||||
MP_VERBOSE(stream, "DVBIN_CLOSE, close(%d), fd=%d, COUNT=%d\n", i,
|
|
||||||
state->demux_fds[i], state->demux_fds_cnt);
|
|
||||||
close(state->demux_fds[i]);
|
close(state->demux_fds[i]);
|
||||||
}
|
}
|
||||||
close(state->dvr_fd);
|
close(state->dvr_fd);
|
||||||
|
@ -911,8 +899,6 @@ static int dvb_streaming_start(stream_t *stream, char *progname)
|
||||||
|
|
||||||
if (progname == NULL)
|
if (progname == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
MP_VERBOSE(stream, "\r\ndvb_streaming_start(PROG: %s, ADAPTER: %d)\n",
|
|
||||||
progname, priv->devno);
|
|
||||||
|
|
||||||
list = state->adapters[state->cur_adapter].list;
|
list = state->adapters[state->cur_adapter].list;
|
||||||
for (i = 0; i < list->NUM_CHANNELS; i ++) {
|
for (i = 0; i < list->NUM_CHANNELS; i ++) {
|
||||||
|
@ -923,7 +909,7 @@ static int dvb_streaming_start(stream_t *stream, char *progname)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel == NULL) {
|
if (channel == NULL) {
|
||||||
MP_ERR(stream, "\n\nDVBIN: no such channel \"%s\"\n\n", progname);
|
MP_ERR(stream, "no such channel \"%s\"\n", progname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -934,17 +920,14 @@ static int dvb_streaming_start(stream_t *stream, char *progname)
|
||||||
list->current = (list->NUM_CHANNELS + list->current + priv->opts->cfg_channel_switch_offset) % list->NUM_CHANNELS;
|
list->current = (list->NUM_CHANNELS + list->current + priv->opts->cfg_channel_switch_offset) % list->NUM_CHANNELS;
|
||||||
channel = &(list->channels[list->current]);
|
channel = &(list->channels[list->current]);
|
||||||
MP_INFO(stream, "Tuning to channel \"%s\"...\n", channel->name);
|
MP_INFO(stream, "Tuning to channel \"%s\"...\n", channel->name);
|
||||||
MP_VERBOSE(stream, "PROGRAM NUMBER %d: name=%s, freq=%u\n", i,
|
MP_VERBOSE(stream, "Program number %d: name=\"%s\", freq=%u\n", i,
|
||||||
channel->name, channel->freq);
|
channel->name, channel->freq);
|
||||||
|
|
||||||
if (!dvb_set_channel(stream, state->cur_adapter, list->current)) {
|
if (!dvb_set_channel(stream, state->cur_adapter, list->current)) {
|
||||||
MP_ERR(stream, "ERROR, COULDN'T SET CHANNEL %i: \"%s\"\n", list->current, progname);
|
|
||||||
dvbin_close(stream);
|
dvbin_close(stream);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_VERBOSE(stream, "SUCCESSFUL EXIT from dvb_streaming_start\n");
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -979,8 +962,6 @@ void dvb_update_config(stream_t *stream)
|
||||||
|
|
||||||
static int dvb_open(stream_t *stream)
|
static int dvb_open(stream_t *stream)
|
||||||
{
|
{
|
||||||
// I don't force the file format because, although it's almost always TS,
|
|
||||||
// there are some providers that stream an IP multicast with M$ Mpeg4 inside
|
|
||||||
dvb_priv_t *priv = NULL;
|
dvb_priv_t *priv = NULL;
|
||||||
|
|
||||||
pthread_mutex_lock(&global_dvb_state_lock);
|
pthread_mutex_lock(&global_dvb_state_lock);
|
||||||
|
@ -1001,7 +982,7 @@ static int dvb_open(stream_t *stream)
|
||||||
priv->state = state;
|
priv->state = state;
|
||||||
priv->log = stream->log;
|
priv->log = stream->log;
|
||||||
if (state == NULL) {
|
if (state == NULL) {
|
||||||
MP_ERR(stream, "DVB CONFIGURATION IS EMPTY, exit\n");
|
MP_ERR(stream, "DVB configuration is empty\n");
|
||||||
pthread_mutex_unlock(&global_dvb_state_lock);
|
pthread_mutex_unlock(&global_dvb_state_lock);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
@ -1020,9 +1001,6 @@ static int dvb_open(stream_t *stream)
|
||||||
|
|
||||||
state->cur_frontend = -1;
|
state->cur_frontend = -1;
|
||||||
|
|
||||||
MP_VERBOSE(stream, "OPEN_DVB: prog=%s, devno=%d\n",
|
|
||||||
priv->prog, state->adapters[state->cur_adapter].devno);
|
|
||||||
|
|
||||||
if (!dvb_streaming_start(stream, priv->prog))
|
if (!dvb_streaming_start(stream, priv->prog))
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1057,7 @@ int dvb_parse_path(stream_t *stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state->cur_adapter == -1) {
|
if (state->cur_adapter == -1) {
|
||||||
MP_ERR(stream, "NO CONFIGURATION FOUND FOR ADAPTER N. %d!\n",
|
MP_ERR(stream, "No configuration found for adapter %d!\n",
|
||||||
priv->devno);
|
priv->devno);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1100,7 +1078,7 @@ int dvb_parse_path(stream_t *stream)
|
||||||
priv->prog = talloc_strdup(priv, state->adapters[state->cur_adapter].list->channels[0].name);
|
priv->prog = talloc_strdup(priv, state->adapters[state->cur_adapter].list->channels[0].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
MP_VERBOSE(stream, "DVB_CONFIG: prog=%s, devno=%d\n",
|
MP_VERBOSE(stream, "dvb_config: prog=\"%s\", devno=%d\n",
|
||||||
priv->prog, priv->devno);
|
priv->prog, priv->devno);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1133,7 +1111,6 @@ dvb_state_t *dvb_get_state(stream_t *stream)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mp_verbose(log, "Opened device %s, FD: %d\n", filename, fd);
|
|
||||||
delsys_mask[f] = dvb_get_tuner_delsys_mask(fd, log);
|
delsys_mask[f] = dvb_get_tuner_delsys_mask(fd, log);
|
||||||
delsys_mask[f] &= DELSYS_SUPP_MASK; /* Filter unsupported delivery systems. */
|
delsys_mask[f] &= DELSYS_SUPP_MASK; /* Filter unsupported delivery systems. */
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -1142,8 +1119,6 @@ dvb_state_t *dvb_get_state(stream_t *stream)
|
||||||
filename);
|
filename);
|
||||||
continue; /* Skip tuner. */
|
continue; /* Skip tuner. */
|
||||||
}
|
}
|
||||||
mp_verbose(log, "Frontend device %s offers some supported delivery systems.\n",
|
|
||||||
filename);
|
|
||||||
/* Create channel list for adapter. */
|
/* Create channel list for adapter. */
|
||||||
for (delsys = 0; delsys < SYS_DVB__COUNT__; delsys++) {
|
for (delsys = 0; delsys < SYS_DVB__COUNT__; delsys++) {
|
||||||
if (!DELSYS_IS_SET(delsys_mask[f], delsys))
|
if (!DELSYS_IS_SET(delsys_mask[f], delsys))
|
||||||
|
|
Loading…
Reference in New Issue