MythTV master
filetransfer.h
Go to the documentation of this file.
1#ifndef MYTHBACKEND_FILETRANSFER_H_
2#define MYTHBACKEND_FILETRANSFER_H_
3
4// C++ headers
5#include <cstdint>
6#include <vector>
7
8// Qt headers
9#include <QMutex>
10#include <QWaitCondition>
11
12// MythTV headers
14
15class ProgramInfo;
16class MythMediaBuffer;
17class MythSocket;
18class QString;
19
21{
22 friend class QObject; // quiet OSX gcc warning
23
24 public:
25 BEFileTransfer(QString &filename, MythSocket *remote,
26 bool usereadahead, std::chrono::milliseconds timeout);
27 BEFileTransfer(QString &filename, MythSocket *remote, bool write);
28
30
31 bool isOpen(void);
32 bool ReOpen(const QString& newFilename = "");
33
34 void Stop(void);
35
36 void Pause(void);
37 void Unpause(void);
38 int RequestBlock(int size);
39 int WriteBlock(int size);
40
41 long long Seek(long long curpos, long long pos, int whence);
42
43 uint64_t GetFileSize(void);
44 QString GetFileName(void);
45
46 void SetTimeout(bool fast);
47
48 private:
49 ~BEFileTransfer() override;
50
51 volatile bool m_readthreadlive {true};
52 bool m_readsLocked {false};
53 QWaitCondition m_readsUnlockedCond;
54
57 MythSocket *m_sock {nullptr};
58 bool m_ateof {false};
59
60 std::vector<char> m_requestBuffer;
61
62 QMutex m_lock;
63
64 bool m_writemode {false};
65};
66
67#endif // MYTHBACKEND_FILETRANSFER_H_
int RequestBlock(int size)
bool isOpen(void)
int WriteBlock(int size)
uint64_t GetFileSize(void)
MythSocket * getSocket()
Definition: filetransfer.h:29
BEFileTransfer(QString &filename, MythSocket *remote, bool usereadahead, std::chrono::milliseconds timeout)
MythSocket * m_sock
Definition: filetransfer.h:57
void Unpause(void)
volatile bool m_readthreadlive
Definition: filetransfer.h:51
void Stop(void)
friend class QObject
Definition: filetransfer.h:22
MythMediaBuffer * m_rbuffer
Definition: filetransfer.h:56
QWaitCondition m_readsUnlockedCond
Definition: filetransfer.h:53
bool ReOpen(const QString &newFilename="")
std::vector< char > m_requestBuffer
Definition: filetransfer.h:60
ProgramInfo * m_pginfo
Definition: filetransfer.h:55
~BEFileTransfer() override
void SetTimeout(bool fast)
long long Seek(long long curpos, long long pos, int whence)
void Pause(void)
QString GetFileName(void)
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:26
Holds information on recordings and videos.
Definition: programinfo.h:68
General purpose reference counter.
def write(text, progress=True)
Definition: mythburn.py:307