|
SASC-NG
DVBSoftCAM
|
00001 /* 00002 * dvbdevice.c: The DVB device interface 00003 * 00004 * See the main source file 'vdr.c' for copyright information and 00005 * how to reach the author. 00006 * 00007 * $Id: dvbdevice.c 1.93 2004/06/19 09:33:42 kls Exp $ 00008 */ 00009 00010 #include "include/vdr/dvbdevice.h" 00011 #include <errno.h> 00012 #include <limits.h> 00013 // #include <linux/videodev.h> 00014 #include <libv4l1-videodev.h> 00015 #include <linux/dvb/audio.h> 00016 #include <linux/dvb/dmx.h> 00017 #include <linux/dvb/frontend.h> 00018 #include <linux/dvb/video.h> 00019 #include <sys/ioctl.h> 00020 #include <sys/mman.h> 00021 00022 #define DO_REC_AND_PLAY_ON_PRIMARY_DEVICE 1 00023 #define DO_MULTIPLE_RECORDINGS 1 00024 //#define WAIT_FOR_LOCK_AFTER_TUNING 1 00025 00026 #define DEV_VIDEO "/dev/video" 00027 #define DEV_DVB_ADAPTER "/dev/dvb/adapter" 00028 #define DEV_DVB_OSD "osd" 00029 #define DEV_DVB_FRONTEND "frontend" 00030 #define DEV_DVB_DVR "dvr" 00031 #define DEV_DVB_DEMUX "demux" 00032 #define DEV_DVB_VIDEO "video" 00033 #define DEV_DVB_AUDIO "audio" 00034 #define DEV_DVB_CA "ca" 00035 00036 class cDvbName { 00037 private: 00038 char buffer[PATH_MAX]; 00039 public: 00040 cDvbName(const char *Name, int n) { 00041 snprintf(buffer, sizeof(buffer), "%s%d/%s%d", DEV_DVB_ADAPTER, n, Name, 0); 00042 } 00043 const char *operator*() { return buffer; } 00044 }; 00045 00046 // --- cDvbDevice ------------------------------------------------------------ 00047 00048 int cDvbDevice::devVideoOffset = -1; 00049 int DvbOpen(const char *Name, int n, int Mode, bool ReportError=false); 00050 cDvbDevice::cDvbDevice(int n) 00051 { 00052 //int camfd; 00053 fd_video = 0; 00054 cardIndex=n; 00055 //For sasc-ng, we never use the ca device here! 00056 //camfd=DvbOpen("ca",cardIndex,O_RDWR|O_NONBLOCK); 00057 //if (camfd > 0) 00058 //{ 00059 // fd_video = 1; 00060 // close(camfd); 00061 //} 00062 //else 00063 // fd_video = 0; 00064 //printf("HW Decoder: %s\n", fd_video ? "Yes" : "No"); 00065 } 00066 00067 cDvbDevice::~cDvbDevice() 00068 { 00069 } 00070 00071 bool cDvbDevice::Probe(const char *FileName) 00072 { 00073 return false; 00074 } 00075 00076 bool cDvbDevice::Initialize(void) 00077 { 00078 return true; 00079 } 00080 00081 void cDvbDevice::MakePrimaryDevice(bool On) 00082 { 00083 } 00084 00085 bool cDvbDevice::HasDecoder(void) const 00086 { 00087 return fd_video; 00088 } 00089 00090 cSpuDecoder *cDvbDevice::GetSpuDecoder(void) 00091 { 00092 return NULL; 00093 } 00094 00095 void cDvbDevice::SetVideoFormat(bool VideoFormat16_9) 00096 { 00097 } 00098 00099 eVideoSystem cDvbDevice::GetVideoSystem(void) 00100 { 00101 return vsNTSC; 00102 } 00103 00104 // ptAudio ptVideo ptPcr ptTeletext ptDolby ptOther 00105 dmx_pes_type_t PesTypes[] = { DMX_PES_AUDIO, DMX_PES_VIDEO, DMX_PES_PCR, DMX_PES_TELETEXT, DMX_PES_OTHER, DMX_PES_OTHER }; 00106 00107 bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On) 00108 { 00109 return true; 00110 } 00111 00112 int cDvbDevice::OpenFilter(u_short Pid, u_char Tid, u_char Mask) 00113 { 00114 const char *FileName = *cDvbName(DEV_DVB_DEMUX, CardIndex()); 00115 int f = open(FileName, O_RDWR | O_NONBLOCK); 00116 if (f >= 0) { 00117 dmx_sct_filter_params sctFilterParams; 00118 memset(&sctFilterParams, 0, sizeof(sctFilterParams)); 00119 sctFilterParams.pid = Pid; 00120 sctFilterParams.timeout = 0; 00121 sctFilterParams.flags = DMX_IMMEDIATE_START; 00122 sctFilterParams.filter.filter[0] = Tid; 00123 sctFilterParams.filter.mask[0] = Mask; 00124 if (ioctl(f, DMX_SET_FILTER, &sctFilterParams) >= 0) 00125 return f; 00126 else { 00127 esyslog("ERROR: can't set filter (pid=%d, tid=%02X, mask=%02X): %m", Pid, Tid, Mask); 00128 close(f); 00129 } 00130 } 00131 else 00132 esyslog("ERROR: can't open filter handle on '%s'", FileName); 00133 return -1; 00134 } 00135 00136 void cDvbDevice::CloseFilter(int Handle) 00137 { 00138 close(Handle); 00139 } 00140 00141 bool cDvbDevice::ProvidesSource(int Source) const 00142 { 00143 return true; 00144 } 00145 00146 bool cDvbDevice::ProvidesTransponder(const cChannel *Channel) const 00147 { 00148 return false; 00149 } 00150 00151 bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) const 00152 { 00153 bool result = false; 00154 return result; 00155 } 00156 00157 bool cDvbDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) 00158 { 00159 return true; 00160 } 00161 00162 bool cDvbDevice::HasLock(int TimeoutMs) 00163 { 00164 return true; 00165 } 00166 00167 void cDvbDevice::SetVolumeDevice(int Volume) 00168 { 00169 } 00170 00171 void cDvbDevice::SetAudioTrackDevice(eTrackType Type) 00172 { 00173 } 00174 00175 bool cDvbDevice::CanReplay(void) const 00176 { 00177 return false; 00178 } 00179 00180 bool cDvbDevice::SetPlayMode(ePlayMode PlayMode) 00181 { 00182 return true; 00183 } 00184 00185 int64_t cDvbDevice::GetSTC(void) 00186 { 00187 return -1; 00188 } 00189 00190 void cDvbDevice::TrickSpeed(int Speed) 00191 { 00192 } 00193 00194 void cDvbDevice::Clear(void) 00195 { 00196 } 00197 00198 void cDvbDevice::Play(void) 00199 { 00200 } 00201 00202 void cDvbDevice::Freeze(void) 00203 { 00204 } 00205 00206 void cDvbDevice::Mute(void) 00207 { 00208 } 00209 00210 void cDvbDevice::StillPicture(const uchar *Data, int Length) 00211 { 00212 } 00213 00214 bool cDvbDevice::Poll(cPoller &Poller, int TimeoutMs) 00215 { 00216 return false; 00217 } 00218 00219 bool cDvbDevice::Flush(int TimeoutMs) 00220 { 00221 return true; 00222 } 00223 00224 int cDvbDevice::PlayVideo(const uchar *Data, int Length) 00225 { 00226 return -1; 00227 } 00228 00229 int cDvbDevice::PlayAudio(const uchar *Data, int Length, uchar Id) 00230 { 00231 return -1; 00232 } 00233 00234 bool cDvbDevice::OpenDvr(void) 00235 { 00236 return false; 00237 } 00238 00239 void cDvbDevice::CloseDvr(void) 00240 { 00241 } 00242 00243 bool cDvbDevice::GetTSPacket(uchar *&Data) 00244 { 00245 return false; 00246 } 00247 00248 bool cDvbDevice::Ready(void) 00249 { 00250 return true; 00251 } 00252 00253 bool cDvbDevice::IsTunedToTransponder(const cChannel *Channel) 00254 { 00255 return true; 00256 } 00257 00258 bool cDvbDevice::HasCi(void) 00259 { 00260 return false; 00261 } 00262 00263 uchar *cDvbDevice::GrabImage(int &Size, bool Jpeg, int Quality, int SizeX, int SizeY) 00264 { 00265 return NULL; 00266 } 00267 00268 void cDvbDevice::SetVideoDisplayFormat(eVideoDisplayFormat VideoDisplayFormat) 00269 { 00270 } 00271 00272 int cDvbDevice::GetAudioChannelDevice(void) 00273 { 00274 return 0; 00275 } 00276 00277 void cDvbDevice::SetAudioChannelDevice(int AudioChannel) 00278 { 00279 } 00280 00281 void cDvbDevice::SetDigitalAudioDevice(bool On) 00282 { 00283 } 00284 00285 void cDvbDevice::SetTransferModeForDolbyDigital(int Mode) 00286 { 00287 }