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 #define TS_SIZE 188
34 #define TRANS_ERROR 0x80
35 #define PAY_START 0x40
36 #define TRANS_PRIO 0x20
37 #define PID_MASK_HI 0x1F
38 
39 //flags
40 #define TRANS_SCRMBL1 0x80
41 #define TRANS_SCRMBL2 0x40
42 #define ADAPT_FIELD 0x20
43 #define PAYLOAD 0x10
44 #define COUNT_MASK 0x0F
45 
46 // adaptation flags
47 #define DISCON_IND 0x80
48 #define RAND_ACC_IND 0x40
49 #define ES_PRI_IND 0x20
50 #define PCR_FLAG 0x10
51 #define OPCR_FLAG 0x08
52 #define SPLICE_FLAG 0x04
53 #define TRANS_PRIV 0x02
54 #define ADAP_EXT_FLAG 0x01
55 
56 // adaptation extension flags
57 #define LTW_FLAG 0x80
58 #define PIECE_RATE 0x40
59 #define SEAM_SPLICE 0x20
60 
61 #define TS_VIDPID 4101
62 #define TS_MP2PID 4201
63 #define 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_*/
int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid, uint8_t *buf, int len)
Definition: ts.c:126
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.c:237
uint16_t get_pid(const uint8_t *pid)
Definition: ts.c:46
void write_ts_patpmt(extdata_t *ext, int extcnt, uint8_t prog_num, uint8_t *buf)
Definition: ts.c:389
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.c:56
unsigned short uint16_t
Definition: iso6937tables.h:1
int write_ac3_ts(int n, uint64_t pts, uint8_t *buf, int *alength, uint8_t ptsdts, int nframes, ringbuffer *ac3rbuffer)
Definition: ts.c:337
int write_audio_ts(int n, uint64_t pts, uint8_t *buf, int *alength, uint8_t ptsdts, ringbuffer *arbuffer)
Definition: ts.c:292