| 1 |
#pragma once |
| 2 |
/* |
| 3 |
* Copyright (C) 2005-2012 Team Kodi |
| 4 |
* https://kodi.tv |
| 5 |
* |
| 6 |
* This program is free software: you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU General Public License as published by |
| 8 |
* the Free Software Foundation, either version 2 of the License, or |
| 9 |
* (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
************************************************************************* |
| 20 |
* This file is a modified version from Team MediaPortal's |
| 21 |
* TsReader DirectShow filter |
| 22 |
* MediaPortal is a GPL'ed HTPC-Application |
| 23 |
* Copyright (C) 2005-2012 Team MediaPortal |
| 24 |
* http://www.team-mediaportal.com |
| 25 |
* |
| 26 |
* Changes compared to Team MediaPortal's version: |
| 27 |
* - Code cleanup for PVR addon usage |
| 28 |
* - Code refactoring for cross platform usage |
| 29 |
************************************************************************* |
| 30 |
* This file originates from TSFileSource, a GPL directshow push |
| 31 |
* source filter that provides an MPEG transport stream output. |
| 32 |
* Copyright (C) 2005-2006 nate, bear |
| 33 |
* http://forums.dvbowners.com/ |
| 34 |
*/ |
| 35 |
|
| 36 |
#include <string> |
| 37 |
#include <kodi/Filesystem.h> |
| 38 |
|
| 39 |
namespace MPTV |
| 40 |
{ |
| 41 |
class FileReader |
| 42 |
{ |
| 43 |
public: |
| 44 |
FileReader(); |
| 45 |
virtual ~FileReader(); |
| 46 |
|
| 47 |
// Open and write to the file |
| 48 |
virtual long GetFileName(std::string& fileName); |
| 49 |
virtual long SetFileName(const std::string& fileName); |
| 50 |
virtual long OpenFile(const std::string& fileName); |
| 51 |
virtual long OpenFile(); |
| 52 |
virtual long CloseFile(); |
| 53 |
virtual long Read(unsigned char* pbData, size_t lDataLength, size_t *dwReadBytes); |
| 54 |
virtual bool IsFileInvalid(); |
| 55 |
virtual int64_t SetFilePointer(int64_t llDistanceToMove, unsigned long dwMoveMethod); |
| 56 |
virtual int64_t GetFilePointer(); |
| 57 |
virtual int64_t GetFileSize(); |
| 58 |
virtual bool IsBuffer() { return false; }; |
| 59 |
virtual int64_t OnChannelChange(void); |
| 60 |
virtual size_t HasData(){ return 0; }; |
| 61 |
virtual void SetNoBuffer(); |
| 62 |
|
| 63 |
protected: |
| 64 |
kodi::vfs::CFile m_hFile; // Handle to file for streaming |
| 65 |
std::string m_fileName; // The filename where we read from |
| 66 |
int64_t m_fileSize; |
| 67 |
uint32_t m_flags; |
| 68 |
}; |
| 69 |
} |