Ginga  0.13.6
 All Classes Namespaces Functions Variables
TSAdaptationField.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao das ferramentas DTV do TeleMidia
3 
4 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
5 
6 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
7 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
8 Software Foundation.
9 
10 Este programa eh distribuido na expectativa de que seja util, porem, SEM
11 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
12 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
13 GNU versao 2 para mais detalhes.
14 
15 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
16 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
17 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
18 
19 Para maiores informacoes:
20 ncl @ telemidia.puc-rio.br
21 http://www.ncl.org.br
22 http://www.ginga.org.br
23 http://www.telemidia.puc-rio.br
24 ******************************************************************************
25 This file is part of the TeleMidia DTV Tools
26 
27 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
28 
29 This program is free software; you can redistribute it and/or modify it under
30 the terms of the GNU General Public License version 2 as published by
31 the Free Software Foundation.
32 
33 This program is distributed in the hope that it will be useful, but WITHOUT ANY
34 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
35 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
36 details.
37 
38 You should have received a copy of the GNU General Public License version 2
39 along with this program; if not, write to the Free Software
40 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
41 
42 For further information contact:
43 ncl @ telemidia.puc-rio.br
44 http://www.ncl.org.br
45 http://www.ginga.org.br
46 http://www.telemidia.puc-rio.br
47 *******************************************************************************/
48 
49 #ifndef TSADAPTATIONFIELD_H_
50 #define TSADAPTATIONFIELD_H_
51 
52 #define MAX_ADAPTATION_FIELD_SIZE 183
53 #define MAX_PRIVATE_DATA_SIZE 255
54 
55 #include "system/time/Stc.h"
56 using namespace ::br::pucrio::telemidia::ginga::core::system::time;
57 
58 #include <iostream>
59 #include <string.h>
60 using namespace std;
61 
62 namespace br {
63 namespace pucrio {
64 namespace telemidia {
65 namespace ginga {
66 namespace core {
67 namespace tsparser {
69  private:
70  char adapFieldStream[MAX_ADAPTATION_FIELD_SIZE];
71  char* privateDataStream;
72  bool streamUpdated;
73  bool fixedSize;
74  void init();
75  void updateStream();
76  void process();
77 
78  protected:
79  unsigned char adaptationFieldLength;
80  unsigned char discontinuityIndicator;
81  unsigned char randomAccessIndicator;
82  unsigned char elementaryStreamPriorityIndicator;
83  unsigned char pcrFlag;
84  unsigned char oPCRFlag;
85  unsigned char splicingPointFlag;
86  unsigned char transportPrivateDataFlag;
87  unsigned char adaptationFieldExtensionFlag;
88  uint64_t pcrBase;
89  uint64_t pcrExtension;
90  uint64_t originalPcrBase;
91  uint64_t originalPcrExtension;
92  char spliceCountdown;
93  unsigned char transportPrivateDataLength;
94  unsigned char adaptationFieldExtensionLength;
95  unsigned char ltwFlag;
96  unsigned char piecewiseRateFlag;
97  unsigned char seamlessSpliceFlag;
98  unsigned char ltwValidFlag;
99  unsigned int ltwOffset;
100  unsigned int piecewiseRate;
101  unsigned char spliceType;
102  uint64_t dtsNextAU;
103 
104  public:
106  TSAdaptationField(uint64_t pcr);
107  TSAdaptationField(uint64_t pcrBase, uint64_t pcrExtension);
108  TSAdaptationField(char adapField[MAX_ADAPTATION_FIELD_SIZE]);
110 
111  private:
112  void releasePrivateDataStream();
113 
114  public:
115  unsigned char getAdaptationFieldLength();
116  void setAdaptationFieldLength(unsigned char afl);
117  void noFixedSize();
118  unsigned char getDiscontinuityIndicator();
119  void setDiscontinuityIndicator(unsigned char di);
120  unsigned char getRandomAccessIndicator();
121  void setRandomAccessIndicator(unsigned char rai);
122  unsigned char getElementaryStreamPriorityIndicator();
123  void setElementaryStreamPriorityIndicator(unsigned char espi);
124  unsigned char getPcrFlag();
125  void setPcrFlag(unsigned char pf);
126  unsigned char getOPcrFlag();
127  void setOPcrFlag(unsigned char opf);
128  unsigned char getSplicingPointFlag();
129  void setSplicingPointFlag(unsigned char spf);
130  unsigned char getTransportPrivateDataFlag();
131  void setTransportPrivateDataFlag(unsigned char tpdf);
132  unsigned char getAdaptationFieldExtensionFlag();
133  void setAdaptationFieldExtensionFlag(unsigned char afef);
134  uint64_t getPcrBase();
135  void setPcrBase(uint64_t pb);
136  uint64_t getPcrExtension();
137  void setPcrExtension(uint64_t pe);
138  uint64_t getOriginalPcrBase();
139  void setOriginalPcrBase(uint64_t opb);
140  uint64_t getOriginalPcrExtension();
141  void setOriginalPcrExtension(uint64_t ope);
142  char getSpliceCountdown();
143  void setSpliceCountdown(char sc);
144  unsigned char getTransportPrivateDataLength();
145  void setTransportPrivateDataLength(unsigned char tpdl);
146  unsigned char getAdaptationFieldExtensionLength();
147  void setAdaptationFieldExtensionLength(unsigned char afel);
148  unsigned char getLtwFlag();
149  void setLtwFlag(unsigned char lf);
150  unsigned char getPiecewiseRateFlag();
151  void setPiecewiseRateFlag(unsigned char prf);
152  unsigned char getSeamlessSpliceFlag();
153  void setSeamlessSpliceFlag(unsigned char ssf);
154  unsigned char getLtwValidFlag();
155  void setLtwValidFlag(unsigned char lvf);
156  unsigned int getLtwOffset();
157  void setLtwOffset(unsigned int lo);
158  unsigned int getPiecewiseRate();
159  void setPiecewiseRate(unsigned int pr);
160  unsigned char getSpliceType();
161  void setSpliceType(unsigned char st);
162  uint64_t getDtsNextAU();
163  void setDtsNextAU(uint64_t dna);
164  void setTransportPrivateDataStream(char* stream, unsigned char length);
165  int getTransportPrivateDataStream(char** stream);
166 
167  int getStream(char stream[MAX_ADAPTATION_FIELD_SIZE]);
168  };
169 }
170 }
171 }
172 }
173 }
174 }
175 
176 #endif /* TSADAPTATIONFIELD_H_ */