macOS vout: fix forgotten ';'
[vlc.git] / src / input / input_internal.h
blobdb53577e63a3e4c4b70dc2ca0def171c112113eb
1 /*****************************************************************************
2 * input_internal.h: Internal input structures
3 *****************************************************************************
4 * Copyright (C) 1998-2006 VLC authors and VideoLAN
5 * $Id$
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
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 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef LIBVLC_INPUT_INTERNAL_H
25 #define LIBVLC_INPUT_INTERNAL_H 1
27 #include <stddef.h>
28 #include <stdatomic.h>
30 #include <vlc_access.h>
31 #include <vlc_demux.h>
32 #include <vlc_input.h>
33 #include <vlc_viewpoint.h>
34 #include <libvlc.h>
35 #include "input_interface.h"
36 #include "misc/interrupt.h"
38 struct input_stats;
40 /*****************************************************************************
41 * Private input fields
42 *****************************************************************************/
44 #define INPUT_CONTROL_FIFO_SIZE 100
46 /* input_source_t: gathers all information per input source */
47 typedef struct
49 struct vlc_common_members obj;
51 demux_t *p_demux; /**< Demux object (most downstream) */
53 /* Title infos for that input */
54 bool b_title_demux; /* Titles/Seekpoints provided by demux */
55 int i_title;
56 input_title_t **title;
58 int i_title_offset;
59 int i_seekpoint_offset;
61 int i_title_start;
62 int i_title_end;
63 int i_seekpoint_start;
64 int i_seekpoint_end;
66 /* Properties */
67 bool b_can_pause;
68 bool b_can_pace_control;
69 bool b_can_rate_control;
70 bool b_can_stream_record;
71 bool b_rescale_ts;
72 double f_fps;
74 /* */
75 int64_t i_pts_delay;
77 bool b_eof; /* eof of demuxer */
79 } input_source_t;
81 typedef struct
83 int i_type;
84 vlc_value_t val;
85 } input_control_t;
87 /** Private input fields */
88 typedef struct input_thread_private_t
90 struct input_thread_t input;
92 /* Global properties */
93 bool b_preparsing;
94 bool b_can_pause;
95 bool b_can_rate_control;
96 bool b_can_pace_control;
98 /* Current state */
99 int i_state;
100 bool is_running;
101 bool is_stopped;
102 bool b_recording;
103 int i_rate;
105 /* Playtime configuration and state */
106 int64_t i_start; /* :start-time,0 by default */
107 int64_t i_stop; /* :stop-time, 0 if none */
108 int64_t i_time; /* Current time */
109 bool b_fast_seek;/* :input-fast-seek */
111 /* Output */
112 bool b_out_pace_control; /* XXX Move it ot es_sout ? */
113 sout_instance_t *p_sout; /* Idem ? */
114 es_out_t *p_es_out;
115 es_out_t *p_es_out_display;
116 vlc_viewpoint_t viewpoint;
117 bool viewpoint_changed;
118 vlc_renderer_item_t *p_renderer;
120 /* Title infos FIXME multi-input (not easy) ? */
121 int i_title;
122 const input_title_t **title;
124 int i_title_offset;
125 int i_seekpoint_offset;
127 /* User bookmarks FIXME won't be easy with multiples input */
128 seekpoint_t bookmark;
129 int i_bookmark;
130 seekpoint_t **pp_bookmark;
132 /* Input attachment */
133 int i_attachment;
134 input_attachment_t **attachment;
135 const demux_t **attachment_demux;
137 /* Main input properties */
139 /* Input item */
140 input_item_t *p_item;
142 /* Main source */
143 input_source_t *master;
144 /* Slave sources (subs, and others) */
145 int i_slave;
146 input_source_t **slave;
148 /* Resources */
149 input_resource_t *p_resource;
150 input_resource_t *p_resource_private;
152 /* Stats counters */
153 struct input_stats *stats;
155 /* Buffer of pending actions */
156 vlc_mutex_t lock_control;
157 vlc_cond_t wait_control;
158 int i_control;
159 input_control_t control[INPUT_CONTROL_FIFO_SIZE];
161 vlc_thread_t thread;
162 vlc_interrupt_t interrupt;
163 } input_thread_private_t;
165 static inline input_thread_private_t *input_priv(input_thread_t *input)
167 return container_of(input, input_thread_private_t, input);
170 /***************************************************************************
171 * Internal control helpers
172 ***************************************************************************/
173 enum input_control_e
175 INPUT_CONTROL_SET_STATE,
177 INPUT_CONTROL_SET_RATE,
179 INPUT_CONTROL_SET_POSITION,
181 INPUT_CONTROL_SET_TIME,
183 INPUT_CONTROL_SET_PROGRAM,
185 INPUT_CONTROL_SET_TITLE,
186 INPUT_CONTROL_SET_TITLE_NEXT,
187 INPUT_CONTROL_SET_TITLE_PREV,
189 INPUT_CONTROL_SET_SEEKPOINT,
190 INPUT_CONTROL_SET_SEEKPOINT_NEXT,
191 INPUT_CONTROL_SET_SEEKPOINT_PREV,
193 INPUT_CONTROL_SET_BOOKMARK,
195 INPUT_CONTROL_NAV_ACTIVATE, // NOTE: INPUT_CONTROL_NAV_* values must be
196 INPUT_CONTROL_NAV_UP, // contiguous and in the same order as
197 INPUT_CONTROL_NAV_DOWN, // INPUT_NAV_* and DEMUX_NAV_*.
198 INPUT_CONTROL_NAV_LEFT,
199 INPUT_CONTROL_NAV_RIGHT,
200 INPUT_CONTROL_NAV_POPUP,
201 INPUT_CONTROL_NAV_MENU,
203 INPUT_CONTROL_SET_ES,
204 INPUT_CONTROL_RESTART_ES,
206 INPUT_CONTROL_SET_VIEWPOINT, // new absolute viewpoint
207 INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
208 INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current
210 INPUT_CONTROL_SET_AUDIO_DELAY,
211 INPUT_CONTROL_SET_SPU_DELAY,
213 INPUT_CONTROL_ADD_SLAVE,
215 INPUT_CONTROL_SET_RECORD_STATE,
217 INPUT_CONTROL_SET_FRAME_NEXT,
219 INPUT_CONTROL_SET_RENDERER,
222 /* Internal helpers */
224 /* XXX for string value you have to allocate it before calling
225 * input_ControlPush
227 void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
229 bool input_Stopped( input_thread_t * );
231 /* Bound pts_delay */
232 #define INPUT_PTS_DELAY_MAX INT64_C(60000000)
234 /**********************************************************************
235 * Item metadata
236 **********************************************************************/
237 /* input_ExtractAttachmentAndCacheArt:
238 * Be careful: p_item lock will be taken! */
239 void input_ExtractAttachmentAndCacheArt( input_thread_t *, const char *name );
241 /***************************************************************************
242 * Internal prototypes
243 ***************************************************************************/
245 /* var.c */
246 void input_ControlVarInit ( input_thread_t * );
247 void input_ControlVarStop( input_thread_t * );
248 void input_ControlVarNavigation( input_thread_t * );
249 void input_ControlVarTitle( input_thread_t *, int i_title );
251 void input_ConfigVarInit ( input_thread_t * );
253 /* Subtitles */
254 int subtitles_Detect( input_thread_t *, char *, const char *, input_item_slave_t ***, int * );
255 int subtitles_Filter( const char *);
257 /* meta.c */
258 void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
259 const vlc_meta_t *p_meta );
261 /* item.c */
262 void input_item_node_PostAndDelete( input_item_node_t *p_node );
264 /* stats.c */
265 typedef struct input_rate_t
267 vlc_mutex_t lock;
268 uintmax_t updates;
269 uintmax_t value;
270 struct
272 uintmax_t value;
273 mtime_t date;
274 } samples[2];
275 } input_rate_t;
277 struct input_stats {
278 input_rate_t input_bitrate;
279 input_rate_t demux_bitrate;
280 atomic_uintmax_t demux_corrupted;
281 atomic_uintmax_t demux_discontinuity;
282 atomic_uintmax_t decoded_audio;
283 atomic_uintmax_t decoded_video;
284 atomic_uintmax_t played_abuffers;
285 atomic_uintmax_t lost_abuffers;
286 atomic_uintmax_t displayed_pictures;
287 atomic_uintmax_t lost_pictures;
290 struct input_stats *input_stats_Create(void);
291 void input_stats_Destroy(struct input_stats *);
292 void input_rate_Add(input_rate_t *, uintmax_t);
293 void input_stats_Compute(struct input_stats *, input_stats_t*);
295 #endif