es_out.h 6.39 KB
Newer Older
1 2 3
/*****************************************************************************
 * es_out.h: Input es_out functions
 *****************************************************************************
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
4
 * Copyright (C) 1998-2008 VLC authors and VideoLAN
5 6 7 8 9
 * Copyright (C) 2008 Laurent Aimar
 * $Id$
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
10 11 12
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
13 14 15 16
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
17 18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
19
 *
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
20 21 22
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24
 *****************************************************************************/

25 26
#ifndef LIBVLC_INPUT_ES_OUT_H
#define LIBVLC_INPUT_ES_OUT_H 1
27 28 29

#include <vlc_common.h>

30 31 32 33 34
enum es_out_mode_e
{
    ES_OUT_MODE_NONE,   /* don't select anything */
    ES_OUT_MODE_ALL,    /* eg for stream output */
    ES_OUT_MODE_AUTO,   /* best audio/video or for input follow audio-track, sub-track */
35 36
    ES_OUT_MODE_PARTIAL,/* select programs given after --programs */
    ES_OUT_MODE_END     /* mark the es_out as dead */
37 38
};

39 40
enum es_out_query_private_e
{
41
    /* set/get mode */
42
    ES_OUT_SET_MODE = ES_OUT_PRIVATE_START,         /* arg1= int                            */
43

44
    /* Get date to wait before demuxing more data */
45
    ES_OUT_GET_WAKE_UP,                             /* arg1=mtime_t*            res=cannot fail */
46

47 48 49 50
    /* Wrapper for some ES command to work with id */
    ES_OUT_SET_ES_BY_ID,
    ES_OUT_RESTART_ES_BY_ID,
    ES_OUT_SET_ES_DEFAULT_BY_ID,
51
    ES_OUT_GET_ES_OBJECTS_BY_ID,                    /* arg1=int id, vlc_object_t **dec, vout_thread_t **, audio_output_t ** res=can fail*/
52 53

    /* Get buffering state */
54
    ES_OUT_GET_BUFFERING,                           /* arg1=bool*               res=cannot fail */
55

56
    /* Set delay for a ES category */
57
    ES_OUT_SET_DELAY,                               /* arg1=es_category_e,      res=cannot fail */
58

59
    /* Set record state */
60
    ES_OUT_SET_RECORD_STATE,                        /* arg1=bool                res=can fail */
61 62

    /* Set pause state */
63
    ES_OUT_SET_PAUSE_STATE,                         /* arg1=bool b_source_paused, bool b_paused arg2=mtime_t   res=can fail */
64 65

    /* Set rate */
66
    ES_OUT_SET_RATE,                                /* arg1=int i_source_rate arg2=int i_rate                  res=can fail */
67 68 69 70 71 72

    /* Set a new time */
    ES_OUT_SET_TIME,                                /* arg1=mtime_t             res=can fail */

    /* Set next frame */
    ES_OUT_SET_FRAME_NEXT,                          /*                          res=can fail */
73 74 75

    /* Set position/time/length */
    ES_OUT_SET_TIMES,                               /* arg1=double f_position arg2=mtime_t i_time arg3=mtime_t i_length res=cannot fail */
76 77

    /* Set jitter */
78
    ES_OUT_SET_JITTER,                              /* arg1=mtime_t i_pts_delay arg2= mtime_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
79 80 81

    /* Get forced group */
    ES_OUT_GET_GROUP_FORCED,                        /* arg1=int * res=cannot fail */
82 83 84

    /* Set End Of Stream */
    ES_OUT_SET_EOS,                                 /* res=cannot fail */
85 86
};

87 88 89 90 91
static inline void es_out_SetMode( es_out_t *p_out, int i_mode )
{
    int i_ret = es_out_Control( p_out, ES_OUT_SET_MODE, i_mode );
    assert( !i_ret );
}
92 93 94 95 96 97 98 99
static inline mtime_t es_out_GetWakeup( es_out_t *p_out )
{
    mtime_t i_wu;
    int i_ret = es_out_Control( p_out, ES_OUT_GET_WAKE_UP, &i_wu );

    assert( !i_ret );
    return i_wu;
}
100
static inline bool es_out_GetBuffering( es_out_t *p_out )
101 102
{
    bool b;
103
    int i_ret = es_out_Control( p_out, ES_OUT_GET_BUFFERING, &b );
104

105
    assert( !i_ret );
106 107
    return b;
}
108 109 110 111
static inline bool es_out_GetEmpty( es_out_t *p_out )
{
    bool b;
    int i_ret = es_out_Control( p_out, ES_OUT_GET_EMPTY, &b );
112

113 114 115
    assert( !i_ret );
    return b;
}
116
static inline void es_out_SetDelay( es_out_t *p_out, int i_cat, mtime_t i_delay )
117
{
118 119
    int i_ret = es_out_Control( p_out, ES_OUT_SET_DELAY, i_cat, i_delay );
    assert( !i_ret );
120 121 122 123 124
}
static inline int es_out_SetRecordState( es_out_t *p_out, bool b_record )
{
    return es_out_Control( p_out, ES_OUT_SET_RECORD_STATE, b_record );
}
125
static inline int es_out_SetPauseState( es_out_t *p_out, bool b_source_paused, bool b_paused, mtime_t i_date )
126
{
127
    return es_out_Control( p_out, ES_OUT_SET_PAUSE_STATE, b_source_paused, b_paused, i_date );
128
}
129
static inline int es_out_SetRate( es_out_t *p_out, int i_source_rate, int i_rate )
130
{
131
    return es_out_Control( p_out, ES_OUT_SET_RATE, i_source_rate, i_rate );
132 133 134 135 136 137 138 139 140
}
static inline int es_out_SetTime( es_out_t *p_out, mtime_t i_date )
{
    return es_out_Control( p_out, ES_OUT_SET_TIME, i_date );
}
static inline int es_out_SetFrameNext( es_out_t *p_out )
{
    return es_out_Control( p_out, ES_OUT_SET_FRAME_NEXT );
}
141 142 143 144 145
static inline void es_out_SetTimes( es_out_t *p_out, double f_position, mtime_t i_time, mtime_t i_length )
{
    int i_ret = es_out_Control( p_out, ES_OUT_SET_TIMES, f_position, i_time, i_length );
    assert( !i_ret );
}
146 147
static inline void es_out_SetJitter( es_out_t *p_out,
                                     mtime_t i_pts_delay, mtime_t i_pts_jitter, int i_cr_average )
148
{
149 150
    int i_ret = es_out_Control( p_out, ES_OUT_SET_JITTER,
                                i_pts_delay, i_pts_jitter, i_cr_average );
151 152
    assert( !i_ret );
}
153
static inline int es_out_GetEsObjects( es_out_t *p_out, int i_id,
154
                                       vlc_object_t **pp_decoder, vout_thread_t **pp_vout, audio_output_t **pp_aout )
155 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 160 161 162 163 164
static inline int es_out_GetGroupForced( es_out_t *p_out )
{
    int i_group;
    int i_ret = es_out_Control( p_out, ES_OUT_GET_GROUP_FORCED, &i_group );
    assert( !i_ret );
    return i_group;
}
165 166 167 168 169
static inline void es_out_Eos( es_out_t *p_out )
{
    int i_ret = es_out_Control( p_out, ES_OUT_SET_EOS );
    assert( !i_ret );
}
170

171
es_out_t  *input_EsOutNew( input_thread_t *, int i_rate );
172

173
#endif