]> git.sesse.net Git - vlc/blob - include/vlc_codec.h
* ALL: Major rework of the subpictures architecture.
[vlc] / include / vlc_codec.h
1 /*****************************************************************************
2  * vlc_codec.h: codec related structures
3  *****************************************************************************
4  * Copyright (C) 1999-2003 VideoLAN
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., 59 Temple Place - Suite 330, Boston, MA  02111, 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 struct decoder_t
42 {
43     VLC_COMMON_MEMBERS
44
45     /* Module properties */
46     module_t *          p_module;
47     decoder_sys_t *     p_sys;
48
49     picture_t *         ( * pf_decode_video )( decoder_t *, block_t ** );
50     aout_buffer_t *     ( * pf_decode_audio )( decoder_t *, block_t ** );
51     subpicture_t *      ( * pf_decode_sub)   ( decoder_t *, block_t ** );
52     block_t *           ( * pf_packetize )   ( decoder_t *, block_t ** );
53
54     /* Some decoders only accept packetized data (ie. not truncated) */
55     vlc_bool_t          b_need_packetized;
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     /*
64      * Buffers allocation
65      */
66
67     /* Audio output callbacks */
68     aout_buffer_t * ( * pf_aout_buffer_new) ( decoder_t *, int );
69     void            ( * pf_aout_buffer_del) ( decoder_t *, aout_buffer_t * );
70
71     /* Video output callbacks */
72     picture_t     * ( * pf_vout_buffer_new) ( decoder_t * );
73     void            ( * pf_vout_buffer_del) ( decoder_t *, picture_t * );
74     void            ( * pf_picture_link)    ( decoder_t *, picture_t * );
75     void            ( * pf_picture_unlink)  ( decoder_t *, picture_t * );
76
77     /* SPU output callbacks */
78     subpicture_t *  ( * pf_spu_buffer_new) ( decoder_t * );
79     void            ( * pf_spu_buffer_del) ( decoder_t *, subpicture_t * );
80
81     /* Private structure for the owner of the decoder */
82     decoder_owner_sys_t *p_owner;
83 };
84
85 /**
86  * @}
87  */
88
89 /**
90  * \defgroup decoder Encoder
91  *
92  * The structure describing a Encoder
93  *
94  * @{
95  */
96
97 struct encoder_t
98 {
99     VLC_COMMON_MEMBERS
100
101     /* Module properties */
102     module_t *          p_module;
103     encoder_sys_t *     p_sys;
104     vlc_bool_t          b_force;
105
106     block_t *           ( * pf_header )( encoder_t * );
107     block_t *           ( * pf_encode_video )( encoder_t *, picture_t * );
108     block_t *           ( * pf_encode_audio )( encoder_t *, aout_buffer_t * );
109
110     /* Properties of the input data fed to the encoder */
111     es_format_t         fmt_in;
112
113     /* Properties of the output of the encoder */
114     es_format_t         fmt_out;
115
116     /* Common encoder options */
117     int i_threads;               /* Number of threads to use during encoding */
118     int i_iframes;               /* One I frame per i_iframes */
119     int i_bframes;               /* One B frame per i_bframes */
120     int i_tolerance;             /* Bitrate tolerance */
121
122     /* Encoder config */
123     sout_cfg_t *p_cfg;
124 };
125
126 /**
127  * @}
128  */
129
130 #endif /* _VLC_CODEC_H */