MythTV  master
ts.h
Go to the documentation of this file.
1 /*
2  * ts.h
3  *
4  *
5  * Copyright (C) 2003 Marcus Metzler <mocm@metzlerbros.de>
6  * Metzler Brothers Systementwicklung GbR
7  *
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.
12  *
13  *
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  * General Public License for more details.
18  *
19  *
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
24  *
25  */
26 
27 #ifndef TS_H
28 #define TS_H
29 
30 #include "ringbuffer.h"
31 #include "mpg_common.h"
32 
33 static constexpr ssize_t TS_SIZE { 188 };
34 static constexpr uint8_t TRANS_ERROR { 0x80 };
35 static constexpr uint8_t PAY_START { 0x40 };
36 static constexpr uint8_t TRANS_PRIO { 0x20 };
37 static constexpr uint8_t PID_MASK_HI { 0x1F };
38 
39 //flags
40 static constexpr uint8_t TRANS_SCRMBL1 { 0x80 };
41 static constexpr uint8_t TRANS_SCRMBL2 { 0x40 };
42 static constexpr uint8_t ADAPT_FIELD { 0x20 };
43 static constexpr uint8_t PAYLOAD { 0x10 };
44 static constexpr uint8_t COUNT_MASK { 0x0F };
45 
46 // adaptation flags
47 static constexpr uint8_t DISCON_IND { 0x80 };
48 static constexpr uint8_t RAND_ACC_IND { 0x40 };
49 static constexpr uint8_t ES_PRI_IND { 0x20 };
50 static constexpr uint8_t PCR_FLAG { 0x10 };
51 static constexpr uint8_t OPCR_FLAG { 0x08 };
52 static constexpr uint8_t SPLICE_FLAG { 0x04 };
53 static constexpr uint8_t TRANS_PRIV { 0x02 };
54 static constexpr uint8_t ADAP_EXT_FLAG { 0x01 };
55 
56 // adaptation extension flags
57 static constexpr uint8_t LTW_FLAG { 0x80 };
58 static constexpr uint8_t PIECE_RATE { 0x40 };
59 static constexpr uint8_t SEAM_SPLICE { 0x20 };
60 
61 static constexpr uint16_t TS_VIDPID { 4101 };
62 static constexpr uint16_t TS_MP2PID { 4201 };
63 static constexpr uint16_t TS_AC3PID { 4301 };
64 uint16_t get_pid(const uint8_t *pid);
65 int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid,uint8_t *buf, int len);
66 int find_pids_pos(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid,uint8_t *buf, int len, int *vpos, int *apos, int *ac3pos);
67 
68 int write_video_ts(uint64_t vpts, uint64_t vdts, uint64_t SCR,
69  uint8_t *buf, int *vlength, uint8_t ptsdts, ringbuffer *vrbuffer);
70 int write_audio_ts(int n, uint64_t pts,
71  uint8_t *buf, int *alength, uint8_t ptsdts, ringbuffer *arbuffer);
72 int write_ac3_ts(int n, uint64_t pts, uint8_t *buf, int *alength,
73  uint8_t ptsdts, int nframes, ringbuffer *ac3rbuffer);
74 void write_ts_patpmt(extdata_t *ext, int extcnt, uint8_t prog_num,
75  uint8_t *buf);
76 #endif /* TS_H */
SPLICE_FLAG
static constexpr uint8_t SPLICE_FLAG
Definition: ts.h:52
ringbuffer.h
write_ts_patpmt
void write_ts_patpmt(extdata_t *ext, int extcnt, uint8_t prog_num, uint8_t *buf)
Definition: ts.cpp:381
write_ac3_ts
int write_ac3_ts(int n, uint64_t pts, uint8_t *buf, int *alength, uint8_t ptsdts, int nframes, ringbuffer *ac3rbuffer)
Definition: ts.cpp:331
ringbuffer
Definition: ringbuffer.h:39
PIECE_RATE
static constexpr uint8_t PIECE_RATE
Definition: ts.h:58
TRANS_SCRMBL2
static constexpr uint8_t TRANS_SCRMBL2
Definition: ts.h:41
PCR_FLAG
static constexpr uint8_t PCR_FLAG
Definition: ts.h:50
ADAP_EXT_FLAG
static constexpr uint8_t ADAP_EXT_FLAG
Definition: ts.h:54
TS_AC3PID
static constexpr uint16_t TS_AC3PID
Definition: ts.h:63
TRANS_PRIV
static constexpr uint8_t TRANS_PRIV
Definition: ts.h:53
LTW_FLAG
static constexpr uint8_t LTW_FLAG
Definition: ts.h:57
find_pids_pos
int find_pids_pos(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid, uint8_t *buf, int len, int *vpos, int *apos, int *ac3pos)
Definition: ts.cpp:58
COUNT_MASK
static constexpr uint8_t COUNT_MASK
Definition: ts.h:44
ES_PRI_IND
static constexpr uint8_t ES_PRI_IND
Definition: ts.h:49
write_audio_ts
int write_audio_ts(int n, uint64_t pts, uint8_t *buf, int *alength, uint8_t ptsdts, ringbuffer *arbuffer)
Definition: ts.cpp:288
PAY_START
static constexpr uint8_t PAY_START
Definition: ts.h:35
TRANS_ERROR
static constexpr uint8_t TRANS_ERROR
Definition: ts.h:34
TS_SIZE
static constexpr ssize_t TS_SIZE
Definition: ts.h:33
TS_MP2PID
static constexpr uint16_t TS_MP2PID
Definition: ts.h:62
mpg_common.h
extdata_t
Definition: mpg_common.h:54
ADAPT_FIELD
static constexpr uint8_t ADAPT_FIELD
Definition: ts.h:42
SEAM_SPLICE
static constexpr uint8_t SEAM_SPLICE
Definition: ts.h:59
DISCON_IND
static constexpr uint8_t DISCON_IND
Definition: ts.h:47
TRANS_PRIO
static constexpr uint8_t TRANS_PRIO
Definition: ts.h:36
TRANS_SCRMBL1
static constexpr uint8_t TRANS_SCRMBL1
Definition: ts.h:40
get_pid
uint16_t get_pid(const uint8_t *pid)
Definition: ts.cpp:48
PAYLOAD
static constexpr uint8_t PAYLOAD
Definition: ts.h:43
OPCR_FLAG
static constexpr uint8_t OPCR_FLAG
Definition: ts.h:51
write_video_ts
int write_video_ts(uint64_t vpts, uint64_t vdts, uint64_t SCR, uint8_t *buf, int *vlength, uint8_t ptsdts, ringbuffer *vrbuffer)
Definition: ts.cpp:233
RAND_ACC_IND
static constexpr uint8_t RAND_ACC_IND
Definition: ts.h:48
mpeg::chrono::pts
std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > pts
Definition: mythchrono.h:55
find_pids
int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid, uint8_t *buf, int len)
Definition: ts.cpp:128
uint16_t
unsigned short uint16_t
Definition: iso6937tables.h:3
TS_VIDPID
static constexpr uint16_t TS_VIDPID
Definition: ts.h:61
PID_MASK_HI
static constexpr uint8_t PID_MASK_HI
Definition: ts.h:37