22 #include "mythfileplayback.h" 23 #include "mythlivetvplayback.h" 24 #include "private/debug.h" 25 #include "private/os/threads/mutex.h" 26 #include "private/builtin.h" 38 FilePlayback::FilePlayback(
const std::string& server,
unsigned port)
42 ProtoPlayback::Open();
45 FilePlayback::~FilePlayback()
50 bool FilePlayback::Open()
53 OS::CLockGuard lock(*m_mutex);
54 if (ProtoPlayback::IsOpen())
56 return ProtoPlayback::Open();
59 void FilePlayback::Close()
62 OS::CLockGuard lock(*m_mutex);
64 ProtoPlayback::Close();
67 bool FilePlayback::OpenTransfer(
const std::string& pathname,
const std::string& sgname)
70 OS::CLockGuard lock(*m_mutex);
71 if (!ProtoPlayback::IsOpen())
74 m_transfer.reset(
new ProtoTransfer(m_server, m_port, pathname, sgname));
75 if (m_transfer->Open())
80 void FilePlayback::CloseTransfer()
83 OS::CLockGuard lock(*m_mutex);
86 TransferDone(*m_transfer);
92 bool FilePlayback::TransferIsOpen()
94 ProtoTransferPtr transfer(m_transfer);
96 return ProtoPlayback::TransferIsOpen(*transfer);
100 int64_t FilePlayback::GetSize()
const 102 ProtoTransferPtr transfer(m_transfer);
104 return transfer->GetSize();
108 int FilePlayback::Read(
void *buffer,
unsigned n)
110 ProtoTransferPtr transfer(m_transfer);
114 int64_t s = transfer->GetRemaining();
120 r = TransferRequestBlock(*transfer, buffer, n);
127 int64_t FilePlayback::Seek(int64_t offset, WHENCE_t whence)
129 ProtoTransferPtr transfer(m_transfer);
131 return TransferSeek(*transfer, offset, whence);
135 int64_t FilePlayback::GetPosition()
const 137 ProtoTransferPtr transfer(m_transfer);
139 return transfer->GetPosition();
This is the main namespace that encloses all public classes.