contrib: schroedinger: remove obsolete patches
[vlc/gmpfix.git] / src / input / input_internal.h
blob9f7129480edf7bf4b5dc1dad69178169eababfbb
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 <vlc_access.h>
28 #include <vlc_demux.h>
29 #include <vlc_input.h>
30 #include <libvlc.h>
31 #include "input_interface.h"
33 /*****************************************************************************
34 * Private input fields
35 *****************************************************************************/
37 #define INPUT_CONTROL_FIFO_SIZE 100
39 /* input_source_t: gathers all information per input source */
40 typedef struct
42 demux_t *p_demux; /**< Demux plugin instance */
44 /* Title infos for that input */
45 bool b_title_demux; /* Titles/Seekpoints provided by demux */
46 int i_title;
47 input_title_t **title;
49 int i_title_offset;
50 int i_seekpoint_offset;
52 int i_title_start;
53 int i_title_end;
54 int i_seekpoint_start;
55 int i_seekpoint_end;
57 /* Properties */
58 bool b_can_pause;
59 bool b_can_pace_control;
60 bool b_can_rate_control;
61 bool b_can_stream_record;
62 bool b_rescale_ts;
64 /* */
65 int64_t i_pts_delay;
67 bool b_eof; /* eof of demuxer */
69 } input_source_t;
71 typedef struct
73 int i_type;
74 vlc_value_t val;
75 } input_control_t;
77 /** Private input fields */
78 struct input_thread_private_t
80 /* Global properties */
81 double f_fps;
82 int i_state;
83 bool b_can_pause;
84 bool b_can_rate_control;
85 bool b_can_pace_control;
87 /* Current state */
88 bool b_recording;
89 int i_rate;
91 /* Playtime configuration and state */
92 int64_t i_start; /* :start-time,0 by default */
93 int64_t i_stop; /* :stop-time, 0 if none */
94 int64_t i_run; /* :run-time, 0 if none */
95 int64_t i_time; /* Current time */
96 bool b_fast_seek;/* :input-fast-seek */
98 /* Output */
99 bool b_out_pace_control; /* XXX Move it ot es_sout ? */
100 sout_instance_t *p_sout; /* Idem ? */
101 es_out_t *p_es_out;
102 es_out_t *p_es_out_display;
104 /* Title infos FIXME multi-input (not easy) ? */
105 int i_title;
106 input_title_t **title;
108 int i_title_offset;
109 int i_seekpoint_offset;
111 /* User bookmarks FIXME won't be easy with multiples input */
112 seekpoint_t bookmark;
113 int i_bookmark;
114 seekpoint_t **pp_bookmark;
116 /* Input attachment */
117 int i_attachment;
118 input_attachment_t **attachment;
120 /* Main input properties */
122 /* Input item */
123 input_item_t *p_item;
125 /* Main source */
126 input_source_t input;
127 /* Slave sources (subs, and others) */
128 int i_slave;
129 input_source_t **slave;
131 /* Resources */
132 input_resource_t *p_resource;
133 input_resource_t *p_resource_private;
135 /* Stats counters */
136 struct {
137 counter_t *p_read_packets;
138 counter_t *p_read_bytes;
139 counter_t *p_input_bitrate;
140 counter_t *p_demux_read;
141 counter_t *p_demux_bitrate;
142 counter_t *p_demux_corrupted;
143 counter_t *p_demux_discontinuity;
144 counter_t *p_decoded_audio;
145 counter_t *p_decoded_video;
146 counter_t *p_decoded_sub;
147 counter_t *p_sout_sent_packets;
148 counter_t *p_sout_sent_bytes;
149 counter_t *p_sout_send_bitrate;
150 counter_t *p_played_abuffers;
151 counter_t *p_lost_abuffers;
152 counter_t *p_displayed_pictures;
153 counter_t *p_lost_pictures;
154 vlc_mutex_t counters_lock;
155 } counters;
157 /* Buffer of pending actions */
158 vlc_mutex_t lock_control;
159 vlc_cond_t wait_control;
160 int i_control;
161 input_control_t control[INPUT_CONTROL_FIFO_SIZE];
163 bool b_abort;
164 bool is_running;
165 vlc_thread_t thread;
168 /***************************************************************************
169 * Internal control helpers
170 ***************************************************************************/
171 enum input_control_e
173 INPUT_CONTROL_SET_DIE,
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,
201 INPUT_CONTROL_SET_ES,
202 INPUT_CONTROL_RESTART_ES,
204 INPUT_CONTROL_SET_AUDIO_DELAY,
205 INPUT_CONTROL_SET_SPU_DELAY,
207 INPUT_CONTROL_ADD_SLAVE,
209 INPUT_CONTROL_ADD_SUBTITLE,
211 INPUT_CONTROL_SET_RECORD_STATE,
213 INPUT_CONTROL_SET_FRAME_NEXT,
216 /* Internal helpers */
218 /* XXX for string value you have to allocate it before calling
219 * input_ControlPush
221 void input_ControlPush( input_thread_t *, int i_type, vlc_value_t * );
223 /* Bound pts_delay */
224 #define INPUT_PTS_DELAY_MAX INT64_C(60000000)
226 /**********************************************************************
227 * Item metadata
228 **********************************************************************/
229 /* input_ExtractAttachmentAndCacheArt:
230 * Becarefull; p_item lock HAS to be taken */
231 void input_ExtractAttachmentAndCacheArt( input_thread_t *p_input );
233 /***************************************************************************
234 * Internal prototypes
235 ***************************************************************************/
237 /* var.c */
238 void input_ControlVarInit ( input_thread_t * );
239 void input_ControlVarStop( input_thread_t * );
240 void input_ControlVarNavigation( input_thread_t * );
241 void input_ControlVarTitle( input_thread_t *, int i_title );
243 void input_ConfigVarInit ( input_thread_t * );
245 /* Subtitles */
246 char **subtitles_Detect( input_thread_t *, char* path, const char *fname );
247 int subtitles_Filter( const char *);
249 /* input.c */
250 void input_SplitMRL( const char **, const char **, const char **,
251 const char **, char * );
253 /* meta.c */
254 void vlc_audio_replay_gain_MergeFromMeta( audio_replay_gain_t *p_dst,
255 const vlc_meta_t *p_meta );
257 #endif