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 using namespace std;
8 
9 // Qt headers
10 #include <QMutex>
11 #include <QWaitCondition>
12 
13 // MythTV headers
14 #include "referencecounter.h"
15 
16 class ProgramInfo;
17 class MythMediaBuffer;
18 class MythSocket;
19 class QString;
20 
21 class FileTransfer : public ReferenceCounter
22 {
23  friend class QObject; // quiet OSX gcc warning
24 
25  public:
26  FileTransfer(QString &filename, MythSocket *remote,
27  bool usereadahead, int timeout_ms);
28  FileTransfer(QString &filename, MythSocket *remote, bool write);
29 
30  MythSocket *getSocket() { return m_sock; }
31 
32  bool isOpen(void);
33  bool ReOpen(const QString& newFilename = "");
34 
35  void Stop(void);
36 
37  void Pause(void);
38  void Unpause(void);
39  int RequestBlock(int size);
40  int WriteBlock(int size);
41 
42  long long Seek(long long curpos, long long pos, int whence);
43 
44  uint64_t GetFileSize(void);
45  QString GetFileName(void);
46 
47  void SetTimeout(bool fast);
48 
49  private:
50  ~FileTransfer() override;
51 
52  volatile bool m_readthreadlive {true};
53  bool m_readsLocked {false};
54  QWaitCondition m_readsUnlockedCond;
55 
56  ProgramInfo *m_pginfo {nullptr};
57  MythMediaBuffer* m_rbuffer {nullptr};
58  MythSocket *m_sock {nullptr};
59  bool m_ateof {false};
60 
61  vector<char> m_requestBuffer;
62 
63  QMutex m_lock {QMutex::NonRecursive};
64 
65  bool m_writemode {false};
66 };
67 
68 #endif
FileTransfer::Pause
void Pause(void)
FileTransfer::Stop
void Stop(void)
mythburn.write
def write(text, progress=True)
Definition: mythburn.py:308
FileTransfer::GetFileName
QString GetFileName(void)
MythMediaBuffer
Definition: mythmediabuffer.h:50
FileTransfer::~FileTransfer
~FileTransfer() override
FileTransfer::WriteBlock
int WriteBlock(int size)
FileTransfer
Definition: libs/libmythprotoserver/sockethandler/filetransfer.h:22
MythSocket
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:27
FileTransfer::Seek
long long Seek(long long curpos, long long pos, int whence)
filename
QString filename
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:640
FileTransfer::ReOpen
bool ReOpen(const QString &newFilename="")
referencecounter.h
FileTransfer::Unpause
void Unpause(void)
FileTransfer::RequestBlock
int RequestBlock(int size)
ProgramInfo
Holds information on recordings and videos.
Definition: programinfo.h:68
FileTransfer::GetFileSize
uint64_t GetFileSize(void)
FileTransfer::getSocket
MythSocket * getSocket()
Definition: programs/mythbackend/filetransfer.h:30
FileTransfer::SetTimeout
void SetTimeout(bool fast)
FileTransfer::isOpen
bool isOpen(void)
ReferenceCounter
General purpose reference counter.
Definition: referencecounter.h:27