| 1 |
/* |
| 2 |
* Copyright (C) 2005-2013 Team Kodi |
| 3 |
* https://kodi.tv |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
************************************************************************* |
| 19 |
* This file is a modified version from Team MediaPortal's |
| 20 |
* TsReader DirectShow filter |
| 21 |
* MediaPortal is a GPL'ed HTPC-Application |
| 22 |
* Copyright (C) 2005-2012 Team MediaPortal |
| 23 |
* http://www.team-mediaportal.com |
| 24 |
* |
| 25 |
* Changes compared to Team MediaPortal's version: |
| 26 |
* - Code cleanup for PVR addon usage |
| 27 |
* - Code refactoring for cross platform usage |
| 28 |
************************************************************************* |
| 29 |
* This file originates from TSFileSource, a GPL directshow push |
| 30 |
* source filter that provides an MPEG transport stream output. |
| 31 |
* Copyright (C) 2005-2006 nate, bear |
| 32 |
* http://forums.dvbowners.com/ |
| 33 |
*/ |
| 34 |
#pragma once |
| 35 |
|
| 36 |
#include "MultiFileReader.h" |
| 37 |
#include "PacketSync.h" |
| 38 |
#include "TSHeader.h" |
| 39 |
#include "PatParser.h" |
| 40 |
#include <mutex> |
| 41 |
|
| 42 |
namespace MPTV |
| 43 |
{ |
| 44 |
|
| 45 |
class CTsReader; |
| 46 |
|
| 47 |
class CDeMultiplexer : public CPacketSync, public IPatParserCallback |
| 48 |
{ |
| 49 |
public: |
| 50 |
CDeMultiplexer(CTsReader& filter); |
| 51 |
virtual ~CDeMultiplexer(void); |
| 52 |
|
| 53 |
void Start(); |
| 54 |
void OnTsPacket(byte* tsPacket); |
| 55 |
void OnNewChannel(CChannelInfo& info); |
| 56 |
void SetFileReader(FileReader* reader); |
| 57 |
void RequestNewPat(void); |
| 58 |
size_t ReadFromFile(); |
| 59 |
|
| 60 |
private: |
| 61 |
unsigned long long m_LastDataFromRtsp; |
| 62 |
bool m_bEndOfFile; |
| 63 |
std::mutex m_sectionRead; |
| 64 |
FileReader* m_reader; |
| 65 |
CPatParser m_patParser; |
| 66 |
CTsReader& m_filter; |
| 67 |
|
| 68 |
int m_iPatVersion; |
| 69 |
int m_ReqPatVersion; |
| 70 |
unsigned long long m_WaitNewPatTmo; |
| 71 |
int m_receivedPackets; |
| 72 |
|
| 73 |
bool m_bStarting; |
| 74 |
|
| 75 |
bool m_bAudioAtEof; |
| 76 |
bool m_bVideoAtEof; |
| 77 |
|
| 78 |
// Kodi specific |
| 79 |
bool m_bGotNewChannel; |
| 80 |
}; |
| 81 |
} |