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