qml: Create MediaGroupDisplay
[vlc.git] / modules / demux / mpeg / ts_pid.h
blob8fea481805ec61f3ebcf80c800aefb8e2bc9a672
1 /*****************************************************************************
2 * ts_pid.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 General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *****************************************************************************/
19 #ifndef VLC_TS_PID_H
20 #define VLC_TS_PID_H
22 #include "ts_pid_fwd.h"
24 #define MIN_ES_PID 4 /* Should be 32.. broken muxers */
25 #define MAX_ES_PID 8190
27 #include "ts_streams.h"
29 typedef struct demux_sys_t demux_sys_t;
31 typedef enum
33 TYPE_FREE = 0,
34 TYPE_CAT,
35 TYPE_PAT,
36 TYPE_PMT,
37 TYPE_STREAM,
38 TYPE_SI,
39 TYPE_PSIP,
40 } ts_pid_type_t;
42 enum
44 FLAGS_NONE = 0,
45 FLAG_SEEN = 1,
46 FLAG_SCRAMBLED = 2,
47 FLAG_FILTERED = 4
50 #define SEEN(x) ((x)->i_flags & FLAG_SEEN)
51 #define SCRAMBLED(x) ((x).i_flags & FLAG_SCRAMBLED)
52 #define PREVPKTKEEPBYTES 16
54 struct ts_pid_t
56 uint16_t i_pid;
58 uint8_t i_flags;
59 uint8_t i_cc; /* countinuity counter */
60 uint8_t i_dup; /* duplicate counter */
61 uint8_t type;
62 uint8_t prevpktbytes[PREVPKTKEEPBYTES];
64 uint16_t i_refcount;
66 /* */
67 union
69 ts_pat_t *p_pat;
70 ts_pmt_t *p_pmt;
71 ts_stream_t *p_stream;
72 ts_si_t *p_si;
73 ts_psip_t *p_psip;
74 } u;
76 struct
78 vlc_fourcc_t i_fourcc;
79 vlc_fourcc_t i_original_fourcc;
80 int i_cat;
81 int i_dts_count;
82 int i_pcr_count; /* carries PCR field */
83 uint8_t i_stream_id;
84 } probed;
88 struct ts_pid_list_t
90 ts_pid_t pat;
91 ts_pid_t dummy;
92 ts_pid_t base_si;
93 /* all non commons ones, dynamically allocated */
94 ts_pid_t **pp_all;
95 int i_all;
96 int i_all_alloc;
97 /* last recently used */
98 uint16_t i_last_pid;
99 ts_pid_t *p_last;
103 /* opacified pid list */
104 void ts_pid_list_Init( ts_pid_list_t * );
105 void ts_pid_list_Release( demux_t *, ts_pid_list_t * );
107 /* creates missing pid on the fly */
108 ts_pid_t * ts_pid_Get( ts_pid_list_t *, uint16_t i_pid );
110 /* returns NULL on end. requires context */
111 typedef struct
113 int i_pos;
114 } ts_pid_next_context_t;
115 #define ts_pid_NextContextInitValue { 0 }
116 ts_pid_t * ts_pid_Next( ts_pid_list_t *, ts_pid_next_context_t * );
118 /* for legacy only: don't use and pass directly list reference */
119 #define GetPID(p_sys, i_pid) ts_pid_Get((&(p_sys)->pids), i_pid)
121 int UpdateHWFilter( demux_sys_t *, ts_pid_t * );
122 int SetPIDFilter( demux_sys_t *, ts_pid_t *, bool b_selected );
124 bool PIDSetup( demux_t *p_demux, ts_pid_type_t i_type, ts_pid_t *pid, ts_pid_t *p_parent );
125 void PIDRelease( demux_t *p_demux, ts_pid_t *pid );
128 #endif