]> git.sesse.net Git - vlc/blob - include/vlc_codec.h
FSF address change.
[vlc] / include / vlc_codec.h
1 /*****************************************************************************
2  * vlc_codec.h: codec related structures
3  *****************************************************************************
4  * Copyright (C) 1999-2003 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@netcourrier.com>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23 #ifndef _VLC_CODEC_H
24 #define _VLC_CODEC_H 1
25
26 /**
27  * \file
28  * This file defines the structure and types used by decoders and encoders
29  */
30
31 typedef struct decoder_owner_sys_t decoder_owner_sys_t;
32
33 /**
34  * \defgroup decoder Decoder
35  *
36  * The structure describing a decoder
37  *
38  * @{
39  */
40
41 /*
42  * BIG FAT WARNING : the code relies in the first 4 members of filter_t
43  * and decoder_t to be the same, so if you have anything to add, do it
44  * at the end of the structure.
45  */
46 struct decoder_t
47 {
48     VLC_COMMON_MEMBERS
49
50     /* Module properties */
51     module_t *          p_module;
52     decoder_sys_t *     p_sys;
53
54     /* Input format ie from demuxer (XXX: a lot of field could be invalid) */
55     es_format_t         fmt_in;
56
57     /* Output format of decoder/packetizer */
58     es_format_t         fmt_out;
59
60     /* Some decoders only accept packetized data (ie. not truncated) */
61     vlc_bool_t          b_need_packetized;
62
63     /* Tell the decoder if it is allowed to drop frames */
64     vlc_bool_t          b_pace_control;
65
66     picture_t *         ( * pf_decode_video )( decoder_t *, block_t ** );
67     aout_buffer_t *     ( * pf_decode_audio )( decoder_t *, block_t ** );
68     subpicture_t *      ( * pf_decode_sub)   ( decoder_t *, block_t ** );
69     block_t *           ( * pf_packetize )   ( decoder_t *, block_t ** );
70
71     /*
72      * Buffers allocation
73      */
74
75     /* Audio output callbacks */
76     aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
77     void            ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
78
79     /* Video output callbacks */
80     picture_t     * ( * pf_vout_buffer_new) ( decoder_t * );
81     void            ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
82     void            ( * pf_picture_link)    ( decoder_t *, picture_t * );
83     void            ( * pf_picture_unlink)  ( decoder_t *, picture_t * );
84
85     /* SPU output callbacks */
86     subpicture_t *  ( * pf_spu_buffer_new) ( decoder_t * );
87     void            ( * pf_spu_buffer_del) ( decoder_t *, subpicture_t * );
88
89     /* Private structure for the owner of the decoder */
90     decoder_owner_sys_t *p_owner;
91 };
92
93 /**
94  * @}
95  */
96
97 /**
98  * \defgroup decoder Encoder
99  *
100  * The structure describing a Encoder
101  *
102  * @{
103  */
104
105 struct encoder_t
106 {
107     VLC_COMMON_MEMBERS
108
109     /* Module properties */
110     module_t *          p_module;
111     encoder_sys_t *     p_sys;
112
113     /* Properties of the input data fed to the encoder */
114     es_format_t         fmt_in;
115
116     /* Properties of the output of the encoder */
117     es_format_t         fmt_out;
118
119     block_t *           ( * pf_encode_video )( encoder_t *, picture_t * );
120     block_t *           ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
121     block_t *           ( * pf_encode_sub )( encoder_t *, subpicture_t * );
122
123     /* Common encoder options */
124     int i_threads;               /* Number of threads to use during encoding */
125     int i_iframes;               /* One I frame per i_iframes */
126     int i_bframes;               /* One B frame per i_bframes */
127     int i_tolerance;             /* Bitrate tolerance */
128
129     /* Encoder config */
130     sout_cfg_t *p_cfg;
131 };
132
133 /**
134  * @}
135  */
136
137 #endif /* _VLC_CODEC_H */