00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _DVB_H
00024 #define _DVB_H
00025 #include <stdint.h>
00026 #include <pthread.h>
00027 #include <linux/dvb/dmx.h>
00028 #include <linux/dvb/frontend.h>
00029
00030 #include "types.h"
00031
00071 #define DVB_MAX_PID_FILTERS 15
00072
00076 typedef struct DVBAdapterPIDFilter_s
00077 {
00078 int demuxFd;
00079 uint16_t pid;
00080 bool system;
00081 }DVBAdapterPIDFilter_t;
00082
00088 typedef struct DVBAdapter_t
00089 {
00090 int adapter;
00091 struct dvb_frontend_info info;
00093 char frontEndPath[30];
00094 int frontEndFd;
00096 char demuxPath[30];
00097 DVBAdapterPIDFilter_t filters[DVB_MAX_PID_FILTERS];
00099 char dvrPath[30];
00100 int dvrFd;
00102 int lnbLowFreq;
00103 int lnbHighFreq;
00104 int lnbSwitchFreq;
00106 bool hardwareRestricted;
00108 pthread_t monitorThread;
00109 bool monitorExit;
00110 }
00111 DVBAdapter_t;
00112
00117 enum Polarisation_e
00118 {
00119 POL_HORIZONTAL = 0,
00120 POL_VERTICAL
00121 };
00122
00127 typedef struct DVBDiSEqCSettings_s
00128 {
00129 enum Polarisation_e polarisation;
00130 unsigned long satellite_number;
00131 }DVBDiSEqCSettings_t;
00132
00141 DVBAdapter_t *DVBInit(int adapter, bool hwRestricted);
00142
00148 void DVBDispose(DVBAdapter_t *adapter);
00149
00157 int DVBFrontEndTune(DVBAdapter_t *adapter, struct dvb_frontend_parameters *frontend, DVBDiSEqCSettings_t *diseqc);
00158
00167 void DVBFrontEndLNBInfoSet(DVBAdapter_t *adapter, int lowFreq, int highFreq, int switchFreq);
00168
00179 int DVBFrontEndStatus(DVBAdapter_t *adapter, fe_status_t *status,
00180 unsigned int *ber, unsigned int *strength,
00181 unsigned int *snr, unsigned int *ucblocks);
00182
00189 int DVBDemuxSetBufferSize(DVBAdapter_t *adapter, unsigned long size);
00190
00198 int DVBDemuxAllocateFilter(DVBAdapter_t *adapter, uint16_t pid, bool system);
00199
00206 int DVBDemuxReleaseFilter(DVBAdapter_t *adapter, uint16_t pid);
00207
00214 int DVBDemuxReleaseAllFilters(DVBAdapter_t *adapter, bool system);
00215
00224 int DVBDVRRead(DVBAdapter_t *adapter, char *data, int max, int timeout);
00225
00226
00228 #endif