]> git.sesse.net Git - vlc/blob - modules/codec/ffmpeg/avcodec.h
5938f08cf87d3875edefb7d9fd8ddf3a9c143c20
[vlc] / modules / codec / ffmpeg / 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 /*****************************************************************************
40  * Module descriptor help strings
41  *****************************************************************************/
42 #define DR_TEXT N_("Direct rendering")
43 /* FIXME Does somebody who knows what it does, explain */
44 #define DR_LONGTEXT N_("Direct rendering")
45
46 #define ERROR_TEXT N_("Error resilience")
47 #define ERROR_LONGTEXT N_( \
48     "Ffmpeg can do error resilience.\n" \
49     "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
50     "this can produce a lot of errors.\n" \
51     "Valid values range from 0 to 4 (0 disables all errors resilience).")
52
53 #define BUGS_TEXT N_("Workaround bugs")
54 #define BUGS_LONGTEXT N_( \
55     "Try to fix some bugs:\n" \
56     "1  autodetect\n" \
57     "2  old msmpeg4\n" \
58     "4  xvid interlaced\n" \
59     "8  ump4 \n" \
60     "16 no padding\n" \
61     "32 ac vlc\n" \
62     "64 Qpel chroma.\n" \
63     "This must be the sum of the values. For example, to fix \"ac vlc\" and " \
64     "\"ump4\", enter 40.")
65
66 #define HURRYUP_TEXT N_("Hurry up")
67 #define HURRYUP_LONGTEXT N_( \
68     "The decoder can partially decode or skip frame(s) " \
69     "when there is not enough time. It's useful with low CPU power " \
70     "but it can produce distorted pictures.")
71
72 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
73 #define SKIP_FRAME_LONGTEXT N_( \
74     "Force skipping of frames to speed up decoding " \
75     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
76
77 #define SKIP_IDCT_TEXT N_("Skip idct (default=0)")
78 #define SKIP_IDCT_LONGTEXT N_( \
79     "Force skipping of idct to speed up decoding for frame types" \
80     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
81
82 #define PP_Q_TEXT N_("Post processing quality")
83 #define PP_Q_LONGTEXT N_( \
84     "Quality of post processing. Valid range is 0 to 6\n" \
85     "Higher levels require considerable more CPU power, but produce " \
86     "better looking pictures." )
87
88 #define DEBUG_TEXT N_( "Debug mask" )
89 #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
90
91 /* TODO: Use a predefined list, with 0,1,2,4,7 */
92 #define VISMV_TEXT N_( "Visualize motion vectors" )
93 #define VISMV_LONGTEXT N_( \
94     "You can overlay the motion vectors (arrows showing how the images move) "\
95     "on the image. This value is a mask, based on these values:\n"\
96     "1 - visualize forward predicted MVs of P frames\n" \
97     "2 - visualize forward predicted MVs of B frames\n" \
98     "4 - visualize backward predicted MVs of B frames\n" \
99     "To visualize all vectors, the value should be 7." )
100
101 #define LOWRES_TEXT N_( "Low resolution decoding" )
102 #define LOWRES_LONGTEXT N_( "Only decode a low resolution version of " \
103     "the video. This requires less processing power" )
104
105 #define SKIPLOOPF_TEXT N_( "Skip the loop filter for H.264 decoding" )
106 #define SKIPLOOPF_LONGTEXT N_( "Skipping the loop filter (aka deblocking) " \
107     "usually has a detrimental effect on quality. However it provides a big " \
108     "speedup for high definition streams." )
109
110 #define LIBAVCODEC_PP_TEXT N_("FFmpeg post processing filter chains")
111 /* FIXME (cut/past from ffmpeg */
112 #define LIBAVCODEC_PP_LONGTEXT \
113 N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
114 "long form example:\n" \
115 "vdeblock:autoq/hdeblock:autoq/linblenddeint    default,-vdeblock\n" \
116 "short form example:\n" \
117 "vb:a/hb:a/lb de,-vb\n" \
118 "more examples:\n" \
119 "tn:64:128:256\n" \
120 "Filters                        Options\n" \
121 "short  long name       short   long option     Description\n" \
122 "*      *               a       autoq           cpu power dependent enabler\n" \
123 "                       c       chrom           chrominance filtring enabled\n" \
124 "                       y       nochrom         chrominance filtring disabled\n" \
125 "hb     hdeblock        (2 Threshold)           horizontal deblocking filter\n" \
126 "       1. difference factor: default=64, higher -> more deblocking\n" \
127 "       2. flatness threshold: default=40, lower -> more deblocking\n" \
128 "                       the h & v deblocking filters share these\n" \
129 "                       so u cant set different thresholds for h / v\n" \
130 "vb     vdeblock        (2 Threshold)           vertical deblocking filter\n" \
131 "h1     x1hdeblock                              Experimental h deblock filter 1\n" \
132 "v1     x1vdeblock                              Experimental v deblock filter 1\n" \
133 "dr     dering                                  Deringing filter\n" \
134 "al     autolevels                              automatic brightness / contrast\n" \
135 "                       f       fullyrange      stretch luminance to (0..255)\n" \
136 "lb     linblenddeint                           linear blend deinterlacer\n" \
137 "li     linipoldeint                            linear interpolating deinterlace\n" \
138 "ci     cubicipoldeint                          cubic interpolating deinterlacer\n" \
139 "md     mediandeint                             median deinterlacer\n" \
140 "fd     ffmpegdeint                             ffmpeg deinterlacer\n" \
141 "de     default                                 hb:a,vb:a,dr:a,al\n" \
142 "fa     fast                                    h1:a,v1:a,dr:a,al\n" \
143 "tn     tmpnoise        (3 Thresholds)          Temporal Noise Reducer\n" \
144 "                       1. <= 2. <= 3.          larger -> stronger filtering\n" \
145 "fq     forceQuant      <quantizer>             Force quantizer\n")
146
147 /*
148  * Encoder options
149  */
150 #define ENC_CFG_PREFIX "sout-ffmpeg-"
151
152 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
153 #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
154   "that will be coded for one key frame." )
155
156 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
157 #define ENC_BFRAMES_LONGTEXT N_( "Number of " \
158   "B frames that will be coded between two reference frames." )
159
160 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
161 #define ENC_VT_LONGTEXT N_( "Video bitrate tolerance in kbit/s." )
162
163 #define ENC_INTERLACE_TEXT N_( "Interlaced encoding" )
164 #define ENC_INTERLACE_LONGTEXT N_( "Enable dedicated " \
165   "algorithms for interlaced frames." )
166
167 #define ENC_INTERLACE_ME_TEXT N_( "Interlaced motion estimation" )
168 #define ENC_INTERLACE_ME_LONGTEXT N_( "Enable interlaced " \
169   "motion estimation algorithms. This requires more CPU." )
170
171 #define ENC_PRE_ME_TEXT N_( "Pre-motion estimation" )
172 #define ENC_PRE_ME_LONGTEXT N_( "Enable the pre-motion " \
173   "estimation algorithm.")
174
175 #define ENC_RC_STRICT_TEXT N_( "Strict rate control" )
176 #define ENC_RC_STRICT_LONGTEXT N_( "Enable the strict rate " \
177   "control algorithm." )
178
179 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
180 #define ENC_RC_BUF_LONGTEXT N_( "Rate control " \
181   "buffer size (in kbytes). A bigger buffer will allow for better rate " \
182   "control, but will cause a delay in the stream." )
183
184 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressiveness" )
185 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Rate control "\
186   "buffer aggressiveness." )
187
188 #define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
189 #define ENC_IQUANT_FACTOR_LONGTEXT N_(  \
190   "Quantization factor of I frames, compared with P frames (for instance " \
191   "1.0 => same qscale for I and P frames)." )
192
193 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
194 #define ENC_NOISE_RED_LONGTEXT N_( "Enable a simple noise " \
195   "reduction algorithm to lower the encoding length and bitrate, at the " \
196   "expense of lower quality frames." )
197
198 #define ENC_MPEG4_MATRIX_TEXT N_( "MPEG4 quantization matrix" )
199 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Use the MPEG4 " \
200   "quantization matrix for MPEG2 encoding. This generally yields a " \
201   "better looking picture, while still retaining the compatibility with " \
202   "standard MPEG2 decoders.")
203
204 #define ENC_HQ_TEXT N_( "Quality level" )
205 #define ENC_HQ_LONGTEXT N_( "Quality level " \
206   "for the encoding of motions vectors (this can slow down the encoding " \
207   "very much)." )
208
209 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
210 #define ENC_HURRYUP_LONGTEXT N_( "The encoder " \
211   "can make on-the-fly quality tradeoffs if your CPU can't keep up with " \
212   "the encoding rate. It will disable trellis quantization, then the rate " \
213   "distortion of motion vectors (hq), and raise the noise reduction " \
214   "threshold to ease the encoder's task." )
215
216 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
217 #define ENC_QMIN_LONGTEXT N_( "Minimum video " \
218   "quantizer scale." )
219
220 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
221 #define ENC_QMAX_LONGTEXT N_( "Maximum video " \
222   "quantizer scale." )
223
224 #define ENC_TRELLIS_TEXT N_( "Trellis quantization" )
225 #define ENC_TRELLIS_LONGTEXT N_( "Enable trellis " \
226   "quantization (rate distortion for block coefficients)." )
227
228 #define ENC_QSCALE_TEXT N_( "Fixed quantizer scale" )
229 #define ENC_QSCALE_LONGTEXT N_( "A fixed video " \
230   "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )
231
232 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
233 #define ENC_STRICT_LONGTEXT N_( "Force a strict standard " \
234   "compliance when encoding (accepted values: -1, 0, 1)." )
235
236 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
237 #define ENC_LUMI_MASKING_LONGTEXT N_( "Raise the quantizer for " \
238   "very bright macroblocks (default: 0.0)." )
239
240 #define ENC_DARK_MASKING_TEXT N_( "Darkness masking" )
241 #define ENC_DARK_MASKING_LONGTEXT N_( "Raise the quantizer for " \
242   "very dark macroblocks (default: 0.0)." )
243
244 #define ENC_P_MASKING_TEXT N_( "Motion masking" )
245 #define ENC_P_MASKING_LONGTEXT N_( "Raise the quantizer for " \
246   "macroblocks with a high temporal complexity (default: 0.0)." )
247
248 #define ENC_BORDER_MASKING_TEXT N_( "Border masking" )
249 #define ENC_BORDER_MASKING_LONGTEXT N_( "Raise the quantizer " \
250   "for macroblocks at the border of the frame (default: 0.0)." )
251
252 #define ENC_LUMA_ELIM_TEXT N_( "Luminance elimination" )
253 #define ENC_LUMA_ELIM_LONGTEXT N_( "Eliminates luminance blocks when " \
254   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
255   "recommends -4." )
256
257 #define ENC_CHROMA_ELIM_TEXT N_( "Chrominance elimination" )
258 #define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
259   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
260   "recommends 7." )
261
262 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
263 #define ENC_PROFILE_TEXT N_( "Specify AAC audio profile to use" )
264 #define ENC_PROFILE_LONGTEXT N_( "Specify the AAC audio profile to use " \
265    "for encoding the audio bitstream. It takes the following options: " \
266    "main, low, ssr (not supported) and ltp (default: main)" )
267 #endif
268
269 #define FFMPEG_COMMON_MEMBERS   \
270     int i_cat;                  \
271     int i_codec_id;             \
272     const char *psz_namecodec;  \
273     AVCodecContext *p_context;  \
274     AVCodec        *p_codec;
275