"Fossies" - the Fresh Open Source Software Archive

Member "kaffeine-2.0.18/src/dvb/dvbdevice_linux.h" (14 May 2019, 3612 Bytes) of package /linux/misc/kaffeine-2.0.18.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "dvbdevice_linux.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.0.16_vs_2.0.17.

    1 /*
    2  * dvbdevice_linux.h
    3  *
    4  * Copyright (C) 2007-2011 Christoph Pfister <christophpfister@gmail.com>
    5  *
    6  * This program is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License as published by
    8  * the Free Software Foundation; either version 2 of the License, or
    9  * (at your option) any later version.
   10  *
   11  * This program is distributed in the hope that it will be useful,
   12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14  * GNU General Public License for more details.
   15  *
   16  * You should have received a copy of the GNU General Public License along
   17  * with this program; if not, write to the Free Software Foundation, Inc.,
   18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
   19  */
   20 
   21 #ifndef DVBDEVICE_LINUX_H
   22 #define DVBDEVICE_LINUX_H
   23 
   24 #include <QThread>
   25 #include "dvbbackenddevice.h"
   26 #include "dvbcam_linux.h"
   27 
   28 extern "C" {
   29   #include <libdvbv5/dvb-file.h>
   30   #include <libdvbv5/dvb-demux.h>
   31   #include <libdvbv5/dvb-v5-std.h>
   32   #include <libdvbv5/dvb-scan.h>
   33 }
   34 
   35 class DvbLinuxDevice : public QThread, public DvbBackendDevice
   36 {
   37 public:
   38     explicit DvbLinuxDevice(QObject *parent);
   39     ~DvbLinuxDevice();
   40 
   41     bool isReady() const;
   42     void startDevice(const QString &deviceId_);
   43     void startCa();
   44     void stopCa();
   45     void stopDevice();
   46     void enableDvbDump();
   47     QString getDeviceId();
   48     QString getFrontendName();
   49 
   50     QString caPath;
   51     QString caUdi;
   52     QString demuxPath;
   53     QString demuxUdi;
   54     QString dvrPath;
   55     QString dvrUdi;
   56     int adapter;
   57     int index;
   58     int numDemux;
   59     struct dvb_v5_fe_parms *dvbv5_parms;
   60     QString frontendPath;
   61     QString frontendUdi;
   62 
   63 protected:
   64     TransmissionTypes getTransmissionTypes();
   65     Capabilities getCapabilities();
   66     void setFrontendDevice(DvbFrontendDevice *frontend_);
   67     void setDeviceEnabled(bool enabled_);
   68     bool acquire();
   69     bool setHighVoltage(int higherVoltage);
   70     bool sendMessage(const char *message, int length);
   71     bool sendBurst(SecBurst burst);
   72     bool satSetup(QString lnbModel, int satNumber, int bpf);
   73     bool tune(const DvbTransponder &transponder); // discards obsolete data
   74     bool getProps(DvbTransponder &transponder);
   75     bool isTuned();
   76     float getFrqMHz();
   77     float getSignal(Scale &scale);
   78     float getSnr(DvbBackendDevice::Scale &scale);
   79     bool addPidFilter(int pid);
   80     void removePidFilter(int pid);
   81     void startDescrambling(const QByteArray &pmtSectionData);
   82     void stopDescrambling(int serviceId);
   83     void release();
   84 
   85 private:
   86     void startDvr();
   87     void stopDvr();
   88     void run();
   89 
   90     bool ready;
   91     QString deviceId;
   92     QString frontendName;
   93     TransmissionTypes transmissionTypes;
   94     Capabilities capabilities;
   95     DvbFrontendDevice *frontend;
   96     bool enabled;
   97     QMap<int, int> dmxFds;
   98 
   99     float freqMHz;
  100 
  101     int verbose;
  102     int dvrFd;
  103     int dvrPipe[2];
  104     DvbDataBuffer dvrBuffer;
  105 
  106     DvbLinuxCam cam;
  107 };
  108 
  109 class DvbDeviceMonitor;
  110 class DvbLinuxDeviceManager : public QObject
  111 {
  112     Q_OBJECT
  113 public:
  114     explicit DvbLinuxDeviceManager(QObject *parent);
  115     ~DvbLinuxDeviceManager();
  116 
  117     void componentAdded(QString node, int adapter, int index);
  118     void componentRemoved(QString node, int adapter, int index);
  119 public slots:
  120     void doColdPlug();
  121 
  122 signals:
  123     void requestBuiltinDeviceManager(QObject *&bultinDeviceManager);
  124     void deviceAdded(DvbBackendDevice *device);
  125     void deviceRemoved(DvbBackendDevice *device);
  126 
  127 private slots:
  128     void componentAdded(const QString &udi);
  129     void componentRemoved(const QString &udi);
  130 
  131 private:
  132     int readSysAttr(const QString &path);
  133 
  134     QMap<int, DvbLinuxDevice *> devices;
  135     QMap<QString, DvbLinuxDevice *> udis;
  136     class DvbDeviceMonitor *monitor;
  137 };
  138 
  139 #endif /* DVBDEVICE_LINUX_H */