ffmpeg.h 10.7 KB
Newer Older
1
/*****************************************************************************
gbazin's avatar
 
gbazin committed
2
 * ffmpeg.h: decoder using the ffmpeg library
3 4
 *****************************************************************************
 * Copyright (C) 2001 VideoLAN
Carlo Calabrò's avatar
Carlo Calabrò committed
5
 * $Id$
6 7
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
Sam Hocevar's avatar
Sam Hocevar committed
8
 *
9 10 11 12
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
Sam Hocevar's avatar
Sam Hocevar committed
13
 *
14 15 16 17 18 19 20 21 22 23
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

gbazin's avatar
 
gbazin committed
24
#include "codecs.h"                                      /* BITMAPINFOHEADER */
25

26 27 28 29 30 31
#if LIBAVCODEC_BUILD >= 4663
#   define LIBAVCODEC_PP
#else
#   undef  LIBAVCODEC_PP
#endif

gbazin's avatar
 
gbazin committed
32 33 34 35
struct picture_t;
struct AVFrame;
struct AVCodecContext;
struct AVCodec;
36

gbazin's avatar
 
gbazin committed
37
void E_(InitLibavcodec)( vlc_object_t * );
gbazin's avatar
 
gbazin committed
38 39
int E_(GetFfmpegCodec) ( vlc_fourcc_t, int *, int *, char ** );
int E_(GetVlcFourcc)   ( int, int *, vlc_fourcc_t *, char ** );
gbazin's avatar
 
gbazin committed
40
int E_(GetFfmpegChroma)( vlc_fourcc_t );
41
vlc_fourcc_t E_(GetVlcChroma)( int );
42

gbazin's avatar
 
gbazin committed
43 44 45 46
/* Video decoder module */
int  E_( InitVideoDec )( decoder_t *, AVCodecContext *, AVCodec *,
                         int, char * );
void E_( EndVideoDec ) ( decoder_t * );
gbazin's avatar
 
gbazin committed
47
picture_t *E_( DecodeVideo ) ( decoder_t *, block_t ** );
48

gbazin's avatar
 
gbazin committed
49 50 51 52
/* Audio decoder module */
int  E_( InitAudioDec )( decoder_t *, AVCodecContext *, AVCodec *,
                         int, char * );
void E_( EndAudioDec ) ( decoder_t * );
gbazin's avatar
 
gbazin committed
53
aout_buffer_t *E_( DecodeAudio ) ( decoder_t *, block_t ** );
hartman's avatar
hartman committed
54

gbazin's avatar
 
gbazin committed
55 56
/* Chroma conversion module */
int  E_(OpenChroma)( vlc_object_t * );
gbazin's avatar
 
gbazin committed
57
void E_(CloseChroma)( vlc_object_t * );
58

gbazin's avatar
 
gbazin committed
59
/* Video encoder module */
gbazin's avatar
 
gbazin committed
60 61
int  E_(OpenEncoder) ( vlc_object_t * );
void E_(CloseEncoder)( vlc_object_t * );
62

gbazin's avatar
 
gbazin committed
63 64 65
/* Audio encoder module */
int  E_(OpenAudioEncoder) ( vlc_object_t * );
void E_(CloseAudioEncoder)( vlc_object_t * );
66

gbazin's avatar
 
gbazin committed
67 68 69 70
/* Demux module */
int  E_(OpenDemux) ( vlc_object_t * );
void E_(CloseDemux)( vlc_object_t * );

71 72 73
/* Video filter module */
int  E_(OpenFilter)( vlc_object_t * );
void E_(CloseFilter)( vlc_object_t * );
74 75
int  E_(OpenDeinterlace)( vlc_object_t * );
void E_(CloseDeinterlace)( vlc_object_t * );
76

gbazin's avatar
 
gbazin committed
77
/* Postprocessing module */
gbazin's avatar
 
gbazin committed
78
void *E_(OpenPostproc)( decoder_t *, vlc_bool_t * );
gbazin's avatar
 
gbazin committed
79 80 81
int E_(InitPostproc)( decoder_t *, void *, int, int, int );
int E_(PostprocPict)( decoder_t *, void *, picture_t *, AVFrame * );
void E_(ClosePostproc)( decoder_t *, void * );
hartman's avatar
hartman committed
82

gbazin's avatar
 
gbazin committed
83 84 85 86 87 88 89
/*****************************************************************************
 * Module descriptor help strings
 *****************************************************************************/
#define DR_TEXT N_("Direct rendering")

