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
9#include "libmythtv/tv.h" // for VBIMode
10
11class VBI608Extractor;
12class VBIThread;
13class TVRec;
14
17{
18 friend class VBIThread;
19 public:
20 explicit V4LRecorder(TVRec *rec) : DTVRecorder(rec) {}
21 ~V4LRecorder() override;
22
23 void StopRecording(void) override; // RecorderBase
24 void SetOption(const QString &name, const QString &value) override; // DTVRecorder
25 void SetOption(const QString &name, int value) override // DTVRecorder
26 { DTVRecorder::SetOption(name, value); }
27
28 protected:
29 int OpenVBIDevice(void);
30 void CloseVBIDevice(void);
31 void RunVBIDevice(void);
32
33 virtual bool IsHelperRequested(void) const;
34 virtual void FormatCC(uint /*code1*/, uint /*code2*/) {}
35
36 protected:
39 int m_vbiMode {VBIMode::None};
40 uint m_ntscVbiWidth {0};
41 uint m_ntscVbiStartLine {0};
42 uint m_ntscVbiLineCount {0};
43 VBI608Extractor *m_vbi608 {nullptr};
44 VBIThread *m_vbiThread {nullptr};
45 int m_vbiFd {-1};
46 volatile bool m_requestHelper {false};
47};
48
49class VBIThread : public MThread
50{
51 public:
52 explicit VBIThread(V4LRecorder *_parent) :
53 MThread("VBIThread"), m_parent(_parent)
54 {
55 start();
56 }
57
58 ~VBIThread() override
59 {
60 while (isRunning())
61 {
63 wait(1s);
64 }
65 }
66
67 void run(void) override // MThread
68 {
69 RunProlog();
71 RunEpilog();
72 }
73
74 private:
76};
77
78#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:92
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
bool isRunning(void) const
Definition: mthread.cpp:263
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
Definition: mthread.cpp:196
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
Definition: mthread.cpp:283
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
Definition: mthread.cpp:209
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
Definition: mthread.cpp:300
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:143
Abstract base class for Video4Linux based recorders.
Definition: v4lrecorder.h:17
V4LRecorder(TVRec *rec)
Definition: v4lrecorder.h:20
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:25
QString m_vbiDeviceName
Definition: v4lrecorder.h:38
virtual void FormatCC(uint, uint)
Definition: v4lrecorder.h:34
QString m_audioDeviceName
Definition: v4lrecorder.h:37
@ None
Definition: tv.h:12
V4LRecorder * m_parent
Definition: v4lrecorder.h:75
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:67
VBIThread(V4LRecorder *_parent)
Definition: v4lrecorder.h:52
~VBIThread() override
Definition: v4lrecorder.h:58
unsigned int uint
Definition: freesurround.h:24
#define MTV_PUBLIC
Definition: mythtvexp.h:15