xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Functions | Variables
input_dvb.c File Reference
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <sys/poll.h>
#include <time.h>
#include <ctype.h>
#include <basedir.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/input_plugin.h>
#include "net_buf_ctrl.h"
#include "input_helper.h"

Data Structures

struct  tuner_t
 
struct  epg_entry_t
 
struct  channel_t
 
struct  dvb_input_class_t
 
struct  dvb_input_plugin_t
 
struct  Param
 

Macros

#define LOG_MODULE   "input_dvb"
 
#define LOG_VERBOSE
 
#define BUFSIZE   16384
 
#define DVB_NOPID   0xffff
 
#define INTERNAL_FILTER   0
 
#define PATFILTER   1
 
#define PMTFILTER   2
 
#define EITFILTER   3
 
#define PCRFILTER   4
 
#define VIDFILTER   5
 
#define AUDFILTER   6
 
#define AC3FILTER   7
 
#define TXTFILTER   8
 
#define MAX_FILTERS   9
 
#define MAX_AUTOCHANNELS   200
 
#define MAX_SUBTITLES   4
 
#define MOUSE_BUTTON_LEFT   1
 
#define MOUSE_BUTTON_MIDDLE   2
 
#define MOUSE_BUTTON_RIGHT   3
 
#define MOUSE_WHEEL_UP   4
 
#define MOUSE_WHEEL_DOWN   5
 
#define MOUSE_SIDE_LEFT   6
 
#define MOUSE_SIDE_RIGHT   7
 
#define EPG_UPDATE_DELAY   60
 
#define EPG_WIDTH   520
 
#define EPG_HEIGHT   620
 
#define EPG_TOP   50
 
#define EPG_CHANNEL_FONT_SIZE   32
 
#define EPG_CLOCK_FONT_SIZE   18
 
#define EPG_TITLE_FONT_SIZE   24
 
#define EPG_CONTENT_FONT_SIZE   18
 
#define EPG_DESCRIPTION_FONT_SIZE   18
 
#define EPG_PIXELS_BETWEEN_TEXT_ROWS   2
 
#define EPG_PIXELS_BETWEEN_PROGRAM_ENTRIES   2
 
#define EPG_BACKGROUND_MARGIN   5
 
#define MAX_EPG_PROGRAM_NAME_LENGTH   255
 
#define MAX_EPG_PROGRAM_DESCRIPTION_LENGTH   255
 
#define MAX_EPG_CONTENT_TYPE_LENGTH   20
 
#define MAX_EPG_ENTRIES_PER_CHANNEL   10
 
#define MAX_EPG_ENTRY_LATENESS   5*60.0
 
#define CHSEL_WIDTH   600
 
#define CHSEL_HEIGHT   400
 
#define CHSEL_CHANNEL_FONT_SIZE   26
 
#define CHSEL_PROGRAM_NAME_FONT_SIZE   12
 
#define bcdtoint(i)   ((((i & 0xf0) >> 4) * 10) + (i & 0x0f))
 
#define find_param(list, name)    find_param_0(list, sizeof(list)/sizeof(list[0]), name)
 
#define PKT_SIZE   188
 
#define BODY_SIZE   (188-4)
 

Functions

static time_t dvb_mjdtime (uint8_t *buf)
 
static void load_epg_data (dvb_input_plugin_t *this)
 
static void show_eit (dvb_input_plugin_t *this)
 
static void print_error (const char *estring)
 
static unsigned int getbits (unsigned char *buffer, unsigned int bitpos, unsigned int bitcount)
 
static int find_descriptor (uint8_t tag, const unsigned char *buf, int descriptors_loop_len, const unsigned char **desc, int *desc_len)
 
static void tuner_dispose (tuner_t *this)
 
static tuner_ttuner_init (xine_t *xine, int adapter)
 
static int dvb_set_pidfilter (dvb_input_plugin_t *this, int filter, ushort pid, int pidtype, int taptype)
 
