| 1 |
/* |
| 2 |
* Copyright (C) 2006 Team MediaPortal |
| 3 |
* http://www.team-mediaportal.com |
| 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, or (at your option) |
| 8 |
* 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 GNU Make; see the file COPYING. If not, write to |
| 17 |
* the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, |
| 18 |
* MA 02110-1335 USA |
| 19 |
* http://www.gnu.org/copyleft/gpl.html |
| 20 |
* |
| 21 |
*/ |
| 22 |
#pragma once |
| 23 |
|
| 24 |
#include "SectionDecoder.h" |
| 25 |
#include "PmtParser.h" |
| 26 |
#include "ChannelInfo.h" |
| 27 |
#include <vector> |
| 28 |
|
| 29 |
namespace MPTV |
| 30 |
{ |
| 31 |
class IPatParserCallback |
| 32 |
{ |
| 33 |
public: |
| 34 |
virtual void OnNewChannel(CChannelInfo& info) = 0; |
| 35 |
}; |
| 36 |
|
| 37 |
class CPatParser : public CSectionDecoder |
| 38 |
{ |
| 39 |
public: |
| 40 |
enum PatState |
| 41 |
{ |
| 42 |
Idle, |
| 43 |
Parsing, |
| 44 |
}; |
| 45 |
CPatParser(void); |
| 46 |
virtual ~CPatParser(void); |
| 47 |
void SkipPacketsAtStart(int64_t packets); |
| 48 |
void OnTsPacket(byte* tsPacket); |
| 49 |
void Reset(); |
| 50 |
void OnNewSection(CSection& section); |
| 51 |
size_t Count(); |
| 52 |
void Dump(); |
| 53 |
void SetCallBack(IPatParserCallback* callback); |
| 54 |
private: |
| 55 |
bool GetChannel(size_t index, CChannelInfo& info); |
| 56 |
void CleanUp(); |
| 57 |
IPatParserCallback* m_pCallback; |
| 58 |
std::vector<CPmtParser*> m_pmtParsers; |
| 59 |
int64_t m_packetsReceived; |
| 60 |
int64_t m_packetsToSkip; |
| 61 |
int m_iPatTableVersion; |
| 62 |
PatState m_iState; |
| 63 |
}; |
| 64 |
} |