Ginga  0.13.6
 All Classes Namespaces Functions Variables
IDemuxer.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef IDEMUXER_H_
51 #define IDEMUXER_H_
52 
53 #include "tuner/ITuner.h"
54 #include "tuner/providers/frontends/IFrontendFilter.h"
55 using namespace ::br::pucrio::telemidia::ginga::core::tuning;
56 
57 #include "ITSFilter.h"
58 
59 namespace br {
60 namespace pucrio {
61 namespace telemidia {
62 namespace ginga {
63 namespace core {
64 namespace tsparser {
65  // specific packet ids
66  static const short PAT_PID = 0x0000;
67  static const short CAT_PID = 0x0001;
68  static const short TSDT_PID = 0x0001; //TS Description Table
69  static const short NIT_PID = 0x0010;
70  static const short SDT_PID = 0x0011;
71  static const short EIT_PID = 0x0012;
72  static const short CDT_PID = 0x0029;
73 
74  // specific section ids
75  static const short PAT_TID = 0x00;
76  static const short CAT_TID = 0x01;
77  static const short PMT_TID = 0x02;
78  static const short TSDT_TID = 0x03; //TS Description Section
79  static const short OCI_TID = 0x3B; //Object Carousel Info
80  static const short OCD_TID = 0x3C; //Object Carousel Data
81  static const short DDE_TID = 0x3D; //DSM-CC Descriptors
82  static const short NIT_TID = 0x40;
83  static const short SDT_TID = 0x42;
84  static const short EIT_TID = 0x4E;
85  static const short CDT_TID = 0xC8;
86  static const short AIT_TID = 0x74;
87  static const short TOT_TID = 0x73;
88 
89  // specific stream types
90  static const short STREAM_TYPE_VIDEO_MPEG1 = 0x01;
91  static const short STREAM_TYPE_VIDEO_MPEG2 = 0x02;
92  static const short STREAM_TYPE_AUDIO_MPEG1 = 0x03;
93  static const short STREAM_TYPE_AUDIO_MPEG2 = 0x04;
94  static const short STREAM_TYPE_PRIVATE_SECTION = 0x05;
95  static const short STREAM_TYPE_PRIVATE_DATA = 0x06;
96  static const short STREAM_TYPE_MHEG = 0x07;
97  static const short STREAM_TYPE_DSMCC_TYPE_A = 0x0A;
98  static const short STREAM_TYPE_DSMCC_TYPE_B = 0x0B;
99  static const short STREAM_TYPE_DSMCC_TYPE_C = 0x0C;
100  static const short STREAM_TYPE_DSMCC_TYPE_D = 0x0D;
101  static const short STREAM_TYPE_AUDIO_AAC = 0x0F;
102  static const short STREAM_TYPE_VIDEO_MPEG4 = 0x10;
103  static const short STREAM_TYPE_AUDIO_MPEG4 = 0x11;
104  static const short STREAM_TYPE_VIDEO_H264 = 0x1B;
105  static const short STREAM_TYPE_AUDIO_AC3 = 0x81;
106  static const short STREAM_TYPE_AUDIO_DTS = 0x8A;
107 
108  class IDemuxer : public ITunerListener {
109  public:
110  virtual ~IDemuxer(){};
111 
112  virtual string disableDemuxer(string tsOutputUri)=0;
113  virtual bool hasStreamType(short streamType)=0;
114  virtual void printPat()=0;
115  virtual void setNptPrinter(bool nptPrinter)=0;
116 
117  virtual unsigned int getTSId()=0;
118 
119  static int getTableIdFromStreamType(short streamType) {
120  switch (streamType) {
121  case STREAM_TYPE_DSMCC_TYPE_B:
122  return OCI_TID;
123 
124  case STREAM_TYPE_DSMCC_TYPE_C:
125  return OCD_TID;
126 
127  case STREAM_TYPE_DSMCC_TYPE_D:
128  return DDE_TID;
129 
130  case STREAM_TYPE_PRIVATE_SECTION:
131  return AIT_TID;
132 
133  default:
134  return -1;
135  }
136  };
137 
138  static int getStreamTypeFromTableId(short tid) {
139  switch (tid) {
140  case OCI_TID:
141  return STREAM_TYPE_DSMCC_TYPE_B;
142 
143  case OCD_TID:
144  return STREAM_TYPE_DSMCC_TYPE_C;
145 
146  case DDE_TID:
147  return STREAM_TYPE_DSMCC_TYPE_D;
148 
149  case AIT_TID:
150  return STREAM_TYPE_PRIVATE_SECTION;
151 
152  default:
153  return -1;
154  }
155  };
156 
157  virtual void setDestination(short streamType)=0; //debug purpose only
158  virtual void removeFilter(ITSFilter* tsFilter)=0;
159  virtual void addFilter(ITSFilter* tsFilter, int pid, int tid)=0;
160  virtual void addFilter(IFrontendFilter* filter)=0;
161  virtual void receiveSection(
162  char* section, int secLen, IFrontendFilter* filter)=0;
163 
164  virtual void addPidFilter(unsigned int pid, ITSFilter* filter)=0;
165  virtual void addSectionFilter(unsigned int tid, ITSFilter* filter)=0;
166  virtual void addStreamTypeFilter(short streamType, ITSFilter* filter)=0;
167  virtual void addPesFilter(short type, ITSFilter* filter)=0;
168 
169  virtual int getDefaultMainVideoPid()=0;
170  virtual int getDefaultMainAudioPid()=0;
171  virtual int getDefaultMainCarouselPid()=0;
172 
173  virtual void receiveData(char* buff, unsigned int size)=0;
174  virtual void updateChannelStatus(short newStatus, IChannel* channel)=0;
175 
176  virtual short getCaps()=0;
177 
178  virtual bool waitProgramInformation()=0;
179  virtual bool waitBuffers()=0;
180  };
181 }
182 }
183 }
184 }
185 }
186 }
187 
188 typedef ::br::pucrio::telemidia::ginga::core::tsparser::IDemuxer* demCreator(
189  ITuner* tuner);
190 
191 typedef void demDestroyer(
193 
194 #endif /*IDEMUXER_H_*/