/************************************************************************* * Copyright 2009 Ralph Spitzner (rasp@spitzner.org) * * This file is part of Yahdr. * * Yahdr is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Yahdr is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Yahdr. If not, see . **************************************************************************/ #ifndef DVBTCONTROL_H #define DVBTCONTROL_H #include "defs.hpp" class DVBtcontrol { public: /** Default constructor */ DVBtcontrol(); virtual bool init(uint16_t adapter,uint16_t device,char *ch_fname); virtual bool scan(); // virtual bool tuneto(uint32_t freq,uint8_t bw,uint16_t vpid, uint16_t apid,uint16_t textpid,fe_modulation_t QAM); virtual bool tuneto(uint32_t freq,uint8_t bw,CPIDS *pids,fe_modulation_t QAM); /** Default destructor */ virtual ~DVBtcontrol(); int frontend_fd,demux_fd,dvr_fd,video_fd,audio_fd,nit_fd, text_fd; int pidfds[256]; protected: typedef struct channel { uint32_t freq; uint8_t bw; }CH; typedef struct sdata ///all I need to know about a service { uint16_t tsid; /// transport stream id uint8_t type; /// RADIO || TV uint16_t service_id; /// serviceid needed for epg bool epg; /// has EPG bool pf; /// has present/follow bool CA; /// conditional access uint8_t run; /// 4 == service running char provider[256]; char name[256]; struct sdata *next; }SDATA; // SDATA *first; typedef struct sdth { uint8_t table_id; // 8 bits uint8_t section_syntax_indicator; // 1 bit uint8_t reserved1; // 1 bit uint8_t reserved2; // 2 bits uint16_t section_length; // 12 bits uint16_t transport_stream_id; // 16 bits uint8_t reserved3; // 2 bits uint8_t version_number; // 5 bits uint8_t current_next_indicator; // 1 bit uint8_t section_number; // 8 bits uint8_t last_section_number; // 8 bits uint16_t original_network_id; // 16 bits uint8_t reserved_fut_use; // 8 bits } SDTHEAD; #define SDTHEAD_SIZ 10 typedef struct sdts { uint16_t service_id; // 16 bit uint8_t reserved; // 6 bit uint8_t EIT_schedule_flag; // 1 bit uint8_t EIT_present_follow; // 1 bit uint8_t runningstatus; // 3 bit uint8_t freeCA; // 1bit uint16_t descriptors_loop_length; //12 bit } SDTSEC; #define SDTSEC_SIZ 5 typedef struct datad { uint8_t descriptor_tag; uint8_t descriptor_length; } DESCRIPTOR; uint16_t intchan; FILE *ch_filep; uint8_t adapnum,devnum; SDTSEC *fill_sdtsec(uint8_t *data); SDTHEAD *fill_sdthead(uint8_t *data); SDATA *find_sdata(uint16_t pgnum); struct dvb_frontend_parameters frontend_param; string ch_dbname; virtual bool setup_frontend (int fe_fd, struct dvb_frontend_parameters *frontend); bool check_frontend (int fe_fd); /// for scanning bool read_tpinfo(CH *chp,uint16_t tpnum); /**/ int input_timeout (int filedes, unsigned int seconds); void clearfds(); SDATA *first_sdt,*sdp; struct dmx_pes_filter_params pesfilter; uint16_t oldvpid; uint32_t oldfreq; fe_modulation_t qam; static CH channels_ger[]; /**/ }; class DVBccontrol : public DVBtcontrol { public: /** Default constructor */ DVBccontrol(); bool init(uint16_t adapter,uint16_t device,char *ch_fname); bool scan(); // bool tuneto(uint32_t freq,uint8_t bw,uint16_t vpid, uint16_t apid,uint16_t textpid, fe_modulation_t QAM); bool tuneto(uint32_t freq,uint8_t bw,CPIDS *pids, fe_modulation_t QAM); /** Default destructor */ virtual ~DVBccontrol(); protected: bool setup_frontend (int fe_fd, struct dvb_frontend_parameters *frontend); }; #endif // DVBTCONTROL_H