1
0
mirror of https://github.com/DigitalDevices/dddvb.git synced 2023-10-10 13:37:43 +02:00

TUNER_PAD_RF_INPUT and TUNER_PAD_OUTPUT are no longer used in kernels >5.2

use media_get_pad_index() function instead
This commit is contained in:
drmocm 2019-07-24 07:03:02 +02:00
parent e7f6f67a49
commit 31a833acfd

View File

@ -598,6 +598,7 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
unsigned demux_pad = 0; unsigned demux_pad = 0;
unsigned dvr_pad = 0; unsigned dvr_pad = 0;
unsigned ntuner = 0, ndemod = 0; unsigned ntuner = 0, ndemod = 0;
u16 source_pad = 0;
int ret; int ret;
static const char *connector_name = "Television"; static const char *connector_name = "Television";
@ -658,7 +659,18 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
if (ret) if (ret)
return ret; return ret;
if (!ntuner) if (!ntuner) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0))
if ((ret = media_get_pad_index(tuner, true,
PAD_SIGNAL_ANALOG)) < 0)
return ret;
source_pad = (u16) ret;
ret = 0;
#else
source_pad = TUNER_PAD_RF_INPUT;
#endif
ret = media_create_pad_links(mdev, ret = media_create_pad_links(mdev,
MEDIA_ENT_F_CONN_RF, MEDIA_ENT_F_CONN_RF,
conn, 0, conn, 0,
@ -666,22 +678,33 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
demod, 0, demod, 0,
MEDIA_LNK_FL_ENABLED, MEDIA_LNK_FL_ENABLED,
false); false);
else } else {
ret = media_create_pad_links(mdev, ret = media_create_pad_links(mdev,
MEDIA_ENT_F_CONN_RF, MEDIA_ENT_F_CONN_RF,
conn, 0, conn, 0,
MEDIA_ENT_F_TUNER, MEDIA_ENT_F_TUNER,
tuner, TUNER_PAD_RF_INPUT, tuner, source_pad,
MEDIA_LNK_FL_ENABLED, MEDIA_LNK_FL_ENABLED,
false); false);
}
if (ret) if (ret)
return ret; return ret;
} }
if (ntuner && ndemod) { if (ntuner && ndemod) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,2,0))
if ((ret = media_get_pad_index(tuner, true, PAD_SIGNAL_ANALOG)) < 0)
return ret;
source_pad = (u16) ret;
ret = 0;
#else
source_pad = TUNER_PAD_OUTPUT;
#endif
ret = media_create_pad_links(mdev, ret = media_create_pad_links(mdev,
MEDIA_ENT_F_TUNER, MEDIA_ENT_F_TUNER,
tuner, TUNER_PAD_OUTPUT, tuner, source_pad,
MEDIA_ENT_F_DTV_DEMOD, MEDIA_ENT_F_DTV_DEMOD,
demod, 0, MEDIA_LNK_FL_ENABLED, demod, 0, MEDIA_LNK_FL_ENABLED,
false); false);