Commit aa87371f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Linux DVB: migrate EN 50221 code

This needs testing (my DVB driver is not CI-capable).
parent 2b4266d1
...@@ -135,6 +135,11 @@ libdtv_plugin_la_DEPENDENCIES = ...@@ -135,6 +135,11 @@ libdtv_plugin_la_DEPENDENCIES =
if HAVE_LINUX if HAVE_LINUX
libdtv_plugin_la_SOURCES += dtv/linux.c libdtv_plugin_la_SOURCES += dtv/linux.c
if HAVE_DVBPSI
libdtv_plugin_la_SOURCES += dtv/en50221.c dtv/en50221.h
libdtv_plugin_la_CFLAGS += -DHAVE_DVBPSI $(DVBPSI_CFLAGS)
libdtv_plugin_la_LIBADD += $(DVBPSI_LIBS)
endif
libvlc_LTLIBRARIES += libdtv_plugin.la libvlc_LTLIBRARIES += libdtv_plugin.la
endif endif
......
...@@ -43,6 +43,11 @@ const delsys_t *dvb_guess_system (dvb_device_t *); ...@@ -43,6 +43,11 @@ const delsys_t *dvb_guess_system (dvb_device_t *);
float dvb_get_signal_strength (dvb_device_t *); float dvb_get_signal_strength (dvb_device_t *);
float dvb_get_snr (dvb_device_t *); float dvb_get_snr (dvb_device_t *);
#ifdef HAVE_DVBPSI
struct dvbpsi_pmt_s;
void dvb_set_ca_pmt (dvb_device_t *, struct dvbpsi_pmt_s *);
#endif
int dvb_set_inversion (dvb_device_t *, int); int dvb_set_inversion (dvb_device_t *, int);
int dvb_tune (dvb_device_t *); int dvb_tune (dvb_device_t *);
......
...@@ -50,13 +50,13 @@ ...@@ -50,13 +50,13 @@
# include <dvbpsi/demux.h> # include <dvbpsi/demux.h>
# include <dvbpsi/sdt.h> # include <dvbpsi/sdt.h>
#undef ENABLE_HTTPD
#ifdef ENABLE_HTTPD #ifdef ENABLE_HTTPD
# include <vlc_httpd.h> # include <vlc_httpd.h>
#endif #endif
#include "dvb.h" #include "../demux/dvb-text.h"
#include "../../demux/dvb-text.h" #include "dtv/en50221.h"
#include "en50221.h"
typedef struct en50221_session_t typedef struct en50221_session_t
{ {
......
...@@ -24,10 +24,11 @@ ...@@ -24,10 +24,11 @@
*****************************************************************************/ *****************************************************************************/
typedef struct cam cam_t; typedef struct cam cam_t;
struct dvbpsi_pmt_s;
cam_t *en50221_Init( vlc_object_t *, int fd ); cam_t *en50221_Init( vlc_object_t *, int fd );
void en50221_Poll( cam_t * ); void en50221_Poll( cam_t * );
int en50221_SetCAPMT( cam_t *, dvbpsi_pmt_t * ); int en50221_SetCAPMT( cam_t *, struct dvbpsi_pmt_s * );
char *en50221_Status( cam_t *, char *req ); char *en50221_Status( cam_t *, char *req );
void en50221_End( cam_t * ); void en50221_End( cam_t * );
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
#include <linux/dvb/dmx.h> #include <linux/dvb/dmx.h>
#include "dtv/dtv.h" #include "dtv/dtv.h"
#ifdef HAVE_DVBPSI
# include "dtv/en50221.h"
#endif
#ifndef O_SEARCH #ifndef O_SEARCH
# define O_SEARCH O_RDONLY # define O_SEARCH O_RDONLY
...@@ -179,7 +182,9 @@ struct dvb_device ...@@ -179,7 +182,9 @@ struct dvb_device
uint16_t pid; uint16_t pid;
} pids[MAX_PIDS]; } pids[MAX_PIDS];
#endif #endif
int ca; #ifdef HAVE_DVBPSI
cam_t *cam;
#endif
struct dvb_frontend_info info; struct dvb_frontend_info info;
bool budget; bool budget;
//size_t buffer_size; //size_t buffer_size;
...@@ -209,7 +214,9 @@ dvb_device_t *dvb_open (vlc_object_t *obj, bool tune) ...@@ -209,7 +214,9 @@ dvb_device_t *dvb_open (vlc_object_t *obj, bool tune)
d->obj = obj; d->obj = obj;
d->frontend = -1; d->frontend = -1;
d->ca = -1; #ifdef HAVE_DVBPSI
d->cam = NULL;
#endif
d->budget = var_InheritBool (obj, "dvb-budget-mode"); d->budget = var_InheritBool (obj, "dvb-budget-mode");
#ifndef USE_DMX #ifndef USE_DMX
...@@ -290,10 +297,17 @@ dvb_device_t *dvb_open (vlc_object_t *obj, bool tune) ...@@ -290,10 +297,17 @@ dvb_device_t *dvb_open (vlc_object_t *obj, bool tune)
msg_Dbg (obj, " (%"PRIu32" tolerance)", msg_Dbg (obj, " (%"PRIu32" tolerance)",
d->info.symbol_rate_tolerance); d->info.symbol_rate_tolerance);
d->ca = dvb_open_node (dirfd, device, "ca", O_RDWR); #ifdef HAVE_DVBPSI
if (d->ca == -1) int ca = dvb_open_node (dirfd, device, "ca", O_RDWR);
if (ca != -1)
{
d->cam = en50221_Init (obj, ca);
if (d->cam == NULL)
close (ca);
}
else
msg_Dbg (obj, "conditional access module not available (%m)"); msg_Dbg (obj, "conditional access module not available (%m)");
#endif
} }
close (dirfd); close (dirfd);
return d; return d;
...@@ -315,8 +329,10 @@ void dvb_close (dvb_device_t *d) ...@@ -315,8 +329,10 @@ void dvb_close (dvb_device_t *d)
close (d->pids[i].fd); close (d->pids[i].fd);
} }
#endif #endif
if (d->ca != -1) #ifdef HAVE_DVBPSI
close (d->ca); if (d->cam != NULL)
en50221_End (d->cam);
#endif
if (d->frontend != -1) if (d->frontend != -1)
close (d->frontend); close (d->frontend);
close (d->demux); close (d->demux);
...@@ -332,6 +348,11 @@ ssize_t dvb_read (dvb_device_t *d, void *buf, size_t len) ...@@ -332,6 +348,11 @@ ssize_t dvb_read (dvb_device_t *d, void *buf, size_t len)
struct pollfd ufd[2]; struct pollfd ufd[2];
int n; int n;
#ifdef HAVE_DVBPSI
if (d->cam != NULL)
en50221_Poll (d->cam);
#endif
ufd[0].fd = d->demux; ufd[0].fd = d->demux;
ufd[0].events = POLLIN; ufd[0].events = POLLIN;
if (d->frontend != -1) if (d->frontend != -1)
...@@ -481,6 +502,14 @@ float dvb_get_snr (dvb_device_t *d) ...@@ -481,6 +502,14 @@ float dvb_get_snr (dvb_device_t *d)
return snr / 65535.; return snr / 65535.;
} }
#ifdef HAVE_DVBPSI
void dvb_set_ca_pmt (dvb_device_t *d, struct dvbpsi_pmt_s *pmt)
{
if (d->cam != NULL)
en50221_SetCAPMT (d->cam, pmt);
}
#endif
static int dvb_vset_props (dvb_device_t *d, size_t n, va_list ap) static int dvb_vset_props (dvb_device_t *d, size_t n, va_list ap)
{ {
struct dtv_property buf[n], *prop = buf; struct dtv_property buf[n], *prop = buf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment