1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 1998-2004 VideoLAN
5 * $Id: input.c 7955 2004-06-07 22:21:33Z fenrir $
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 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 General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 #ifndef _INPUT_INTERNAL_H
25 #define _INPUT_INTERNAL_H 1
26 #include "../../modules/demux/util/sub.h"
32 INPUT_CONTROL_SET_DIE,
34 INPUT_CONTROL_SET_STATE,
36 INPUT_CONTROL_SET_RATE,
37 INPUT_CONTROL_SET_RATE_SLOWER,
38 INPUT_CONTROL_SET_RATE_FASTER,
40 INPUT_CONTROL_SET_POSITION,
41 INPUT_CONTROL_SET_POSITION_OFFSET,
43 INPUT_CONTROL_SET_TIME,
44 INPUT_CONTROL_SET_TIME_OFFSET,
46 INPUT_CONTROL_SET_PROGRAM,
48 INPUT_CONTROL_SET_TITLE,
49 INPUT_CONTROL_SET_TITLE_NEXT,
50 INPUT_CONTROL_SET_TITLE_PREV,
52 INPUT_CONTROL_SET_SEEKPOINT,
53 INPUT_CONTROL_SET_SEEKPOINT_NEXT,
54 INPUT_CONTROL_SET_SEEKPOINT_PREV,
56 INPUT_CONTROL_SET_BOOKMARK,
60 INPUT_CONTROL_SET_AUDIO_DELAY,
61 INPUT_CONTROL_SET_SPU_DELAY,
63 struct input_thread_sys_t
67 subtitle_demux_t **sub;
71 /* Internal helpers */
72 static inline void input_ControlPush( input_thread_t *p_input,
73 int i_type, vlc_value_t *p_val )
75 vlc_mutex_lock( &p_input->lock_control );
76 if( i_type == INPUT_CONTROL_SET_DIE )
78 /* Special case, empty the control */
79 p_input->i_control = 1;
80 p_input->control[0].i_type = i_type;
81 memset( &p_input->control[0].val, 0, sizeof( vlc_value_t ) );
85 if( p_input->i_control >= INPUT_CONTROL_FIFO_SIZE )
87 msg_Err( p_input, "input control fifo overflow, trashing type=%d",
89 vlc_mutex_unlock( &p_input->lock_control );
92 p_input->control[p_input->i_control].i_type = i_type;
94 p_input->control[p_input->i_control].val = *p_val;
96 memset( &p_input->control[p_input->i_control].val, 0,
97 sizeof( vlc_value_t ) );
101 vlc_mutex_unlock( &p_input->lock_control );
105 void input_ControlVarInit ( input_thread_t * );
106 void input_ControlVarClean( input_thread_t * );
107 void input_ControlVarNavigation( input_thread_t * );
108 void input_ControlVarTitle( input_thread_t *, int i_title );
110 void input_ConfigVarInit ( input_thread_t * );
113 stream_t *stream_AccessNew( access_t *p_access );
114 void stream_AccessDelete( stream_t *s );
115 void stream_AccessReset( stream_t *s );
117 /* Decoder FIXME make it public */
118 void input_DecoderDiscontinuity( decoder_t * p_dec );
121 es_out_t *input_EsOutNew( input_thread_t * );
122 void input_EsOutDelete( es_out_t * );
123 es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
124 void input_EsOutDiscontinuity( es_out_t *, vlc_bool_t b_audio );
125 void input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
128 enum /* Synchro states */
137 /* Synchronization information */
139 mtime_t cr_ref, sysdate_ref;
140 mtime_t last_cr; /* reference to detect unexpected stream
143 count_t c_average_count;
144 /* counter used to compute dynamic average values */
153 void input_ClockInit( input_clock_t *, vlc_bool_t b_master, int i_cr_average );
154 void input_ClockSetPCR( input_thread_t *, input_clock_t *, mtime_t );
155 mtime_t input_ClockGetTS( input_thread_t *, input_clock_t *, mtime_t );
158 char **subtitles_Detect( input_thread_t *, char* path, char *fname );