]> git.sesse.net Git - vlc/blob - src/input/es_out.h
Use var_Inherit* instead of var_CreateGet*.
[vlc] / src / input / es_out.h
1 /*****************************************************************************
2  * es_out.h: Input es_out functions
3  *****************************************************************************
4  * Copyright (C) 1998-2008 the VideoLAN team
5  * Copyright (C) 2008 Laurent Aimar
6  * $Id$
7  *
8  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #if defined(__PLUGIN__) || defined(__BUILTIN__) || !defined(__LIBVLC__)
26 # error This header file can only be included from LibVLC.
27 #endif
28
29 #ifndef _INPUT_ES_OUT_H
30 #define _INPUT_ES_OUT_H 1
31
32 #include <vlc_common.h>
33
34 enum es_out_mode_e
35 {
36     ES_OUT_MODE_NONE,   /* don't select anything */
37     ES_OUT_MODE_ALL,    /* eg for stream output */
38     ES_OUT_MODE_AUTO,   /* best audio/video or for input follow audio-track, sub-track */
39     ES_OUT_MODE_PARTIAL,/* select programs given after --programs */
40     ES_OUT_MODE_END     /* mark the es_out as dead */
41 };
42
43 enum es_out_query_private_e
44 {
45     /* set/get mode */
46     ES_OUT_SET_MODE = ES_OUT_PRIVATE_START,         /* arg1= int                            */
47
48     /* Get date to wait before demuxing more data */
49     ES_OUT_GET_WAKE_UP,                             /* arg1=mtime_t*            res=cannot fail */
50
51     /* Wrapper for some ES command to work with id */
52     ES_OUT_SET_ES_BY_ID,
53     ES_OUT_RESTART_ES_BY_ID,
54     ES_OUT_SET_ES_DEFAULT_BY_ID,
55     ES_OUT_GET_ES_OBJECTS_BY_ID,                    /* arg1=int id, vlc_object_t **dec, vout_thread_t **, aout_instance_t ** res=can fail*/
56
57     /* Get buffering state */
58     ES_OUT_GET_BUFFERING,                           /* arg1=bool*               res=cannot fail */
59
60     /* Set delay for a ES category */
61     ES_OUT_SET_DELAY,                               /* arg1=es_category_e,      res=cannot fail */
62
63     /* Set record state */
64     ES_OUT_SET_RECORD_STATE,                        /* arg1=bool                res=can fail */
65
66     /* Set pause state */
67     ES_OUT_SET_PAUSE_STATE,                         /* arg1=bool b_source_paused, bool b_paused arg2=mtime_t   res=can fail */
68
69     /* Set rate */
70     ES_OUT_SET_RATE,                                /* arg1=int i_source_rate arg2=int i_rate                  res=can fail */
71
72     /* Set a new time */
73     ES_OUT_SET_TIME,                                /* arg1=mtime_t             res=can fail */
74
75     /* Set next frame */
76     ES_OUT_SET_FRAME_NEXT,                          /*                          res=can fail */
77
78     /* Set position/time/length */
79     ES_OUT_SET_TIMES,                               /* arg1=double f_position arg2=mtime_t i_time arg3=mtime_t i_length res=cannot fail */
80
81     /* Set jitter */
82     ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
83
84     /* Get forced group */
85     ES_OUT_GET_GROUP_FORCED,                        /* arg1=int * res=cannot fail */
86 };
87
88 static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
89 {
90     int i_ret = es_out_Control( p_out, ES_OUT_SET_MODE, i_mode );
91     assert( !i_ret );
92 }
93 static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
94 {
95     mtime_t i_wu;
96     int i_ret = es_out_Control( p_out, ES_OUT_GET_WAKE_UP, &i_wu );
97
98     assert( !i_ret );
99     return i_wu;
100 }
101 static inline bool es_out_GetBuffering( es_out_t *p_out )
102 {
103     bool b;
104     int i_ret = es_out_Control( p_out, ES_OUT_GET_BUFFERING, &b );
105
106     assert( !i_ret );
107     return b;
108 }
109 static inline bool es_out_GetEmpty( es_out_t *p_out )
110 {
111     bool b;
112     int i_ret = es_out_Control( p_out, ES_OUT_GET_EMPTY, &b );
113
114     assert( !i_ret );
115     return b;
116 }
117 static inline void es_out_SetDelay( es_out_t *p_out, int i_cat, mtime_t i_delay )
118 {
119     int i_ret = es_out_Control( p_out, ES_OUT_SET_DELAY, i_cat, i_delay );
120     assert( !i_ret );
121 }
122 static inline int es_out_SetRecordState( es_out_t *p_out, bool b_record )
123 {
124     return es_out_Control( p_out, ES_OUT_SET_RECORD_STATE, b_record );
125 }
126 static inline int es_out_SetPauseState( es_out_t *p_out, bool b_source_paused, bool b_paused, mtime_t i_date )
127 {
128     return es_out_Control( p_out, ES_OUT_SET_PAUSE_STATE, b_source_paused, b_paused, i_date );
129 }
130 static inline int es_out_SetRate( es_out_t *p_out, int i_source_rate, int i_rate )
131 {
132     return es_out_Control( p_out, ES_OUT_SET_RATE, i_source_rate, i_rate );
133 }
134 static inline int es_out_SetTime( es_out_t *p_out, mtime_t i_date )
135 {
136     return es_out_Control( p_out, ES_OUT_SET_TIME, i_date );
137 }
138 static inline int es_out_SetFrameNext( es_out_t *p_out )
139 {
140     return es_out_Control( p_out, ES_OUT_SET_FRAME_NEXT );
141 }
142 static inline void es_out_SetTimes( es_out_t *p_out, double f_position, mtime_t i_time, mtime_t i_length )
143 {
144     int i_ret = es_out_Control( p_out, ES_OUT_SET_TIMES, f_position, i_time, i_length );
145     assert( !i_ret );
146 }
147 static inline void es_out_SetJitter( es_out_t *p_out,
148                                      mtime_t i_pts_delay, mtime_t i_pts_jitter, int i_cr_average )
149 {
150     int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER,
151                                 i_pts_delay, i_pts_jitter, i_cr_average );
152     assert( !i_ret );
153 }
154 static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
155                                        vlc_object_t **pp_decoder, vout_thread_t **pp_vout, aout_instance_t **pp_aout )
156 {
157     return es_out_Control( p_out, ES_OUT_GET_ES_OBJECTS_BY_ID, i_id, pp_decoder, pp_vout, pp_aout );
158 }
159 static inline int es_out_GetGroupForced( es_out_t *p_out )
160 {
161     int i_group;
162     int i_ret = es_out_Control( p_out, ES_OUT_GET_GROUP_FORCED, &i_group );
163     assert( !i_ret );
164     return i_group;
165 }
166
167 es_out_t  *input_EsOutNew( input_thread_t *, int i_rate );
168
169 #endif