|
MythTV master
|
#include <libmythtv/recorders/ExternalStreamHandler.h>
Public Member Functions | |
| ExternalStreamHandler (const QString &path, int inputid, int majorid) | |
| ~ExternalStreamHandler (void) override | |
| void | PriorityEvent (int fd) override |
| QString | GetDescription (void) |
| QString | UpdateDescription (void) |
| bool | IsDamaged (void) const |
| void | ClearDamaged (void) |
| bool | IsAppOpen (void) |
| bool | IsTSOpen (void) |
| bool | HasTuner (void) const |
| bool | HasPictureAttributes (void) const |
| bool | RestartStream (void) |
| void | LockReplay (void) |
| void | UnlockReplay (bool enable_replay=false) |
| void | ReplayStream (void) |
| bool | StartStreaming (bool recording) |
| bool | StopStreaming (void) |
| bool | Monitor (void) |
| void | PurgeBuffer (void) |
| bool | ProcessCommand (const QString &cmd, QString &result, std::chrono::milliseconds timeout=4s, uint retry_cnt=3) |
| bool | ProcessVer1 (const QString &cmd, QString &result, std::chrono::milliseconds timeout, uint retry_cnt) |
| bool | ProcessVer2 (const QString &command, QString &result, std::chrono::milliseconds timeout, uint retry_cnt) |
| bool | ProcessJson (const QVariantMap &vmsg, QVariantMap &elements, QByteArray &response, std::chrono::milliseconds timeout=4s, uint retry_cnt=3) |
| int | APIVersion (void) const |
Public Member Functions inherited from StreamHandler | |
| virtual void | AddListener (MPEGStreamData *data, bool allow_section_reader=false, bool needs_buffering=false, const QString &output_file=QString()) |
| virtual void | RemoveListener (MPEGStreamData *data) |
| bool | IsRunning (void) const |
| bool | HasError (void) const |
| virtual bool | AddNamedOutputFile (const QString &filename) |
| Called with _listener_lock locked just after adding new output file. More... | |
| virtual void | RemoveNamedOutputFile (const QString &filename) |
| Called with _listener_lock locked just before removing old output file. More... | |
| void | ReaderPaused (int fd) override |
| void | PriorityEvent (int fd) override |
| virtual void | ReaderPaused (int fd)=0 |
| virtual void | PriorityEvent (int fd)=0 |
Static Public Member Functions | |
| static ExternalStreamHandler * | Get (const QString &devname, int inputid, int majorid) |
| static void | Return (ExternalStreamHandler *&ref, int inputid) |
Protected Member Functions | |
| void | run (void) override |
| Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More... | |
Protected Member Functions inherited from StreamHandler | |
| StreamHandler (QString device, int inputid) | |
| ~StreamHandler () override | |
| void | Start (void) |
| void | Stop (void) |
| void | SetRunning (bool running, bool using_buffering, bool using_section_reader) |
| bool | AddPIDFilter (PIDInfo *info) |
| bool | RemovePIDFilter (uint pid) |
| bool | RemoveAllPIDFilters (void) |
| void | UpdateListeningForEIT (void) |
| bool | UpdateFiltersFromStreamData (void) |
| virtual bool | UpdateFilters (void) |
| virtual void | CycleFiltersByPriority () |
| PIDPriority | GetPIDPriority (uint pid) const |
| virtual PIDInfo * | CreatePIDInfo (uint pid, uint stream_type, int pes_type) |
| void | WriteMPTS (const unsigned char *buffer, uint len) |
| Write out a copy of the raw MPTS. More... | |
| virtual void | SetRunningDesired (bool desired) |
| At minimum this sets _running_desired, this may also send signals to anything that might be blocking the run() loop. More... | |
Protected Member Functions inherited from MThread | |
| virtual void | run (void) |
| Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More... | |
| int | exec (void) |
| Enters the qt event loop. call exit or quit to exit thread. More... | |
| MThread (const QString &objectName) | |
| Standard constructor. More... | |
| MThread (const QString &objectName, QRunnable *runnable) | |
| Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More... | |
| virtual | ~MThread () |
| MThread (const MThread &)=delete | |
| MThread & | operator= (const MThread &)=delete |
| void | RunProlog (void) |
| Sets up a thread, call this if you reimplement run(). More... | |
| void | RunEpilog (void) |
| Cleans up a thread's resources, call this if you reimplement run(). More... | |
| QThread * | qthread (void) |
| Returns the thread, this will always return the same pointer no matter how often you restart the thread. More... | |
| void | setObjectName (const QString &name) |
| QString | objectName (void) const |
| void | setPriority (QThread::Priority priority) |
| QThread::Priority | priority (void) const |
| bool | isFinished (void) const |
| bool | isRunning (void) const |
| void | setStackSize (uint stackSize) |
| uint | stackSize (void) const |
| void | exit (int retcode=0) |
| Use this to exit from the thread if you are using a Qt event loop. More... | |
| void | start (QThread::Priority p=QThread::InheritPriority) |
| Tell MThread to start running the thread in the near future. More... | |
| void | terminate (void) |
| Kill a thread unsafely. More... | |
| void | quit (void) |
| calls exit(0) More... | |
| bool | wait (std::chrono::milliseconds time=std::chrono::milliseconds::max()) |
| Wait for the MThread to exit, with a maximum timeout. More... | |
Protected Member Functions inherited from DeviceReaderCB | |
| virtual | ~DeviceReaderCB ()=default |
| virtual void | ReaderPaused (int fd)=0 |
| virtual void | PriorityEvent (int fd)=0 |
Private Types | |
| enum | constants { MAX_API_VERSION = 3 , TS_PACKET_SIZE = 188 , PACKET_SIZE = TS_PACKET_SIZE * 8192 , TOO_FAST_SIZE = TS_PACKET_SIZE * 32768 } |
Private Member Functions | |
| int | StreamingCount (void) const |
| bool | SetAPIVersion (void) |
| bool | OpenApp (void) |
| void | CloseApp (void) |
Private Attributes | |
| QString | m_loc |
| int | m_majorId |
| QMutex | m_ioLock |
| ExternIO * | m_io {nullptr} |
| QStringList | m_args |
| QString | m_app |
| bool | m_tsOpen {false} |
| int | m_ioErrCnt {0} |
| bool | m_pollMode {false} |
| int | m_apiVersion {1} |
| uint | m_serialNo {0} |
| bool | m_hasTuner {false} |
| bool | m_hasPictureAttributes {false} |
| QByteArray | m_replayBuffer |
| bool | m_replay {false} |
| bool | m_xon {false} |
| bool | m_recording {false} |
| bool | m_damaged {false} |
| QAtomicInt | m_streamingCnt |
| QMutex | m_streamLock |
| QMutex | m_replayLock |
| QMutex | m_processLock |
Static Private Attributes | |
| static QMutex | s_handlersLock |
| static QMap< int, ExternalStreamHandler * > | s_handlers |
| static QMap< int, uint > | s_handlersRefCnt |
Additional Inherited Members | |
Protected Types inherited from StreamHandler | |
| using | StreamDataList = QHash< MPEGStreamData *, QString > |
Static Protected Member Functions inherited from MThread | |
| static void | setTerminationEnabled (bool enabled=true) |
| static void | ThreadSetup (const QString &name) |
| This is to be called on startup in those few threads that haven't been ported to MThread. More... | |
| static void | ThreadCleanup (void) |
| This is to be called on exit in those few threads that haven't been ported to MThread. More... | |
| static void | Cleanup (void) |
| This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More... | |
| static void | GetAllThreadNames (QStringList &list) |
| static void | GetAllRunningThreadNames (QStringList &list) |
Protected Attributes inherited from StreamHandler | |
| QString | m_device |
| int | m_inputId |
| bool | m_needsBuffering {false} |
| bool | m_allowSectionReader {false} |
| QMutex | m_addRmLock |
| QMutex | m_startStopLock |
| volatile bool | m_runningDesired {false} |
| volatile bool | m_bError {false} |
| bool | m_running {false} |
| bool | m_restarting {false} |
| bool | m_usingBuffering {false} |
| bool | m_usingSectionReader {false} |
| QWaitCondition | m_runningStateChanged |
| QRecursiveMutex | m_pidLock |
| std::vector< uint > | m_eitPids |
| PIDInfoMap | m_pidInfo |
| uint | m_openPidFilters {0} |
| bool | m_filtersChanged {false} |
| MythTimer | m_cycleTimer |
| ThreadedFileWriter * | m_mptsTfw {nullptr} |
| QSet< QString > | m_mptsFiles |
| QString | m_mptsBaseFile |
| QMutex | m_mptsLock |
| QRecursiveMutex | m_listenerLock |
| StreamDataList | m_streamDataList |
Protected Attributes inherited from MThread | |
| MThreadInternal * | m_thread {nullptr} |
| QRunnable * | m_runnable {nullptr} |
| bool | m_prologExecuted {true} |
| bool | m_epilogExecuted {true} |
Definition at line 69 of file ExternalStreamHandler.h.
|
private |
| Enumerator | |
|---|---|
| MAX_API_VERSION | |
| TS_PACKET_SIZE | |
| PACKET_SIZE | |
| TOO_FAST_SIZE | |
Definition at line 71 of file ExternalStreamHandler.h.
|
explicit |
Definition at line 558 of file ExternalStreamHandler.cpp.
Referenced by Get().
|
inlineoverride |
Definition at line 84 of file ExternalStreamHandler.h.
|
inline |
Definition at line 122 of file ExternalStreamHandler.h.
Referenced by ExternalChannel::Tune().
|
inline |
Definition at line 91 of file ExternalStreamHandler.h.
Referenced by ExternalRecorder::run().
|
private |
Definition at line 1050 of file ExternalStreamHandler.cpp.
Referenced by run(), and ~ExternalStreamHandler().
|
static |
Definition at line 478 of file ExternalStreamHandler.cpp.
Referenced by ExternalSignalMonitor::ExternalSignalMonitor(), ExternalRecorder::Open(), and ExternalChannel::Open().
|
inline |
Definition at line 88 of file ExternalStreamHandler.h.
Referenced by ExternalChannel::GetDescription().
|
inline |
Definition at line 95 of file ExternalStreamHandler.h.
|
inline |
Definition at line 94 of file ExternalStreamHandler.h.
Referenced by ExternalChannel::Tune(), and ExternalRecChannelFetcher::Valid().
| bool ExternalStreamHandler::IsAppOpen | ( | void | ) |
Definition at line 1023 of file ExternalStreamHandler.cpp.
Referenced by ExternalRecorder::Open(), ExternalChannel::Open(), OpenApp(), StartStreaming(), and StopStreaming().
|
inline |
Definition at line 90 of file ExternalStreamHandler.h.
Referenced by ExternalRecorder::run().
| bool ExternalStreamHandler::IsTSOpen | ( | void | ) |
Definition at line 1036 of file ExternalStreamHandler.cpp.
Referenced by run().
|
inline |
Definition at line 99 of file ExternalStreamHandler.h.
| bool ExternalStreamHandler::Monitor | ( | void | ) |
Definition at line 1698 of file ExternalStreamHandler.cpp.
Referenced by run().
|
private |
Definition at line 930 of file ExternalStreamHandler.cpp.
Referenced by ExternalStreamHandler().
|
overridevirtual |
Implements DeviceReaderCB.
Definition at line 1837 of file ExternalStreamHandler.cpp.
| bool ExternalStreamHandler::ProcessCommand | ( | const QString & | cmd, |
| QString & | result, | ||
| std::chrono::milliseconds | timeout = 4s, |
||
| uint | retry_cnt = 3 |
||
| ) |
Definition at line 1259 of file ExternalStreamHandler.cpp.
Referenced by CloseApp(), ExternalRecChannelFetcher::FetchChannel(), ExternalSignalMonitor::GetLockTimeout(), ExternalSignalMonitor::GetSignalStrengthPercent(), ExternalChannel::GetTuneStatus(), ExternalSignalMonitor::HasLock(), IsAppOpen(), IsTSOpen(), ExternalRecChannelFetcher::LoadChannels(), OpenApp(), ReplayStream(), run(), SetAPIVersion(), StartStreaming(), StopStreaming(), ExternalChannel::Tune(), and UpdateDescription().
| bool ExternalStreamHandler::ProcessJson | ( | const QVariantMap & | vmsg, |
| QVariantMap & | elements, | ||
| QByteArray & | response, | ||
| std::chrono::milliseconds | timeout = 4s, |
||
| uint | retry_cnt = 3 |
||
| ) |
Definition at line 1542 of file ExternalStreamHandler.cpp.
Referenced by ProcessCommand(), and ExternalChannel::Tune().
| bool ExternalStreamHandler::ProcessVer1 | ( | const QString & | cmd, |
| QString & | result, | ||
| std::chrono::milliseconds | timeout, | ||
| uint | retry_cnt | ||
| ) |
Definition at line 1294 of file ExternalStreamHandler.cpp.
Referenced by ProcessCommand().
| bool ExternalStreamHandler::ProcessVer2 | ( | const QString & | command, |
| QString & | result, | ||
| std::chrono::milliseconds | timeout, | ||
| uint | retry_cnt | ||
| ) |
Definition at line 1400 of file ExternalStreamHandler.cpp.
Referenced by ProcessCommand().
| void ExternalStreamHandler::PurgeBuffer | ( | void | ) |
Definition at line 1827 of file ExternalStreamHandler.cpp.
Referenced by StopStreaming().
| void ExternalStreamHandler::ReplayStream | ( | void | ) |
Definition at line 1106 of file ExternalStreamHandler.cpp.
| bool ExternalStreamHandler::RestartStream | ( | void | ) |
Definition at line 1088 of file ExternalStreamHandler.cpp.
Referenced by run().
|
static |
Definition at line 509 of file ExternalStreamHandler.cpp.
Referenced by ExternalRecChannelFetcher::Close(), ExternalRecorder::Close(), ExternalChannel::Close(), ExternalSignalMonitor::ExternalSignalMonitor(), ExternalRecorder::Open(), and ExternalSignalMonitor::~ExternalSignalMonitor().
|
overrideprotectedvirtual |
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
Reimplemented from MThread.
Definition at line 593 of file ExternalStreamHandler.cpp.
|
private |
Definition at line 890 of file ExternalStreamHandler.cpp.
Referenced by OpenApp().
| bool ExternalStreamHandler::StartStreaming | ( | bool | recording | ) |
Definition at line 1149 of file ExternalStreamHandler.cpp.
Referenced by RestartStream(), ExternalRecorder::StartStreaming(), and ExternalSignalMonitor::UpdateValues().
| bool ExternalStreamHandler::StopStreaming | ( | void | ) |
Definition at line 1199 of file ExternalStreamHandler.cpp.
Referenced by RestartStream(), ExternalSignalMonitor::Stop(), and ExternalRecorder::StopStreaming().
|
private |
Definition at line 588 of file ExternalStreamHandler.cpp.
Referenced by RestartStream(), run(), StartStreaming(), and StopStreaming().
|
inline |
Definition at line 100 of file ExternalStreamHandler.h.
| QString ExternalStreamHandler::UpdateDescription | ( | void | ) |
Definition at line 915 of file ExternalStreamHandler.cpp.
Referenced by OpenApp(), StartStreaming(), and ExternalChannel::UpdateDescription().
|
private |
Definition at line 143 of file ExternalStreamHandler.h.
Referenced by APIVersion(), Monitor(), OpenApp(), ProcessCommand(), SetAPIVersion(), and UpdateDescription().
|
private |
Definition at line 138 of file ExternalStreamHandler.h.
Referenced by ExternalStreamHandler(), and OpenApp().
|
private |
Definition at line 137 of file ExternalStreamHandler.h.
Referenced by CloseApp(), ExternalStreamHandler(), and OpenApp().
|
private |
Definition at line 152 of file ExternalStreamHandler.h.
Referenced by ClearDamaged(), IsDamaged(), Monitor(), and RestartStream().
|
private |
Definition at line 146 of file ExternalStreamHandler.h.
Referenced by HasPictureAttributes(), and OpenApp().
|
private |
Definition at line 145 of file ExternalStreamHandler.h.
Referenced by HasTuner(), and OpenApp().
|
private |
Definition at line 136 of file ExternalStreamHandler.h.
Referenced by CloseApp(), IsAppOpen(), Monitor(), OpenApp(), ProcessJson(), ProcessVer1(), ProcessVer2(), PurgeBuffer(), and run().
|
private |
Definition at line 140 of file ExternalStreamHandler.h.
Referenced by ProcessJson(), ProcessVer1(), and ProcessVer2().
|
private |
Definition at line 135 of file ExternalStreamHandler.h.
Referenced by CloseApp(), Monitor(), OpenApp(), ProcessVer1(), and ProcessVer2().
|
private |
Definition at line 133 of file ExternalStreamHandler.h.
Referenced by GetDescription(), and UpdateDescription().
|
private |
Definition at line 134 of file ExternalStreamHandler.h.
Referenced by Return().
|
private |
Definition at line 141 of file ExternalStreamHandler.h.
Referenced by OpenApp(), ReplayStream(), run(), and StopStreaming().
|
private |
Definition at line 162 of file ExternalStreamHandler.h.
Referenced by ProcessCommand().
|
private |
Definition at line 151 of file ExternalStreamHandler.h.
Referenced by Monitor(), RestartStream(), StartStreaming(), and StopStreaming().
|
private |
Definition at line 149 of file ExternalStreamHandler.h.
Referenced by ReplayStream(), run(), and UnlockReplay().
|
private |
Definition at line 148 of file ExternalStreamHandler.h.
Referenced by ReplayStream(), and run().
|
private |
Definition at line 161 of file ExternalStreamHandler.h.
Referenced by LockReplay(), and UnlockReplay().
|
private |
Definition at line 144 of file ExternalStreamHandler.h.
Referenced by ProcessJson(), and ProcessVer2().
|
private |
Definition at line 159 of file ExternalStreamHandler.h.
Referenced by StartStreaming(), StopStreaming(), and StreamingCount().
|
private |
Definition at line 160 of file ExternalStreamHandler.h.
Referenced by run(), StartStreaming(), and StopStreaming().
|
private |
Definition at line 139 of file ExternalStreamHandler.h.
Referenced by IsTSOpen().
|
private |
Definition at line 150 of file ExternalStreamHandler.h.
Referenced by ReplayStream(), run(), and StopStreaming().
|
staticprivate |
Definition at line 156 of file ExternalStreamHandler.h.
|
staticprivate |
Definition at line 155 of file ExternalStreamHandler.h.
|
staticprivate |
Definition at line 157 of file ExternalStreamHandler.h.