]> git.sesse.net Git - vlc/blob - src/input/input_internal.h
* src/input/*: update position on title change.
[vlc] / src / input / input_internal.h
1 /*****************************************************************************
2  * input_internal.h:
3  *****************************************************************************
4  * Copyright (C) 1998-2004 VideoLAN
5  * $Id: input.c 7955 2004-06-07 22:21:33Z fenrir $
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8  *
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.
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 General Public License for more details.
18  *
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  *****************************************************************************/
23
24 #ifndef _INPUT_INTERNAL_H
25 #define _INPUT_INTERNAL_H 1
26
27 enum input_control_e
28 {
29     INPUT_CONTROL_SET_DIE,
30
31     INPUT_CONTROL_SET_STATE,
32
33     INPUT_CONTROL_SET_RATE,
34     INPUT_CONTROL_SET_RATE_SLOWER,
35     INPUT_CONTROL_SET_RATE_FASTER,
36
37     INPUT_CONTROL_SET_POSITION,
38     INPUT_CONTROL_SET_POSITION_OFFSET,
39
40     INPUT_CONTROL_SET_TIME,
41     INPUT_CONTROL_SET_TIME_OFFSET,
42
43     INPUT_CONTROL_SET_PROGRAM,
44
45     INPUT_CONTROL_SET_TITLE,
46     INPUT_CONTROL_SET_TITLE_NEXT,
47     INPUT_CONTROL_SET_TITLE_PREV,
48
49     INPUT_CONTROL_SET_SEEKPOINT,
50     INPUT_CONTROL_SET_SEEKPOINT_NEXT,
51     INPUT_CONTROL_SET_SEEKPOINT_PREV,
52
53     INPUT_CONTROL_SET_BOOKMARK,
54
55     INPUT_CONTROL_SET_ES,
56
57     INPUT_CONTROL_SET_AUDIO_DELAY,
58     INPUT_CONTROL_SET_SPU_DELAY,
59 };
60
61 /* Internal helpers */
62 static inline void input_ControlPush( input_thread_t *p_input,
63                                       int i_type, vlc_value_t *p_val )
64 {
65     vlc_mutex_lock( &p_input->lock_control );
66     if( i_type == INPUT_CONTROL_SET_DIE )
67     {
68         /* Special case, empty the control */
69         p_input->i_control = 1;
70         p_input->control[0].i_type = i_type;
71         memset( &p_input->control[0].val, 0, sizeof( vlc_value_t ) );
72     }
73     else
74     {
75         if( p_input->i_control >= INPUT_CONTROL_FIFO_SIZE )
76         {
77             msg_Err( p_input, "input control fifo overflow, trashing type=%d",
78                      i_type );
79             vlc_mutex_unlock( &p_input->lock_control );
80             return;
81         }
82         p_input->control[p_input->i_control].i_type = i_type;
83         if( p_val )
84             p_input->control[p_input->i_control].val = *p_val;
85         else
86             memset( &p_input->control[p_input->i_control].val, 0,
87                     sizeof( vlc_value_t ) );
88
89         p_input->i_control++;
90     }
91     vlc_mutex_unlock( &p_input->lock_control );
92 }
93
94 /* var.c */
95 void input_ControlVarInit ( input_thread_t * );
96 void input_ControlVarClean( input_thread_t * );
97 void input_ControlVarNavigation( input_thread_t * );
98 void input_ControlVarTitle( input_thread_t *, int i_title );
99
100 void input_ConfigVarInit ( input_thread_t * );
101
102 /* stream.c */
103 stream_t *stream_AccessNew( access_t *p_access );
104 void stream_AccessDelete( stream_t *s );
105 void stream_AccessReset( stream_t *s );
106 void stream_AccessUpdate( stream_t *s );
107
108 /* decoder.c FIXME make it public ?*/
109 void       input_DecoderDiscontinuity( decoder_t * p_dec );
110 vlc_bool_t input_DecoderEmpty( decoder_t * p_dec );
111
112 /* es_out.c */
113 es_out_t  *input_EsOutNew( input_thread_t * );
114 void       input_EsOutDelete( es_out_t * );
115 es_out_id_t *input_EsOutGetFromID( es_out_t *, int i_id );
116 void       input_EsOutDiscontinuity( es_out_t *, vlc_bool_t b_audio );
117 void       input_EsOutSetDelay( es_out_t *, int i_cat, int64_t );
118 vlc_bool_t input_EsOutDecodersEmpty( es_out_t * );
119
120 /* clock.c */
121 enum /* Synchro states */
122 {
123     SYNCHRO_OK     = 0,
124     SYNCHRO_START  = 1,
125     SYNCHRO_REINIT = 2,
126 };
127
128 typedef struct
129 {
130     /* Synchronization information */
131     mtime_t                 delta_cr;
132     mtime_t                 cr_ref, sysdate_ref;
133     mtime_t                 last_cr; /* reference to detect unexpected stream
134                                       * discontinuities                      */
135     mtime_t                 last_pts;
136     count_t                 c_average_count;
137                            /* counter used to compute dynamic average values */
138     int                     i_synchro_state;
139
140     vlc_bool_t              b_master;
141
142     /* Config */
143     int                     i_cr_average;
144 } input_clock_t;
145
146 void input_ClockInit( input_clock_t *, vlc_bool_t b_master, int i_cr_average );
147 void    input_ClockSetPCR( input_thread_t *, input_clock_t *, mtime_t );
148 mtime_t input_ClockGetTS( input_thread_t *, input_clock_t *, mtime_t );
149
150 /* Subtitles */
151 char **subtitles_Detect( input_thread_t *, char* path, char *fname );
152
153 #endif