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