avcodec.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * avcodec.h: decoder and encoder using libavcodec
00003  *****************************************************************************
00004  * Copyright (C) 2001-2008 the VideoLAN team
00005  * $Id: 605168034a00b8ad86c9bcfa833f3b259646b2e2 $
00006  *
00007  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 /* VLC <-> avcodec tables */
00025 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
00026                     int *pi_ffmpeg_codec, const char **ppsz_name );
00027 int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
00028                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
00029 int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
00030 int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
00031 int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
00032 void GetVlcAudioFormat( vlc_fourcc_t *, unsigned *pi_bits, int i_sample_fmt );
00033 
00034 
00035 picture_t * DecodeVideo    ( decoder_t *, block_t ** );
00036 aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
00037 subpicture_t *DecodeSubtitle( decoder_t *p_dec, block_t ** );
00038 
00039 /* Video encoder module */
00040 int  OpenEncoder ( vlc_object_t * );
00041 void CloseEncoder( vlc_object_t * );
00042 
00043 /* Audio encoder module */
00044 int  OpenAudioEncoder ( vlc_object_t * );
00045 void CloseAudioEncoder( vlc_object_t * );
00046 
00047 /* Deinterlace video filter module */
00048 int  OpenDeinterlace( vlc_object_t * );
00049 void CloseDeinterlace( vlc_object_t * );
00050 
00051 void InitLibavcodec( vlc_object_t *p_object );
00052 
00053 /* Video Decoder */
00054 int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
00055                   AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
00056 void EndVideoDec( decoder_t *p_dec );
00057 
00058 /* Audio Decoder */
00059 int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
00060                   AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
00061 void EndAudioDec( decoder_t *p_dec );
00062 
00063 /* Subtitle Decoder */
00064 int InitSubtitleDec( decoder_t *p_dec, AVCodecContext *p_context,
00065                      AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
00066 void EndSubtitleDec( decoder_t *p_dec );
00067 
00068 
00069 /*****************************************************************************
00070  * Module descriptor help strings
00071  *****************************************************************************/
00072 #define DR_TEXT N_("Direct rendering")
00073 /* FIXME Does somebody who knows what it does, explain */
00074 #define DR_LONGTEXT N_("Direct rendering")
00075 
00076 #define ERROR_TEXT N_("Error resilience")
00077 #define ERROR_LONGTEXT N_( \
00078     "FFmpeg can do error resilience.\n" \
00079     "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
00080     "this can produce a lot of errors.\n" \
00081     "Valid values range from 0 to 4 (0 disables all errors resilience).")
00082 
00083 #define BUGS_TEXT N_("Workaround bugs")
00084 #define BUGS_LONGTEXT N_( \
00085     "Try to fix some bugs:\n" \
00086     "1  autodetect\n" \
00087     "2  old msmpeg4\n" \
00088     "4  xvid interlaced\n" \
00089     "8  ump4 \n" \
00090     "16 no padding\n" \
00091     "32 ac vlc\n" \
00092     "64 Qpel chroma.\n" \
00093     "This must be the sum of the values. For example, to fix \"ac vlc\" and " \
00094     "\"ump4\", enter 40.")
00095 
00096 #define HURRYUP_TEXT N_("Hurry up")
00097 #define HURRYUP_LONGTEXT N_( \
00098     "The decoder can partially decode or skip frame(s) " \
00099     "when there is not enough time. It's useful with low CPU power " \
00100     "but it can produce distorted pictures.")
00101 
00102 #define FAST_TEXT N_("Allow speed tricks")
00103 #define FAST_LONGTEXT N_( \
00104     "Allow non specification compliant speedup tricks. Faster but error-prone.")
00105 
00106 #define SKIP_FRAME_TEXT N_("Skip frame (default=0)")
00107 #define SKIP_FRAME_LONGTEXT N_( \
00108     "Force skipping of frames to speed up decoding " \
00109     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
00110 
00111 #define SKIP_IDCT_TEXT N_("Skip idct (default=0)")
00112 #define SKIP_IDCT_LONGTEXT N_( \
00113     "Force skipping of idct to speed up decoding for frame types" \
00114     "(-1=None, 0=Default, 1=B-frames, 2=P-frames, 3=B+P frames, 4=all frames)." )
00115 
00116 #define DEBUG_TEXT N_( "Debug mask" )
00117 #define DEBUG_LONGTEXT N_( "Set FFmpeg debug mask" )
00118 
00119 /* TODO: Use a predefined list, with 0,1,2,4,7 */
00120 #define VISMV_TEXT N_( "Visualize motion vectors" )
00121 #define VISMV_LONGTEXT N_( \
00122     "You can overlay the motion vectors (arrows showing how the images move) "\
00123     "on the image. This value is a mask, based on these values:\n"\
00124     "1 - visualize forward predicted MVs of P frames\n" \
00125     "2 - visualize forward predicted MVs of B frames\n" \
00126     "4 - visualize backward predicted MVs of B frames\n" \
00127     "To visualize all vectors, the value should be 7." )
00128 
00129 #define LOWRES_TEXT N_( "Low resolution decoding" )
00130 #define LOWRES_LONGTEXT N_( "Only decode a low resolution version of " \
00131     "the video. This requires less processing power" )
00132 
00133 #define SKIPLOOPF_TEXT N_( "Skip the loop filter for H.264 decoding" )
00134 #define SKIPLOOPF_LONGTEXT N_( "Skipping the loop filter (aka deblocking) " \
00135     "usually has a detrimental effect on quality. However it provides a big " \
00136     "speedup for high definition streams." )
00137 
00138 #define HW_TEXT N_("Hardware decoding")
00139 #define HW_LONGTEXT N_("This allows hardware decoding when available.")
00140 
00141 #define THREADS_TEXT N_( "Threads" )
00142 #define THREADS_LONGTEXT N_( "Number of threads used for decoding, 0 meaning auto" )
00143 
00144 /*
00145  * Encoder options
00146  */
00147 #define ENC_CFG_PREFIX "sout-ffmpeg-"
00148 
00149 #define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
00150 #define ENC_KEYINT_LONGTEXT N_( "Number of frames " \
00151   "that will be coded for one key frame." )
00152 
00153 #define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
00154 #define ENC_BFRAMES_LONGTEXT N_( "Number of " \
00155   "B frames that will be coded between two reference frames." )
00156 
00157 #define ENC_VT_TEXT N_( "Video bitrate tolerance" )
00158 #define ENC_VT_LONGTEXT N_( "Video bitrate tolerance in kbit/s." )
00159 
00160 #define ENC_INTERLACE_TEXT N_( "Interlaced encoding" )
00161 #define ENC_INTERLACE_LONGTEXT N_( "Enable dedicated " \
00162   "algorithms for interlaced frames." )
00163 
00164 #define ENC_INTERLACE_ME_TEXT N_( "Interlaced motion estimation" )
00165 #define ENC_INTERLACE_ME_LONGTEXT N_( "Enable interlaced " \
00166   "motion estimation algorithms. This requires more CPU." )
00167 
00168 #define ENC_PRE_ME_TEXT N_( "Pre-motion estimation" )
00169 #define ENC_PRE_ME_LONGTEXT N_( "Enable the pre-motion " \
00170   "estimation algorithm.")
00171 
00172 #define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
00173 #define ENC_RC_BUF_LONGTEXT N_( "Rate control " \
00174   "buffer size (in kbytes). A bigger buffer will allow for better rate " \
00175   "control, but will cause a delay in the stream." )
00176 
00177 #define ENC_RC_BUF_AGGR_TEXT N_( "Rate control buffer aggressiveness" )
00178 #define ENC_RC_BUF_AGGR_LONGTEXT N_( "Rate control "\
00179   "buffer aggressiveness." )
00180 
00181 #define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
00182 #define ENC_IQUANT_FACTOR_LONGTEXT N_(  \
00183   "Quantization factor of I frames, compared with P frames (for instance " \
00184   "1.0 => same qscale for I and P frames)." )
00185 
00186 #define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
00187 #define ENC_NOISE_RED_LONGTEXT N_( "Enable a simple noise " \
00188   "reduction algorithm to lower the encoding length and bitrate, at the " \
00189   "expense of lower quality frames." )
00190 
00191 #define ENC_MPEG4_MATRIX_TEXT N_( "MPEG4 quantization matrix" )
00192 #define ENC_MPEG4_MATRIX_LONGTEXT N_( "Use the MPEG4 " \
00193   "quantization matrix for MPEG2 encoding. This generally yields a " \
00194   "better looking picture, while still retaining the compatibility with " \
00195   "standard MPEG2 decoders.")
00196 
00197 #define ENC_HQ_TEXT N_( "Quality level" )
00198 #define ENC_HQ_LONGTEXT N_( "Quality level " \
00199   "for the encoding of motions vectors (this can slow down the encoding " \
00200   "very much)." )
00201 
00202 #define ENC_HURRYUP_TEXT N_( "Hurry up" )
00203 #define ENC_HURRYUP_LONGTEXT N_( "The encoder " \
00204   "can make on-the-fly quality tradeoffs if your CPU can't keep up with " \
00205   "the encoding rate. It will disable trellis quantization, then the rate " \
00206   "distortion of motion vectors (hq), and raise the noise reduction " \
00207   "threshold to ease the encoder's task." )
00208 
00209 #define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
00210 #define ENC_QMIN_LONGTEXT N_( "Minimum video " \
00211   "quantizer scale." )
00212 
00213 #define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
00214 #define ENC_QMAX_LONGTEXT N_( "Maximum video " \
00215   "quantizer scale." )
00216 
00217 #define ENC_TRELLIS_TEXT N_( "Trellis quantization" )
00218 #define ENC_TRELLIS_LONGTEXT N_( "Enable trellis " \
00219   "quantization (rate distortion for block coefficients)." )
00220 
00221 #define ENC_QSCALE_TEXT N_( "Fixed quantizer scale" )
00222 #define ENC_QSCALE_LONGTEXT N_( "A fixed video " \
00223   "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )
00224 
00225 #define ENC_STRICT_TEXT N_( "Strict standard compliance" )
00226 #define ENC_STRICT_LONGTEXT N_( "Force a strict standard " \
00227   "compliance when encoding (accepted values: -1, 0, 1)." )
00228 
00229 #define ENC_LUMI_MASKING_TEXT N_( "Luminance masking" )
00230 #define ENC_LUMI_MASKING_LONGTEXT N_( "Raise the quantizer for " \
00231   "very bright macroblocks (default: 0.0)." )
00232 
00233 #define ENC_DARK_MASKING_TEXT N_( "Darkness masking" )
00234 #define ENC_DARK_MASKING_LONGTEXT N_( "Raise the quantizer for " \
00235   "very dark macroblocks (default: 0.0)." )
00236 
00237 #define ENC_P_MASKING_TEXT N_( "Motion masking" )
00238 #define ENC_P_MASKING_LONGTEXT N_( "Raise the quantizer for " \
00239   "macroblocks with a high temporal complexity (default: 0.0)." )
00240 
00241 #define ENC_BORDER_MASKING_TEXT N_( "Border masking" )
00242 #define ENC_BORDER_MASKING_LONGTEXT N_( "Raise the quantizer " \
00243   "for macroblocks at the border of the frame (default: 0.0)." )
00244 
00245 #define ENC_LUMA_ELIM_TEXT N_( "Luminance elimination" )
00246 #define ENC_LUMA_ELIM_LONGTEXT N_( "Eliminates luminance blocks when " \
00247   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
00248   "recommends -4." )
00249 
00250 #define ENC_CHROMA_ELIM_TEXT N_( "Chrominance elimination" )
00251 #define ENC_CHROMA_ELIM_LONGTEXT N_( "Eliminates chrominance blocks when " \
00252   "the PSNR isn't much changed (default: 0.0). The H264 specification " \
00253   "recommends 7." )
00254 
00255 #define ENC_PROFILE_TEXT N_( "Specify AAC audio profile to use" )
00256 #define ENC_PROFILE_LONGTEXT N_( "Specify the AAC audio profile to use " \
00257    "for encoding the audio bitstream. It takes the following options: " \
00258    "main, low, ssr (not supported) and ltp (default: main)" )
00259 
00260 #define FFMPEG_COMMON_MEMBERS   \
00261     int i_cat;                  \
00262     int i_codec_id;             \
00263     const char *psz_namecodec;  \
00264     AVCodecContext *p_context;  \
00265     AVCodec        *p_codec;    \
00266     bool b_delayed_open;
00267 
00268 #ifndef AV_VERSION_INT
00269 #   define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
00270 #endif
00271 
00272 /* Uncomment it to enable compilation with vaapi/dxva2 (you also must change the build
00273  * system) */
00274 //#define HAVE_AVCODEC_VAAPI 1
00275 //#define HAVE_AVCODEC_DXVA2 1

Generated on Tue May 25 08:04:53 2010 for VLC by  doxygen 1.5.6