/usr/include/libdvb/DVB.hh is in libdvb-dev 0.5.5.1-5.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | #ifndef _DVB_DEV_HH_
#define _DVB_DEV_HH_
extern "C" {
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include <netinet/in.h>
#include <stdint.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <time.h>
#include <unistd.h>
#define NEWSTRUCT
#include <channel.h>
#include <sys/times.h>
}
#include <sstream>
#include <iostream>
#include <iomanip>
using namespace std;
#include <osd.hh>
#include <devices.hh>
#define FRONT_DVBS 1
#define FRONT_DVBC 2
#define FRONT_DVBT 3
#define VTXDIR "/var/vtx"
#define MAXSECSIZE 4096
enum {LNB=0,TRANS,CHAN,SAT,PICS,NK};
static const int nums[]={LNB,TRANS,CHAN,SAT,PICS};
static const int maxs[]={ 32, 512,3000,512,100, 50};
#define MAX_TRANS_CHAN 1024
#ifndef DMX_FULL_TS_PID
#define DMX_FULL_TS_PID 0x2000
#endif
enum{DVB_ORIG=0, DVB_NOKIA, DVB_XML, DVB_SATCO, DVB_ZAPS, DVB_ZAPC, DVB_ZAPT
, DVB_VDR};
typedef struct frontend_stat_s{
fe_status_t status;
uint16_t snr;
uint16_t strength;
uint32_t ber;
uint32_t u_blocks;
} frontend_stat;
extern uint8_t hamtab[256];
extern uint8_t invtab[256];
#define MAX_MAG 8
typedef struct mag_struct_ {
int valid;
int magn;
uint8_t flags;
uint8_t lang;
int pnum,sub;
uint8_t pagebuf[25*40];
} magazin_t;
#define secflags (DMX_IMMEDIATE_START|DMX_CHECK_CRC)
typedef
enum {LIBDVB_OUT, ZAP_OUT, VDR_OUT, MYTH_OUT}
dvb_outtype;
class DVB {
public:
int no_open;
int fd_frontend;
int fd_demuxa;
int fd_demuxv;
int fd_demuxpcr;
int fd_demuxtt;
int fdvb;
dvb_outtype outtype;
clock_t lastclock;
struct tms ts;
int showtime;
int minor;
int adapter;
int max_tpid;
int max_satid;
int max_chanid;
frontend_stat festat;
struct dvb_diseqc_master_cmd dcmd;
fe_sec_tone_mode_t tone;
fe_sec_voltage_t voltage;
int burst;
struct dmx_pes_filter_params pesFilterParamsV;
struct dmx_pes_filter_params pesFilterParamsA;
struct dmx_pes_filter_params pesFilterParamsP;
struct dmx_pes_filter_params pesFilterParamsTT;
struct dvb_frontend_parameters front_param;
int front_type;
int dvr_enabled;
OSD osd;
uint32_t transponder_freq;
char transponder_pol;
uint32_t transponder_srate;
fe_status_t status;
uint32_t ber, uncorrected_blocks;
uint16_t snr, signal;
struct Lnb *lnbs;
struct Transponder *tps;
struct Channel *chans;
struct Sat *sats;
struct Picture *pics;
struct Network *ntws;
int num[NK];
int oldsec;
int tryit;
int oldpol;
char *vtxdir;
magazin_t magazin[MAX_MAG];
DVB(){
showtime = 0;
no_open = 0;
max_tpid = 0;
max_satid = 0;
max_chanid = 0;
minor = 0;
fd_frontend = -1;
fd_demuxa = -1;
fd_demuxpcr = -1;
fd_demuxv = -1;
fd_demuxtt = -1;
fdvb = -1;
vtxdir = NULL;
transponder_freq=0;
transponder_pol=0;
transponder_srate=0;
outtype = LIBDVB_OUT;
}
DVB(int i){
showtime = 0;
if (i >= 0)
no_open = 0;
else
no_open = 1;
max_tpid = 0;
max_satid = 0;
max_chanid = 0;
fd_frontend = -1;
fd_demuxa = -1;
fd_demuxpcr = -1;
fd_demuxv = -1;
fd_demuxtt = -1;
fdvb = -1;
vtxdir = NULL;
transponder_freq=0;
transponder_pol=0;
transponder_srate=0;
outtype = LIBDVB_OUT;
init("","",i);
}
DVB(char *a, char *b) {
showtime = 0;
max_tpid = 0;
max_satid = 0;
max_chanid = 0;
fd_frontend = -1;
fd_demuxa = -1;
fd_demuxpcr = -1;
fd_demuxv = -1;
fd_demuxtt = -1;
fdvb = -1;
vtxdir = NULL;
init(a,b,0);
outtype = LIBDVB_OUT;
}
~DVB();
void use_osd(int fd = -1){
char dvn[32];
if (no_open) return;
if (fd < 0) fd = 0;
sprintf(dvn,OSD_DEV,adapter,fd);
fdvb = open(dvn, O_RDWR);
if (fdvb >= 0){
cerr << dvn << " for OSD" << endl;
osd.init(fdvb);
} else perror("osd");
osd.Open(80, 500, 640, 540, 2, 0, 2);
osd.SetColor(0, 0, 0, 0, 255);
osd.SetColor(1, 240, 240, 240, 255);
osd.Show();
}
void set_vtxdir(char *newname){
if (!newname) return;
if (vtxdir) free(vtxdir);
vtxdir = (char *) malloc(sizeof(char)*(strlen(newname)+1));
if (vtxdir)
strncpy(vtxdir, newname, strlen(newname));
}
void close_osd(){
osd.Close(fdvb);
close(fdvb);
}
void set_showtime(int s){
showtime = s;
}
int DVR_enabled(){
if (no_open) return -1;
return dvr_enabled;
}
void enable_DVR(){
if (no_open) return;
dvr_enabled = 1;
}
void enable_DVR_other(){
if (no_open) return;
dvr_enabled = 2;
}
void disable_DVR(){
if (no_open) return;
dvr_enabled = 0;
}
void init(char *a="/dev/video0", char *b="/dev/vbi0",int adapt=0,
int minor = 0);
inline void init(char *a, char *b){
if (no_open) return;
init(a,b,0,0);
}
int check_frontend();
void set_apid(ushort apid);
void set_vpid(ushort vpid);
void set_pcrpid(ushort vpid);
void set_ttpid(ushort ttpid);
void stop_apid();
void stop_vpid();
void stop_ttpid();
void stop_pcrpid();
int set_apid_fd(ushort apid, int fd);
int set_vpid_fd(ushort vpid, int fd);
int set_ttpid_fd(ushort ttpid, int fd);
int set_pcrpid_fd(ushort pcrpid, int fd);
int set_otherpid_fd(ushort otherpid, int fd);
void stop_pid_fd(int fd);
int set_lnb(int dis);
void set_diseqc_nb(int nr);
void set_diseqc();
void toggle_diseqc();
int set_front(void);
void get_front(void);
void scan_multi_eit(int verbose=0);
void scan_pf_eit(int chnr,
int (*callback)(uint8_t *data, int l, int pnr,
int c_n, uint8_t *t));
void scan_pf_eit(Channel *chan,
int (*callback)(uint8_t *data, int l, int pnr,
int c_n, uint8_t *t));
void scan_pf_eit(int chnr);
int search_in_TP(Transponder &tp, int show=1, int verbose=0);
int search_in_TP(uint16_t tpid, uint16_t satid, int show=1,
int verbose=0);
int scan_tp(uint16_t tpid, uint16_t satid, int timeout=-1, int verbose=0);
int scan_TP(uint16_t tpid, uint16_t satid, int timeout=-1, int verbose=0);
int scan_current(int timeout=-1, int verbose=0);
int GetSection(uint8_t *buf,
uint16_t PID, uint8_t TID, uint16_t TIDExt,
uint16_t FilterTIDExt,
uint8_t secnum, uint8_t &msecnum);
int GetSection(uint8_t *buf,
uint16_t PID, uint8_t *filter, uint8_t *mask,
uint8_t secnum, uint8_t &msecnum);
int GetSection(uint8_t *buf, ushort PID, uint8_t sec,
uint8_t secnum, uint8_t &msecnum);
int SetFilter(uint16_t pid, uint8_t *filter,
uint8_t *mask,
uint32_t timeout, uint32_t flags);
uint16_t SetFilter(uint16_t pid, uint16_t section, uint16_t mode);
int CloseFilter(int h);
int SetFullFilter(uint16_t pid=NOPID);
void bar2(int x, int y, int w, int h, int val, int col1, int col2);
int SetTP(unsigned int, unsigned int);
int scan(void);
int scan_all_tps(void);
int scan_lnb(struct Lnb &);
int scan_cable(Sat &sat);
int scan_sat(struct Sat &);
int scan_tp(struct Transponder &);
int AddLNB(int id, int t, uint l1, uint l2, uint sl,
int dnr, int dis, int sw);
int AddSat(Sat &sat);
int AddSat(int satid, unsigned int lnbid, char *name, uint fmin, uint fmax);
int AddTP(Transponder &tp);
int AddChannel(Channel &chan);
int parse_descriptor(Channel *chan, uint8_t *data, int length,
int verb, Transponder *tp);
int parse_pmt(Channel *chan, uint8_t *data);
int parse_pat(Channel *chan, uint8_t *data);
int check_pids(Channel *chan);
void check_all_pids();
void scan_sdt(Channel *chan);
int scan_sdts(int *chs, int n);
int channel_num(void) {
return num[CHAN];
};
int channel_change(int n) {
return 0;
};
int SetChannel(uint16_t, uint16_t, uint16_t, uint16_t);
int SetChannel(Channel *chan, char* apref=NULL, uint16_t *apidp=NULL,
uint16_t *vpidp=NULL) ;
int SetChannel(int chnr, char *apref=NULL, uint16_t *apidp=NULL,
uint16_t *vpidp=NULL, bool tune=true);
int GetChannel(int chnr, struct channel *);
int NumChannel(void) {
return num[CHAN];
}
int tune_it(struct dvb_frontend_parameters *qpsk);
void find_satid(Channel &chan);
Transponder *find_tp(Channel *chan);
Transponder *find_tp(unsigned int tpid, unsigned int satid);
Sat *find_sat(Transponder *tp);
Sat *find_sat(Channel *chan);
Lnb *find_lnb(Sat *sat);
int check_input_format(istream &ins);
void read_original(istream &ins);
int get_all_progs(uint16_t *progbuf, uint16_t *pnrbuf, int length);
uint16_t find_pnr(uint16_t vpid, uint16_t apid);
int get_pids(uint16_t prog_pid, uint16_t *vpid, uint16_t *apids,
uint16_t *ttpid, uint8_t *apids_name=NULL);
void AddECM(Channel *chan, uint8_t *data, int length);
int check_ecm(Channel *chan);
void add_vtx_line(magazin_t *mag, int line, uint8_t *data, int pnr);
dvb_outtype get_outtype(void);
void set_outtype(dvb_outtype type);
friend ostream &operator<<(ostream &stream, DVB &x);
friend istream &operator>>(istream &stream, DVB &x);
};
#define NOKIA_MAX_SAT 4
class nokiaconv{
public:
DVB *dvb;
struct lnb_sat_l{
int n;
int diseqc[NOKIA_MAX_SAT];
char sat_names[NOKIA_MAX_SAT][MAXNAM+1];
int satid[NOKIA_MAX_SAT];
} lnb_sat;
nokiaconv(DVB *d){
dvb = d;
}
friend istream &operator>>(istream &stream, nokiaconv &x);
};
#define XML_MAX_SAT 4
class xmlconv{
public:
DVB *dvb;
struct lnb_sat_l{
int n;
int diseqc[XML_MAX_SAT];
char sat_names[XML_MAX_SAT][MAXNAM+1];
int satid[XML_MAX_SAT];
} lnb_sat;
xmlconv(DVB *d){
dvb = d;
}
int read_stream(istream &ins, int nchan);
int read_desc(istream &ins, int nchan);
int read_serv(istream &ins, int ctp, int csat);
int read_trans(istream &ins, int satid);
int read_sat(istream &ins, int satid = -1);
int skip_tag(istream &ins, char *tag);
int read_iso639(istream &ins, int nchan, int apids);
friend istream &operator>>(istream &stream, xmlconv &x);
};
#define SATCO_MAX_SAT 10
class satcoconv{
public:
DVB *dvb;
int nlnb;
satcoconv(DVB *d){
dvb = d;
}
friend istream &operator>>(istream &stream, satcoconv &x);
};
class vdrconv{
public:
DVB *dvb;
vdrconv(DVB *d){
dvb = d;
}
friend istream &operator>>(istream &stream, vdrconv &x);
};
class zapconv{
public:
DVB *dvb;
zapconv(DVB *d){
dvb = d;
}
friend istream &operator>>(istream &stream, zapconv &x);
};
void hdump(uint8_t *buf, int n);
int get_dvbrc(char *path, DVB &dv, int dev, int len);
int set_dvbrc(char *path, DVB &dv, int dev, int len);
void dvb2txt(char *out, char *in, int len);
int set_sfront(int fdf, uint32_t freq, uint32_t pol, uint32_t sr , int snum, fe_code_rate_t fec);
void set_pes_filt(int fd,uint16_t pes_pid);
void set_diseqc(int fdf, int snum, fe_sec_voltage_t v, fe_sec_tone_mode_t t);
int tune(int fdf, uint32_t freq, uint32_t sr, fe_code_rate_t fec,
fe_spectral_inversion_t inv);
int set_sfront(int fdf, uint32_t freq, uint32_t pol, uint32_t sr , int snum,
fe_code_rate_t fec);
struct in_addr getaddress (const char *name);
int tcp_client_connect(const char *hostname, int sckt);
int udp_client_connect(const char *filename);
void client_send_msg(int fd, uint8_t *msg, int size);
int chck_frontend (int fefd, frontend_stat *festat);
uint8_t deham(uint8_t x, uint8_t y);
#endif
|