]> git.sesse.net Git - vlc/blob - modules/codec/avcodec/avcodec.h
591d1258db8b6aa8b2f82c39439cb84afa8fa779
[vlc] / modules / codec / avcodec / avcodec.h
1 /*****************************************************************************
2  * avcodec.h: decoder and encoder using libavcodec
3  *****************************************************************************
4  * Copyright (C) 2001-2008 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
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 picture_t * DecodeVideo    ( decoder_t *, block_t ** );
25 aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
26
27 /* Video encoder module */
28 int  OpenEncoder ( vlc_object_t * );
29 void CloseEncoder( vlc_object_t * );
30
31 /* Audio encoder module */
32 int  OpenAudioEncoder ( vlc_object_t * );
33 void CloseAudioEncoder( vlc_object_t * );
34
35 /* Deinterlace video filter module */
36 int  OpenDeinterlace( vlc_object_t * );
37 void CloseDeinterlace( vlc_object_t * );
38
39 void InitLibavcodec( vlc_object_t *p_object );
40
41 /* Video Decoder */
42 int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
43                   AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
44 void EndVideoDec( decoder_t *p_dec );
45
46 /* Audio Decoder */
47 int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
48                   AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
49 void EndAudioDec( decoder_t *p_dec );
50
51 /*****************************************************************************
52  * Module descriptor help strings
53  *****************************************************************************/
54 #define DR_TEXT N_("Direct rendering")
55 /* FIXME Does somebody who knows what it does, explain */
56 #define DR_LONGTEXT N_("Direct rendering")
57
58 #define ERROR_TEXT N_("Error resilience")
59 #define ERROR_LONGTEXT N_( \
60     "Ffmpeg can do error resilience.\n" \
61     "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
62     "this can produce a lot of errors.\n" \
63     "Valid values range from 0 to 4 (0 disables all errors resilience).")
64
65 #define BUGS_TEXT N_("Workaround bugs")
66 #define BUGS_LONGTEXT N_( \
67     "Try to fix some bugs:\n" \
68     "1  autodetect\n" \
69     "2  old msmpeg4\n" \
70     "4  xvid interlaced\n" \
71     "8  ump4 \n" \
72     "16 no padding\n" \
73     "32 ac vlc\n" \
74     "64 Qpel chroma.\n" \
75     "This must be the sum of the values. For example, to fix \"ac vlc\" and " \
76     "\"ump4\", enter 40.")
77
78 #define HURRYUP_TEXT N_("Hurry up")
79 #define HURRYUP_LONGTEXT N_( \
80     "The decoder can partially decode or skip frame(s) " \
81     "when there is not enough time. It's useful with low CPU power " \
82     "but it can produce distorted pictures.")
83
84 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
85 #define SKIP_FRAME_LONGTEXT N_( \
86     "Force skipping of frames to speed up decoding " \
87     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
88
89 #define SKIP_IDCT_TEXT N_("Skip idct (default=0)")
90 #define SKIP_IDCT_LONGTEXT N_( \
91     "Force skipping of idct to speed up decoding for frame types" \
92     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
93
94 #define DEBUG_TEXT N_( "Debug mask" )
95 #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
96
97 /* TODO: Use a predefined list, with 0,1,2,4,7 */
98 #define VISMV_TEXT N_( "Visualize motion vectors" )
99 #define VISMV_LONGTEXT N_( \
100     "You can overlay the motion vectors (arrows showing how the images move) "\
101     "on the image. This value is a mask, based on these values:\n"\
102     "1 - visualize forward predicted MVs of P frames\n" \
103     "2 - visualize forward predicted MVs of B frames\n" \
104     "4 - visualize backward predicted MVs of B frames\n" \
105     "To visualize all vectors, the value should be 7." )
106
107 #define LOWRES_TEXT N_( "Low resolution decoding" )
108 #define LOWRES_LONGTEXT N_( "Only decode a low resolution version of " \
109     "the video. This requires less processing power" )
110
111 #define SKIPLOOPF_TEXT N_( "Skip the loop filter for H.264 decoding" )
112 #define SKIPLOOPF_LONGTEXT N_( "Skipping the loop filter (aka deblocking) " \
113     "usually has a detrimental effect on quality. However it provides a big " \
114     "speedup for high definition streams." )
115
116 /*
117  * Encoder options
118  */
119 #define ENC_CFG_PREFIX "sout-ffmpeg-"
120
121 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
122 #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
123   "that will be coded for one key frame." )
124
125 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
126 #define ENC_BFRAMES_LONGTEXT N_( "Number of " \
127   "B frames that will be coded between two reference frames." )
128
129 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
130 #define ENC_VT_LONGTEXT N_( "Video bitrate tolerance in kbit/s." )
131
132 #define ENC_INTERLACE_TEXT N_( "Interlaced encoding" )
133 #define ENC_INTERLACE_LONGTEXT N_( "Enable dedicated " \
134   "algorithms for interlaced frames." )
135
136 #define ENC_INTERLACE_ME_TEXT N_( "Interlaced motion estimation" )
137 #define ENC_INTERLACE_ME_LONGTEXT N_( "Enable interlaced " \
138   "motion estimation algorithms. This requires more CPU." )
139
140 #define ENC_PRE_ME_TEXT N_( "Pre-motion estimation" )
141 #define ENC_PRE_ME_LONGTEXT N_( "Enable the pre-motion " \
142   "estimation algorithm.")
143
144 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
145 #define ENC_RC_BUF_LONGTEXT N_( "Rate control " \
146   "buffer size (in kbytes). A bigger buffer will allow for better rate " \
147   "control, but will cause a delay in the stream." )
148
149 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressiveness" )
150 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Rate control "\
151   "buffer aggressiveness." )
152
153 #define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
154 #define ENC_IQUANT_FACTOR_LONGTEXT N_(  \
155   "Quantization factor of I frames, compared with P frames (for instance " \
156   "1.0 => same qscale for I and P frames)." )
157
158 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
159 #define ENC_NOISE_RED_LONGTEXT N_( "Enable a simple noise " \
160   "reduction algorithm to lower the encoding length and bitrate, at the " \
161   "expense of lower quality frames." )
162
163 #define ENC_MPEG4_MATRIX_TEXT N_( "MPEG4 quantization matrix" )
164 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Use the MPEG4 " \
165   "quantization matrix for MPEG2 encoding. This generally yields a " \
166   "better looking picture, while still retaining the compatibility with " \
167   "standard MPEG2 decoders.")
168
169 #define ENC_HQ_TEXT N_( "Quality level" )
170 #define ENC_HQ_LONGTEXT N_( "Quality level " \
171   "for the encoding of motions vectors (this can slow down the encoding " \
172   "very much)." )
173
174 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
175 #define ENC_HURRYUP_LONGTEXT N_( "The encoder " \
176   "can make on-the-fly quality tradeoffs if your CPU can't keep up with " \
177   "the encoding rate. It will disable trellis quantization, then the rate " \
178   "distortion of motion vectors (hq), and raise the noise reduction " \
179   "threshold to ease the encoder's task." )
180
181 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
182 #define ENC_QMIN_LONGTEXT N_( "Minimum video " \
183   "quantizer scale." )
184
185 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
186 #define ENC_QMAX_LONGTEXT N_( "Maximum video " \
187   "quantizer scale." )
188
189 #define ENC_TRELLIS_TEXT N_( "Trellis quantization" )
190 #define ENC_TRELLIS_LONGTEXT N_( "Enable trellis " \
191   "quantization (rate distortion for block coefficients)." )
192
193 #define ENC_QSCALE_TEXT N_( "Fixed quantizer scale" )
194 #define ENC_QSCALE_LONGTEXT N_( "A fixed video " \
195   "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )
196
197 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
198 #define ENC_STRICT_LONGTEXT N_( "Force a strict standard " \
199   "compliance when encoding (accepted values: -1, 0, 1)." )
200
201 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
202 #define ENC_LUMI_MASKING_LONGTEXT N_( "Raise the quantizer for " \
203   "very bright macroblocks (default: 0.0)." )
204
205 #define ENC_DARK_MASKING_TEXT N_( "Darkness masking" )
206 #define ENC_DARK_MASKING_LONGTEXT N_( "Raise the quantizer for " \
207   "very dark macroblocks (default: 0.0)." )
208
209 #define ENC_P_MASKING_TEXT N_( "Motion masking" )
210 #define ENC_P_MASKING_LONGTEXT N_( "Raise the quantizer for " \
211   "macroblocks with a high temporal complexity (default: 0.0)." )
212
213 #define ENC_BORDER_MASKING_TEXT N_( "Border masking" )
214 #define ENC_BORDER_MASKING_LONGTEXT N_( "Raise the quantizer " \
215   "for macroblocks at the border of the frame (default: 0.0)." )
216
217 #define ENC_LUMA_ELIM_TEXT N_( "Luminance elimination" )
218 #define ENC_LUMA_ELIM_LONGTEXT N_( "Eliminates luminance blocks when " \
219   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
220   "recommends -4." )
221
222 #define ENC_CHROMA_ELIM_TEXT N_( "Chrominance elimination" )
223 #define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
224   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
225   "recommends 7." )
226
227 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
228 #define ENC_PROFILE_TEXT N_( "Specify AAC audio profile to use" )
229 #define ENC_PROFILE_LONGTEXT N_( "Specify the AAC audio profile to use " \
230    "for encoding the audio bitstream. It takes the following options: " \
231    "main, low, ssr (not supported) and ltp (default: main)" )
232 #endif
233
234 #define FFMPEG_COMMON_MEMBERS   \
235     int i_cat;                  \
236     int i_codec_id;             \
237     const char *psz_namecodec;  \
238     AVCodecContext *p_context;  \
239     AVCodec        *p_codec;
240