1 /*****************************************************************************
2 * ffmpeg.h: decoder using the ffmpeg library
3 *****************************************************************************
4 * Copyright (C) 2001 the VideoLAN team
7 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
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.
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.
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 *****************************************************************************/
24 #include <vlc_codecs.h> /* BITMAPINFOHEADER */
28 struct AVCodecContext;
31 void E_(InitLibavcodec)( vlc_object_t * );
32 void E_(LibavcodecCallback)( void *p_opaque, int i_level,
33 const char *psz_format, va_list va );
34 int E_(GetFfmpegCodec) ( vlc_fourcc_t, int *, int *, const char ** );
35 int E_(GetVlcFourcc) ( int, int *, vlc_fourcc_t *, const char ** );
36 int E_(GetFfmpegChroma)( vlc_fourcc_t );
37 vlc_fourcc_t E_(GetVlcChroma)( int );
39 /* Video decoder module */
40 int E_( InitVideoDec )( decoder_t *, struct AVCodecContext *, struct AVCodec *,
42 void E_( EndVideoDec ) ( decoder_t * );
43 picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
45 /* Audio decoder module */
46 int E_( InitAudioDec )( decoder_t *, struct AVCodecContext *, struct AVCodec *,
48 void E_( EndAudioDec ) ( decoder_t * );
49 aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
51 /* Chroma conversion module */
52 int E_(OpenChroma)( vlc_object_t * );
53 void E_(CloseChroma)( vlc_object_t * );
55 /* Video encoder module */
56 int E_(OpenEncoder) ( vlc_object_t * );
57 void E_(CloseEncoder)( vlc_object_t * );
59 /* Audio encoder module */
60 int E_(OpenAudioEncoder) ( vlc_object_t * );
61 void E_(CloseAudioEncoder)( vlc_object_t * );
64 int E_(OpenDemux) ( vlc_object_t * );
65 void E_(CloseDemux)( vlc_object_t * );
68 int E_(OpenMux) ( vlc_object_t * );
69 void E_(CloseMux)( vlc_object_t * );
71 /* Video filter module */
72 int E_(OpenFilter)( vlc_object_t * );
73 int E_(OpenCropPadd)( vlc_object_t * );
74 void E_(CloseFilter)( vlc_object_t * );
75 int E_(OpenDeinterlace)( vlc_object_t * );
76 void E_(CloseDeinterlace)( vlc_object_t * );
77 int E_(OpenScaler)( vlc_object_t * );
78 void E_(CloseScaler)( vlc_object_t * );
80 /* Postprocessing module */
81 void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
82 int E_(InitPostproc)( void *, int, int, int );
83 int E_(PostprocPict)( void *, picture_t *, struct AVFrame * );
84 void E_(ClosePostproc)( decoder_t *, void * );
86 /*****************************************************************************
87 * Module descriptor help strings
88 *****************************************************************************/
89 #define DR_TEXT N_("Direct rendering")
90 /* FIXME Does somebody who knows what it does, explain */
91 #define DR_LONGTEXT N_("Direct rendering")
93 #define ERROR_TEXT N_("Error resilience")
94 #define ERROR_LONGTEXT N_( \
95 "Ffmpeg can do error resilience.\n" \
96 "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
97 "this can produce a lot of errors.\n" \
98 "Valid values range from 0 to 4 (0 disables all errors resilience).")
100 #define BUGS_TEXT N_("Workaround bugs")
101 #define BUGS_LONGTEXT N_( \
102 "Try to fix some bugs:\n" \
105 "4 xvid interlaced\n" \
109 "64 Qpel chroma.\n" \
110 "This must be the sum of the values. For example, to fix \"ac vlc\" and " \
111 "\"ump4\", enter 40.")
113 #define HURRYUP_TEXT N_("Hurry up")
114 #define HURRYUP_LONGTEXT N_( \
115 "The decoder can partially decode or skip frame(s) " \
116 "when there is not enough time. It's useful with low CPU power " \
117 "but it can produce distorted pictures.")
119 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
120 #define SKIP_FRAME_LONGTEXT N_( \
121 "Force skipping of frames to speed up decoding " \
122 "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
124 #define SKIP_IDCT_TEXT N_("Skip idct (default=0)")
125 #define SKIP_IDCT_LONGTEXT N_( \
126 "Force skipping of idct to speed up decoding for frame types" \
127 "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
129 #define PP_Q_TEXT N_("Post processing quality")
130 #define PP_Q_LONGTEXT N_( \
131 "Quality of post processing. Valid range is 0 to 6\n" \
132 "Higher levels require considerable more CPU power, but produce " \
133 "better looking pictures." )
135 #define DEBUG_TEXT N_( "Debug mask" )
136 #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
138 /* TODO: Use a predefined list, with 0,1,2,4,7 */
139 #define VISMV_TEXT N_( "Visualize motion vectors" )
140 #define VISMV_LONGTEXT N_( \
141 "You can overlay the motion vectors (arrows showing how the images move) "\
142 "on the image. This value is a mask, based on these values:\n"\
143 "1 - visualize forward predicted MVs of P frames\n" \
144 "2 - visualize forward predicted MVs of B frames\n" \
145 "4 - visualize backward predicted MVs of B frames\n" \
146 "To visualize all vectors, the value should be 7." )
148 #define LOWRES_TEXT N_( "Low resolution decoding" )
149 #define LOWRES_LONGTEXT N_( "Only decode a low resolution version of " \
150 "the video. This requires less processing power" )
152 #define SKIPLOOPF_TEXT N_( "Skip the loop filter for H.264 decoding" )
153 #define SKIPLOOPF_LONGTEXT N_( "Skipping the loop filter (aka deblocking) " \
154 "usually has a detrimental effect on quality. However it provides a big " \
155 "speedup for high definition streams." )
157 #define LIBAVCODEC_PP_TEXT N_("FFmpeg post processing filter chains")
158 /* FIXME (cut/past from ffmpeg */
159 #define LIBAVCODEC_PP_LONGTEXT \
160 N_("<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
161 "long form example:\n" \
162 "vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock\n" \
163 "short form example:\n" \
164 "vb:a/hb:a/lb de,-vb\n" \
167 "Filters Options\n" \
168 "short long name short long option Description\n" \
169 "* * a autoq cpu power dependant enabler\n" \
170 " c chrom chrominance filtring enabled\n" \
171 " y nochrom chrominance filtring disabled\n" \
172 "hb hdeblock (2 Threshold) horizontal deblocking filter\n" \
173 " 1. difference factor: default=64, higher -> more deblocking\n" \
174 " 2. flatness threshold: default=40, lower -> more deblocking\n" \
175 " the h & v deblocking filters share these\n" \
176 " so u cant set different thresholds for h / v\n" \
177 "vb vdeblock (2 Threshold) vertical deblocking filter\n" \
178 "h1 x1hdeblock Experimental h deblock filter 1\n" \
179 "v1 x1vdeblock Experimental v deblock filter 1\n" \
180 "dr dering Deringing filter\n" \
181 "al autolevels automatic brightness / contrast\n" \
182 " f fullyrange stretch luminance to (0..255)\n" \
183 "lb linblenddeint linear blend deinterlacer\n" \
184 "li linipoldeint linear interpolating deinterlace\n" \
185 "ci cubicipoldeint cubic interpolating deinterlacer\n" \
186 "md mediandeint median deinterlacer\n" \
187 "fd ffmpegdeint ffmpeg deinterlacer\n" \
188 "de default hb:a,vb:a,dr:a,al\n" \
189 "fa fast h1:a,v1:a,dr:a,al\n" \
190 "tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n" \
191 " 1. <= 2. <= 3. larger -> stronger filtering\n" \
192 "fq forceQuant <quantizer> Force quantizer\n")
197 #define ENC_CFG_PREFIX "sout-ffmpeg-"
199 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
200 #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
201 "that will be coded for one key frame." )
203 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
204 #define ENC_BFRAMES_LONGTEXT N_( "Number of " \
205 "B frames that will be coded between two reference frames." )
207 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
208 #define ENC_VT_LONGTEXT N_( "Video bitrate tolerance in kbit/s." )
210 #define ENC_INTERLACE_TEXT N_( "Interlaced encoding" )
211 #define ENC_INTERLACE_LONGTEXT N_( "Enable dedicated " \
212 "algorithms for interlaced frames." )
214 #define ENC_INTERLACE_ME_TEXT N_( "Interlaced motion estimation" )
215 #define ENC_INTERLACE_ME_LONGTEXT N_( "Enable interlaced " \
216 "motion estimation algorithms. This requires more CPU." )
218 #define ENC_PRE_ME_TEXT N_( "Pre-motion estimation" )
219 #define ENC_PRE_ME_LONGTEXT N_( "Enable the pre-motion " \
220 "estimation algorithm.")
222 #define ENC_RC_STRICT_TEXT N_( "Strict rate control" )
223 #define ENC_RC_STRICT_LONGTEXT N_( "Enable the strict rate " \
224 "control algorithm." )
226 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
227 #define ENC_RC_BUF_LONGTEXT N_( "Rate control " \
228 "buffer size (in kbytes). A bigger buffer will allow for better rate " \
229 "control, but will cause a delay in the stream." )
231 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressiveness" )
232 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Rate control "\
233 "buffer aggressiveness." )
235 #define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
236 #define ENC_IQUANT_FACTOR_LONGTEXT N_( \
237 "Quantization factor of I frames, compared with P frames (for instance " \
238 "1.0 => same qscale for I and P frames)." )
240 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
241 #define ENC_NOISE_RED_LONGTEXT N_( "Enable a simple noise " \
242 "reduction algorithm to lower the encoding length and bitrate, at the " \
243 "expense of lower quality frames." )
245 #define ENC_MPEG4_MATRIX_TEXT N_( "MPEG4 quantization matrix" )
246 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Use the MPEG4 " \
247 "quantization matrix for MPEG2 encoding. This generally yields a " \
248 "better looking picture, while still retaining the compatibility with " \
249 "standard MPEG2 decoders.")
251 #define ENC_HQ_TEXT N_( "Quality level" )
252 #define ENC_HQ_LONGTEXT N_( "Quality level " \
253 "for the encoding of motions vectors (this can slow down the encoding " \
256 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
257 #define ENC_HURRYUP_LONGTEXT N_( "The encoder " \
258 "can make on-the-fly quality tradeoffs if your CPU can't keep up with " \
259 "the encoding rate. It will disable trellis quantization, then the rate " \
260 "distortion of motion vectors (hq), and raise the noise reduction " \
261 "threshold to ease the encoder's task." )
263 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
264 #define ENC_QMIN_LONGTEXT N_( "Minimum video " \
267 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
268 #define ENC_QMAX_LONGTEXT N_( "Maximum video " \
271 #define ENC_TRELLIS_TEXT N_( "Trellis quantization" )
272 #define ENC_TRELLIS_LONGTEXT N_( "Enable trellis " \
273 "quantization (rate distortion for block coefficients)." )
275 #define ENC_QSCALE_TEXT N_( "Fixed quantizer scale" )
276 #define ENC_QSCALE_LONGTEXT N_( "A fixed video " \
277 "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )
279 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
280 #define ENC_STRICT_LONGTEXT N_( "Force a strict standard " \
281 "compliance when encoding (accepted values: -1, 0, 1)." )
283 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
284 #define ENC_LUMI_MASKING_LONGTEXT N_( "Raise the quantizer for " \
285 "very bright macroblocks (default: 0.0)." )
287 #define ENC_DARK_MASKING_TEXT N_( "Darkness masking" )
288 #define ENC_DARK_MASKING_LONGTEXT N_( "Raise the quantizer for " \
289 "very dark macroblocks (default: 0.0)." )
291 #define ENC_P_MASKING_TEXT N_( "Motion masking" )
292 #define ENC_P_MASKING_LONGTEXT N_( "Raise the quantizer for " \
293 "macroblocks with a high temporal complexity (default: 0.0)." )
295 #define ENC_BORDER_MASKING_TEXT N_( "Border masking" )
296 #define ENC_BORDER_MASKING_LONGTEXT N_( "Raise the quantizer " \
297 "for macroblocks at the border of the frame (default: 0.0)." )
299 #define ENC_LUMA_ELIM_TEXT N_( "Luminance elimination" )
300 #define ENC_LUMA_ELIM_LONGTEXT N_( "Eliminates luminance blocks when " \
301 "the PSNR isn't much changed (default: 0.0). The H264 specification " \
304 #define ENC_CHROMA_ELIM_TEXT N_( "Chrominance elimination" )
305 #define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
306 "the PSNR isn't much changed (default: 0.0). The H264 specification " \
309 #define SCALEMODE_TEXT N_("Scaling mode")
310 #define SCALEMODE_LONGTEXT N_("Scaling mode to use.")
312 #define MUX_TEXT N_("Ffmpeg mux")
313 #define MUX_LONGTEXT N_("Force use of ffmpeg muxer.")
315 #define FFMPEG_COMMON_MEMBERS \
318 const char *psz_namecodec; \
319 AVCodecContext *p_context; \