static int dvb_set_sectfilter (dvb_input_plugin_t *this, int filter, ushort pid, int pidtype, uint8_t table, uint8_t mask)
 
static int find_param_0 (const Param *list, size_t list_size, const char *name)
 
static int extract_channel_from_string_internal (channel_t *channel, char *str, fe_type_t fe_type)
 
static int extract_channel_from_string (channel_t *channel, char *str, fe_type_t fe_type)
 
static channel_tload_channels (xine_t *xine, xine_stream_t *stream, int *num_ch, fe_type_t fe_type)
 
static void free_channel_list (channel_t *channels, int num_channels)
 
static int tuner_set_diseqc (tuner_t *this, channel_t *c)
 
static int tuner_tune_it (tuner_t *this, struct dvb_frontend_parameters *front_param)
 
static void parse_pmt (dvb_input_plugin_t *this, const unsigned char *buf, int section_length)
 
static void dvb_parse_si (dvb_input_plugin_t *this)
 
static int channel_index (dvb_input_plugin_t *this, int service_id)
 
static int compare_epg_by_starttime (const void *a, const void *b)
 
static int epg_with_starttime (channel_t *channel, time_t starttime)
 
static void render_text_area (osd_renderer_t *renderer, osd_object_t *osd, const char *text, int x, int y, int row_space, int max_x, int max_y, int *height, int color_base)
 
static epg_entry_tith_next_epg (channel_t *channel, int count)
 
static epg_entry_tcurrent_epg (channel_t *channel)
 
static epg_entry_tnext_epg (channel_t *channel)
 
static void show_program_info (int x, int y, int max_x, int max_y, int *last_y, epg_entry_t *epg_data, osd_renderer_t *renderer, osd_object_t *osd)
 
static int tuner_set_channel (dvb_input_plugin_t *this, channel_t *c)
 
static void osd_show_channel (dvb_input_plugin_t *this, int channel)
 
static int switch_channel (dvb_input_plugin_t *this, int channel)
 
static void do_record (dvb_input_plugin_t *this)
 
static void dvb_event_handler (dvb_input_plugin_t *this)
 
static void ts_rewrite_packets (dvb_input_plugin_t *this, unsigned char *originalPkt, int len)
 
static off_t dvb_plugin_read (input_plugin_t *this_gen, void *buf_gen, off_t len)
 
static off_t dvb_plugin_seek (input_plugin_t *this_gen, off_t offset, int origin)
 
static off_t dvb_plugin_get_current_pos (input_plugin_t *this_gen)
 
static void dvb_plugin_dispose (input_plugin_t *this_gen)
 
static const char * dvb_plugin_get_mrl (input_plugin_t *this_gen)
 
static void dvb_zoom_cb (void *this_gen, xine_cfg_entry_t *cfg)
 
static int dvb_plugin_open (input_plugin_t *this_gen)
 
static int dvb_plugin_get_optional_data (input_plugin_t *this_gen, void *data, int data_type)
 
static input_plugin_tdvb_class_get_instance (input_class_t *class_gen, xine_stream_t *stream, const char *data)
 
static void dvb_class_dispose (input_class_t *this_gen)
 
static int dvb_class_eject_media (input_class_t *this_gen)
 
static const char *const * dvb_class_get_autoplay_list (input_class_t *this_gen, int *num_files)
 
static void * init_class (xine_t *xine, const void *data)
 

Variables

static const Param inversion_list []
 
static const Param bw_list []
 
static const Param fec_list []
 
static const Param guard_list []
 
static const Param hierarchy_list []
 
static const Param atsc_list []
 
static const Param qam_list []
 
static const Param transmissionmode_list []
 
const plugin_info_t xine_plugin_info[] EXPORTED
 

Macro Definition Documentation

◆ AC3FILTER

#define AC3FILTER   7

Referenced by parse_pmt().

◆ AUDFILTER

#define AUDFILTER   6

◆ bcdtoint

#define bcdtoint ( i)    ((((i & 0xf0) >> 4) * 10) + (i & 0x0f))

Referenced by dvb_mjdtime(), and load_epg_data().

