2 * dvb-mpegtools for the Siemens Fujitsu DVB PCI card
4 * Copyright (C) 2000, 2001 Marcus Metzler
5 * for convergence integrated media GmbH
6 * Copyright (C) 2002 Marcus Metzler
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
26 * The author can be reached at mocm@metzlerbros.de,
53 delete [] p.pack_header;
57 delete [] p.pes_pckt_data;
59 delete [] p.mpeg1_headr;
64 delete [] p.pack_header;
68 delete [] p.pes_pckt_data;
70 delete [] p.mpeg1_headr;
76 inline pes_packet *P(){
80 inline void setlength(){
83 p.pes_pckt_data = new uint8_t[p.length];
86 inline void Nlength(){
88 p.pes_pckt_data = new uint8_t[p.length];
92 inline uint8_t &Stream_ID(){
96 inline uint8_t &Flags1(){
100 inline uint8_t &Flags2(){
104 inline uint32_t &Length(){
108 inline uint8_t &HLength(){
109 return p.pes_hlength;
112 inline uint8_t &Stuffing(){
116 inline uint8_t *Data(){
117 return p.pes_pckt_data;
120 inline int has_pts(){
121 return (p.flags2 & PTS_DTS);
127 inline uint8_t *PTS(){
131 inline uint8_t *DTS(){
141 inline uint8_t high_pts(){
143 return ((p.pts[0] & 0x08)>>3);
148 inline uint8_t high_dts(){
149 return ((p.dts[0] & 0x08)>>3);
154 w_dts = (int)trans_pts_dts(p.dts);
160 w_dts = (int)trans_pts_dts(p.pts);
164 friend ostream & operator << (ostream & stream, PES_Packet & x);
165 friend istream & operator >> (istream & stream, PES_Packet & x);
182 delete [] p.priv_dat;
187 delete [] p.priv_dat;
193 inline ts_packet *P(){
201 inline uint8_t *Data(){
209 inline uint8_t FLAG1(){
210 return (p.pid[0] & ~PID_MASK_HI);
217 friend ostream & operator << (ostream & stream, TS_Packet & x);
218 friend istream & operator >> (istream & stream, TS_Packet & x);
245 inline ps_packet *P(){
257 inline void setlength(){
259 p.data = new uint8_t[p.sheader_length];
262 inline int Stuffing(){
263 return p.stuff_length & PACK_STUFF_MASK;
274 inline uint8_t &operator()(int l){
278 inline char * Data() {
279 return (char *)p.data+p.stuff_length;
282 inline int &SLENGTH(){
283 return p.sheader_length;
291 return scr_base_ps(&p);
295 return scr_ext_ps(&p);
298 friend ostream & operator << (ostream & stream, PS_Packet & x);
299 friend istream & operator >> (istream & stream, PS_Packet & x);
303 typedef void (* FILTER)(istream &in, ostream &out);
305 typedef struct thread_args_{
313 void extract_audio_from_PES(istream &in, ostream &out);
314 void extract_video_from_PES(istream &in, ostream &out);
315 void extract_es_audio_from_PES(istream &in, ostream &out);
316 void extract_es_video_from_PES(istream &in, ostream &out);
317 int TS_PIDS(istream &in, ostream &out);
318 int ifilter (istream &in, FILTER function);
319 int ofilter (istream &in, FILTER function);
320 int itfilter (int in, FILTER function);
321 int otfilter (istream &in, FILTER function);
322 int stream_type(int fd);
323 int stream_type(istream &stream);
324 int tv_norm(istream &fin);
326 void analyze(istream &fin);
329 #endif //_CPPTOOLS_HH_