-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmpeg2ts.h
162 lines (148 loc) · 5.16 KB
/
mpeg2ts.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
# libmpeg2ts, a MPEG2 transport stream reading/writing library
#
# Copyright (C) 2012 Alexander Izvorski <[email protected]>
#
# This file is part of libmpeg2ts.
#
# libmpeg2ts is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# libmpeg2ts is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with libmpeg2ts. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MPEG2TS_H
#define _MPEG2TS_H 1
#include <stdint.h>
#include "bs.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int adaptation_field_length;
int discontinuity_indicator;
int random_access_indicator;
int elementary_stream_priority_indicator;
int PCR_flag;
int OPCR_flag;
int splicing_point_flag;
int transport_private_data_flag;
int adaptation_field_extension_flag;
int program_clock_reference_base;
int program_clock_reference_extension;
int original_program_clock_reference_base;
int original_program_clock_reference_extension;
int splice_countdown;
int transport_private_data_length;
uint8_t* private_data;
int private_data_len;
int adaptation_field_extension_length;
int ltw_flag;
int piecewise_rate_flag;
int seamless_splice_flag;
int ltw_valid_flag;
int ltw_offset;
int piecewise_rate;
int splice_type;
int DTS_next_AU;
} adaptation_field_t;
typedef struct {
int transport_error_indicator;
int payload_unit_start_indicator;
int transport_priority;
int PID;
int transport_scrambling_control;
int adaptation_field_control;
int continuity_counter;
adaptation_field_t* adaptation_field;
uint8_t* data;
int data_len;
} transport_packet_t;
#define pes_stream_id_program_stream_map 0
#define pes_stream_id_padding_stream 0
#define pes_stream_id_private_stream_2 0
#define pes_stream_id_ECM 0
#define pes_stream_id_EMM 0
#define pes_stream_id_program_stream_directory 0
#define pes_stream_id_DSMCC_stream 0
#define pes_stream_id_H_222_1 0
#define trick_mode_control_fast_forward 0
#define trick_mode_control_slow_motion 0
#define trick_mode_control_freeze_frame 0
#define trick_mode_control_fast_reverse 0
#define trick_mode_control_slow_reverse 0
typedef struct {
int packet_start_code_prefix;
int stream_id;
int PES_packet_length;
int PES_scrambling_control;
int PES_priority;
int data_alignment_indicator;
int copyright;
int original_or_copy;
int PTS_DTS_flags;
int ESCR_flag;
int ES_rate_flag;
int DSM_trick_mode_flag;
int additional_copy_info_flag;
int PES_CRC_flag;
int PES_extension_flag;
int PES_header_data_length;
int PTS;
int DTS;
int ESCR_base;
int ESCR_extension;
int ES_rate;
int trick_mode_control;
int field_id;
int intra_slice_refresh;
int frequency_truncation;
int rep_cntrl;
int additional_copy_info;
int previous_PES_packet_CRC;
int PES_private_data_flag;
int pack_header_field_flag;
int program_packet_sequence_counter_flag;
int P_STD_buffer_flag;
int PES_extension_flag_2;
int PES_private_data;
int pack_field_length;
uint8_t* pack_header;
int pack_header_len;
int program_packet_sequence_counter;
int MPEG1_MPEG2_identifier;
int original_stuff_length;
int P_STD_buffer_scale;
int P_STD_buffer_size;
int PES_extension_field_length;
uint8_t* PES_extension_field;
int PES_extension_field_len;
uint8_t* PES_packet_data;
int PES_packet_data_len;
} PES_packet_t;
adaptation_field_t* adaptation_field_new();
void adaptation_field_free(adaptation_field_t* p);
int adaptation_field_write(adaptation_field_t* p, bs_t* bs);
int adaptation_field_read(adaptation_field_t* p, bs_t* bs);
int adaptation_field_len(adaptation_field_t* p);
transport_packet_t* transport_packet_new();
void transport_packet_free(transport_packet_t* p);
int transport_packet_write(transport_packet_t* p, bs_t* bs);
int transport_packet_read(transport_packet_t* p, bs_t* bs);
int transport_packet_len(transport_packet_t* p);
PES_packet_t* PES_packet_new();
void PES_packet_free(PES_packet_t* p);
int PES_packet_write(PES_packet_t* p, bs_t* bs);
int PES_packet_read(PES_packet_t* p, bs_t* bs);
int PES_packet_len(PES_packet_t* p);
#ifdef __cplusplus
}
#endif
#endif