110 long Size,
int NumBufs)
115 QByteArray fname =
Name.toLatin1();
116 const char *aname = fname.constData();
117 if (
mkfifo(aname, S_IREAD | S_IWRITE | S_IRGRP | S_IROTH) == -1)
119 LOG(VB_GENERAL, LOG_ERR, QString(
"Couldn't create fifo for file: '%1'").arg(
Name) +
ENO);
123 LOG(VB_GENERAL, LOG_INFO, QString(
"Created %1 fifo: %2").arg(Desc,
Name));
144 fifoptr = fifoptr->
m_next;
154 std::this_thread::sleep_for(1ms);
174 fd = open(fname.constData(), O_WRONLY|
O_SYNC);
182 static_cast<size_t>(
m_fbOutptr[Id]->m_blockSize-written)));
185 LOG(VB_GENERAL, LOG_ERR, QString(
"FIFOW: write failed with %1")
186 .arg(strerror(errno)));
201 unlink(
m_filename[Id].toLocal8Bit().constData());
219 bool blocking =
false;
237 QString msg = QString(
"allocating additonal buffer for : %1(%2)")
239 LOG(VB_FILE, LOG_INFO, msg);
250 m_fbInptr[Id]->
m_data =
new unsigned char[
static_cast<unsigned long>(Size)];
275 std::this_thread::sleep_for(1ms);
This is a wrapper around QThread that does several additional things.
bool isRunning(void) const
void RunProlog(void)
Sets up a thread, call this if you reimplement run().
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
void RunEpilog(void)
Cleans up a thread's resources, call this if you reimplement run().
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
MythFIFOWriter * m_parent
void SetParent(MythFIFOWriter *Parent)
~MythFIFOThread() override
void run(void) override
Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.
QWaitCondition * m_fullCond
MythFifoBuffer ** m_fbOutptr
MythFifoBuffer ** m_fifoBuf
void FIFOWriteThread(int Id)
MythFifoBuffer ** m_fbInptr
MythFIFOThread * m_fifoThrds
bool FIFOInit(uint Id, const QString &Desc, const QString &Name, long Size, int NumBufs)
void FIFOWrite(uint Id, void *Buffer, long Size)
MythFIFOWriter(uint Count, bool Sync)
QWaitCondition * m_emptyCond
#define mkfifo(path, mode)
#define ENO
This can be appended to the LOG args with "+".
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static bool isRunning(const char *program)
Returns true if a program containing the specified string is running on this machine.
def write(text, progress=True)
struct MythFifoBuffer * m_next