MythTV  master
v4lchannel.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 
3 #ifndef CHANNEL_H
4 #define CHANNEL_H
5 
6 #include "dtvchannel.h"
7 
8 #ifdef USING_V4L2
9 #include "videodev2.h" // needed for v4l2_std_id type
10 #else
11 typedef uint64_t v4l2_std_id;
12 #endif
13 
14 using namespace std;
15 
16 #define FAKE_VIDEO 0
17 
18 class TVRec;
19 
20 typedef QMap<int,v4l2_std_id> VidModV4L2;
21 
32 class V4LChannel : public DTVChannel
33 {
34  public:
35  V4LChannel(TVRec *parent, const QString &videodevice,
36  const QString &audiodevice = "");
37  virtual ~V4LChannel(void);
38 
39  bool Init(QString &startchannel, bool setchan) override; // ChannelBase
40 
41  // Commands
42  bool Open(void) override; // ChannelBase
43  void Close(void) override; // ChannelBase
44  using DTVChannel::Tune;
45  bool Tune(const DTVMultiplex &tuning) override; // DTVChannel
46  bool Tune(uint64_t frequency) override; // DTVChannel
47  bool Tune(const QString &freqid, int finetune) override; // DTVChannel
48  bool Retune(void) override; // ChannelBase
49 
50  // Sets
51  void SetFd(int fd) override; // ChannelBase
52  void SetFormat(const QString &format) override; // DTVChannel
53  int SetDefaultFreqTable(const QString &name);
54 
55  // Gets
56  bool IsOpen(void) const override // ChannelBase
57  { return GetFd() >= 0; }
58  int GetFd(void) const override // ChannelBase
59  { return videofd; }
60  QString GetDevice(void) const override // ChannelBase
61  { return device; }
62  QString GetAudioDevice(void) const { return audio_device; }
63  QString GetSIStandard(void) const { return "atsc"; }
64 
65  // Picture attributes.
66  bool InitPictureAttributes(void) override; // ChannelBase
67  int GetPictureAttribute(PictureAttribute) const override; // ChannelBase
68  int ChangePictureAttribute(PictureAdjustType,
69  PictureAttribute, bool up) override; // ChannelBase
70 
71  protected:
72  bool IsExternalChannelChangeSupported(void) override // ChannelBase
73  { return true; }
74 
75  private:
76  // Helper Sets
77  void SetFreqTable(const int index);
78  int SetFreqTable(const QString &name) override; // ChannelBase
79  bool SetInputAndFormat(int newcapchannel, QString newFmt);
80 
81  // Helper Gets
82  int GetCurrentChannelNum(const QString &channame);
83  QString GetFormatForChannel(QString channum,
84  QString inputname);
85 
86  // Helper Commands
87  bool InitPictureAttribute(const QString &db_col_name);
88  bool InitializeInputs(void);
89 
90  private:
91  // Data
92  QString device;
93  QString audio_device;
94  int videofd;
95  QString device_name;
96  QString driver_name;
97  QMap<QString,int> pict_attr_default;
98 
99  struct CHANLIST *curList;
101 
105  bool has_tuner;
107 
109 
113 };
114 
115 #endif
int m_videoModeV4L2
Definition: v4lchannel.h:112
bool IsExternalChannelChangeSupported(void) override
Definition: v4lchannel.h:72
QMap< QString, int > pict_attr_default
Definition: v4lchannel.h:97
bool has_std_io
Definition: v4lchannel.h:103
int totalChannels
Definition: v4lchannel.h:100
QString GetDevice(void) const override
Returns String representing device, useful for debugging.
Definition: v4lchannel.h:60
QString GetAudioDevice(void) const
Definition: v4lchannel.h:62
Class providing a generic interface to digital tuning hardware.
Definition: dtvchannel.h:34
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:150
bool has_stream_io
Definition: v4lchannel.h:102
QString audio_device
Definition: v4lchannel.h:93
PictureAttribute
Definition: videoouttypes.h:89
int GetFd(void) const override
Returns file descriptor, -1 if it does not exist.
Definition: v4lchannel.h:58
const char * name
Definition: ParseText.cpp:339
bool IsOpen(void) const override
Reports whether channel is already open.
Definition: v4lchannel.h:56
Implements tuning for TV cards using the V4L driver API, both versions 1 and 2.
Definition: v4lchannel.h:32
QMap< int, v4l2_std_id > VidModV4L2
Definition: v4lchannel.h:18
virtual bool Tune(const DTVMultiplex &tuning)=0
This performs the actual frequency tuning and in some cases input switching.
int m_inputNumV4L
Definition: v4lchannel.h:111
VidModV4L2 videomode_v4l2
Current video mode if 'usingv4l2' is true.
Definition: v4lchannel.h:108
bool has_sliced_vbi
Definition: v4lchannel.h:106
PictureAdjustType
Definition: tv.h:120
QString driver_name
Definition: v4lchannel.h:96
QString device_name
Definition: v4lchannel.h:95
QString device
Definition: v4lchannel.h:92
int videofd
Definition: v4lchannel.h:94
QString GetSIStandard(void) const
Definition: v4lchannel.h:63
bool has_async_io
Definition: v4lchannel.h:104
struct CHANLIST * curList
Definition: v4lchannel.h:99
bool has_tuner
Definition: v4lchannel.h:105
int defaultFreqTable
Definition: v4lchannel.h:110