◆ BODY_SIZE

#define BODY_SIZE   (188-4)

◆ BUFSIZE

#define BUFSIZE   16384

Referenced by load_channels().

◆ CHSEL_CHANNEL_FONT_SIZE

#define CHSEL_CHANNEL_FONT_SIZE   26

Referenced by osd_show_channel().

◆ CHSEL_HEIGHT

#define CHSEL_HEIGHT   400

◆ CHSEL_PROGRAM_NAME_FONT_SIZE

#define CHSEL_PROGRAM_NAME_FONT_SIZE   12

◆ CHSEL_WIDTH

#define CHSEL_WIDTH   600

◆ DVB_NOPID

#define DVB_NOPID   0xffff

◆ EITFILTER

#define EITFILTER   3

◆ EPG_BACKGROUND_MARGIN

#define EPG_BACKGROUND_MARGIN   5

Referenced by dvb_plugin_open(), and show_eit().

◆ EPG_CHANNEL_FONT_SIZE

#define EPG_CHANNEL_FONT_SIZE   32

Referenced by show_eit().

◆ EPG_CLOCK_FONT_SIZE

#define EPG_CLOCK_FONT_SIZE   18

Referenced by show_eit().

◆ EPG_CONTENT_FONT_SIZE

#define EPG_CONTENT_FONT_SIZE   18

Referenced by show_program_info().

◆ EPG_DESCRIPTION_FONT_SIZE

#define EPG_DESCRIPTION_FONT_SIZE   18

Referenced by show_program_info().

◆ EPG_HEIGHT

#define EPG_HEIGHT   620

Referenced by dvb_plugin_open(), and show_eit().

◆ EPG_PIXELS_BETWEEN_PROGRAM_ENTRIES

#define EPG_PIXELS_BETWEEN_PROGRAM_ENTRIES   2

◆ EPG_PIXELS_BETWEEN_TEXT_ROWS

#define EPG_PIXELS_BETWEEN_TEXT_ROWS   2

Referenced by show_program_info().

◆ EPG_TITLE_FONT_SIZE

#define EPG_TITLE_FONT_SIZE   24

Referenced by show_program_info().

◆ EPG_TOP

#define EPG_TOP   50

Referenced by show_eit().

◆ EPG_UPDATE_DELAY

#define EPG_UPDATE_DELAY   60

◆ EPG_WIDTH

#define EPG_WIDTH   520

Referenced by dvb_plugin_open(), and show_eit().

◆ find_param

#define find_param ( list,
name )    find_param_0(list, sizeof(list)/sizeof(list[0]), name)

◆ INTERNAL_FILTER

#define INTERNAL_FILTER   0

Referenced by dvb_parse_si(), and tuner_init().

◆ LOG_MODULE

#define LOG_MODULE   "input_dvb"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ MAX_AUTOCHANNELS

#define MAX_AUTOCHANNELS   200

◆ MAX_EPG_CONTENT_TYPE_LENGTH

#define MAX_EPG_CONTENT_TYPE_LENGTH   20

Referenced by load_epg_data().

◆ MAX_EPG_ENTRIES_PER_CHANNEL

#define MAX_EPG_ENTRIES_PER_CHANNEL   10

◆ MAX_EPG_ENTRY_LATENESS

#define MAX_EPG_ENTRY_LATENESS   5*60.0

Referenced by ith_next_epg().

◆ MAX_EPG_PROGRAM_DESCRIPTION_LENGTH

#define MAX_EPG_PROGRAM_DESCRIPTION_LENGTH   255

Referenced by load_epg_data().

◆ MAX_EPG_PROGRAM_NAME_LENGTH

#define MAX_EPG_PROGRAM_NAME_LENGTH   255

Referenced by load_epg_data().

◆ MAX_FILTERS

#define MAX_FILTERS   9

◆ MAX_SUBTITLES

#define MAX_SUBTITLES   4

◆ MOUSE_BUTTON_LEFT

#define MOUSE_BUTTON_LEFT   1

