| 1 |
/* |
| 2 |
* Copyright (C) 2006-2008 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 "ISectionCallback.h" |
| 25 |
#include "DvbUtil.h" |
| 26 |
#include "Section.h" |
| 27 |
#include "TSHeader.h" |
| 28 |
|
| 29 |
#define MAX_SECTIONS 256 |
| 30 |
|
| 31 |
namespace MPTV |
| 32 |
{ |
| 33 |
class CSectionDecoder : public CDvbUtil |
| 34 |
{ |
| 35 |
public: |
| 36 |
CSectionDecoder(void); |
| 37 |
~CSectionDecoder(void); |
| 38 |
void SetCallBack(ISectionCallback* callback); |
| 39 |
void OnTsPacket(byte* tsPacket); |
| 40 |
void OnTsPacket(CTsHeader& header, byte* tsPacket); |
| 41 |
void SetPid(int pid); |
| 42 |
int GetPid(); |
| 43 |
void Reset(); |
| 44 |
void EnableLogging(bool onOff); |
| 45 |
void EnableCrcCheck(bool onOff); |
| 46 |
virtual void OnNewSection(CSection& section); |
| 47 |
protected: |
| 48 |
private: |
| 49 |
int StartNewSection(byte* tsPacket, int index, int sectionLen); |
| 50 |
int AppendSection(byte* tsPacket, int index, int sectionLen); |
| 51 |
int SnapshotSectionLength(byte* tsPacket, int start); |
| 52 |
|
| 53 |
bool m_bLog; |
| 54 |
bool m_bCrcCheck; |
| 55 |
int m_pid; |
| 56 |
CSection m_section; |
| 57 |
int m_iContinuityCounter; |
| 58 |
ISectionCallback* m_pCallback; |
| 59 |
CTsHeader m_header; |
| 60 |
CTsHeader m_headerSection; |
| 61 |
}; |
| 62 |
} |