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 using namespace std;
8 
9 #include <QMutex>
10 #include <QString>
11 #include <QWaitCondition>
12 
13 #include <vector>
14 
15 #include "mythsocket.h"
16 #include "sockethandler.h"
17 
18 class ProgramInfo;
19 class RingBuffer;
20 
22 {
23  public:
24  FileTransfer(QString &filename, MythSocket *remote,
25  MythSocketManager *parent,
26  bool usereadahead, int timeout_ms);
27  FileTransfer(QString &filename, MythSocket *remote,
28  MythSocketManager *parent, bool write);
29 
30  bool isOpen(void);
31  bool ReOpen(QString newFilename = "");
32 
33  void Stop(void);
34 
35  void Pause(void);
36  void Unpause(void);
37  int RequestBlock(int size);
38  int WriteBlock(int size);
39 
40  long long Seek(long long curpos, long long pos, int whence);
41 
42  uint64_t GetFileSize(void);
43  QString GetFileName(void);
44 
45  void SetTimeout(bool fast);
46 
47  private:
48  ~FileTransfer() override;
49 
50  volatile bool m_readthreadlive {true};
51  bool m_readsLocked {false};
52  QWaitCondition m_readsUnlockedCond;
53 
54  ProgramInfo *m_pginfo {nullptr};
55  RingBuffer *m_rbuffer {nullptr};
56  bool m_ateof {false};
57 
58  vector<char> m_requestBuffer;
59 
60  QMutex m_lock {QMutex::NonRecursive};
61 
62  bool m_writemode {false};
63 };
64 
65 #endif
def write(text, progress=True)
Definition: mythburn.py:279
Holds information on recordings and videos.
Definition: programinfo.h:66
Class for communcating between myth backends and frontends.
Definition: mythsocket.h:26
Implements a file/stream reader/writer.
static qint64 GetFileSize(ProgramInfo *program_info)