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 RingBuffer;
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 sock; }
31 
32  bool isOpen(void);
33  bool ReOpen(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();
51 
52  volatile bool readthreadlive;
53  bool readsLocked;
54  QWaitCondition readsUnlockedCond;
55 
56  ProgramInfo *pginfo;
57  RingBuffer *rbuffer;
59  bool ateof;
60 
61  vector<char> requestBuffer;
62 
63  QMutex lock;
64 
65  bool writemode;
66 };
67 
68 #endif
def write(text, progress=True)
Definition: mythburn.py:279
General purpose reference counter.
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)