| 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 "FileReader.h" |
| 37 |
#include <vector> |
| 38 |
#include <string> |
| 39 |
|
| 40 |
namespace MPTV |
| 41 |
{ |
| 42 |
class MultiFileReaderFile |
| 43 |
{ |
| 44 |
public: |
| 45 |
std::string filename; |
| 46 |
int64_t startPosition; |
| 47 |
int64_t length; |
| 48 |
long filePositionId; |
| 49 |
}; |
| 50 |
|
| 51 |
class MultiFileReader : public FileReader |
| 52 |
{ |
| 53 |
public: |
| 54 |
MultiFileReader(); |
| 55 |
virtual ~MultiFileReader(); |
| 56 |
|
| 57 |
virtual long SetFileName(const std::string& fileName); |
| 58 |
virtual long OpenFile(); |
| 59 |
virtual long OpenFile(const std::string& fileName); |
| 60 |
virtual long CloseFile(); |
| 61 |
virtual long Read(unsigned char* pbData, size_t lDataLength, size_t *dwReadBytes); |
| 62 |
|
| 63 |
virtual bool IsFileInvalid(); |
| 64 |
|
| 65 |
virtual int64_t SetFilePointer(int64_t llDistanceToMove, unsigned long dwMoveMethod); |
| 66 |
virtual int64_t GetFilePointer(); |
| 67 |
virtual int64_t GetFileSize(); |
| 68 |
virtual int64_t OnChannelChange(void); |
| 69 |
int64_t SetCurrentFilePointer(int64_t timeShiftBufferFilePos, long timeshiftBufferFileID); |
| 70 |
|
| 71 |
protected: |
| 72 |
long RefreshTSBufferFile(); |
| 73 |
long GetFileLength(const char* pFilename, int64_t &length); |
| 74 |
|
| 75 |
FileReader m_TSBufferFile; |
| 76 |
int64_t m_startPosition; |
| 77 |
int64_t m_currentFileStartOffset; |
| 78 |
int64_t m_endPosition; |
| 79 |
int64_t m_currentPosition; |
| 80 |
int64_t m_lastZapPosition; |
| 81 |
int32_t m_filesAdded; |
| 82 |
int32_t m_filesRemoved; |
| 83 |
|
| 84 |
std::vector<MultiFileReaderFile *> m_tsFiles; |
| 85 |
|
| 86 |
FileReader m_TSFile; |
| 87 |
long m_TSFileId; |
| 88 |
bool m_bDelay; |
| 89 |
}; |
| 90 |
} |
| 91 |
|