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
6
8#include "libmythtv/tv.h" // for VBIMode
9
10class VBI608Extractor;
11class VBIThread;
12class TVRec;
13
16{
17 friend class VBIThread;
18 public:
19 explicit V4LRecorder(TVRec *rec) : DTVRecorder(rec) {}
20 ~V4LRecorder() override;
21
22 void StopRecording(void) override; // RecorderBase
23 void SetOption(const QString &name, const QString &value) override; // DTVRecorder
24 void SetOption(const QString &name, int value) override // DTVRecorder
25 { DTVRecorder::SetOption(name, value); }
26
27 protected:
28 int OpenVBIDevice(void);
29 void CloseVBIDevice(void);
30 void RunVBIDevice(void);
31
32 virtual bool IsHelperRequested(void) const;
33 virtual void FormatCC(uint /*code1*/, uint /*code2*/) {}
34
35 protected:
38 int m_vbiMode {VBIMode::None};
39 uint m_ntscVbiWidth {0};
40 uint m_ntscVbiStartLine {0};
41 uint m_ntscVbiLineCount {0};
42 VBI608Extractor *m_vbi608 {nullptr};
43 VBIThread *m_vbiThread {nullptr};
44 int m_vbiFd {-1};
45 volatile bool m_requestHelper {false};
46};
47
48class VBIThread : public MThread
49{
50 public:
51 explicit VBIThread(V4LRecorder *_parent) :
52 MThread("VBIThread"), m_parent(_parent)
53 {
54 start();
55 }
56
57 ~VBIThread() override
58 {
59 while (isRunning())
60 {
62 wait(1s);
63 }
64 }
65
66 void run(void) override // MThread
67 {
68 RunProlog();
70 RunEpilog();
71 }
72
73 private:
75};
76
77#endif // V4L_RECORDER_H
This is a specialization of RecorderBase used to handle MPEG-2, MPEG-4, MPEG-4 AVC,...
Definition: dtvrecorder.h:35
void SetOption(const QString &name, const QString &value) override
Set an specific option.
Definition: dtvrecorder.cpp:98
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
bool isRunning(void) const
Definition: mthread.cpp:261
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:194
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:281
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:207
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:298
virtual void StopRecording(void)
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
This is the coordinating class of the Recorder Subsystem.
Definition: tv_rec.h:142
Abstract base class for Video4Linux based recorders.
Definition: v4lrecorder.h:16
V4LRecorder(TVRec *rec)
Definition: v4lrecorder.h:19
void StopRecording(void) override
StopRecording() signals to the recorder that it should stop recording and exit cleanly.
Definition: v4lrecorder.cpp:43
void RunVBIDevice(void)
void SetOption(const QString &name, int value) override
handles the "wait_for_seqstart" option.
Definition: v4lrecorder.h:24
QString m_vbiDeviceName
Definition: v4lrecorder.h:37
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:33
QString m_audioDeviceName
Definition: v4lrecorder.h:36
@ None
Definition: tv.h:12
V4LRecorder * m_parent
Definition: v4lrecorder.h:74
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:66
VBIThread(V4LRecorder *_parent)
Definition: v4lrecorder.h:51
~VBIThread() override
Definition: v4lrecorder.h:57
unsigned int uint
Definition: compat.h:60
#define MTV_PUBLIC
Definition: mythtvexp.h:8