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
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:215
QString m_audioDeviceName
Definition: v4lrecorder.h:46
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:46
void RunVBIDevice(void)
This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC,...
Definition: dtvrecorder.h:27
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:311
QList< struct txtbuffertype * > m_textBuffer
Definition: v4lrecorder.h:56
Definition: vt.h:36
Abstract base class for Video4Linux based recorders.
Definition: v4lrecorder.h:24
RecorderBase * nvr
Definition: v4lrecorder.h:18
#define MTV_PUBLIC
Definition: mythtvexp.h:15
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:142
bool isRunning(void) const
Definition: mthread.cpp:274
V4LRecorder * m_parent
Definition: v4lrecorder.h:87
unsigned int uint
Definition: compat.h:140
virtual void FormatTT(struct VBIData *)
Definition: v4lrecorder.h:42
This is the abstract base class for supporting recorder hardware.
Definition: recorderbase.h:66
void StopRecording(void) override
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: v4lrecorder.cpp:46
void SetOption(const QString &name, const QString &value) override
Set an specific option.
Definition: dtvrecorder.cpp:79
void SetOption(const QString &name, int value) override
handles the "wait_for_seqstart" option.
Definition: v4lrecorder.h:33
vt_page teletextpage
Definition: v4lrecorder.h:19
V4LRecorder(TVRec *rec)
Definition: v4lrecorder.h:28
bool foundteletextpage
Definition: v4lrecorder.h:20
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:202
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:294
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
VBIThread(V4LRecorder *_parent)
Definition: v4lrecorder.h:64
QString m_vbiDeviceName
Definition: v4lrecorder.h:47
virtual void StopRecording(void)
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: vbi.h:17
~VBIThread() override
Definition: v4lrecorder.h:70
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:43