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
33static constexpr ssize_t TS_SIZE { 188 };
34static constexpr uint8_t TRANS_ERROR { 0x80 };
35static constexpr uint8_t PAY_START { 0x40 };
36static constexpr uint8_t TRANS_PRIO { 0x20 };
37static constexpr uint8_t PID_MASK_HI { 0x1F };
38
39//flags
40static constexpr uint8_t TRANS_SCRMBL1 { 0x80 };
41static constexpr uint8_t TRANS_SCRMBL2 { 0x40 };
42static constexpr uint8_t ADAPT_FIELD { 0x20 };
43static constexpr uint8_t PAYLOAD { 0x10 };
44static constexpr uint8_t COUNT_MASK { 0x0F };
45
46// adaptation flags
47static constexpr uint8_t DISCON_IND { 0x80 };
48static constexpr uint8_t RAND_ACC_IND { 0x40 };
49static constexpr uint8_t ES_PRI_IND { 0x20 };
50static constexpr uint8_t PCR_FLAG { 0x10 };
51static constexpr uint8_t OPCR_FLAG { 0x08 };
52static constexpr uint8_t SPLICE_FLAG { 0x04 };
53static constexpr uint8_t TRANS_PRIV { 0x02 };
54static constexpr uint8_t ADAP_EXT_FLAG { 0x01 };
55
56// adaptation extension flags
57static constexpr uint8_t LTW_FLAG { 0x80 };
58static constexpr uint8_t PIECE_RATE { 0x40 };
59static constexpr uint8_t SEAM_SPLICE { 0x20 };
60
61static constexpr uint16_t TS_VIDPID { 4101 };
62static constexpr uint16_t TS_MP2PID { 4201 };
63static constexpr uint16_t TS_AC3PID { 4301 };
64uint16_t get_pid(const uint8_t *pid);
65int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid,uint8_t *buf, int len);
66int find_pids_pos(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid,uint8_t *buf, int len, int *vpos, int *apos, int *ac3pos);
67
68int write_video_ts(uint64_t vpts, uint64_t vdts, uint64_t SCR,
69 uint8_t *buf, int *vlength, uint8_t ptsdts, ringbuffer *vrbuffer);
70int write_audio_ts(int n, uint64_t pts,
71 uint8_t *buf, int *alength, uint8_t ptsdts, ringbuffer *arbuffer);
72int write_ac3_ts(int n, uint64_t pts, uint8_t *buf, int *alength,
73 uint8_t ptsdts, int nframes, ringbuffer *ac3rbuffer);
74void write_ts_patpmt(extdata_t *ext, int extcnt, uint8_t prog_num,
75 uint8_t *buf);
76#endif /* TS_H */
unsigned short uint16_t
Definition: iso6937tables.h:3
std::chrono::duration< CHRONO_TYPE, std::ratio< 1, 90000 > > pts
Definition: mythchrono.h:55
static constexpr uint8_t ES_PRI_IND
Definition: ts.h:49
static constexpr uint16_t TS_VIDPID
Definition: ts.h:61
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
static constexpr uint8_t TRANS_PRIO
Definition: ts.h:36
static constexpr uint8_t PIECE_RATE
Definition: ts.h:58
static constexpr uint8_t RAND_ACC_IND
Definition: ts.h:48
static constexpr uint8_t DISCON_IND
Definition: ts.h:47
static constexpr uint8_t LTW_FLAG
Definition: ts.h:57
static constexpr uint8_t TRANS_ERROR
Definition: ts.h:34
static constexpr uint8_t ADAP_EXT_FLAG
Definition: ts.h:54
static constexpr uint8_t OPCR_FLAG
Definition: ts.h:51
static constexpr uint8_t SPLICE_FLAG
Definition: ts.h:52
static constexpr uint8_t PID_MASK_HI
Definition: ts.h:37
void write_ts_patpmt(extdata_t *ext, int extcnt, uint8_t prog_num, uint8_t *buf)
Definition: ts.cpp:381
static constexpr uint8_t TRANS_PRIV
Definition: ts.h:53
int write_audio_ts(int n, uint64_t pts, uint8_t *buf, int *alength, uint8_t ptsdts, ringbuffer *arbuffer)
Definition: ts.cpp:288
uint16_t get_pid(const uint8_t *pid)
Definition: ts.cpp:48
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
static constexpr uint16_t TS_MP2PID
Definition: ts.h:62
static constexpr uint8_t PAYLOAD
Definition: ts.h:43
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
static constexpr uint8_t COUNT_MASK
Definition: ts.h:44
static constexpr uint8_t ADAPT_FIELD
Definition: ts.h:42
static constexpr uint16_t TS_AC3PID
Definition: ts.h:63
int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid, uint8_t *buf, int len)
Definition: ts.cpp:128
static constexpr ssize_t TS_SIZE
Definition: ts.h:33
static constexpr uint8_t TRANS_SCRMBL1
Definition: ts.h:40
static constexpr uint8_t PCR_FLAG
Definition: ts.h:50
static constexpr uint8_t TRANS_SCRMBL2
Definition: ts.h:41
static constexpr uint8_t PAY_START
Definition: ts.h:35
static constexpr uint8_t SEAM_SPLICE
Definition: ts.h:59