MythTV  master
libs/libmythprotoserver/sockethandler/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 
7 #include <QMutex>
8 #include <QString>
9 #include <QWaitCondition>
10 
11 #include <vector>
12 
13 #include "mythsocket.h"
14 #include "sockethandler.h"
15 
16 class ProgramInfo;
17 class MythMediaBuffer;
18 
20 {
21  public:
22  FileTransfer(QString &filename, MythSocket *remote,
23  MythSocketManager *parent,
24  bool usereadahead, int timeout_ms);
25  FileTransfer(QString &filename, MythSocket *remote,
26  MythSocketManager *parent, bool write);
27 
28  bool isOpen(void);
29  bool ReOpen(const QString& newFilename = "");
30 
31  void Stop(void);
32 
33  void Pause(void);
34  void Unpause(void);
35  int RequestBlock(int size);
36  int WriteBlock(int size);
37 
38  long long Seek(long long curpos, long long pos, int whence);
39 
40  uint64_t GetFileSize(void);
41  QString GetFileName(void);
42 
43  void SetTimeout(bool fast);
44 
45  private:
46  ~FileTransfer() override;
47 
48  volatile bool m_readthreadlive {true};
49  bool m_readsLocked {false};
50  QWaitCondition m_readsUnlockedCond;
51 
52  ProgramInfo *m_pginfo {nullptr};
54  bool m_ateof {false};
55 
56  std::vector<char> m_requestBuffer;
57 
58  QMutex m_lock {QMutex::NonRecursive};
59 
60  bool m_writemode {false};
61 };
62 
63 #endif
FileTransfer::Pause
void Pause(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:88
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:49
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
MythSocketManager
Definition: mythsocketmanager.h:34
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:26
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
sockethandler.h
FileTransfer::Seek
long long Seek(long long curpos, long long pos, int whence)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:214
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:637
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
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
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:67
FileTransfer::FileTransfer
FileTransfer(QString &filename, MythSocket *remote, MythSocketManager *parent, bool usereadahead, int timeout_ms)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:11
FileTransfer::GetFileSize
uint64_t GetFileSize(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:246
SocketHandler
Definition: sockethandler.h:16
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
FileTransfer::m_ateof
bool m_ateof
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:54
mythsocket.h
FileTransfer::isOpen
bool isOpen(void)
Definition: libs/libmythprotoserver/sockethandler/filetransfer.cpp:54