2005-04-16 12:51:09 +00:00
|
|
|
/* Imported from the dvbstream project
|
|
|
|
*
|
2006-06-22 13:34:00 +00:00
|
|
|
* Modified for use with MPlayer, for details see the changelog at
|
|
|
|
* http://svn.mplayerhq.hu/mplayer/trunk/
|
2005-04-16 12:51:09 +00:00
|
|
|
* $Id$
|
|
|
|
*/
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_DVBIN_H
|
|
|
|
#define MPLAYER_DVBIN_H
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2010-01-04 18:58:35 +00:00
|
|
|
#include "config.h"
|
2003-08-11 00:02:46 +00:00
|
|
|
#include "stream.h"
|
|
|
|
|
2017-10-10 13:51:16 +00:00
|
|
|
#if !HAVE_GPL
|
|
|
|
#error GPL only
|
|
|
|
#endif
|
|
|
|
|
2015-01-06 19:19:49 +00:00
|
|
|
#define SLOF (11700 * 1000UL)
|
|
|
|
#define LOF1 (9750 * 1000UL)
|
|
|
|
#define LOF2 (10600 * 1000UL)
|
2006-07-14 22:07:05 +00:00
|
|
|
|
2010-06-21 14:39:24 +00:00
|
|
|
#include <inttypes.h>
|
2010-03-02 19:57:17 +00:00
|
|
|
#include <linux/dvb/dmx.h>
|
|
|
|
#include <linux/dvb/frontend.h>
|
2016-04-02 18:51:39 +00:00
|
|
|
#include <linux/dvb/video.h>
|
|
|
|
#include <linux/dvb/audio.h>
|
2010-03-02 19:57:17 +00:00
|
|
|
#include <linux/dvb/version.h>
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2017-12-15 12:37:30 +00:00
|
|
|
#define MAX_ADAPTERS 16
|
|
|
|
#define MAX_FRONTENDS 8
|
|
|
|
|
2005-01-06 09:43:10 +00:00
|
|
|
#undef DVB_ATSC
|
|
|
|
#if defined(DVB_API_VERSION_MINOR)
|
2009-02-22 14:12:33 +00:00
|
|
|
|
|
|
|
/* kernel headers >=2.6.28 have version 5.
|
|
|
|
*
|
2014-12-30 19:33:16 +00:00
|
|
|
* Version 5 is also called S2API, it adds support for tuning to S2 channels
|
2015-01-06 19:19:49 +00:00
|
|
|
* and is extensible for future delivery systems. Old API is deprecated.
|
|
|
|
* StreamID-implementation only supported since API >=5.2.
|
2016-01-22 10:43:46 +00:00
|
|
|
* At least DTV_ENUM_DELSYS requires 5.5.
|
2009-02-22 14:12:33 +00:00
|
|
|
*/
|
|
|
|
|
2016-01-22 10:43:46 +00:00
|
|
|
#if (DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 5)
|
2014-12-30 19:33:16 +00:00
|
|
|
#define DVB_USE_S2API 1
|
|
|
|
|
2015-01-06 19:19:49 +00:00
|
|
|
// This had a different name until API 5.8.
|
2014-12-30 19:33:16 +00:00
|
|
|
#ifndef DTV_STREAM_ID
|
|
|
|
#define DTV_STREAM_ID DTV_ISDBS_TS_ID
|
|
|
|
#endif
|
2015-02-28 03:51:05 +00:00
|
|
|
#endif
|
2014-12-30 19:33:16 +00:00
|
|
|
|
|
|
|
// This is only defined, for convenience, since API 5.8.
|
|
|
|
#ifndef NO_STREAM_ID_FILTER
|
|
|
|
#define NO_STREAM_ID_FILTER (~0U)
|
|
|
|
#endif
|
|
|
|
|
2009-02-22 14:12:33 +00:00
|
|
|
#if (DVB_API_VERSION == 3 && DVB_API_VERSION_MINOR >= 1) || DVB_API_VERSION == 5
|
2005-01-06 09:43:10 +00:00
|
|
|
#define DVB_ATSC 1
|
|
|
|
#endif
|
2009-02-22 14:12:33 +00:00
|
|
|
|
2005-01-06 09:43:10 +00:00
|
|
|
#endif
|
2003-03-16 20:13:28 +00:00
|
|
|
|
|
|
|
#define DVB_CHANNEL_LOWER -1
|
|
|
|
#define DVB_CHANNEL_HIGHER 1
|
|
|
|
|
2004-07-12 20:52:02 +00:00
|
|
|
#ifndef DMX_FILTER_SIZE
|
2015-01-05 19:27:22 +00:00
|
|
|
#define DMX_FILTER_SIZE 32
|
2004-07-12 20:52:02 +00:00
|
|
|
#endif
|
2003-03-16 20:13:28 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2015-01-06 19:19:49 +00:00
|
|
|
char *name;
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int freq, srate, diseqc;
|
2015-01-06 19:19:49 +00:00
|
|
|
char pol;
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int tpid, dpid1, dpid2, progid, ca, pids[DMX_FILTER_SIZE], pids_cnt;
|
2017-12-15 12:37:30 +00:00
|
|
|
bool is_dvb_x2; /* Used only in dvb_get_channels() and parse_vdr_par_string(), use delsys. */
|
|
|
|
unsigned int frontend;
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int delsys;
|
|
|
|
unsigned int stream_id;
|
|
|
|
unsigned int service_id;
|
2015-01-06 19:19:49 +00:00
|
|
|
fe_spectral_inversion_t inv;
|
|
|
|
fe_modulation_t mod;
|
|
|
|
fe_transmit_mode_t trans;
|
|
|
|
fe_bandwidth_t bw;
|
|
|
|
fe_guard_interval_t gi;
|
|
|
|
fe_code_rate_t cr, cr_lp;
|
|
|
|
fe_hierarchy_t hier;
|
2003-03-16 20:13:28 +00:00
|
|
|
} dvb_channel_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int NUM_CHANNELS;
|
|
|
|
unsigned int current;
|
2015-01-06 19:19:49 +00:00
|
|
|
dvb_channel_t *channels;
|
2017-02-13 01:55:35 +00:00
|
|
|
} dvb_channels_list_t;
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2004-04-26 21:22:33 +00:00
|
|
|
typedef struct {
|
2015-01-06 19:19:49 +00:00
|
|
|
int devno;
|
2017-12-15 12:37:30 +00:00
|
|
|
unsigned int delsys_mask[MAX_FRONTENDS];
|
2017-02-13 01:55:35 +00:00
|
|
|
dvb_channels_list_t *list;
|
|
|
|
} dvb_adapter_config_t;
|
2004-04-26 21:22:33 +00:00
|
|
|
|
|
|
|
typedef struct {
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int adapters_count;
|
|
|
|
dvb_adapter_config_t *adapters;
|
|
|
|
unsigned int cur_adapter;
|
2017-12-15 12:37:30 +00:00
|
|
|
unsigned int cur_frontend;
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2015-01-06 19:19:49 +00:00
|
|
|
int fe_fd;
|
|
|
|
int dvr_fd;
|
2016-01-07 17:53:42 +00:00
|
|
|
int demux_fd[3], demux_fds[DMX_FILTER_SIZE], demux_fds_cnt;
|
2015-01-06 19:19:49 +00:00
|
|
|
|
|
|
|
int is_on;
|
|
|
|
int retry;
|
|
|
|
int timeout;
|
2017-02-13 01:55:35 +00:00
|
|
|
unsigned int last_freq;
|
2016-01-07 22:55:15 +00:00
|
|
|
bool switching_channel;
|
2016-01-08 17:37:30 +00:00
|
|
|
bool stream_used;
|
2016-01-07 22:30:46 +00:00
|
|
|
} dvb_state_t;
|
|
|
|
|
2017-02-13 01:55:35 +00:00
|
|
|
typedef struct {
|
2016-01-07 22:30:46 +00:00
|
|
|
struct mp_log *log;
|
|
|
|
|
|
|
|
dvb_state_t *state;
|
2015-01-06 19:19:49 +00:00
|
|
|
|
|
|
|
char *cfg_prog;
|
2017-02-13 01:55:35 +00:00
|
|
|
int cfg_devno;
|
2015-01-06 19:19:49 +00:00
|
|
|
int cfg_timeout;
|
|
|
|
char *cfg_file;
|
|
|
|
|
|
|
|
int cfg_full_transponder;
|
2003-03-16 20:13:28 +00:00
|
|
|
} dvb_priv_t;
|
|
|
|
|
2017-02-13 01:55:35 +00:00
|
|
|
|
|
|
|
/* Keep in sync with enum fe_delivery_system. */
|
|
|
|
#ifndef DVB_USE_S2API
|
|
|
|
# define SYS_DVBC_ANNEX_A 1
|
2017-10-08 16:34:45 +00:00
|
|
|
# define SYS_DVBC_ANNEX_B 1
|
2017-02-13 01:55:35 +00:00
|
|
|
# define SYS_DVBT 3
|
|
|
|
# define SYS_DVBS 5
|
|
|
|
# define SYS_DVBS2 6
|
|
|
|
# define SYS_ATSC 11
|
|
|
|
# define SYS_DVBT2 16
|
|
|
|
# define SYS_DVBC_ANNEX_C 18
|
|
|
|
#endif
|
|
|
|
#define SYS_DVB__COUNT__ (SYS_DVBC_ANNEX_C + 1)
|
|
|
|
|
|
|
|
|
|
|
|
#define DELSYS_BIT(__bit) (((unsigned int)1) << (__bit))
|
|
|
|
|
|
|
|
#define DELSYS_SET(__mask, __bit) \
|
|
|
|
(__mask) |= DELSYS_BIT((__bit))
|
|
|
|
|
|
|
|
#define DELSYS_IS_SET(__mask, __bit) \
|
|
|
|
(0 != ((__mask) & DELSYS_BIT((__bit))))
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DVB_ATSC
|
|
|
|
#define DELSYS_SUPP_MASK \
|
|
|
|
( \
|
|
|
|
DELSYS_BIT(SYS_DVBC_ANNEX_A) | \
|
|
|
|
DELSYS_BIT(SYS_DVBT) | \
|
|
|
|
DELSYS_BIT(SYS_DVBS) | \
|
|
|
|
DELSYS_BIT(SYS_DVBS2) | \
|
|
|
|
DELSYS_BIT(SYS_ATSC) | \
|
2017-10-08 16:34:45 +00:00
|
|
|
DELSYS_BIT(SYS_DVBC_ANNEX_B) | \
|
2017-02-13 01:55:35 +00:00
|
|
|
DELSYS_BIT(SYS_DVBT2) | \
|
|
|
|
DELSYS_BIT(SYS_DVBC_ANNEX_C) \
|
|
|
|
)
|
|
|
|
#else
|
|
|
|
#define DELSYS_SUPP_MASK \
|
|
|
|
( \
|
|
|
|
DELSYS_BIT(SYS_DVBC_ANNEX_A) | \
|
|
|
|
DELSYS_BIT(SYS_DVBT) | \
|
|
|
|
DELSYS_BIT(SYS_DVBS) | \
|
|
|
|
DELSYS_BIT(SYS_DVBS2) | \
|
|
|
|
DELSYS_BIT(SYS_DVBT2) | \
|
|
|
|
DELSYS_BIT(SYS_DVBC_ANNEX_C) \
|
|
|
|
)
|
|
|
|
#endif
|
|
|
|
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2008-12-03 23:01:03 +00:00
|
|
|
int dvb_step_channel(stream_t *, int);
|
2017-02-13 01:55:35 +00:00
|
|
|
int dvb_set_channel(stream_t *, unsigned int, unsigned int);
|
2016-01-07 22:30:46 +00:00
|
|
|
dvb_state_t *dvb_get_state(stream_t *);
|
|
|
|
void dvb_free_state(dvb_state_t *);
|
2003-03-16 20:13:28 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_DVBIN_H */
|