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"
6 #include "cc608decoder.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  virtual ~V4LRecorder();
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:
46  QString m_audiodevice;
47  QString m_vbidevice;
48  int m_vbimode {VBIMode::None};
49  struct VBIData *m_pal_vbi_cb {nullptr};
50  struct vbi *m_pal_vbi_tt {nullptr};
51  uint m_ntsc_vbi_width {0};
52  uint m_ntsc_vbi_start_line {0};
53  uint m_ntsc_vbi_line_count {0};
54  VBI608Extractor *m_vbi608 {nullptr};
55  VBIThread *m_vbi_thread {nullptr};
56  QList<struct txtbuffertype*> m_textbuffer;
57  int m_vbi_fd {-1};
58  volatile bool m_request_helper {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  virtual ~VBIThread()
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
QList< struct txtbuffertype * > m_textbuffer
Definition: v4lrecorder.h:56
void start(QThread::Priority=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:294
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:28
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:311
unsigned int uint
Definition: compat.h:140
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:150
QString m_audiodevice
Definition: v4lrecorder.h:46
bool isRunning(void) const
Definition: mthread.cpp:274
V4LRecorder * m_parent
Definition: v4lrecorder.h:87
QString m_vbidevice
Definition: v4lrecorder.h:47
const char * name
Definition: ParseText.cpp:328
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 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
virtual void StopRecording(void)
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: vbi.h:21
virtual ~VBIThread()
Definition: v4lrecorder.h:70
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:43