]> git.sesse.net Git - vlc/blob - modules/codec/ffmpeg/ffmpeg.h
Copyright fixes
[vlc] / modules / codec / ffmpeg / ffmpeg.h
1 /*****************************************************************************
2  * ffmpeg.h: decoder using the ffmpeg library
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN (Centrale Réseaux) and its contributors
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #include "codecs.h"                                      /* BITMAPINFOHEADER */
25
26 #if LIBAVCODEC_BUILD >= 4663
27 #   define LIBAVCODEC_PP
28 #else
29 #   undef  LIBAVCODEC_PP
30 #endif
31
32 struct picture_t;
33 struct AVFrame;
34 struct AVCodecContext;
35 struct AVCodec;
36
37 void E_(InitLibavcodec)( vlc_object_t * );
38 int E_(GetFfmpegCodec) ( vlc_fourcc_t, int *, int *, char ** );
39 int E_(GetVlcFourcc)   ( int, int *, vlc_fourcc_t *, char ** );
40 int E_(GetFfmpegChroma)( vlc_fourcc_t );
41 vlc_fourcc_t E_(GetVlcChroma)( int );
42
43 /* Video decoder module */
44 int  E_( InitVideoDec )( decoder_t *, AVCodecContext *, AVCodec *,
45                          int, char * );
46 void E_( EndVideoDec ) ( decoder_t * );
47 picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
48
49 /* Audio decoder module */
50 int  E_( InitAudioDec )( decoder_t *, AVCodecContext *, AVCodec *,
51                          int, char * );
52 void E_( EndAudioDec ) ( decoder_t * );
53 aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
54
55 /* Chroma conversion module */
56 int  E_(OpenChroma)( vlc_object_t * );
57 void E_(CloseChroma)( vlc_object_t * );
58
59 /* Video encoder module */
60 int  E_(OpenEncoder) ( vlc_object_t * );
61 void E_(CloseEncoder)( vlc_object_t * );
62
63 /* Audio encoder module */
64 int  E_(OpenAudioEncoder) ( vlc_object_t * );
65 void E_(CloseAudioEncoder)( vlc_object_t * );
66
67 /* Demux module */
68 int  E_(OpenDemux) ( vlc_object_t * );
69 void E_(CloseDemux)( vlc_object_t * );
70
71 /* Video filter module */
72 int  E_(OpenFilter)( vlc_object_t * );
73 void E_(CloseFilter)( vlc_object_t * );
74 int  E_(OpenDeinterlace)( vlc_object_t * );
75 void E_(CloseDeinterlace)( vlc_object_t * );
76
77 /* Postprocessing module */
78 void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
79 int E_(InitPostproc)( decoder_t *, void *, int, int, int );
80 int E_(PostprocPict)( decoder_t *, void *, picture_t *, AVFrame * );
81 void E_(ClosePostproc)( decoder_t *, void * );
82
83 /*****************************************************************************
84  * Module descriptor help strings
85  *****************************************************************************/
86 #define DR_TEXT N_("Direct rendering")
87
88 #define ERROR_TEXT N_("Error resilience")
89 #define ERROR_LONGTEXT N_( \
90     "ffmpeg can do error resilience.\n" \
91     "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
92     "this can produce a lot of errors.\n" \
93     "Valid values range from 0 to 4 (0 disables all errors resilience).")
94
95 #define BUGS_TEXT N_("Workaround bugs")
96 #define BUGS_LONGTEXT N_( \
97     "Try to fix some bugs\n" \
98     "1  autodetect\n" \
99     "2  old msmpeg4\n" \
100     "4  xvid interlaced\n" \
101     "8  ump4 \n" \
102     "16 no padding\n" \
103     "32 ac vlc\n" \
104     "64 Qpel chroma")
105
106 #define HURRYUP_TEXT N_("Hurry up")
107 #define HURRYUP_LONGTEXT N_( \
108     "Allow the decoder to partially decode or skip frame(s) " \
109     "when there is not enough time. It's useful with low CPU power " \
110     "but it can produce distorted pictures.")
111
112 #define PP_Q_TEXT N_("Post processing quality")
113 #define PP_Q_LONGTEXT N_( \
114     "Quality of post processing. Valid range is 0 to 6\n" \
115     "Higher levels require considerable more CPU power, but produce " \
116     "better looking pictures." )
117
118 #define DEBUG_TEXT N_( "Debug mask" )
119 #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
120
121 #define VISMV_TEXT N_( "Visualize motion vectors" )
122 #define VISMV_LONGTEXT N_( "Set motion vectors visualization mask.\n" \
123     "1 - visualize forward predicted MVs of P frames\n" \
124     "2 - visualize forward predicted MVs of B frames\n" \
125     "4 - visualize backward predicted MVs of B frames" )
126
127 #define LOWRES_TEXT N_( "Low resolution decoding" )
128 #define LOWRES_LONGTEXT N_( "Will only decode a low resolution version of " \
129     "the video." )
130
131 #define LIBAVCODEC_PP_TEXT N_("ffmpeg post processing filter chains")
132 /* FIXME (cut/past from ffmpeg */
133 #define LIBAVCODEC_PP_LONGTEXT \
134 "<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
135 "long form example:\n" \
136 "vdeblock:autoq/hdeblock:autoq/linblenddeint    default,-vdeblock\n" \
137 "short form example:\n" \
138 "vb:a/hb:a/lb de,-vb\n" \
139 "more examples:\n" \
140 "tn:64:128:256\n" \
141 "Filters                        Options\n" \
142 "short  long name       short   long option     Description\n" \
143 "*      *               a       autoq           cpu power dependant enabler\n" \
144 "                       c       chrom           chrominance filtring enabled\n" \
145 "                       y       nochrom         chrominance filtring disabled\n" \
146 "hb     hdeblock        (2 Threshold)           horizontal deblocking filter\n" \
147 "       1. difference factor: default=64, higher -> more deblocking\n" \
148 "       2. flatness threshold: default=40, lower -> more deblocking\n" \
149 "                       the h & v deblocking filters share these\n" \
150 "                       so u cant set different thresholds for h / v\n" \
151 "vb     vdeblock        (2 Threshold)           vertical deblocking filter\n" \
152 "h1     x1hdeblock                              Experimental h deblock filter 1\n" \
153 "v1     x1vdeblock                              Experimental v deblock filter 1\n" \
154 "dr     dering                                  Deringing filter\n" \
155 "al     autolevels                              automatic brightness / contrast\n" \
156 "                       f       fullyrange      stretch luminance to (0..255)\n" \
157 "lb     linblenddeint                           linear blend deinterlacer\n" \
158 "li     linipoldeint                            linear interpolating deinterlace\n" \
159 "ci     cubicipoldeint                          cubic interpolating deinterlacer\n" \
160 "md     mediandeint                             median deinterlacer\n" \
161 "fd     ffmpegdeint                             ffmpeg deinterlacer\n" \
162 "de     default                                 hb:a,vb:a,dr:a,al\n" \
163 "fa     fast                                    h1:a,v1:a,dr:a,al\n" \
164 "tn     tmpnoise        (3 Thresholds)          Temporal Noise Reducer\n" \
165 "                       1. <= 2. <= 3.          larger -> stronger filtering\n" \
166 "fq     forceQuant      <quantizer>             Force quantizer\n"
167
168 /*
169  * Encoder options
170  */
171 #define ENC_CFG_PREFIX "sout-ffmpeg-"
172
173 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
174 #define ENC_KEYINT_LONGTEXT N_( "Allows you to specify the number of frames " \
175   "that will be coded for one key frame." )
176
177 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
178 #define ENC_BFRAMES_LONGTEXT N_( "Allows you to specify the number of " \
179   "B frames that will be coded between two reference frames." )
180
181 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
182 #define ENC_VT_LONGTEXT N_( "Allows you to specify the video bitrate " \
183   "tolerance in kbit/s." )
184
185 #define ENC_INTERLACE_TEXT N_( "Enable interlaced encoding" )
186 #define ENC_INTERLACE_LONGTEXT N_( "Allows you to enable dedicated " \
187   "algorithms for interlaced frames." )
188
189 #define ENC_PRE_ME_TEXT N_( "Enable pre motion estimation" )
190 #define ENC_PRE_ME_LONGTEXT N_( "Allows you to enable the pre motion " \
191   "estimation." )
192
193 #define ENC_RC_STRICT_TEXT N_( "Enable strict rate control" )
194 #define ENC_RC_STRICT_LONGTEXT N_( "Allows you to enable the strict rate " \
195   "control algorithm." )
196
197 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
198 #define ENC_RC_BUF_LONGTEXT N_( "Allows you to specify the rate control " \
199   "buffer size." )
200
201 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressiveness" )
202 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Allows you to specify the rate control "\
203   "buffer aggressiveness." )
204
205 #define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
206 #define ENC_IQUANT_FACTOR_LONGTEXT N_( "Allows you to specify the " \
207   "quantization factor of I frames, compared with P frames (for instance " \
208   "1.0 => same qscale for I and P frames)." )
209
210 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
211 #define ENC_NOISE_RED_LONGTEXT N_( "Allows you to enable a simple noise " \
212   "reduction algorithm to lower the encoding length and bitrate, at the " \
213   "expense of lower quality frames." )
214
215 #define ENC_MPEG4_MATRIX_TEXT N_( "Enable MPEG4 quantization matrix" )
216 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Allows you to use the MPEG4 " \
217   "quantization matrix for mpeg2 encoding. This generally yields a " \
218   "better looking picture, while still retaining the compatibility with " \
219   "standard MPEG-2 decoders.")
220
221 #define ENC_HQ_TEXT N_( "Quality level" )
222 #define ENC_HQ_LONGTEXT N_( "Allows you to specify the quality level " \
223   "for the encoding of motions vectors (this can slow down the encoding " \
224   "very much)." )
225
226 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
227 #define ENC_HURRYUP_LONGTEXT N_( "Allows you to specify if the encoder " \
228   "should make on-the-fly quality tradeoffs if your CPU can't keep up with " \
229   "the encoding rate. It will disable trellis quantization, then the rate " \
230   "distortion of motion vectors (hq), and raise the noise reduction " \
231   "threshold to ease the encoder's task." )
232
233 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
234 #define ENC_QMIN_LONGTEXT N_( "Allows you to specify the minimum video " \
235   "quantizer scale." )
236
237 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
238 #define ENC_QMAX_LONGTEXT N_( "Allows you to specify the maximum video " \
239   "quantizer scale." )
240
241 #define ENC_TRELLIS_TEXT N_( "Enable trellis quantization" )
242 #define ENC_TRELLIS_LONGTEXT N_( "Allows you to enable trellis " \
243   "quantization (rate distortion for block coefficients)." )
244
245 #define ENC_QSCALE_TEXT N_( "Use fixed video quantizer scale" )
246 #define ENC_QSCALE_LONGTEXT N_( "Allows you to specify a fixed video " \
247   "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )
248
249 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
250 #define ENC_STRICT_LONGTEXT N_( "Allows you to force a strict standard " \
251   "compliance when encoding (accepted values: -1, 0, 1)." )
252
253 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
254 #define ENC_LUMI_MASKING_LONGTEXT N_( "Allows you to raise the quantizer for " \
255   "very bright macroblocks (default: 0.0)." )
256
257 #define ENC_DARK_MASKING_TEXT N_( "Darkness masking" )
258 #define ENC_DARK_MASKING_LONGTEXT N_( "Allows you to raise the quantizer for " \
259   "very dark macroblocks (default: 0.0)." )
260
261 #define ENC_P_MASKING_TEXT N_( "Motion masking" )
262 #define ENC_P_MASKING_LONGTEXT N_( "Allows you to raise the quantizer for " \
263   "macroblocks with a high temporal complexity (default: 0.0)." )
264
265 #define ENC_BORDER_MASKING_TEXT N_( "Border masking" )
266 #define ENC_BORDER_MASKING_LONGTEXT N_( "Allows you to raise the quantizer " \
267   "for macroblocks at the border of the frame (default: 0.0)." )
268
269 #define ENC_LUMA_ELIM_TEXT N_( "Luminance elimination" )
270 #define ENC_LUMA_ELIM_LONGTEXT N_( "Eliminates luminance blocks when " \
271   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
272   "recommends -4." )
273
274 #define ENC_CHROMA_ELIM_TEXT N_( "Chrominance elimination" )
275 #define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
276   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
277   "recommends 7." )