VLC  3.0.21
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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$
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;
100  bool b_next_frame;
101  int i_rate;
102 
103  /* Playtime configuration and state */
104  int64_t i_start; /* :start-time,0 by default */
105  int64_t i_stop; /* :stop-time, 0 if none */
106  int64_t i_time; /* Current time */
107  bool b_fast_seek;/* :input-fast-seek */
108 
109  /* Output */
110  bool b_out_pace_control; /* XXX Move it ot es_sout ? */
111  sout_instance_t *p_sout; /* Idem ? */
115  bool viewpoint_changed;
117 
118  /* Title infos FIXME multi-input (not easy) ? */
119  int i_title;
121 
122  int i_title_offset;
123  int i_seekpoint_offset;
124 
125  /* User bookmarks FIXME won't be easy with multiples input */
127  int i_bookmark;
129 
130  /* Input attachment */
133  const demux_t **attachment_demux;
134 
135  /* Main input properties */
136 
137  /* Input item */
139 
140  /* Main source */
142  /* Slave sources (subs, and others) */
143  int i_slave;
145 
146  /* Resources */
149 
150  /* Stats counters */
151  struct {
170  } counters;
171 
172  /* Buffer of pending actions */
175  int i_control;
177 
181 
182 static inline input_thread_private_t *input_priv(input_thread_t *input)
183 {
184  return container_of(input, input_thread_private_t, input);
185 }
186 
187 /***************************************************************************
188  * Internal control helpers
189  ***************************************************************************/
191 {
193 
195 
197 
199 
201 
205 
209 
211 
212  INPUT_CONTROL_NAV_ACTIVATE, // NOTE: INPUT_CONTROL_NAV_* values must be
213  INPUT_CONTROL_NAV_UP, // contiguous and in the same order as
214  INPUT_CONTROL_NAV_DOWN, // INPUT_NAV_* and DEMUX_NAV_*.
219 
222 
223  INPUT_CONTROL_SET_VIEWPOINT, // new absolute viewpoint
224  INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video)
225  INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current
226 
229 
231 
233 
235 
237 };
238 
239 /* Internal helpers */
240 
241 /* XXX for string value you have to allocate it before calling
242  * input_ControlPush
243  */
245 
247 
248 /* Bound pts_delay */
249 #define INPUT_PTS_DELAY_MAX INT64_C(60000000)
250 
251 /**********************************************************************
252  * Item metadata
253  **********************************************************************/
254 /* input_ExtractAttachmentAndCacheArt:
255  * Be careful: p_item lock will be taken! */
257 
258 /***************************************************************************
259  * Internal prototypes
260  ***************************************************************************/
261 
262 /* var.c */
266 void input_ControlVarTitle( input_thread_t *, int i_title );
267 
269 
270 /* Subtitles */
271 int subtitles_Detect( input_thread_t *, char *, const char *, input_item_slave_t ***, int * );
272 int subtitles_Filter( const char *);
273 
274 /* input.c */
275 void input_SplitMRL( const char **, const char **, const char **,
276  const char **, char * );
277 
278 /* meta.c */
280  const vlc_meta_t *p_meta );
281 
282 /* item.c */
284 
285 #endif
INPUT_CONTROL_NAV_ACTIVATE
Definition: input_internal.h:210
input_thread_private_t::p_renderer
vlc_renderer_item_t * p_renderer
Definition: input_internal.h:114
input_thread_private_t::viewpoint
vlc_viewpoint_t viewpoint
Definition: input_internal.h:112
input_thread_private_t::i_time
int64_t i_time
Definition: input_internal.h:104
input_SplitMRL
void input_SplitMRL(const char **, const char **, const char **, const char **, char *)
Definition: input.c:3259
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:172
input_thread_private_t::lock_control
vlc_mutex_t lock_control
Definition: input_internal.h:171
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:457
vlc_demux.h
input_attachment_t
Definition: vlc_input.h:154
input_thread_private_t::master
input_source_t * master
Definition: input_internal.h:139
INPUT_CONTROL_SET_SEEKPOINT_NEXT
Definition: input_internal.h:205
input_thread_private_t::p_sout
sout_instance_t * p_sout
Definition: input_internal.h:109
INPUT_CONTROL_SET_RECORD_STATE
Definition: input_internal.h:230
INPUT_CONTROL_ADD_SLAVE
Definition: input_internal.h:228
INPUT_CONTROL_SET_ES
Definition: input_internal.h:218
INPUT_CONTROL_SET_SEEKPOINT_PREV
Definition: input_internal.h:206
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:162
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:155
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:154
input_thread_private_t::interrupt
vlc_interrupt_t interrupt
Definition: input_internal.h:177
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:211
seekpoint_t
Definition: vlc_input.h:48
INPUT_CONTROL_SET_PROGRAM
Definition: input_internal.h:198
INPUT_CONTROL_SET_BOOKMARK
Definition: input_internal.h:208
INPUT_CONTROL_NAV_MENU
Definition: input_internal.h:216
demux_t
Definition: vlc_demux.h:43
input_thread_private_t::i_control
int i_control
Definition: input_internal.h:173
input_thread_private_t::p_played_abuffers
counter_t * p_played_abuffers
Definition: input_internal.h:163
input_thread_private_t::p_demux_discontinuity
counter_t * p_demux_discontinuity
Definition: input_internal.h:156
input_thread_private_t::slave
input_source_t ** slave
Definition: input_internal.h:142
input_thread_private_t::pp_bookmark
seekpoint_t ** pp_bookmark
Definition: input_internal.h:126
input_thread_private_t::counters_lock
vlc_mutex_t counters_lock
Definition: input_internal.h:167
vlc_viewpoint_t
Viewpoints.
Definition: vlc_viewpoint.h:44
input_thread_private_t::thread
vlc_thread_t thread
Definition: input_internal.h:176
vlc_input.h
input_thread_private_t::i_slave
int i_slave
Definition: input_internal.h:141
vlc_cond_t
pthread_cond_t vlc_cond_t
Condition variable.
Definition: vlc_threads.h:279
INPUT_CONTROL_NAV_RIGHT
Definition: input_internal.h:214
input_thread_private_t::i_stop
int64_t i_stop
Definition: input_internal.h:103
INPUT_CONTROL_SET_TITLE
Definition: input_internal.h:200
input_ControlVarTitle
void input_ControlVarTitle(input_thread_t *, int i_title)
Definition: var.c:358
INPUT_CONTROL_SET_VIEWPOINT
Definition: input_internal.h:221
INPUT_CONTROL_SET_RATE
Definition: input_internal.h:192
vlc_meta_t
Definition: meta.c:41
INPUT_CONTROL_UPDATE_VIEWPOINT
Definition: input_internal.h:223
input_control_e
input_control_e
Definition: input_internal.h:187
input_thread_private_t::p_lost_pictures
counter_t * p_lost_pictures
Definition: input_internal.h:166
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:1252
INPUT_CONTROL_SET_RENDERER
Definition: input_internal.h:234
input_thread_private_t::p_resource_private
input_resource_t * p_resource_private
Definition: input_internal.h:146
input_thread_private_t::p_decoded_sub
counter_t * p_decoded_sub
Definition: input_internal.h:159
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:125
input_thread_private_t::attachment_demux
const demux_t ** attachment_demux
Definition: input_internal.h:131
input_thread_private_t::p_item
input_item_t * p_item
Definition: input_internal.h:136
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:165
INPUT_CONTROL_SET_TIME
Definition: input_internal.h:196
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:232
input_thread_private_t::p_read_bytes
counter_t * p_read_bytes
Definition: input_internal.h:151
input_thread_private_t::b_out_pace_control
bool b_out_pace_control
Definition: input_internal.h:108
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:174
INPUT_CONTROL_NAV_POPUP
Definition: input_internal.h:215
input_title_t
Definition: vlc_input.h:89
vlc_interrupt
Definition: interrupt.h:30
INPUT_CONTROL_SET_SEEKPOINT
Definition: input_internal.h:204
container_of
#define container_of(ptr, type, member)
Definition: vlc_common.h:953
input_thread_private_t::i_rate
int i_rate
Definition: input_internal.h:99
input_thread_private_t::p_decoded_audio
counter_t * p_decoded_audio
Definition: input_internal.h:157
input_thread_private_t::viewpoint_changed
bool viewpoint_changed
Definition: input_internal.h:113
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:124
input_thread_private_t::i_start
int64_t i_start
Definition: input_internal.h:102
INPUT_CONTROL_NAV_DOWN
Definition: input_internal.h:212
INPUT_CONTROL_SET_STATE
Definition: input_internal.h:190
input_thread_private_t::p_read_packets
counter_t * p_read_packets
Definition: input_internal.h:150
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:129
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:180
input_thread_private_t::p_lost_abuffers
counter_t * p_lost_abuffers
Definition: input_internal.h:164
input_thread_private_t::p_resource
input_resource_t * p_resource
Definition: input_internal.h:145
input_ControlPush
void input_ControlPush(input_thread_t *, int i_type, vlc_value_t *)
Definition: input.c:1589
input_thread_private_t::p_decoded_video
counter_t * p_decoded_video
Definition: input_internal.h:158
name
const char name[16]
Definition: httpd.c:1251
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:117
INPUT_CONTROL_NAV_LEFT
Definition: input_internal.h:213
input_thread_private_t::p_es_out
es_out_t * p_es_out
Definition: input_internal.h:110
input_thread_private_t::b_next_frame
bool b_next_frame
Definition: input_internal.h:98
INPUT_CONTROL_SET_INITIAL_VIEWPOINT
Definition: input_internal.h:222
input_thread_private_t::i_seekpoint_offset
int i_seekpoint_offset
Definition: input_internal.h:121
input_Stopped
bool input_Stopped(input_thread_t *)
Definition: input.c:538
input_thread_private_t::b_fast_seek
bool b_fast_seek
Definition: input_internal.h:105
INPUT_CONTROL_SET_AUDIO_DELAY
Definition: input_internal.h:225
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:226
vlc_viewpoint.h
INPUT_CONTROL_RESTART_ES
Definition: input_internal.h:219
INPUT_CONTROL_SET_POSITION
Definition: input_internal.h:194
INPUT_CONTROL_SET_TITLE_PREV
Definition: input_internal.h:202
input_thread_private_t::p_input_bitrate
counter_t * p_input_bitrate
Definition: input_internal.h:152
input_thread_private_t::attachment
input_attachment_t ** attachment
Definition: input_internal.h:130
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:160
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:161
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:153
vlc_value_t
VLC value structure.
Definition: vlc_common.h:329
sout_instance_t
Stream output instance (FIXME: should be private to src/ to avoid invalid unsynchronized access)
Definition: vlc_sout.h:48
input_thread_private_t::title
input_title_t *const * title
Definition: input_internal.h:118
INPUT_CONTROL_SET_TITLE_NEXT
Definition: input_internal.h:201
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:120
input_thread_private_t::p_es_out_display
es_out_t * p_es_out_display
Definition: input_internal.h:111