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 "dtvrecorder.h"
7 #include "vbitext/vt.h"
8 #include "mthread.h"
9 #include "tv.h" // for VBIMode
10 
11 class VBI608Extractor;
12 class VBIThread;
13 class TVRec;
14 
15 struct vbi;
16 struct VBIData
17 {
21 };
22 
25 {
26  friend class VBIThread;
27  public:
28  explicit V4LRecorder(TVRec *rec) : DTVRecorder(rec) {}
29  ~V4LRecorder() override;
30 
31  void StopRecording(void) override; // RecorderBase
32  void SetOption(const QString &name, const QString &value) override; // DTVRecorder
33  void SetOption(const QString &name, int value) override // DTVRecorder
34  { DTVRecorder::SetOption(name, value); }
35 
36  protected:
37  int OpenVBIDevice(void);
38  void CloseVBIDevice(void);
39  void RunVBIDevice(void);
40 
41  virtual bool IsHelperRequested(void) const;
42  virtual void FormatTT(struct VBIData */*vbidata*/) {}
43  virtual void FormatCC(uint /*code1*/, uint /*code2*/) {}
44 
45  protected:
47  QString m_vbiDeviceName;
48  int m_vbiMode {VBIMode::None};
49  struct VBIData *m_palVbiCb {nullptr};
50  struct vbi *m_palVbiTt {nullptr};
51  uint m_ntscVbiWidth {0};
52  uint m_ntscVbiStartLine {0};
53  uint m_ntscVbiLineCount {0};
54  VBI608Extractor *m_vbi608 {nullptr};
55  VBIThread *m_vbiThread {nullptr};
56  QList<struct txtbuffertype*> m_textBuffer;
57  int m_vbiFd {-1};
58  volatile bool m_requestHelper {false};
59 };
60 
61 class VBIThread : public MThread
62 {
63  public:
64  explicit VBIThread(V4LRecorder *_parent) :
65  MThread("VBIThread"), m_parent(_parent)
66  {
67  start();
68  }
69 
70  ~VBIThread() override
71  {
72  while (isRunning())
73  {
75  wait(1000);
76  }
77  }
78 
79  void run(void) override // MThread
80  {
81  RunProlog();
83  RunEpilog();
84  }
85 
86  private:
87  V4LRecorder *m_parent {nullptr};
88 };
89 
90 #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:292
vt.h
V4LRecorder::m_textBuffer
QList< struct txtbuffertype * > m_textBuffer
Definition: v4lrecorder.h:56
dtvrecorder.h
vbi
Definition: vbi.h:18
V4LRecorder
Abstract base class for Video4Linux based recorders.
Definition: v4lrecorder.h:25
VBIThread::~VBIThread
~VBIThread() override
Definition: v4lrecorder.h:70
VBI608Extractor
Definition: vbi608extractor.h:30
VBIData::teletextpage
vt_page teletextpage
Definition: v4lrecorder.h:19
vt_page
Definition: vt.h:37
MThread::RunProlog
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:202
VBIMode::None
@ None
Definition: tv.h:11
VBIData::foundteletextpage
bool foundteletextpage
Definition: v4lrecorder.h:20
V4LRecorder::SetOption
void SetOption(const QString &name, int value) override
handles the "wait_for_seqstart" option.
Definition: v4lrecorder.h:33
cc608decoder.h
V4LRecorder::V4LRecorder
V4LRecorder(TVRec *rec)
Definition: v4lrecorder.h:28
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:79
V4LRecorder::StopRecording
void StopRecording(void) override
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: v4lrecorder.cpp:46
MThread::RunEpilog
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:215
DTVRecorder::SetOption
void SetOption(const QString &name, const QString &value) override
Set an specific option.
Definition: dtvrecorder.cpp:89
DTVRecorder
This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC,...
Definition: dtvrecorder.h:36
uint
unsigned int uint
Definition: compat.h:140
VBIThread::m_parent
V4LRecorder * m_parent
Definition: v4lrecorder.h:87
RecorderBase::StopRecording
virtual void StopRecording(void)
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: recorderbase.cpp:226
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
VBIThread::VBIThread
VBIThread(V4LRecorder *_parent)
Definition: v4lrecorder.h:64
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:143
MThread
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
mthread.h
MThread::isRunning
bool isRunning(void) const
Definition: mthread.cpp:272
V4LRecorder::FormatCC
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:43
V4LRecorder::FormatTT
virtual void FormatTT(struct VBIData *)
Definition: v4lrecorder.h:42
MThread::wait
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:309
VBIData::nvr
RecorderBase * nvr
Definition: v4lrecorder.h:18
V4LRecorder::m_audioDeviceName
QString m_audioDeviceName
Definition: v4lrecorder.h:46
V4LRecorder::RunVBIDevice
void RunVBIDevice(void)
Definition: v4lrecorder.cpp:248
V4LRecorder::m_vbiDeviceName
QString m_vbiDeviceName
Definition: v4lrecorder.h:47