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