Referenced by dvb_event_handler().

◆ MOUSE_BUTTON_MIDDLE

#define MOUSE_BUTTON_MIDDLE   2

◆ MOUSE_BUTTON_RIGHT

#define MOUSE_BUTTON_RIGHT   3

◆ MOUSE_SIDE_LEFT

#define MOUSE_SIDE_LEFT   6

Referenced by dvb_event_handler().

◆ MOUSE_SIDE_RIGHT

#define MOUSE_SIDE_RIGHT   7

Referenced by dvb_event_handler().

◆ MOUSE_WHEEL_DOWN

#define MOUSE_WHEEL_DOWN   5

Referenced by dvb_event_handler().

◆ MOUSE_WHEEL_UP

#define MOUSE_WHEEL_UP   4

Referenced by dvb_event_handler().

◆ PATFILTER

#define PATFILTER   1

Referenced by parse_pmt().

◆ PCRFILTER

#define PCRFILTER   4

Referenced by parse_pmt().

◆ PKT_SIZE

#define PKT_SIZE   188

◆ PMTFILTER

#define PMTFILTER   2

Referenced by parse_pmt().

◆ TXTFILTER

#define TXTFILTER   8

Referenced by parse_pmt().

◆ VIDFILTER

#define VIDFILTER   5

Function Documentation

◆ channel_index()

static int channel_index ( dvb_input_plugin_t * this,
int service_id )
static

Referenced by load_epg_data().

◆ compare_epg_by_starttime()

static int compare_epg_by_starttime ( const void * a,
const void * b )
static

Referenced by load_epg_data().

◆ current_epg()

static epg_entry_t * current_epg ( channel_t * channel)
static

◆ do_record()

static void do_record ( dvb_input_plugin_t * this)
static

◆ dvb_class_dispose()

static void dvb_class_dispose ( input_class_t * this_gen)
static

References _x_freep().

Referenced by init_class().

◆ dvb_class_eject_media()

static int dvb_class_eject_media ( input_class_t * this_gen)
static

Referenced by init_class().

◆ dvb_class_get_autoplay_list()

static const char *const * dvb_class_get_autoplay_list ( input_class_t * this_gen,
int * num_files )
static

◆ dvb_class_get_instance()

static input_plugin_t * dvb_class_get_instance ( input_class_t * class_gen,
xine_stream_t * stream,
const char * data )
static

◆ dvb_event_handler()

static void dvb_event_handler ( dvb_input_plugin_t * this)
static

◆ dvb_mjdtime()

static time_t dvb_mjdtime ( uint8_t * buf)
static

References _x_assert, bcdtoint, and NULL.

Referenced by load_epg_data().

◆ dvb_parse_si()

static void dvb_parse_si ( dvb_input_plugin_t * this)
static

◆ dvb_plugin_dispose()

static void dvb_plugin_dispose ( input_plugin_t * this_gen)
static

◆ dvb_plugin_get_current_pos()

static off_t dvb_plugin_get_current_pos ( input_plugin_t * this_gen)
static

Referenced by dvb_class_get_instance().

◆ dvb_plugin_get_mrl()

static const char * dvb_plugin_get_mrl ( input_plugin_t * this_gen)
static

Referenced by dvb_class_get_instance().

◆ dvb_plugin_get_optional_data()

static int dvb_plugin_get_optional_data ( input_plugin_t * this_gen,
void * data,
int data_type )
static

◆ dvb_plugin_open()

static int dvb_plugin_open ( input_plugin_t * this_gen)
static

◆ dvb_plugin_read()

static off_t dvb_plugin_read ( input_plugin_t * this_gen,
void * buf_gen,
off_t len )
static

◆ dvb_plugin_seek()

static off_t dvb_plugin_seek ( input_plugin_t * this_gen,
off_t offset,
int origin )
static

◆ dvb_set_pidfilter()

static int dvb_set_pidfilter ( dvb_input_plugin_t * this,
int filter,
ushort pid,
int pidtype,
int taptype )
static

