mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
sys/dvb/gstdvbsrc.c: Make diseqc work more reliably.
Original commit message from CVS: * sys/dvb/gstdvbsrc.c: Make diseqc work more reliably.
This commit is contained in:
parent
ccf0b720ba
commit
4215e2643f
2 changed files with 102 additions and 93 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-03-27 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
||||||
|
|
||||||
|
* sys/dvb/gstdvbsrc.c:
|
||||||
|
Make diseqc work more reliably.
|
||||||
|
|
||||||
2008-03-26 Sebastian Dröge <slomo@circular-chaos.org>
|
2008-03-26 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* gst/nsf/Makefile.am:
|
* gst/nsf/Makefile.am:
|
||||||
|
|
|
@ -1134,7 +1134,8 @@ diseqc_send_msg (int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
|
||||||
GST_ERROR ("Sending diseqc command failed");
|
GST_ERROR ("Sending diseqc command failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//usleep (cmd->wait * 1000);
|
|
||||||
|
usleep (cmd->wait * 1000);
|
||||||
usleep (15 * 1000);
|
usleep (15 * 1000);
|
||||||
|
|
||||||
if (ioctl (fd, FE_DISEQC_SEND_BURST, b) == -1) {
|
if (ioctl (fd, FE_DISEQC_SEND_BURST, b) == -1) {
|
||||||
|
@ -1181,9 +1182,9 @@ gst_dvbsrc_tune (GstDvbSrc * object)
|
||||||
struct dvb_frontend_parameters feparams;
|
struct dvb_frontend_parameters feparams;
|
||||||
#endif
|
#endif
|
||||||
fe_sec_voltage_t voltage;
|
fe_sec_voltage_t voltage;
|
||||||
int i;
|
|
||||||
fe_status_t status;
|
fe_status_t status;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
unsigned int freq = object->freq;
|
unsigned int freq = object->freq;
|
||||||
unsigned int sym_rate = object->sym_rate * 1000;
|
unsigned int sym_rate = object->sym_rate * 1000;
|
||||||
|
|
||||||
|
@ -1203,107 +1204,110 @@ gst_dvbsrc_tune (GstDvbSrc * object)
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_dvbsrc_unset_pes_filters (object);
|
gst_dvbsrc_unset_pes_filters (object);
|
||||||
|
for (j = 0; j < 5; j++) {
|
||||||
switch (object->adapter_type) {
|
switch (object->adapter_type) {
|
||||||
case FE_QPSK:
|
case FE_QPSK:
|
||||||
object->tone = SEC_TONE_OFF;
|
object->tone = SEC_TONE_OFF;
|
||||||
if (freq > 2200000) {
|
if (freq > 2200000) {
|
||||||
// this must be an absolute frequency
|
// this must be an absolute frequency
|
||||||
if (freq < SLOF) {
|
if (freq < SLOF) {
|
||||||
feparams.frequency = (freq - LOF1);
|
feparams.frequency = (freq - LOF1);
|
||||||
|
} else {
|
||||||
|
feparams.frequency = (freq - LOF2);
|
||||||
|
object->tone = SEC_TONE_ON;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
feparams.frequency = (freq - LOF2);
|
// this is an L-Band frequency
|
||||||
object->tone = SEC_TONE_ON;
|
feparams.frequency = freq;
|
||||||
}
|
}
|
||||||
} else {
|
feparams.inversion = INVERSION_AUTO;
|
||||||
// this is an L-Band frequency
|
GST_DEBUG_OBJECT (object, "api version %d.%d", DVB_API_VERSION,
|
||||||
|
DVB_API_VERSION_MINOR);
|
||||||
|
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
||||||
|
GST_DEBUG_OBJECT (object, "using multiproto driver");
|
||||||
|
feparams.delsys.dvbs.symbol_rate = sym_rate;
|
||||||
|
feparams.delsys.dvbs.fec = object->code_rate_hp;
|
||||||
|
#else
|
||||||
|
feparams.u.qpsk.symbol_rate = sym_rate;
|
||||||
|
feparams.u.qpsk.fec_inner = object->code_rate_hp;
|
||||||
|
#endif
|
||||||
|
GST_INFO_OBJECT (object,
|
||||||
|
"tuning DVB-S to L-Band:%u, Pol:%d, srate=%u, 22kHz=%s",
|
||||||
|
feparams.frequency, object->pol, sym_rate,
|
||||||
|
object->tone == SEC_TONE_ON ? "on" : "off");
|
||||||
|
|
||||||
|
if (object->pol == DVB_POL_H)
|
||||||
|
voltage = SEC_VOLTAGE_18;
|
||||||
|
else
|
||||||
|
voltage = SEC_VOLTAGE_13;
|
||||||
|
|
||||||
|
if (object->diseqc_src == -1 || object->send_diseqc == FALSE) {
|
||||||
|
if (ioctl (object->fd_frontend, FE_SET_VOLTAGE, voltage) < 0) {
|
||||||
|
g_warning ("Unable to set voltage on dvb frontend device");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ioctl (object->fd_frontend, FE_SET_TONE, object->tone) < 0) {
|
||||||
|
g_warning ("Error setting tone: %s", strerror (errno));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GST_DEBUG_OBJECT (object, "Sending DISEqC");
|
||||||
|
diseqc (object->fd_frontend, object->diseqc_src, voltage,
|
||||||
|
object->tone);
|
||||||
|
/* Once diseqc source is set, do not set it again until
|
||||||
|
* app decides to change it */
|
||||||
|
//object->send_diseqc = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case FE_OFDM:
|
||||||
|
|
||||||
feparams.frequency = freq;
|
feparams.frequency = freq;
|
||||||
}
|
|
||||||
feparams.inversion = INVERSION_AUTO;
|
|
||||||
GST_DEBUG_OBJECT (object, "api version %d.%d", DVB_API_VERSION,
|
|
||||||
DVB_API_VERSION_MINOR);
|
|
||||||
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
|
||||||
GST_DEBUG_OBJECT (object, "using multiproto driver");
|
|
||||||
feparams.delsys.dvbs.symbol_rate = sym_rate;
|
|
||||||
feparams.delsys.dvbs.fec = object->code_rate_hp;
|
|
||||||
#else
|
|
||||||
feparams.u.qpsk.symbol_rate = sym_rate;
|
|
||||||
feparams.u.qpsk.fec_inner = object->code_rate_hp;
|
|
||||||
#endif
|
|
||||||
GST_INFO_OBJECT (object,
|
|
||||||
"tuning DVB-S to L-Band:%u, Pol:%d, srate=%u, 22kHz=%s",
|
|
||||||
feparams.frequency, object->pol, sym_rate,
|
|
||||||
object->tone == SEC_TONE_ON ? "on" : "off");
|
|
||||||
|
|
||||||
if (object->pol == DVB_POL_H)
|
|
||||||
voltage = SEC_VOLTAGE_18;
|
|
||||||
else
|
|
||||||
voltage = SEC_VOLTAGE_13;
|
|
||||||
|
|
||||||
if (object->diseqc_src == -1 || object->send_diseqc == FALSE) {
|
|
||||||
if (ioctl (object->fd_frontend, FE_SET_VOLTAGE, voltage) < 0) {
|
|
||||||
g_warning ("Unable to set voltage on dvb frontend device");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ioctl (object->fd_frontend, FE_SET_TONE, object->tone) < 0) {
|
|
||||||
g_warning ("Error setting tone: %s", strerror (errno));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
GST_DEBUG_OBJECT (object, "Sending DISEqC");
|
|
||||||
diseqc (object->fd_frontend, object->diseqc_src, voltage, object->tone);
|
|
||||||
/* Once diseqc source is set, do not set it again until
|
|
||||||
* app decides to change it */
|
|
||||||
object->send_diseqc = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case FE_OFDM:
|
|
||||||
|
|
||||||
feparams.frequency = freq;
|
|
||||||
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
||||||
#else
|
#else
|
||||||
feparams.u.ofdm.bandwidth = object->bandwidth;
|
feparams.u.ofdm.bandwidth = object->bandwidth;
|
||||||
feparams.u.ofdm.code_rate_HP = object->code_rate_hp;
|
feparams.u.ofdm.code_rate_HP = object->code_rate_hp;
|
||||||
feparams.u.ofdm.code_rate_LP = object->code_rate_lp;
|
feparams.u.ofdm.code_rate_LP = object->code_rate_lp;
|
||||||
feparams.u.ofdm.constellation = object->modulation;
|
feparams.u.ofdm.constellation = object->modulation;
|
||||||
feparams.u.ofdm.transmission_mode = object->transmission_mode;
|
feparams.u.ofdm.transmission_mode = object->transmission_mode;
|
||||||
feparams.u.ofdm.guard_interval = object->guard_interval;
|
feparams.u.ofdm.guard_interval = object->guard_interval;
|
||||||
feparams.u.ofdm.hierarchy_information = object->hierarchy_information;
|
feparams.u.ofdm.hierarchy_information = object->hierarchy_information;
|
||||||
#endif
|
#endif
|
||||||
feparams.inversion = object->inversion;
|
feparams.inversion = object->inversion;
|
||||||
|
|
||||||
GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq);
|
GST_INFO_OBJECT (object, "tuning DVB-T to %d Hz\n", freq);
|
||||||
break;
|
break;
|
||||||
case FE_QAM:
|
case FE_QAM:
|
||||||
GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq, sym_rate);
|
GST_INFO_OBJECT (object, "Tuning DVB-C to %d, srate=%d", freq,
|
||||||
feparams.frequency = freq;
|
sym_rate);
|
||||||
feparams.inversion = object->inversion;
|
feparams.frequency = freq;
|
||||||
feparams.u.qam.fec_inner = object->code_rate_hp;
|
feparams.inversion = object->inversion;
|
||||||
feparams.u.qam.modulation = object->modulation;
|
feparams.u.qam.fec_inner = object->code_rate_hp;
|
||||||
feparams.u.qam.symbol_rate = sym_rate;
|
feparams.u.qam.modulation = object->modulation;
|
||||||
break;
|
feparams.u.qam.symbol_rate = sym_rate;
|
||||||
default:
|
break;
|
||||||
g_error ("Unknown frontend type: %d", object->adapter_type);
|
default:
|
||||||
|
g_error ("Unknown frontend type: %d", object->adapter_type);
|
||||||
|
|
||||||
}
|
}
|
||||||
usleep (100000);
|
|
||||||
/* now tune the frontend */
|
|
||||||
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
|
||||||
if (ioctl (object->fd_frontend, DVBFE_SET_PARAMS, &feparams) < 0) {
|
|
||||||
#else
|
|
||||||
if (ioctl (object->fd_frontend, FE_SET_FRONTEND, &feparams) < 0) {
|
|
||||||
#endif
|
|
||||||
g_warning ("Error tuning channel: %s", strerror (errno));
|
|
||||||
}
|
|
||||||
for (i = 0; i < 15; i++) {
|
|
||||||
usleep (100000);
|
usleep (100000);
|
||||||
if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) {
|
/* now tune the frontend */
|
||||||
perror ("FE_READ_STATUS");
|
#if DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR == 3
|
||||||
break;
|
if (ioctl (object->fd_frontend, DVBFE_SET_PARAMS, &feparams) < 0) {
|
||||||
|
#else
|
||||||
|
if (ioctl (object->fd_frontend, FE_SET_FRONTEND, &feparams) < 0) {
|
||||||
|
#endif
|
||||||
|
g_warning ("Error tuning channel: %s", strerror (errno));
|
||||||
}
|
}
|
||||||
if (status & FE_HAS_LOCK) {
|
for (i = 0; i < 5; i++) {
|
||||||
break;
|
usleep (100000);
|
||||||
|
if (ioctl (object->fd_frontend, FE_READ_STATUS, &status) == -1) {
|
||||||
|
perror ("FE_READ_STATUS");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
GST_LOG_OBJECT (object, "status == 0x%02x", status);
|
||||||
}
|
}
|
||||||
|
if (status & FE_HAS_LOCK)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (!(status & FE_HAS_LOCK))
|
if (!(status & FE_HAS_LOCK))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue