mpeg: provide test-and-clear-flags control
[vlc.git] / modules / demux / mpeg / ts.h
blob389bf465e387cbc1d909271cd5c78a63126d7c3b
1 /*****************************************************************************
2 * ts.h: Transport Stream input module for VLC.
3 *****************************************************************************
4 * Copyright (C) 2004-2016 VLC authors and VideoLAN
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation; either version 2.1 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19 *****************************************************************************/
20 #ifndef VLC_TS_H
21 #define VLC_TS_H
23 #ifdef HAVE_ARIBB24
24 typedef struct arib_instance_t arib_instance_t;
25 #endif
26 typedef struct csa_t csa_t;
28 #define TS_USER_PMT_NUMBER (0)
30 #define TS_PSI_PAT_PID 0x00
32 typedef enum ts_standards_e
34 TS_STANDARD_AUTO = 0,
35 TS_STANDARD_MPEG,
36 TS_STANDARD_DVB,
37 TS_STANDARD_ARIB,
38 TS_STANDARD_ATSC,
39 TS_STANDARD_TDMB,
40 } ts_standards_e;
42 typedef struct
44 int i_service;
45 } vdr_info_t;
47 struct demux_sys_t
49 stream_t *stream;
50 bool b_canseek;
51 bool b_canfastseek;
52 int current_title;
53 int current_seekpoint;
54 unsigned updates;
55 vlc_mutex_t csa_lock;
57 /* TS packet size (188, 192, 204) */
58 unsigned i_packet_size;
60 /* Additional TS packet header size (BluRay TS packets have 4-byte header before sync byte) */
61 unsigned i_packet_header_size;
63 /* how many TS packet we read at once */
64 unsigned i_ts_read;
66 bool b_cc_check;
67 bool b_ignore_time_for_positions;
69 ts_standards_e standard;
71 struct
73 #ifdef HAVE_ARIBB24
74 arib_instance_t *p_instance;
75 #endif
76 stream_t *b25stream;
77 } arib;
79 /* All pid */
80 ts_pid_list_t pids;
82 bool b_user_pmt;
83 int i_pmt_es;
85 enum
87 NO_ES, /* for preparse */
88 DELAY_ES,
89 CREATE_ES
90 } es_creation;
91 #define PREPARSING p_sys->es_creation == NO_ES
93 /* */
94 bool b_es_id_pid;
95 uint16_t i_next_extraid;
97 csa_t *csa;
98 int i_csa_pkt_size;
99 bool b_split_es;
100 bool b_valid_scrambling;
102 bool b_trust_pcr;
104 /* */
105 bool b_access_control;
106 bool b_end_preparse;
108 /* */
109 time_t i_network_time;
110 time_t i_network_time_update; /* for network time interpolation */
111 bool b_broken_charset; /* True if broken encoding is used in EPG/SDT */
113 /* Selected programs */
114 enum
116 PROGRAM_AUTO_DEFAULT, /* Always select first program sending data */
117 PROGRAM_LIST, /* explicit list of programs, see list below */
118 PROGRAM_ALL, /* everything */
119 } seltype; /* reflects the DEMUX_SET_GROUP */
120 DECL_ARRAY( int ) programs; /* List of selected/access-filtered programs */
121 bool b_default_selection; /* True if set by default to first pmt seen (to get data from filtered access) */
123 struct
125 mtime_t i_first_dts; /* first dts encountered for the stream */
126 int i_timesourcepid; /* which pid we saved the dts from */
127 enum { PAT_WAITING = 0, PAT_MISSING, PAT_FIXTRIED } status; /* set if we haven't seen PAT within MIN_PAT_INTERVAL */
128 } patfix;
130 vdr_info_t vdr;
132 /* downloadable content */
133 vlc_dictionary_t attachments;
135 /* */
136 bool b_start_record;
139 void TsChangeStandard( demux_sys_t *, ts_standards_e );
141 bool ProgramIsSelected( demux_sys_t *, uint16_t i_pgrm );
143 void UpdatePESFilters( demux_t *p_demux, bool b_all );
145 int ProbeStart( demux_t *p_demux, int i_program );
146 int ProbeEnd( demux_t *p_demux, int i_program );
148 void AddAndCreateES( demux_t *p_demux, ts_pid_t *pid, bool b_create_delayed );
149 int FindPCRCandidate( ts_pmt_t *p_pmt );
151 #endif