CPPMyth
Library to interoperate with MythTV server
mythprototransfer.h
1 /*
2  * Copyright (C) 2014 Jean-Luc Barriere
3  *
4  * This Program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * This Program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
17  * MA 02110-1301 USA
18  * http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21 
22 #ifndef MYTHPROTOTRANSFER_H
23 #define MYTHPROTOTRANSFER_H
24 
25 #include "mythprotobase.h"
26 
27 #define PROTO_TRANSFER_RCVBUF 64000
28 
29 namespace Myth
30 {
31 
32  class ProtoTransfer;
33  typedef MYTH_SHARED_PTR<ProtoTransfer> ProtoTransferPtr;
34 
35  class ProtoTransfer : public ProtoBase
36  {
37  public:
38  ProtoTransfer(const std::string& server, unsigned port, const std::string& pathname, const std::string& sgname);
39 
40  virtual bool Open();
41  virtual void Close();
42 
43  void Lock();
44  void Unlock();
45  bool TryLock();
50  void Flush();
51 
52  uint32_t GetFileId() const;
53  std::string GetPathName() const;
54  std::string GetStorageGroupName() const;
55 
56  int64_t GetSize() const;
57  int64_t GetPosition() const;
58  int64_t GetRequested() const;
59  int64_t GetRemaining() const;
60 
61  void SetSize(int64_t size);
62  void SetPosition(int64_t position);
63  void SetRequested(int64_t requested);
64 
65  private:
66  int64_t m_fileSize;
67  int64_t m_filePosition;
68  int64_t m_fileRequest;
69  uint32_t m_fileId;
70  std::string m_pathName;
71  std::string m_storageGroupName;
72 
73  bool Announce75();
74  };
75 
76 }
77 
78 #endif /* MYTHPROTOTRANSFER_H */
int64_t m_fileRequest
Current requested position.
void Flush()
Flushing unread data previously requested.
int64_t m_fileSize
Size of file.
This is the main namespace that encloses all public classes.
Definition: mythcontrol.h:29
int64_t m_filePosition
Current read position.