MythTV  master
programs/mythbackend/filetransfer.h
Go to the documentation of this file.
1 #ifndef FILETRANSFER_H_
2 #define 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
13 #include "referencecounter.h"
14 
15 class ProgramInfo;
16 class MythMediaBuffer;
17 class MythSocket;
18 class QString;
19 
20 class FileTransfer : public ReferenceCounter
21 {
22  friend class QObject; // quiet OSX gcc warning
23 
24  public:
25  FileTransfer(QString &filename, MythSocket *remote,
26  bool usereadahead, std::chrono::milliseconds timeout);
27  FileTransfer(QString &filename, MythSocket *remote, bool write);
28 
29  MythSocket *getSocket() { return m_sock; }
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  ~FileTransfer() override;
50 
51  volatile bool m_readthreadlive {true};
52  bool m_readsLocked {false};
53  QWaitCondition m_readsUnlockedCond;
54 
55  ProgramInfo *m_pginfo {nullptr};
56  MythMediaBuffer* m_rbuffer {nullptr};
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
FileTransfer::Pause
void Pause(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:88
hardwareprofile.smolt.timeout
float timeout
Definition: smolt.py:103
FileTransfer::m_sock
MythSocket * m_sock
Definition: programs/mythbackend/filetransfer.h:57
FileTransfer::Stop
void Stop(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:70
FileTransfer::m_lock
QMutex m_lock
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:58
FileTransfer::m_readthreadlive
volatile bool m_readthreadlive
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:48
mythburn.write
def write(text, progress=True)
Definition: mythburn.py:308
FileTransfer::GetFileName
QString GetFileName(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:254
MythMediaBuffer
Definition: mythmediabuffer.h:50
FileTransfer::~FileTransfer
~FileTransfer() override
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:37
FileTransfer::WriteBlock
int WriteBlock(int size)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:153
FileTransfer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:19
FileTransfer::m_readsLocked
bool m_readsLocked
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:49
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:25
FileTransfer::m_rbuffer
MythMediaBuffer * m_rbuffer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:53
FileTransfer::m_readsUnlockedCond
QWaitCondition m_readsUnlockedCond
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:50
FileTransfer::Seek
long long Seek(long long curpos, long long pos, int whence)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:214
FileTransfer::QObject
friend class QObject
Definition: programs/mythbackend/filetransfer.h:22
FileTransfer::m_writemode
bool m_writemode
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:60
FileTransfer::ReOpen
bool ReOpen(const QString &newFilename="")
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:59
FileTransfer::m_pginfo
ProgramInfo * m_pginfo
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:52
referencecounter.h
FileTransfer::Unpause
void Unpause(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:99
FileTransfer::RequestBlock
int RequestBlock(int size)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:113
FileTransfer::FileTransfer
FileTransfer(QString &filename, MythSocket *remote, MythSocketManager *parent, bool usereadahead, std::chrono::milliseconds timeout)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:11
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
FileTransfer::GetFileSize
uint64_t GetFileSize(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:246
FileTransfer::getSocket
MythSocket * getSocket()
Definition: programs/mythbackend/filetransfer.h:29
FileTransfer::m_requestBuffer
std::vector< char > m_requestBuffer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:56
FileTransfer::SetTimeout
void SetTimeout(bool fast)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:262
build_compdb.filename
filename
Definition: build_compdb.py:21
FileTransfer::m_ateof
bool m_ateof
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:54
FileTransfer::isOpen
bool isOpen(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:54
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:26