1 /*****************************************************************************
2 * ffmpeg.h: decoder using the ffmpeg library
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
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., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 #include "codecs.h" /* BITMAPINFOHEADER */
26 #if LIBAVCODEC_BUILD >= 4663
27 # define LIBAVCODEC_PP
34 struct AVCodecContext;
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 );
42 /* Video decoder module */
43 int E_( InitVideoDec )( decoder_t *, AVCodecContext *, AVCodec *,
45 void E_( EndVideoDec ) ( decoder_t * );
46 picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
48 /* Audio decoder module */
49 int E_( InitAudioDec )( decoder_t *, AVCodecContext *, AVCodec *,
51 void E_( EndAudioDec ) ( decoder_t * );
52 aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
54 /* Chroma conversion module */
55 int E_(OpenChroma)( vlc_object_t * );
56 void E_(CloseChroma)( vlc_object_t * );
58 /* Video encoder module */
59 int E_(OpenEncoder) ( vlc_object_t * );
60 void E_(CloseEncoder)( vlc_object_t * );
62 /* Audio encoder module */
63 int E_(OpenAudioEncoder) ( vlc_object_t * );
64 void E_(CloseAudioEncoder)( vlc_object_t * );
67 int E_(OpenDemux) ( vlc_object_t * );
68 void E_(CloseDemux)( vlc_object_t * );
70 /* Postprocessing module */
71 void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
72 int E_(InitPostproc)( decoder_t *, void *, int, int, int );
73 int E_(PostprocPict)( decoder_t *, void *, picture_t *, AVFrame * );
74 void E_(ClosePostproc)( decoder_t *, void * );
76 /*****************************************************************************
77 * Module descriptor help strings
78 *****************************************************************************/
79 #define DR_TEXT N_("Direct rendering")
81 #define ERROR_TEXT N_("Error resilience")
82 #define ERROR_LONGTEXT N_( \
83 "ffmpeg can make error resiliences. \n" \
84 "Nevertheless, with a buggy encoder (like ISO MPEG-4 encoder from M$) " \
85 "this will produce a lot of errors.\n" \
86 "Valid range is -1 to 99 (-1 disables all errors resiliences).")
88 #define BUGS_TEXT N_("Workaround bugs")
89 #define BUGS_LONGTEXT N_( \
90 "Try to fix some bugs\n" \
93 "4 xvid interlaced\n" \
99 #define HURRYUP_TEXT N_("Hurry up")
100 #define HURRYUP_LONGTEXT N_( \
101 "Allow the decoder to partially decode or skip frame(s) " \
102 "when there is not enough time. It's useful with low CPU power " \
103 "but it can produce distorted pictures.")
105 #define PP_Q_TEXT N_("Post processing quality")
106 #define PP_Q_LONGTEXT N_( \
107 "Quality of post processing. Valid range is 0 to 6\n" \
108 "Higher levels require considerable more CPU power, but produce " \
109 "better looking pictures." )
111 #define DEBUG_TEXT N_( "Debug mask" )
112 #define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
114 #define LIBAVCODEC_PP_TEXT N_("ffmpeg postproc filter chains")
115 /* FIXME (cut/past from ffmpeg */
116 #define LIBAVCODEC_PP_LONGTEXT \
117 "<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
118 "long form example:\n" \
119 "vdeblock:autoq/hdeblock:autoq/linblenddeint default,-vdeblock\n" \
120 "short form example:\n" \
121 "vb:a/hb:a/lb de,-vb\n" \
124 "Filters Options\n" \
125 "short long name short long option Description\n" \
126 "* * a autoq cpu power dependant enabler\n" \
127 " c chrom chrominance filtring enabled\n" \
128 " y nochrom chrominance filtring disabled\n" \
129 "hb hdeblock (2 Threshold) horizontal deblocking filter\n" \
130 " 1. difference factor: default=64, higher -> more deblocking\n" \
131 " 2. flatness threshold: default=40, lower -> more deblocking\n" \
132 " the h & v deblocking filters share these\n" \
133 " so u cant set different thresholds for h / v\n" \
134 "vb vdeblock (2 Threshold) vertical deblocking filter\n" \
135 "h1 x1hdeblock Experimental h deblock filter 1\n" \
136 "v1 x1vdeblock Experimental v deblock filter 1\n" \
137 "dr dering Deringing filter\n" \
138 "al autolevels automatic brightness / contrast\n" \
139 " f fullyrange stretch luminance to (0..255)\n" \
140 "lb linblenddeint linear blend deinterlacer\n" \
141 "li linipoldeint linear interpolating deinterlace\n" \
142 "ci cubicipoldeint cubic interpolating deinterlacer\n" \
143 "md mediandeint median deinterlacer\n" \
144 "fd ffmpegdeint ffmpeg deinterlacer\n" \
145 "de default hb:a,vb:a,dr:a,al\n" \
146 "fa fast h1:a,v1:a,dr:a,al\n" \
147 "tn tmpnoise (3 Thresholds) Temporal Noise Reducer\n" \
148 " 1. <= 2. <= 3. larger -> stronger filtering\n" \
149 "fq forceQuant <quantizer> Force quantizer\n"
154 #define ENC_CFG_PREFIX "sout-ffmpeg-"
156 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
157 #define ENC_KEYINT_LONGTEXT N_( "Allows you to specify the number of frames " \
158 "that will be coded for one key frame." )
160 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
161 #define ENC_BFRAMES_LONGTEXT N_( "Allows you to specify the number of " \
162 "B frames that will be coded between two reference frames." )
164 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
165 #define ENC_VT_LONGTEXT N_( "Allows you to specify the video bitrate " \
166 "tolerance in kbit/s." )
168 #define ENC_INTERLACE_TEXT N_( "Enable interlaced encoding" )
169 #define ENC_INTERLACE_LONGTEXT N_( "Allows you to enable interlaced " \
172 #define ENC_PRE_ME_TEXT N_( "Enable pre motion estimation" )
173 #define ENC_PRE_ME_LONGTEXT N_( "Allows you to enable the pre motion " \
176 #define ENC_RC_STRICT_TEXT N_( "Enable strict rate control" )
177 #define ENC_RC_STRICT_LONGTEXT N_( "Allows you to enable the strict rate " \
178 "control algorithm." )
180 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
181 #define ENC_RC_BUF_LONGTEXT N_( "Allows you to specify the rate control " \
184 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressivity" )
185 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Allows you to specify the rate control "\
186 "buffer agressivity." )
188 #define ENC_QUANT_FACTOR_TEXT N_( "Quantization factor" )
189 #define ENC_QUANT_FACTOR_LONGTEXT N_( "Allows you to specify the " \
190 "quantization factor." )
192 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
193 #define ENC_NOISE_RED_LONGTEXT N_( "Allows you to specify the noise " \
196 #define ENC_MPEG4_MATRIX_TEXT N_( "Enable mpeg4 quantization matrix" )
197 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Allows you to use the mpeg4 " \
198 "quantization matrix for mpeg2 encoding." )
200 #define ENC_HQ_TEXT N_( "Quality level" )
201 #define ENC_HQ_LONGTEXT N_( "Allows you to specify the quality level " \
202 "for the encoding." )
204 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
205 #define ENC_HURRYUP_LONGTEXT N_( "Allows you to specify if the encoder " \
206 "should make on-the-fly quality tradeoffs if your CPU can't keep up with " \
207 "the encoding rate." )
209 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
210 #define ENC_QMIN_LONGTEXT N_( "Allows you to specify the minimum video " \
213 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
214 #define ENC_QMAX_LONGTEXT N_( "Allows you to specify the maximum video " \
217 #define ENC_TRELLIS_TEXT N_( "Enable trellis quantization" )
218 #define ENC_TRELLIS_LONGTEXT N_( "Allows you to enable trellis " \