◆ dvb_set_sectfilter()

static int dvb_set_sectfilter ( dvb_input_plugin_t * this,
int filter,
ushort pid,
int pidtype,
uint8_t table,
uint8_t mask )
static

◆ dvb_zoom_cb()

static void dvb_zoom_cb ( void * this_gen,
xine_cfg_entry_t * cfg )
static

◆ epg_with_starttime()

static int epg_with_starttime ( channel_t * channel,
time_t starttime )
static

◆ extract_channel_from_string()

static int extract_channel_from_string ( channel_t * channel,
char * str,
fe_type_t fe_type )
static

◆ extract_channel_from_string_internal()

static int extract_channel_from_string_internal ( channel_t * channel,
char * str,
fe_type_t fe_type )
static

◆ find_descriptor()

static int find_descriptor ( uint8_t tag,
const unsigned char * buf,
int descriptors_loop_len,
const unsigned char ** desc,
int * desc_len )
static

Referenced by parse_pmt().

◆ find_param_0()

static int find_param_0 ( const Param * list,
size_t list_size,
const char * name )
static

References name, and Param::value.

◆ free_channel_list()

static void free_channel_list ( channel_t * channels,
int num_channels )
static

References _x_freep(), and name.

Referenced by dvb_class_get_autoplay_list(), and dvb_plugin_dispose().

◆ getbits()

static unsigned int getbits ( unsigned char * buffer,
unsigned int bitpos,
unsigned int bitcount )
static

Referenced by dvb_parse_si(), and load_epg_data().

◆ init_class()

static void * init_class ( xine_t * xine,
const void * data )
static

◆ ith_next_epg()

static epg_entry_t * ith_next_epg ( channel_t * channel,
int count )
static

◆ load_channels()

static channel_t * load_channels ( xine_t * xine,
xine_stream_t * stream,
int * num_ch,
fe_type_t fe_type )
static

◆ load_epg_data()

static void load_epg_data ( dvb_input_plugin_t * this)
static

◆ next_epg()

static epg_entry_t * next_epg ( channel_t * channel)
static

◆ osd_show_channel()

static void osd_show_channel ( dvb_input_plugin_t * this,
int channel )
static

◆ parse_pmt()

static void parse_pmt ( dvb_input_plugin_t * this,
const unsigned char * buf,
int section_length )
static

◆ print_error()

static void print_error ( const char * estring)
static

◆ render_text_area()

static void render_text_area ( osd_renderer_t * renderer,
osd_object_t * osd,
const char * text,
int x,
int y,
int row_space,
int max_x,
int max_y,
int * height,
int color_base )
static

◆ show_eit()

static void show_eit ( dvb_input_plugin_t * this)
static

◆ show_program_info()

static void show_program_info ( int x,
int y,
int max_x,
int max_y,
int * last_y,
epg_entry_t * epg_data,
osd_renderer_t * renderer,
osd_object_t * osd )
static

◆ switch_channel()

static int switch_channel ( dvb_input_plugin_t * this,
int channel )
static

◆ ts_rewrite_packets()

static void ts_rewrite_packets ( dvb_input_plugin_t * this,
unsigned char * originalPkt,
int len )
static

References PKT_SIZE, and xine_crc32_ieee().

Referenced by dvb_plugin_read().

◆ tuner_dispose()

static void tuner_dispose ( tuner_t * this)
static

◆ tuner_init()

static tuner_t * tuner_init ( xine_t * xine,
int adapter )
static

◆ tuner_set_channel()

static int tuner_set_channel ( dvb_input_plugin_t * this,
channel_t * c )
static

◆ tuner_set_diseqc()

static int tuner_set_diseqc ( tuner_t * this,
channel_t * c )
static

◆ tuner_tune_it()

static int tuner_tune_it ( tuner_t * this,
struct dvb_frontend_parameters * front_param )
static

Variable Documentation

◆ atsc_list

