13 #define LOC QString("SH[%1](%2): ").arg(m_inputid).arg(m_device) 23 LOG(VB_GENERAL, LOG_ERR,
LOC +
24 "dtor & _stream_data_list not empty");
34 bool allow_section_reader,
40 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"AddListener(0x%1) -- begin")
41 .arg((uint64_t)data,0,16));
44 LOG(VB_GENERAL, LOG_ERR,
LOC +
45 QString(
"AddListener(0x%1) -- null data")
46 .arg((uint64_t)data,0,16));
52 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"AddListener(0x%1) -- locked")
53 .arg((uint64_t)data,0,16));
74 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"AddListener(0x%1) -- end")
75 .arg((uint64_t)data,0,16));
82 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"RemoveListener(0x%1) -- begin")
83 .arg((uint64_t)data,0,16));
86 LOG(VB_GENERAL, LOG_ERR,
LOC +
87 QString(
"RemoveListener(0x%1) -- null data")
88 .arg((uint64_t)data,0,16));
94 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"RemoveListener(0x%1) -- locked")
95 .arg((uint64_t)data,0,16));
101 if (!(*it).isEmpty())
111 LOG(VB_RECORD, LOG_INFO,
LOC + QString(
"RemoveListener(0x%1) -- end")
112 .arg((uint64_t)data,0,16));
124 LOG(VB_RECORD, LOG_INFO,
LOC +
"Restarting StreamHandler");
148 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Start failed");
155 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"Stopping");
158 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"Stopped");
172 bool is_using_buffering,
173 bool is_using_section_reader)
191 #ifdef DEBUG_PID_FILTERS 192 LOG(VB_RECORD, LOG_DEBUG,
LOC + QString(
"AddPIDFilter(0x%1)")
193 .arg(info->
_pid, 0, 16));
194 #endif // DEBUG_PID_FILTERS 206 #ifdef DEBUG_PID_FILTERS 207 LOG(VB_RECORD, LOG_DEBUG,
LOC +
208 QString(
"RemovePIDFilter(0x%1)").arg(pid, 0, 16));
209 #endif // DEBUG_PID_FILTERS 213 PIDInfoMap::iterator it =
m_pid_info.find(pid);
238 #ifdef DEBUG_PID_FILTERS 239 LOG(VB_RECORD, LOG_DEBUG,
LOC +
"RemoveAllPIDFilters()");
240 #endif // DEBUG_PID_FILTERS 242 vector<int> del_pids;
245 del_pids.push_back(it.key());
248 auto dit = del_pids.begin();
249 for (; dit != del_pids.end(); ++dit)
257 vector<uint> add_eit, del_eit;
268 for (
size_t i = 0; i < del_eit.size(); i++)
270 uint_vec_t::iterator it2;
277 for (
size_t i = 0; i < add_eit.size(); i++)
296 it.key()->GetPIDs(pids);
299 QMap<uint, PIDInfo*> add_pids;
300 vector<uint> del_pids;
306 pid_map_t::const_iterator lit = pids.constBegin();
307 for (; lit != pids.constEnd(); ++lit)
317 PIDInfoMap::const_iterator fit =
m_pid_info.begin();
320 bool in_pids = pids.find(fit.key()) != pids.end();
322 del_pids.push_back(fit.key());
328 auto dit = del_pids.begin();
329 for (; dit != del_pids.end(); ++dit)
333 QMap<uint, PIDInfo*>::iterator ait = add_pids.begin();
334 for (; ait != add_pids.end(); ++ait)
352 tmp = max(
tmp, it.key()->GetPIDPriority(pid));
366 #if !defined( USING_MINGW ) && !defined( _MSC_VER ) 370 QString fn = QString(
"%1.raw").arg(
file);
384 LOG(VB_RECORD, LOG_INFO,
LOC +
391 LOG(VB_GENERAL, LOG_ERR,
LOC +
392 QString(
"Failed to link '%1' to '%2'")
399 LOG(VB_RECORD, LOG_INFO,
LOC +
400 QString(
"linked '%1' to '%2'")
406 #endif // !defined( USING_MINGW ) && !defined( _MSC_VER ) 412 #if !defined( USING_MINGW ) && !defined( _MSC_VER ) 425 #endif // !defined( USING_MINGW ) && !defined( _MSC_VER ) void start(QThread::Priority=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
virtual PIDInfo * CreatePIDInfo(uint pid, uint stream_type, int pes_type)
volatile bool m_running_desired
bool UpdateFiltersFromStreamData(void)
static pid_list_t::iterator find(const PIDInfoMap &map, pid_list_t &list, pid_list_t::iterator begin, pid_list_t::iterator end, bool find_open)
QMap< uint, PIDPriority > pid_map_t
QSet< QString > m_mpts_files
bool wait(unsigned long time=ULONG_MAX)
Wait for the MThread to exit, with a maximum timeout.
QWaitCondition m_running_state_changed
virtual void RemoveListener(MPEGStreamData *data)
ISO 13818-1 private tables & ITU H.222.0.
bool isRunning(void) const
Returns true if start() or restart() has been called at least once since construction and since any c...
virtual bool UpdateFilters(void)
virtual void RemoveListeningPID(uint pid)
virtual void RemoveNamedOutputFile(const QString &filename)
Called with _listener_lock locked just before removing old output file.
int Write(const void *data, uint count)
Writes data to the end of the write buffer.
void SetRunning(bool running, bool using_buffering, bool using_section_reader)
virtual void AddListener(MPEGStreamData *data, bool allow_section_reader=false, bool needs_buffering=false, QString output_file=QString())
bool RemovePIDFilter(uint pid)
void exit(int retcode=0)
Use this to exit from the thread if you are using a Qt event loop.
#define ENO
This can be appended to the LOG args with "+".
virtual void AddListeningPID(uint pid, PIDPriority priority=kPIDPriorityNormal)
bool m_using_section_reader
bool Open(void)
Opens the file we will be writing to.
#define LOG(_MASK_, _LEVEL_, _STRING_)
StreamDataList m_stream_data_list
virtual void SetRunningDesired(bool desired)
At minimum this sets _running_desired, this may also send signals to anything that might be blocking ...
int elapsed(void)
Returns milliseconds elapsed since last start() or restart()
bool AddPIDFilter(PIDInfo *info)
bool m_allow_section_reader
virtual void CycleFiltersByPriority()
This class supports the writing of recordings to disk.
ThreadedFileWriter * m_mpts_tfw
void WriteMPTS(unsigned char *buffer, uint len)
Write out a copy of the raw MPTS.
virtual bool HasEITPIDChanges(const uint_vec_t &) const
virtual bool GetEITPIDChanges(const uint_vec_t &, uint_vec_t &, uint_vec_t &) const
void UpdateListeningForEIT(void)
virtual bool AddNamedOutputFile(const QString &filename)
Called with _listener_lock locked just after adding new output file.
Encapsulates data about MPEG stream and emits events for each table.
bool IsRunning(void) const
vector< uint > m_eit_pids
bool RemoveAllPIDFilters(void)
PIDPriority GetPIDPriority(uint pid) const