MythTV  master
v4lrecorder.h
Go to the documentation of this file.
1 // -*- Mode: c++ -*-
2 #ifndef V4L_RECORDER_H
3 #define V4L_RECORDER_H
4 
5 #include "libmythbase/mthread.h"
6 
10 #include "libmythtv/tv.h" // for VBIMode
11 
12 class VBI608Extractor;
13 class VBIThread;
14 class TVRec;
15 
16 struct vbi;
17 struct VBIData
18 {
22 };
23 
26 {
27  friend class VBIThread;
28  public:
29  explicit V4LRecorder(TVRec *rec) : DTVRecorder(rec) {}
30  ~V4LRecorder() override;
31 
32  void StopRecording(void) override; // RecorderBase
33  void SetOption(const QString &name, const QString &value) override; // DTVRecorder
34  void SetOption(const QString &name, int value) override // DTVRecorder
35  { DTVRecorder::SetOption(name, value); }
36 
37  protected:
38  int OpenVBIDevice(void);
39  void CloseVBIDevice(void);
40  void RunVBIDevice(void);
41 
42  virtual bool IsHelperRequested(void) const;
43  virtual void FormatTT(struct VBIData */*vbidata*/) {}
44  virtual void FormatCC(uint /*code1*/, uint /*code2*/) {}
45 
46  protected:
48  QString m_vbiDeviceName;
49  int m_vbiMode {VBIMode::None};
50  struct VBIData *m_palVbiCb {nullptr};
51  struct vbi *m_palVbiTt {nullptr};
52  uint m_ntscVbiWidth {0};
53  uint m_ntscVbiStartLine {0};
54  uint m_ntscVbiLineCount {0};
55  VBI608Extractor *m_vbi608 {nullptr};
56  VBIThread *m_vbiThread {nullptr};
57  QList<struct txtbuffertype*> m_textBuffer;
58  int m_vbiFd {-1};
59  volatile bool m_requestHelper {false};
60 };
61 
62 class VBIThread : public MThread
63 {
64  public:
65  explicit VBIThread(V4LRecorder *_parent) :
66  MThread("VBIThread"), m_parent(_parent)
67  {
68  start();
69  }
70 
71  ~VBIThread() override
72  {
73  while (isRunning())
74  {
76  wait(1s);
77  }
78  }
79 
80  void run(void) override // MThread
81  {
82  RunProlog();
84  RunEpilog();
85  }
86 
87  private:
88  V4LRecorder *m_parent {nullptr};
89 };
90 
91 #endif // V4L_RECORDER_H
VBIThread
Definition: v4lrecorder.h:62
tv.h
MThread::start
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:283
vt.h
V4LRecorder::m_textBuffer
QList< struct txtbuffertype * > m_textBuffer
Definition: v4lrecorder.h:57
dtvrecorder.h
vbi
Definition: vbi.h:17
V4LRecorder
Abstract base class for Video4Linux based recorders.
Definition: v4lrecorder.h:25
MThread::wait
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:300
VBIThread::~VBIThread
~VBIThread() override
Definition: v4lrecorder.h:71
VBI608Extractor
Definition: vbi608extractor.h:32
VBIData::teletextpage
vt_page teletextpage
Definition: v4lrecorder.h:20
vt_page
Definition: vt.h:36
MThread::RunProlog
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:196
VBIMode::None
@ None
Definition: tv.h:11
VBIData::foundteletextpage
bool foundteletextpage
Definition: v4lrecorder.h:21
V4LRecorder::SetOption
void SetOption(const QString &name, int value) override
handles the "wait_for_seqstart" option.
Definition: v4lrecorder.h:34
cc608decoder.h
V4LRecorder::V4LRecorder
V4LRecorder(TVRec *rec)
Definition: v4lrecorder.h:29
VBIThread::run
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Definition: v4lrecorder.h:80
V4LRecorder::StopRecording
void StopRecording(void) override
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: v4lrecorder.cpp:43
MThread::RunEpilog
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:209
DTVRecorder::SetOption
void SetOption(const QString &name, const QString &value) override
Set an specific option.
Definition: dtvrecorder.cpp:91
DTVRecorder
This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC,...
Definition: dtvrecorder.h:25
uint
unsigned int uint
Definition: compat.h:79
VBIThread::m_parent
V4LRecorder * m_parent
Definition: v4lrecorder.h:88
RecorderBase::StopRecording
virtual void StopRecording(void)
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: recorderbase.cpp:224
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
VBIThread::VBIThread
VBIThread(V4LRecorder *_parent)
Definition: v4lrecorder.h:65
VBIData
Definition: v4lrecorder.h:17
RecorderBase
This is the abstract base class for supporting recorder hardware.
Definition: recorderbase.h:74
TVRec
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:144
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:48
mthread.h
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:263
V4LRecorder::FormatCC
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:44
V4LRecorder::FormatTT
virtual void FormatTT(struct VBIData *)
Definition: v4lrecorder.h:43
VBIData::nvr
RecorderBase * nvr
Definition: v4lrecorder.h:19
V4LRecorder::m_audioDeviceName
QString m_audioDeviceName
Definition: v4lrecorder.h:47
V4LRecorder::RunVBIDevice
void RunVBIDevice(void)
Definition: v4lrecorder.cpp:223
V4LRecorder::m_vbiDeviceName
QString m_vbiDeviceName
Definition: v4lrecorder.h:48