#define ERROR_TEXT N_("Error resilience")
#define ERROR_LONGTEXT N_( \
90 91 92
    "ffmpeg can do error resilience.\n" \
    "However, with a buggy encoder (such as the ISO MPEG-4 encoder from M$) " \
    "this can produce a lot of errors.\n" \
gbazin's avatar
gbazin committed
93
    "Valid values range from 0 to 4 (0 disables all errors resilience).")
gbazin's avatar
 
gbazin committed
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

#define BUGS_TEXT N_("Workaround bugs")
#define BUGS_LONGTEXT N_( \
    "Try to fix some bugs\n" \
    "1  autodetect\n" \
    "2  old msmpeg4\n" \
    "4  xvid interlaced\n" \
    "8  ump4 \n" \
    "16 no padding\n" \
    "32 ac vlc\n" \
    "64 Qpel chroma")

#define HURRYUP_TEXT N_("Hurry up")
#define HURRYUP_LONGTEXT N_( \
    "Allow the decoder to partially decode or skip frame(s) " \
    "when there is not enough time. It's useful with low CPU power " \
    "but it can produce distorted pictures.")

#define PP_Q_TEXT N_("Post processing quality")
#define PP_Q_LONGTEXT N_( \
    "Quality of post processing. Valid range is 0 to 6\n" \
    "Higher levels require considerable more CPU power, but produce " \
    "better looking pictures." )

118 119
#define DEBUG_TEXT N_( "Debug mask" )
#define DEBUG_LONGTEXT N_( "Set ffmpeg debug mask" )
120

gbazin's avatar
gbazin committed
121 122 123 124 125 126
#define VISMV_TEXT N_( "Visualize motion vectors" )
#define VISMV_LONGTEXT N_( "Set motion vectors visualization mask.\n" \
    "1 - visualize forward predicted MVs of P frames\n" \
    "2 - visualize forward predicted MVs of B frames\n" \
    "4 - visualize backward predicted MVs of B frames" )

127 128 129 130
#define LOWRES_TEXT N_( "Low resolution decoding" )
#define LOWRES_LONGTEXT N_( "Will only decode a low resolution version of " \
    "the video." )

131
#define LIBAVCODEC_PP_TEXT N_("ffmpeg post processing filter chains")
gbazin's avatar
 
gbazin committed
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
/* FIXME (cut/past from ffmpeg */
#define LIBAVCODEC_PP_LONGTEXT \
"<filterName>[:<option>[:<option>...]][[,|/][-]<filterName>[:<option>...]]...\n" \
"long form example:\n" \
"vdeblock:autoq/hdeblock:autoq/linblenddeint    default,-vdeblock\n" \
"short form example:\n" \
"vb:a/hb:a/lb de,-vb\n" \
"more examples:\n" \
"tn:64:128:256\n" \
"Filters                        Options\n" \
"short  long name       short   long option     Description\n" \
"*      *               a       autoq           cpu power dependant enabler\n" \
"                       c       chrom           chrominance filtring enabled\n" \
"                       y       nochrom         chrominance filtring disabled\n" \
"hb     hdeblock        (2 Threshold)           horizontal deblocking filter\n" \
"       1. difference factor: default=64, higher -> more deblocking\n" \
"       2. flatness threshold: default=40, lower -> more deblocking\n" \
"                       the h & v deblocking filters share these\n" \
"                       so u cant set different thresholds for h / v\n" \
"vb     vdeblock        (2 Threshold)           vertical deblocking filter\n" \
"h1     x1hdeblock                              Experimental h deblock filter 1\n" \
"v1     x1vdeblock                              Experimental v deblock filter 1\n" \
"dr     dering                                  Deringing filter\n" \
"al     autolevels                              automatic brightness / contrast\n" \
"                       f       fullyrange      stretch luminance to (0..255)\n" \
"lb     linblenddeint                           linear blend deinterlacer\n" \
"li     linipoldeint                            linear interpolating deinterlace\n" \
"ci     cubicipoldeint                          cubic interpolating deinterlacer\n" \
"md     mediandeint                             median deinterlacer\n" \
"fd     ffmpegdeint                             ffmpeg deinterlacer\n" \
"de     default                                 hb:a,vb:a,dr:a,al\n" \
"fa     fast                                    h1:a,v1:a,dr:a,al\n" \
"tn     tmpnoise        (3 Thresholds)          Temporal Noise Reducer\n" \
"                       1. <= 2. <= 3.          larger -> stronger filtering\n" \
"fq     forceQuant      <quantizer>             Force quantizer\n"
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