const Param atsc_list[]
static
Initial value:
= {
{ "8VSB", VSB_8 },
{ "QAM_256", QAM_256 },
{ "QAM_64", QAM_64 },
{ "QAM", QAM_AUTO },
}

Referenced by extract_channel_from_string_internal().

◆ bw_list

const Param bw_list[]
static
Initial value:
= {
{ "BANDWIDTH_6_MHZ", BANDWIDTH_6_MHZ },
{ "BANDWIDTH_7_MHZ", BANDWIDTH_7_MHZ },
{ "BANDWIDTH_8_MHZ", BANDWIDTH_8_MHZ },
{ "BANDWIDTH_AUTO", BANDWIDTH_AUTO },
}

Referenced by extract_channel_from_string_internal().

◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED
Initial value:
= {
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
static void * init_class(xine_t *xine, const void *data)
Definition input_dvb.c:3190
#define XINE_VERSION_CODE
Definition xine_internal.h:57
NULL
Definition xine_plugin.c:78
#define PLUGIN_NONE
Definition xine_plugin.h:29
#define PLUGIN_MUST_PRELOAD
Definition xine_plugin.h:46
#define PLUGIN_INPUT
Definition xine_plugin.h:30

◆ fec_list

const Param fec_list[]
static
Initial value:
= {
{ "FEC_1_2", FEC_1_2 },
{ "FEC_2_3", FEC_2_3 },
{ "FEC_3_4", FEC_3_4 },
{ "FEC_4_5", FEC_4_5 },
{ "FEC_5_6", FEC_5_6 },
{ "FEC_6_7", FEC_6_7 },
{ "FEC_7_8", FEC_7_8 },
{ "FEC_8_9", FEC_8_9 },
{ "FEC_AUTO", FEC_AUTO },
{ "FEC_NONE", FEC_NONE },
}

Referenced by extract_channel_from_string_internal().

◆ guard_list

const Param guard_list[]
static
Initial value:
= {
{"GUARD_INTERVAL_1_16", GUARD_INTERVAL_1_16},
{"GUARD_INTERVAL_1_32", GUARD_INTERVAL_1_32},
{"GUARD_INTERVAL_1_4", GUARD_INTERVAL_1_4},
{"GUARD_INTERVAL_1_8", GUARD_INTERVAL_1_8},
{"GUARD_INTERVAL_AUTO", GUARD_INTERVAL_AUTO},
}

Referenced by extract_channel_from_string_internal().

◆ hierarchy_list

const Param hierarchy_list[]
static
Initial value:
= {
{ "HIERARCHY_1", HIERARCHY_1 },
{ "HIERARCHY_2", HIERARCHY_2 },
{ "HIERARCHY_4", HIERARCHY_4 },
{ "HIERARCHY_NONE", HIERARCHY_NONE },
{ "HIERARCHY_AUTO", HIERARCHY_AUTO },
}

Referenced by extract_channel_from_string_internal().

◆ inversion_list

const Param inversion_list[]
static
Initial value:
= {
{ "INVERSION_OFF", INVERSION_OFF },
{ "INVERSION_ON", INVERSION_ON },
{ "INVERSION_AUTO", INVERSION_AUTO },
}

Referenced by extract_channel_from_string_internal().

◆ qam_list

const Param qam_list[]
static
Initial value:
= {
{ "QPSK", QPSK },
{ "QAM_128", QAM_128 },
{ "QAM_16", QAM_16 },
{ "QAM_256", QAM_256 },
{ "QAM_32", QAM_32 },
{ "QAM_64", QAM_64 },
{ "QAM_AUTO", QAM_AUTO },
}

Referenced by extract_channel_from_string_internal().

◆ transmissionmode_list

const Param transmissionmode_list[]
static
Initial value:
= {
{ "TRANSMISSION_MODE_2K", TRANSMISSION_MODE_2K },
{ "TRANSMISSION_MODE_8K", TRANSMISSION_MODE_8K },
{ "TRANSMISSION_MODE_AUTO", TRANSMISSION_MODE_AUTO },
}

Referenced by extract_channel_from_string_internal().