VLC  3.0.15
input_internal.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * input_internal.h: Internal input structures
3  *****************************************************************************
4  * Copyright (C) 1998-2006 VLC authors and VideoLAN
5  * $Id: af9b35967d147c03017ac0eace19695c56aa8e5f $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
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.
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  * GNU Lesser General Public License for more details.
18  *
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  *****************************************************************************/
23 
24 #ifndef LIBVLC_INPUT_INTERNAL_H
25 #define LIBVLC_INPUT_INTERNAL_H 1
26 
27 #include <stddef.h>
28 
29 #include <vlc_access.h>
30 #include <vlc_demux.h>
31 #include <vlc_input.h>
32 #include <vlc_viewpoint.h>
33 #include <libvlc.h>
34 #include "input_interface.h"
35 #include "misc/interrupt.h"
36 
37 /*****************************************************************************
38  * Private input fields
39  *****************************************************************************/
40 
41 #define INPUT_CONTROL_FIFO_SIZE 100
42 
43 /* input_source_t: gathers all information per input source */
44 typedef struct
45 {
47 
48  demux_t *p_demux; /**< Demux object (most downstream) */
49 
50  /* Title infos for that input */
51  bool b_title_demux; /* Titles/Seekpoints provided by demux */
52  int i_title;
53  input_title_t **title;
54 
55  int i_title_offset;
56  int i_seekpoint_offset;
57 
58  int i_title_start;
59  int i_title_end;
60  int i_seekpoint_start;
61  int i_seekpoint_end;
62 
63  /* Properties */
64  bool b_can_pause;
65  bool b_can_pace_control;
66  bool b_can_rate_control;
67  bool b_can_stream_record;
68  bool b_rescale_ts;
69  double f_fps;
70 
71  /* */
72  int64_t i_pts_delay;
73 
74  bool b_eof; /* eof of demuxer */
75 
77 
78 typedef struct
79 {
80  int i_type;
81  vlc_value_t val;
83 
84 /** Private input fields */
85 typedef struct input_thread_private_t
86 {
87  struct input_thread_t input;
88 
89  /* Global properties */
92  bool b_can_rate_control;
93  bool b_can_pace_control;
94 
95  /* Current state */
96  int i_state;
97  bool is_running;
98  bool is_stopped;
99  bool b_recording;
100  int i_rate;
101 
102  /* Playtime configuration and state */
103  int64_t i_start; /* :start-time,0 by default */
104  int64_t i_stop; /* :stop-time, 0 if none */
105  int64_t i_time; /* Current time */
106  bool b_fast_seek;/* :input-fast-seek */
107 
108  /* Output */
109  bool b_out_pace_control; /* XXX Move it ot es_sout ? */
110  sout_instance_t *p_sout; /* Idem ? */
114  bool viewpoint_changed;
116 
117  /* Title infos FIXME multi-input (not easy) ? */
118  int i_title;
120 
121  int i_title_offset;
122  int i_seekpoint_offset;
123 
124  /* User bookmarks FIXME won't be easy with multiples input */
126  int i_bookmark;
128 
129  /* Input attachment */
132  const demux_t **attachment_demux;
133 
134  /* Main input properties */
135 
136  /* Input item */
138 
139  /* Main source */
141  /* Slave sources (subs, and others) */
142  int i_slave;
144 
145  /* Resources */
148 
149  /* Stats counters */
150  struct {
169  } counters;
170 
171  /* Buffer of pending actions */
174  int i_control;
176 
180 
181 static inline input_thread_private_t *input_priv(input_thread_t *input)
182 {
183  return container_of(input, input_thread_private_t, input);
184 }
185 
186 /***************************************************************************
187  * Internal control helpers
188  ***************************************************************************/
190 {
192 
194 
196 
198 
200 
204 
208 
210 
211  INPUT_CONTROL_NAV_ACTIVATE, // NOTE: INPUT_CONTROL_NAV_* values must be
212  INPUT_CONTROL_NAV_UP, // contiguous and in the same order as
213  INPUT_CONTROL_NAV_DOWN, // INPUT_NAV_* and DEMUX_NAV_*.
218 
221 
222  INPUT_CONTROL_SET_VIEWPOINT, // new absolute viewpoint
223  INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
224  INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current
225 
228 
230 
232 
234 
236 };
237 
238 /* Internal helpers */
239 
240 /* XXX for string value you have to allocate it before calling
241  * input_ControlPush
242  */
244 
246 
247 /* Bound pts_delay */
248 #define INPUT_PTS_DELAY_MAX INT64_C(60000000)
249 
250 /**********************************************************************
251  * Item metadata
252  **********************************************************************/
253 /* input_ExtractAttachmentAndCacheArt:
254  * Be careful: p_item lock will be taken! */
256 
257 /***************************************************************************
258  * Internal prototypes
259  ***************************************************************************/
260 
261 /* var.c */
265 void input_ControlVarTitle( input_thread_t *, int i_title );
266 
268 
269 /* Subtitles */
270 int subtitles_Detect( input_thread_t *, char *, const char *, input_item_slave_t ***, int * );
271 int subtitles_Filter( const char *);
272 
273 /* input.c */
274 void input_SplitMRL( const char **, const char **, const char **,
275  const char **, char * );
276 
277 /* meta.c */
279  const vlc_meta_t *p_meta );
280 
281 /* item.c */
283 
284 #endif
INPUT_CONTROL_NAV_ACTIVATE
Definition: input_internal.h:209
input_thread_private_t::p_renderer
vlc_renderer_item_t * p_renderer
Definition: input_internal.h:113
input_thread_private_t::viewpoint
vlc_viewpoint_t viewpoint
Definition: input_internal.h:111
input_thread_private_t::i_time
int64_t i_time
Definition: input_internal.h:103
input_SplitMRL
void input_SplitMRL(const char **, const char **, const char **, const char **, char *)
Definition: input.c:3241
input_thread_private_t::counters
struct input_thread_private_t::@27 counters
input_thread_private_t::wait_control
vlc_cond_t wait_control
Definition: input_internal.h:171
input_thread_private_t::lock_control
vlc_mutex_t lock_control
Definition: input_internal.h:170
subtitles_Filter
int subtitles_Filter(const char *)
Definition: subtitles.c:137
VLC_COMMON_MEMBERS
#define VLC_COMMON_MEMBERS
Backward compatibility macro.
Definition: vlc_common.h:453
vlc_demux.h
input_attachment_t
Definition: vlc_input.h:154
input_thread_private_t::master
input_source_t * master
Definition: input_internal.h:138
INPUT_CONTROL_SET_SEEKPOINT_NEXT
Definition: input_internal.h:204
input_thread_private_t::p_sout
sout_instance_t * p_sout
Definition: input_internal.h:108
INPUT_CONTROL_SET_RECORD_STATE
Definition: input_internal.h:229
INPUT_CONTROL_ADD_SLAVE
Definition: input_internal.h:227
INPUT_CONTROL_SET_ES
Definition: input_internal.h:217
INPUT_CONTROL_SET_SEEKPOINT_PREV
Definition: input_internal.h:205
audio_replay_gain_t
Definition: vlc_es.h:56
input_thread_private_t::p_sout_send_bitrate
counter_t * p_sout_send_bitrate
Definition: input_internal.h:161
input_item_t
Describes an input and is used to spawn input_thread_t objects.
Definition: vlc_input_item.h:58
input_thread_private_t::p_demux_corrupted
counter_t * p_demux_corrupted
Definition: input_internal.h:154
vlc_access.h
input_thread_private_t
struct input_thread_private_t input_thread_private_t
Private input fields.
input_thread_private_t::b_can_rate_control
bool b_can_rate_control
Definition: input_internal.h:90
input_thread_private_t::p_demux_bitrate
counter_t * p_demux_bitrate
Definition: input_internal.h:153
input_thread_private_t::interrupt
vlc_interrupt_t interrupt
Definition: input_internal.h:176
input_thread_private_t::b_recording
bool b_recording
Definition: input_internal.h:97
input_thread_private_t::b_can_pace_control
bool b_can_pace_control
Definition: input_internal.h:91
INPUT_CONTROL_NAV_UP
Definition: input_internal.h:210
seekpoint_t
Definition: vlc_input.h:48
INPUT_CONTROL_SET_PROGRAM
Definition: input_internal.h:197
INPUT_CONTROL_SET_BOOKMARK
Definition: input_internal.h:207
INPUT_CONTROL_NAV_MENU
Definition: input_internal.h:215
demux_t
Definition: vlc_demux.h:43
input_thread_private_t::i_control
int i_control
Definition: input_internal.h:172
input_thread_private_t::p_played_abuffers
counter_t * p_played_abuffers
Definition: input_internal.h:162
input_thread_private_t::p_demux_discontinuity
counter_t * p_demux_discontinuity
Definition: input_internal.h:155
input_thread_private_t::slave
input_source_t ** slave
Definition: input_internal.h:141
input_thread_private_t::pp_bookmark
seekpoint_t ** pp_bookmark
Definition: input_internal.h:125
input_thread_private_t::counters_lock
vlc_mutex_t counters_lock
Definition: input_internal.h:166
vlc_viewpoint_t
Viewpoints.
Definition: vlc_viewpoint.h:44
input_thread_private_t::thread
vlc_thread_t thread
Definition: input_internal.h:175
vlc_input.h
input_thread_private_t::i_slave
int i_slave
Definition: input_internal.h:140
vlc_cond_t
pthread_cond_t vlc_cond_t
Condition variable.
Definition: vlc_threads.h:279
INPUT_CONTROL_NAV_RIGHT
Definition: input_internal.h:213
input_thread_private_t::i_stop
int64_t i_stop
Definition: input_internal.h:102
INPUT_CONTROL_SET_TITLE
Definition: input_internal.h:199
input_ControlVarTitle
void input_ControlVarTitle(input_thread_t *, int i_title)
Definition: var.c:358
INPUT_CONTROL_SET_VIEWPOINT
Definition: input_internal.h:220
INPUT_CONTROL_SET_RATE
Definition: input_internal.h:191
vlc_meta_t
Definition: meta.c:41
INPUT_CONTROL_UPDATE_VIEWPOINT
Definition: input_internal.h:222
input_control_e
input_control_e
Definition: input_internal.h:186
input_thread_private_t::p_lost_pictures
counter_t * p_lost_pictures
Definition: input_internal.h:165
es_out_t
Definition: vlc_es_out.h:111
input_thread_private_t::is_stopped
bool is_stopped
Definition: input_internal.h:96
interrupt.h
input_ControlVarStop
void input_ControlVarStop(input_thread_t *)
Definition: var.c:222
i_type
int i_type
Definition: httpd.c:1250
INPUT_CONTROL_SET_RENDERER
Definition: input_internal.h:233
input_thread_private_t::p_resource_private
input_resource_t * p_resource_private
Definition: input_internal.h:145
input_thread_private_t::p_decoded_sub
counter_t * p_decoded_sub
Definition: input_internal.h:158
counter_t
Definition: libvlc.h:233
input_thread_private_t::b_can_pause
bool b_can_pause
Definition: input_internal.h:89
input_ConfigVarInit
void input_ConfigVarInit(input_thread_t *)
Definition: var.c:411
input_thread_private_t::i_bookmark
int i_bookmark
Definition: input_internal.h:124
input_thread_private_t::attachment_demux
const demux_t ** attachment_demux
Definition: input_internal.h:130
input_thread_private_t::p_item
input_item_t * p_item
Definition: input_internal.h:135
input_thread_private_t
Private input fields.
Definition: input_internal.h:83
input_thread_private_t::p_displayed_pictures
counter_t * p_displayed_pictures
Definition: input_internal.h:164
INPUT_CONTROL_SET_TIME
Definition: input_internal.h:195
input_control_t
Definition: input_internal.h:76
input_thread_private_t::input
struct input_thread_t input
Definition: input_internal.h:85
INPUT_CONTROL_SET_FRAME_NEXT
Definition: input_internal.h:231
input_thread_private_t::p_read_bytes
counter_t * p_read_bytes
Definition: input_internal.h:150
input_thread_private_t::b_out_pace_control
bool b_out_pace_control
Definition: input_internal.h:107
vlc_thread_t
Thread handle.
Definition: vlc_threads.h:252
input_source_t
Definition: input_internal.h:42
subtitles_Detect
int subtitles_Detect(input_thread_t *, char *, const char *, input_item_slave_t ***, int *)
Detect subtitle files.
Definition: subtitles.c:213
input_thread_private_t::control
input_control_t control[100]
Definition: input_internal.h:173
INPUT_CONTROL_NAV_POPUP
Definition: input_internal.h:214
input_title_t
Definition: vlc_input.h:89
vlc_interrupt
Definition: interrupt.h:30
INPUT_CONTROL_SET_SEEKPOINT
Definition: input_internal.h:203
container_of
#define container_of(ptr, type, member)
Definition: vlc_common.h:944
input_thread_private_t::i_rate
int i_rate
Definition: input_internal.h:98
input_thread_private_t::p_decoded_audio
counter_t * p_decoded_audio
Definition: input_internal.h:156
input_thread_private_t::viewpoint_changed
bool viewpoint_changed
Definition: input_internal.h:112
vlc_mutex_t
pthread_mutex_t vlc_mutex_t
Mutex.
Definition: vlc_threads.h:267
input_interface.h
vlc_audio_replay_gain_MergeFromMeta
void vlc_audio_replay_gain_MergeFromMeta(audio_replay_gain_t *p_dst, const vlc_meta_t *p_meta)
Definition: meta.c:290
input_ControlVarInit
void input_ControlVarInit(input_thread_t *)
Definition: var.c:125
input_thread_private_t::bookmark
seekpoint_t bookmark
Definition: input_internal.h:123
input_thread_private_t::i_start
int64_t i_start
Definition: input_internal.h:101
INPUT_CONTROL_NAV_DOWN
Definition: input_internal.h:211
INPUT_CONTROL_SET_STATE
Definition: input_internal.h:189
input_thread_private_t::p_read_packets
counter_t * p_read_packets
Definition: input_internal.h:149
input_thread_private_t::is_running
bool is_running
Definition: input_internal.h:95
input_thread_private_t::i_attachment
int i_attachment
Definition: input_internal.h:128
input_thread_private_t::i_state
int i_state
Definition: input_internal.h:94
input_priv
static input_thread_private_t * input_priv(input_thread_t *input)
Definition: input_internal.h:179
input_thread_private_t::p_lost_abuffers
counter_t * p_lost_abuffers
Definition: input_internal.h:163
input_thread_private_t::p_resource
input_resource_t * p_resource
Definition: input_internal.h:144
input_ControlPush
void input_ControlPush(input_thread_t *, int i_type, vlc_value_t *)
Definition: input.c:1583
input_thread_private_t::p_decoded_video
counter_t * p_decoded_video
Definition: input_internal.h:157
name
const char name[16]
Definition: httpd.c:1249
vlc_renderer_item_t
Definition: renderer_discovery.c:33
input_ExtractAttachmentAndCacheArt
void input_ExtractAttachmentAndCacheArt(input_thread_t *, const char *name)
Definition: meta.c:206
input_item_slave
Definition: vlc_input_item.h:172
input_thread_private_t::i_title
int i_title
Definition: input_internal.h:116
INPUT_CONTROL_NAV_LEFT
Definition: input_internal.h:212
input_thread_private_t::p_es_out
es_out_t * p_es_out
Definition: input_internal.h:109
INPUT_CONTROL_SET_INITIAL_VIEWPOINT
Definition: input_internal.h:221
input_thread_private_t::i_seekpoint_offset
int i_seekpoint_offset
Definition: input_internal.h:120
input_Stopped
bool input_Stopped(input_thread_t *)
Definition: input.c:537
input_thread_private_t::b_fast_seek
bool b_fast_seek
Definition: input_internal.h:104
INPUT_CONTROL_SET_AUDIO_DELAY
Definition: input_internal.h:224
input_item_node_PostAndDelete
void input_item_node_PostAndDelete(input_item_node_t *p_node)
Definition: item.c:1301
libvlc.h
INPUT_CONTROL_SET_SPU_DELAY
Definition: input_internal.h:225
vlc_viewpoint.h
input_thread_private_t::title
const input_title_t ** title
Definition: input_internal.h:117
INPUT_CONTROL_RESTART_ES
Definition: input_internal.h:218
INPUT_CONTROL_SET_POSITION
Definition: input_internal.h:193
INPUT_CONTROL_SET_TITLE_PREV
Definition: input_internal.h:201
input_thread_private_t::p_input_bitrate
counter_t * p_input_bitrate
Definition: input_internal.h:151
input_thread_private_t::attachment
input_attachment_t ** attachment
Definition: input_internal.h:129
input_thread_t
Main structure representing an input thread.
Definition: vlc_input.h:221
input_item_node_t
Definition: vlc_input_item.h:180
input_thread_private_t::p_sout_sent_packets
counter_t * p_sout_sent_packets
Definition: input_internal.h:159
input_resource_t
Definition: resource.c:44
input_thread_private_t::p_sout_sent_bytes
counter_t * p_sout_sent_bytes
Definition: input_internal.h:160
input_thread_private_t::b_preparsing
bool b_preparsing
Definition: input_internal.h:88
input_ControlVarNavigation
void input_ControlVarNavigation(input_thread_t *)
Definition: var.c:249
input_thread_private_t::p_demux_read
counter_t * p_demux_read
Definition: input_internal.h:152
vlc_value_t
VLC value structure.
Definition: vlc_common.h:325
sout_instance_t
Stream output instance (FIXME: should be private to src/ to avoid invalid unsynchronized access)
Definition: vlc_sout.h:48
INPUT_CONTROL_SET_TITLE_NEXT
Definition: input_internal.h:200
INPUT_CONTROL_FIFO_SIZE
#define INPUT_CONTROL_FIFO_SIZE
Definition: input_internal.h:39
input_thread_private_t::i_title_offset
int i_title_offset
Definition: input_internal.h:119
input_thread_private_t::p_es_out_display
es_out_t * p_es_out_display
Definition: input_internal.h:110