/*
 * Encoder options
 */
#define ENC_CFG_PREFIX "sout-ffmpeg-"

#define ENC_KEYINT_TEXT N_( "Ratio of key frames" )
#define ENC_KEYINT_LONGTEXT N_( "Allows you to specify the number of frames " \
  "that will be coded for one key frame." )

#define ENC_BFRAMES_TEXT N_( "Ratio of B frames" )
#define ENC_BFRAMES_LONGTEXT N_( "Allows you to specify the number of " \
  "B frames that will be coded between two reference frames." )

#define ENC_VT_TEXT N_( "Video bitrate tolerance" )
#define ENC_VT_LONGTEXT N_( "Allows you to specify the video bitrate " \
  "tolerance in kbit/s." )

#define ENC_INTERLACE_TEXT N_( "Enable interlaced encoding" )
186 187
#define ENC_INTERLACE_LONGTEXT N_( "Allows you to enable dedicated " \
  "algorithms for interlaced frames." )
188 189 190 191 192 193 194 195 196 197 198 199 200

#define ENC_PRE_ME_TEXT N_( "Enable pre motion estimation" )
#define ENC_PRE_ME_LONGTEXT N_( "Allows you to enable the pre motion " \
  "estimation." )

#define ENC_RC_STRICT_TEXT N_( "Enable strict rate control" )
#define ENC_RC_STRICT_LONGTEXT N_( "Allows you to enable the strict rate " \
  "control algorithm." )

#define ENC_RC_BUF_TEXT N_( "Rate control buffer size" )
#define ENC_RC_BUF_LONGTEXT N_( "Allows you to specify the rate control " \
  "buffer size." )

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 206 207 208
#define ENC_IQUANT_FACTOR_TEXT N_( "I quantization factor" )
#define ENC_IQUANT_FACTOR_LONGTEXT N_( "Allows you to specify the " \
  "quantization factor of I frames, compared with P frames (for instance " \
  "1.0 => same qscale for I and P frames)." )
209 210

#define ENC_NOISE_RED_TEXT N_( "Noise reduction" )
211 212 213
#define ENC_NOISE_RED_LONGTEXT N_( "Allows you to enable a simple noise " \
  "reduction algorithm to lower the encoding length and bitrate, at the " \
  "expense of lower quality frames." )
214

215 216
#define ENC_MPEG4_MATRIX_TEXT N_( "Enable MPEG4 quantization matrix" )
#define ENC_MPEG4_MATRIX_LONGTEXT N_( "Allows you to use the MPEG4 " \
217 218 219
  "quantization matrix for mpeg2 encoding. This generally yields a " \
  "better looking picture, while still retaining the compatibility with " \
  "standard MPEG-2 decoders.")
220 221 222

#define ENC_HQ_TEXT N_( "Quality level" )
#define ENC_HQ_LONGTEXT N_( "Allows you to specify the quality level " \
223 224
  "for the encoding of motions vectors (this can slow down the encoding " \
  "very much)." )
225 226 227 228

#define ENC_HURRYUP_TEXT N_( "Hurry up" )
#define ENC_HURRYUP_LONGTEXT N_( "Allows you to specify if the encoder " \
  "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 234 235 236 237 238 239 240 241 242

#define ENC_QMIN_TEXT N_( "Minimum video quantizer scale" )
#define ENC_QMIN_LONGTEXT N_( "Allows you to specify the minimum video " \
  "quantizer scale." )

#define ENC_QMAX_TEXT N_( "Maximum video quantizer scale" )
#define ENC_QMAX_LONGTEXT N_( "Allows you to specify the maximum video " \
  "quantizer scale." )

#define ENC_TRELLIS_TEXT N_( "Enable trellis quantization" )
#define ENC_TRELLIS_LONGTEXT N_( "Allows you to enable trellis " \
243
  "quantization (rate distortion for block coefficients)." )
gbazin's avatar
gbazin committed
244 245 246 247 248 249 250 251

#define ENC_QSCALE_TEXT N_( "Use fixed video quantizer scale" )
#define ENC_QSCALE_LONGTEXT N_( "Allows you to specify a fixed video " \
  "quantizer scale for VBR encoding (accepted values: 0.01 to 255.0)." )

#define ENC_STRICT_TEXT N_( "Strict standard compliance" )
#define ENC_STRICT_LONGTEXT N_( "Allows you to force a strict standard " \
  "compliance when encoding (accepted values: -1, 0, 1)." )