ffmpeg.c 55.9 KB
Newer Older
1
2
3
/*****************************************************************************
 * ffmpeg.c: video decoder using ffmpeg library
 *****************************************************************************
4
 * Copyright (C) 1999-2001 the VideoLAN team
5
 * $Id$
6
7
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
8
 *          Gildas Bazin <gbazin@videolan.org>
9
10
11
12
13
 *
 * 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.
14
 *
15
16
17
18
19
20
21
 * 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
dionoea's avatar
dionoea committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23
24
25
26
27
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
28
29
30
31
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

32
#include <vlc/vlc.h>
zorglub's avatar
zorglub committed
33
#include <vlc_codec.h>
34

gbazin's avatar
   
gbazin committed
35
/* ffmpeg header */
36
#define HAVE_MMX 1
37
38
39
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
#   include <libavcodec/avcodec.h>
#elif defined(HAVE_FFMPEG_AVCODEC_H)
40
#   include <ffmpeg/avcodec.h>
gbazin's avatar
   
gbazin committed
41
42
43
#else
#   include <avcodec.h>
#endif
44

45
46
#if LIBAVCODEC_BUILD < 5000
#   error You must have a libavcodec >= 5000 (get CVS)
47
#endif
48

49
#include "ffmpeg.h"
50

51
52
53
54
#ifdef HAVE_POSTPROC_POSTPROCESS_H
#    include <postproc/postprocess.h>
#else
#    include <libpostproc/postprocess.h>
55
56
#endif

gbazin's avatar
   
gbazin committed
57
58
59
60
61
62
/*****************************************************************************
 * decoder_sys_t: decoder descriptor
 *****************************************************************************/
struct decoder_sys_t
{
    /* Common part between video and audio decoder */
63
    FFMPEG_COMMON_MEMBERS
gbazin's avatar
   
gbazin committed
64
};
65

gbazin's avatar
   
gbazin committed
66
67
68
69
/****************************************************************************
 * Local prototypes
 ****************************************************************************/
static int OpenDecoder( vlc_object_t * );
gbazin's avatar
   
gbazin committed
70
static void CloseDecoder( vlc_object_t * );
71

72
static int  nloopf_list[] = { 0, 1, 2, 3, 4 };
73
static const char *nloopf_list_text[] =
74
75
  { N_("None"), N_("Non-ref"), N_("Bidir"), N_("Non-key"), N_("All") };

76
#ifdef ENABLE_SOUT
77
78
static const char *enc_hq_list[] = { "rd", "bits", "simple" };
static const char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
79
#endif
80

81
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)  || defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
82
static int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
83
static const char *ppsz_mode_descriptions[] =
84
85
86
87
{ N_("Fast bilinear"), N_("Bilinear"), N_("Bicubic (good quality)"),
  N_("Experimental"), N_("Nearest neighbour (bad quality)"),
  N_("Area"), N_("Luma bicubic / chroma bilinear"), N_("Gauss"),
  N_("SincR"), N_("Lanczos"), N_("Bicubic spline") };
88
#endif
89

90
91
92
/*****************************************************************************
 * Module descriptor
 *****************************************************************************/
93
94
95
96
#define MODULE_DESCRIPTION N_( "Various audio and video decoders/encoders" \
        "delivered by the FFmpeg library. This includes (MS)MPEG4, DivX, SV1,"\
        "H261, H263, H264, WMV, WMA, AAC, AMR, DV, MJPEG and other codecs")

97
vlc_module_begin();
98
    set_shortname( "FFmpeg");
zorglub's avatar
zorglub committed
99
100
    set_category( CAT_INPUT );
    set_subcategory( SUBCAT_INPUT_SCODEC );
gbazin's avatar
   
gbazin committed
101
    /* decoder main module */
102
103
#if defined(MODULE_NAME_is_ffmpegaltivec) \
     || (defined(CAN_COMPILE_ALTIVEC) && !defined(NO_ALTIVEC_IN_FFMPEG))
104
    set_description( _("AltiVec FFmpeg audio/video decoder/encoder ((MS)MPEG4,SVQ1,H263,WMV,WMA)") );
Sam Hocevar's avatar
Sam Hocevar committed
105
    /*add_requirement( ALTIVEC );*/
106
107
    set_capability( "decoder", 71 );
#else
108
109
    set_description( _("FFmpeg audio/video decoders/encoders") );
    set_help( MODULE_DESCRIPTION );
gbazin's avatar
   
gbazin committed
110
    set_capability( "decoder", 70 );
111
#endif
zorglub's avatar
zorglub committed
112
    set_section( N_("Decoding") , NULL );
gbazin's avatar
   
gbazin committed
113
    set_callbacks( OpenDecoder, CloseDecoder );
gbazin's avatar
   
gbazin committed
114

115

116
    add_bool( "ffmpeg-dr", 1, NULL, DR_TEXT, DR_TEXT, true );
gbazin's avatar
gbazin committed
117
    add_integer ( "ffmpeg-error-resilience", 1, NULL, ERROR_TEXT,
118
        ERROR_LONGTEXT, true );
gbazin's avatar
   
gbazin committed
119
    add_integer ( "ffmpeg-workaround-bugs", 1, NULL, BUGS_TEXT, BUGS_LONGTEXT,
120
        false );
121
    add_bool( "ffmpeg-hurry-up", 1, NULL, HURRYUP_TEXT, HURRYUP_LONGTEXT,
122
        false );
123
    add_integer( "ffmpeg-skip-frame", 0, NULL, SKIP_FRAME_TEXT,
124
        SKIP_FRAME_LONGTEXT, true );
125
126
        change_integer_range( -1, 4 );
    add_integer( "ffmpeg-skip-idct", 0, NULL, SKIP_IDCT_TEXT,
127
        SKIP_IDCT_LONGTEXT, true );
128
        change_integer_range( -1, 4 );
gbazin's avatar
gbazin committed
129
    add_integer ( "ffmpeg-vismv", 0, NULL, VISMV_TEXT, VISMV_LONGTEXT,
130
        true );
131
    add_integer ( "ffmpeg-lowres", 0, NULL, LOWRES_TEXT, LOWRES_LONGTEXT,
132
        true );
133
        change_integer_range( 0, 2 );
134
    add_integer ( "ffmpeg-skiploopfilter", 0, NULL, SKIPLOOPF_TEXT,
135
                  SKIPLOOPF_LONGTEXT, true );
136
        change_integer_list( nloopf_list, nloopf_list_text, 0 );
gbazin's avatar
   
gbazin committed
137

138
    add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, false );
gbazin's avatar
   
gbazin committed
139
    add_string( "ffmpeg-pp-name", "default", NULL, LIBAVCODEC_PP_TEXT,
140
        LIBAVCODEC_PP_LONGTEXT, true );
141
    add_integer( "ffmpeg-debug", 0, NULL, DEBUG_TEXT, DEBUG_LONGTEXT,
142
                 true );
gbazin's avatar
   
gbazin committed
143

144
#ifdef ENABLE_SOUT
gbazin's avatar
   
gbazin committed
145
146
    /* encoder submodule */
    add_submodule();
zorglub's avatar
zorglub committed
147
    set_section( N_("Encoding") , NULL );
148
    set_description( _("FFmpeg audio/video encoder") );
gbazin's avatar
   
gbazin committed
149
150
151
    set_capability( "encoder", 100 );
    set_callbacks( E_(OpenEncoder), E_(CloseEncoder) );

152
    add_string( ENC_CFG_PREFIX "hq", "simple", NULL, ENC_HQ_TEXT,
153
                ENC_HQ_LONGTEXT, false );
154
155
        change_string_list( enc_hq_list, enc_hq_list_text, 0 );
    add_integer( ENC_CFG_PREFIX "keyint", 0, NULL, ENC_KEYINT_TEXT,
156
                 ENC_KEYINT_LONGTEXT, false );
157
    add_integer( ENC_CFG_PREFIX "bframes", 0, NULL, ENC_BFRAMES_TEXT,
158
                 ENC_BFRAMES_LONGTEXT, false );
159
    add_bool( ENC_CFG_PREFIX "hurry-up", 0, NULL, ENC_HURRYUP_TEXT,
160
              ENC_HURRYUP_LONGTEXT, false );
161
    add_bool( ENC_CFG_PREFIX "interlace", 0, NULL, ENC_INTERLACE_TEXT,
162
              ENC_INTERLACE_LONGTEXT, true );
163
    add_bool( ENC_CFG_PREFIX "interlace-me", 1, NULL, ENC_INTERLACE_ME_TEXT,
164
              ENC_INTERLACE_ME_LONGTEXT, true );
165
    add_integer( ENC_CFG_PREFIX "vt", 0, NULL, ENC_VT_TEXT,
166
                 ENC_VT_LONGTEXT, true );
167
    add_bool( ENC_CFG_PREFIX "pre-me", 0, NULL, ENC_PRE_ME_TEXT,
168
              ENC_PRE_ME_LONGTEXT, true );
169
    add_bool( ENC_CFG_PREFIX "strict-rc", 0, NULL, ENC_RC_STRICT_TEXT,
170
              ENC_RC_STRICT_LONGTEXT, true );
171
    add_integer( ENC_CFG_PREFIX "rc-buffer-size", 224*1024*8, NULL,
172
                 ENC_RC_BUF_TEXT, ENC_RC_BUF_LONGTEXT, true );
173
    add_float( ENC_CFG_PREFIX "rc-buffer-aggressivity", 1.0, NULL,
174
               ENC_RC_BUF_AGGR_TEXT, ENC_RC_BUF_AGGR_LONGTEXT, true );
175
    add_float( ENC_CFG_PREFIX "i-quant-factor", 0, NULL,
176
               ENC_IQUANT_FACTOR_TEXT, ENC_IQUANT_FACTOR_LONGTEXT, true );
177
    add_integer( ENC_CFG_PREFIX "noise-reduction", 0, NULL,
178
                 ENC_NOISE_RED_TEXT, ENC_NOISE_RED_LONGTEXT, true );
179
    add_bool( ENC_CFG_PREFIX "mpeg4-matrix", 0, NULL,
180
              ENC_MPEG4_MATRIX_TEXT, ENC_MPEG4_MATRIX_LONGTEXT, true );
181
    add_integer( ENC_CFG_PREFIX "qmin", 0, NULL,
182
                 ENC_QMIN_TEXT, ENC_QMIN_LONGTEXT, true );
183
    add_integer( ENC_CFG_PREFIX "qmax", 0, NULL,
184
                 ENC_QMAX_TEXT, ENC_QMAX_LONGTEXT, true );
185
    add_bool( ENC_CFG_PREFIX "trellis", 0, NULL,
186
              ENC_TRELLIS_TEXT, ENC_TRELLIS_LONGTEXT, true );
gbazin's avatar
gbazin committed
187
    add_float( ENC_CFG_PREFIX "qscale", 0, NULL,
188
               ENC_QSCALE_TEXT, ENC_QSCALE_LONGTEXT, true );
gbazin's avatar
gbazin committed
189
    add_integer( ENC_CFG_PREFIX "strict", 0, NULL,
190
                 ENC_STRICT_TEXT, ENC_STRICT_LONGTEXT, true );
191
    add_float( ENC_CFG_PREFIX "lumi-masking", 0.0, NULL,
192
               ENC_LUMI_MASKING_TEXT, ENC_LUMI_MASKING_LONGTEXT, true );
193
    add_float( ENC_CFG_PREFIX "dark-masking", 0.0, NULL,
194
               ENC_DARK_MASKING_TEXT, ENC_DARK_MASKING_LONGTEXT, true );
195
    add_float( ENC_CFG_PREFIX "p-masking", 0.0, NULL,
196
               ENC_P_MASKING_TEXT, ENC_P_MASKING_LONGTEXT, true );
197
    add_float( ENC_CFG_PREFIX "border-masking", 0.0, NULL,
198
               ENC_BORDER_MASKING_TEXT, ENC_BORDER_MASKING_LONGTEXT, true );
199
    add_integer( ENC_CFG_PREFIX "luma-elim-threshold", 0, NULL,
200
                 ENC_LUMA_ELIM_TEXT, ENC_LUMA_ELIM_LONGTEXT, true );
201
    add_integer( ENC_CFG_PREFIX "chroma-elim-threshold", 0, NULL,
202
                 ENC_CHROMA_ELIM_TEXT, ENC_CHROMA_ELIM_LONGTEXT, true );
203

204
#if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
205
206
    /* Audio AAC encoder profile */
    add_string( ENC_CFG_PREFIX "aac-profile", "main", NULL,
207
                ENC_PROFILE_TEXT, ENC_PROFILE_LONGTEXT, true );
208
#endif
209
#endif /* ENABLE_SOUT */
210

211
#if defined(HAVE_LIBAVFORMAT_AVFORMAT_H) || defined(HAVE_FFMPEG_AVFORMAT_H) || defined(HAVE_LIBAVFORMAT_TREE)
212

gbazin's avatar
   
gbazin committed
213
    /* demux submodule */
gbazin's avatar
   
gbazin committed
214
    add_submodule();
215
    set_description( _("FFmpeg demuxer" ) );
216
    set_capability( "demux", 2 );
gbazin's avatar
   
gbazin committed
217
218
    set_callbacks( E_(OpenDemux), E_(CloseDemux) );

219
#ifdef ENABLE_SOUT
220
221
222
223
    /* mux submodule */
    add_submodule();
    set_description( _("FFmpeg muxer" ) );
    set_capability( "sout mux", 2 );
224
    add_string( "ffmpeg-mux", NULL, NULL, MUX_TEXT,
225
                MUX_LONGTEXT, true );
226
    set_callbacks( E_(OpenMux), E_(CloseMux) );
227
#endif
228
#endif
229

230
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)  || defined(HAVE_FFMPEG_SWSCALE_H) || defined(HAVE_LIBSWSCALE_TREE)
231
232
233
234
235
236
237
    /* video filter submodule */
    add_submodule();
    set_description( _("Video scaling filter") );
    set_capability( "video filter2", 1000 );
    set_category( CAT_VIDEO );
    set_subcategory( SUBCAT_VIDEO_VFILTER );
    set_callbacks( E_(OpenScaler), E_(CloseScaler) );
238
    add_integer( "swscale-mode", 0, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, true );
239
240
        change_integer_list( pi_mode_values, ppsz_mode_descriptions, 0 );

241
#else
242
243
244
245
    /* video filter submodule */
    add_submodule();
    set_capability( "video filter2", 50 );
    set_callbacks( E_(OpenFilter), E_(CloseFilter) );
246
    set_description( _("FFmpeg video filter") );
247

248
249
250
251
    /* crop/padd submodule */
    add_submodule();
    set_capability( "crop padd", 10 );
    set_callbacks( E_(OpenCropPadd), E_(CloseFilter) );
252
    set_description( _("FFmpeg crop padd filter") );
253
#endif
254

255
256
257
258
259
260
    /* chroma conversion submodule */
    add_submodule();
    set_capability( "chroma", 50 );
    set_callbacks( E_(OpenChroma), E_(CloseChroma) );
    set_description( _("FFmpeg chroma conversion") );

261
262
263
264
    /* video filter submodule */
    add_submodule();
    set_capability( "video filter2", 0 );
    set_callbacks( E_(OpenDeinterlace), E_(CloseDeinterlace) );
265
    set_description( _("FFmpeg deinterlace video filter") );
266
    add_shortcut( "ffmpeg-deinterlace" );
267

268
269
270
271
272
273
274
vlc_module_end();

/*****************************************************************************
 * OpenDecoder: probe the decoder and return score
 *****************************************************************************/
static int OpenDecoder( vlc_object_t *p_this )
{
gbazin's avatar
   
gbazin committed
275
    decoder_t *p_dec = (decoder_t*) p_this;
gbazin's avatar
   
gbazin committed
276
    int i_cat, i_codec_id, i_result;
277
    const char *psz_namecodec;
gbazin's avatar
   
gbazin committed
278

Jean-Paul Saman's avatar
Jean-Paul Saman committed
279
280
    AVCodecContext *p_context = NULL;
    AVCodec        *p_codec = NULL;
gbazin's avatar
   
gbazin committed
281
282
283

    /* *** determine codec type *** */
    if( !E_(GetFfmpegCodec)( p_dec->fmt_in.i_codec, &i_cat, &i_codec_id,
gbazin's avatar
   
gbazin committed
284
285
286
287
                             &psz_namecodec ) )
    {
        return VLC_EGENERIC;
    }
288

gbazin's avatar
   
gbazin committed
289
290
291
292
293
294
295
296
    /* Bail out if buggy decoder */
    if( i_codec_id == CODEC_ID_AAC )
    {
        msg_Dbg( p_dec, "refusing to use ffmpeg's (%s) decoder which is buggy",
                 psz_namecodec );
        return VLC_EGENERIC;
    }

gbazin's avatar
   
gbazin committed
297
298
299
    /* Initialization must be done before avcodec_find_decoder() */
    E_(InitLibavcodec)(p_this);

300
    /* *** ask ffmpeg for a decoder *** */
Jean-Paul Saman's avatar
Jean-Paul Saman committed
301
302
    p_codec = avcodec_find_decoder( i_codec_id );
    if( !p_codec )
303
    {
gbazin's avatar
   
gbazin committed
304
        msg_Dbg( p_dec, "codec not found (%s)", psz_namecodec );
gbazin's avatar
   
gbazin committed
305
        return VLC_EGENERIC;
306
307
    }

gbazin's avatar
   
gbazin committed
308
309
    /* *** get a p_context *** */
    p_context = avcodec_alloc_context();
Jean-Paul Saman's avatar
Jean-Paul Saman committed
310
    if( !p_context )
Jean-Paul Saman's avatar
Jean-Paul Saman committed
311
        return VLC_ENOMEM;
312
    p_context->debug = config_GetInt( p_dec, "ffmpeg-debug" );
313
    p_context->opaque = (void *)p_this;
314

gbazin's avatar
   
gbazin committed
315
    /* Set CPU capabilities */
316
    unsigned i_cpu = vlc_CPU();
gbazin's avatar
   
gbazin committed
317
    p_context->dsp_mask = 0;
318
    if( !(i_cpu & CPU_CAPABILITY_MMX) )
gbazin's avatar
   
gbazin committed
319
    {
gbazin's avatar
   
gbazin committed
320
        p_context->dsp_mask |= FF_MM_MMX;
gbazin's avatar
   
gbazin committed
321
    }
322
    if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
gbazin's avatar
   
gbazin committed
323
    {
gbazin's avatar
   
gbazin committed
324
        p_context->dsp_mask |= FF_MM_MMXEXT;
gbazin's avatar
   
gbazin committed
325
    }
326
    if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
gbazin's avatar
   
gbazin committed
327
    {
gbazin's avatar
   
gbazin committed
328
        p_context->dsp_mask |= FF_MM_3DNOW;
gbazin's avatar
   
gbazin committed
329
    }
330
    if( !(i_cpu & CPU_CAPABILITY_SSE) )
gbazin's avatar
   
gbazin committed
331
    {
gbazin's avatar
   
gbazin committed
332
        p_context->dsp_mask |= FF_MM_SSE;
333
    }
334
    if( !(i_cpu & CPU_CAPABILITY_SSE2) )
335
    {
gbazin's avatar
   
gbazin committed
336
        p_context->dsp_mask |= FF_MM_SSE2;
gbazin's avatar
   
gbazin committed
337
338
    }

339
    p_dec->b_need_packetized = true;
gbazin's avatar
   
gbazin committed
340
    switch( i_cat )
341
    {
gbazin's avatar
   
gbazin committed
342
    case VIDEO_ES:
gbazin's avatar
   
gbazin committed
343
        p_dec->pf_decode_video = E_(DecodeVideo);
gbazin's avatar
   
gbazin committed
344
345
346
347
        i_result = E_( InitVideoDec )( p_dec, p_context, p_codec,
                                       i_codec_id, psz_namecodec );
        break;
    case AUDIO_ES:
gbazin's avatar
   
gbazin committed
348
        p_dec->pf_decode_audio = E_(DecodeAudio);
gbazin's avatar
   
gbazin committed
349
350
351
352
353
        i_result = E_( InitAudioDec )( p_dec, p_context, p_codec,
                                       i_codec_id, psz_namecodec );
        break;
    default:
        i_result = VLC_EGENERIC;
354
    }
355

356
    if( i_result == VLC_SUCCESS ) p_dec->p_sys->i_cat = i_cat;
357

gbazin's avatar
   
gbazin committed
358
    return i_result;
359
}
gbazin's avatar
   
gbazin committed
360

361
/*****************************************************************************
gbazin's avatar
   
gbazin committed
362
 * CloseDecoder: decoder destruction
363
 *****************************************************************************/
gbazin's avatar
   
gbazin committed
364
static void CloseDecoder( vlc_object_t *p_this )
365
{
gbazin's avatar
   
gbazin committed
366
    decoder_t *p_dec = (decoder_t *)p_this;
gbazin's avatar
   
gbazin committed
367
    decoder_sys_t *p_sys = p_dec->p_sys;
368

gbazin's avatar
   
gbazin committed
369
    switch( p_sys->i_cat )
370
    {
gbazin's avatar
   
gbazin committed
371
372
373
374
375
376
    case AUDIO_ES:
        E_( EndAudioDec )( p_dec );
        break;
    case VIDEO_ES:
        E_( EndVideoDec )( p_dec );
        break;
377
    }
378

379
380
    if( p_sys->p_context )
    {
381
382
        vlc_mutex_t *lock;

383
384
        if( p_sys->p_context->extradata )
            free( p_sys->p_context->extradata );
Jean-Paul Saman's avatar
Jean-Paul Saman committed
385
        p_sys->p_context->extradata = NULL;
386
387

        lock = var_AcquireMutex( "avcodec" );
388
        avcodec_close( p_sys->p_context );
389
        vlc_mutex_unlock( lock );
390
391
392
393
        msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
        av_free( p_sys->p_context );
    }

gbazin's avatar
   
gbazin committed
394
    free( p_sys );
395
}
396

397
/*****************************************************************************
398
 *
399
 *****************************************************************************/
400
401
void E_(LibavcodecCallback)( void *p_opaque, int i_level,
                             const char *psz_format, va_list va )
402
403
404
405
406
407
408
409
{
    int i_vlc_level;
    AVCodecContext *p_avctx = (AVCodecContext *)p_opaque;
    AVClass *p_avc;
    vlc_object_t *p_this;
    char *psz_new_format;
    const char *psz_item_name;

410
411
    p_avc = p_avctx ? p_avctx->av_class : 0;

412
#define cln p_avc->class_name
413
    /* Make sure we can get p_this back */
414
415
416
    if( !p_avctx || !p_avc || !cln ||
        cln[0]!='A' || cln[1]!='V' || cln[2]!='C' || cln[3]!='o' ||
        cln[4]!='d' || cln[5]!='e' || cln[6]!='c' )
417
418
    {
        if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va );
419
        return;
420
    }
421
#undef cln
422

423
424
425
426
427
428
429
430
431
432
433
434
435
436
    p_this = (vlc_object_t *)p_avctx->opaque;

    switch( i_level )
    {
    case AV_LOG_QUIET:
        i_vlc_level = VLC_MSG_ERR;
        break;
    case AV_LOG_ERROR:
        i_vlc_level = VLC_MSG_WARN;
        break;
    case AV_LOG_INFO:
        i_vlc_level = VLC_MSG_DBG;
        break;
    case AV_LOG_DEBUG:
437
438
439
        /* Print debug messages if they were requested */
        if( p_avctx->debug ) vfprintf( stderr, psz_format, va );
        return;
440
441
442
443
444
445
    default:
        return;
    }

    psz_item_name = p_avc->item_name(p_opaque);
    psz_new_format = malloc( strlen(psz_format) + strlen(psz_item_name)
446
                              + 18 + 5 );
447
448
    snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name)
              + 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque );
449
    msg_GenericVa( p_this, MSG_QUEUE_NORMAL, i_vlc_level,
zorglub's avatar
zorglub committed
450
                    MODULE_STRING, psz_new_format, va );
451
452
453
    free( psz_new_format );
}

gbazin's avatar
   
gbazin committed
454
455
456
void E_(InitLibavcodec)( vlc_object_t *p_object )
{
    static int b_ffmpeginit = 0;
457
    vlc_mutex_t *lock = var_AcquireMutex( "avcodec" );
gbazin's avatar
   
gbazin committed
458
459
460
461
462
463

    /* *** init ffmpeg library (libavcodec) *** */
    if( !b_ffmpeginit )
    {
        avcodec_init();
        avcodec_register_all();
464
        av_log_set_callback( E_(LibavcodecCallback) );
gbazin's avatar
   
gbazin committed
465
        b_ffmpeginit = 1;
466

gbazin's avatar
   
gbazin committed
467
        msg_Dbg( p_object, "libavcodec initialized (interface %d )",
468
                 LIBAVCODEC_VERSION_INT );
gbazin's avatar
   
gbazin committed
469
470
    }
    else
471
    {
gbazin's avatar
   
gbazin committed
472
473
        msg_Dbg( p_object, "libavcodec already initialized" );
    }
474

475
    vlc_mutex_unlock( lock );
gbazin's avatar
   
gbazin committed
476
477
}

478
479
480
481
482
483
484
485
486
487
488
/*****************************************************************************
 * Chroma fourcc -> ffmpeg_id mapping
 *****************************************************************************/
static struct
{
    vlc_fourcc_t  i_chroma;
    int  i_chroma_id;

} chroma_table[] =
{
    /* Planar YUV formats */
489
    { VLC_FOURCC('Y','U','V','A'), PIX_FMT_YUV444P }, /* Hack */
490
    { VLC_FOURCC('I','4','4','4'), PIX_FMT_YUV444P },
491
    { VLC_FOURCC('J','4','4','4'), PIX_FMT_YUVJ444P },
492
    { VLC_FOURCC('I','4','2','2'), PIX_FMT_YUV422P },
493
    { VLC_FOURCC('J','4','2','2'), PIX_FMT_YUVJ422P },
494
495
496
    { VLC_FOURCC('I','4','2','0'), PIX_FMT_YUV420P },
    { VLC_FOURCC('Y','V','1','2'), PIX_FMT_YUV420P },
    { VLC_FOURCC('I','Y','U','V'), PIX_FMT_YUV420P },
497
    { VLC_FOURCC('J','4','2','0'), PIX_FMT_YUVJ420P },
498
499
500
501
502
503
    { VLC_FOURCC('I','4','1','1'), PIX_FMT_YUV411P },
    { VLC_FOURCC('I','4','1','0'), PIX_FMT_YUV410P },
    { VLC_FOURCC('Y','V','U','9'), PIX_FMT_YUV410P },

    /* Packed YUV formats */
    { VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUV422 },
504
    { VLC_FOURCC('Y','U','Y','V'), PIX_FMT_YUV422 },
505
    { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
506
507

    /* Packed RGB formats */
508
#if defined(WORDS_BIGENDIAN)
509
    { VLC_FOURCC('R','G','B','8'), PIX_FMT_BGR8 },
510
511
512
513
    { VLC_FOURCC('R','V','1','5'), PIX_FMT_BGR555 },
    { VLC_FOURCC('R','V','1','6'), PIX_FMT_BGR565 },
    { VLC_FOURCC('R','V','2','4'), PIX_FMT_BGR24 },
#else
514
#if defined(PIX_FMT_RGB8)
515
    { VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8 },
516
#endif
517
518
519
    { VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
    { VLC_FOURCC('R','V','1','6'), PIX_FMT_RGB565 },
    { VLC_FOURCC('R','V','2','4'), PIX_FMT_RGB24 },
520
#endif
521
    { VLC_FOURCC('R','V','3','2'), PIX_FMT_RGBA32 },
522
#if defined(PIX_FMT_RGBA)
523
524
    { VLC_FOURCC('R','G','B','A'), PIX_FMT_RGBA },
#endif
525
526
    { VLC_FOURCC('G','R','E','Y'), PIX_FMT_GRAY8 },

527
    { 0, 0 }
528
};
gbazin's avatar
   
gbazin committed
529

530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
int E_(GetFfmpegChroma)( vlc_fourcc_t i_chroma )
{
    int i;

    for( i = 0; chroma_table[i].i_chroma != 0; i++ )
    {
        if( chroma_table[i].i_chroma == i_chroma )
            return chroma_table[i].i_chroma_id;
    }
    return -1;
}

vlc_fourcc_t E_(GetVlcChroma)( int i_ffmpeg_chroma )
{
    int i;

    for( i = 0; chroma_table[i].i_chroma != 0; i++ )
    {
        if( chroma_table[i].i_chroma_id == i_ffmpeg_chroma )
            return chroma_table[i].i_chroma;
    }
    return 0;
}

/*****************************************************************************
 * Codec fourcc -> ffmpeg_id mapping
 *****************************************************************************/
gbazin's avatar
   
gbazin committed
557
558
559
560
561
static struct
{
    vlc_fourcc_t  i_fourcc;
    int  i_codec;
    int  i_cat;
562
    const char *psz_name;
gbazin's avatar
   
gbazin committed
563

gbazin's avatar
   
gbazin committed
564
565
} codecs_table[] =
{
566
567
568
569
    /*
     * Video Codecs
     */

gbazin's avatar
   
gbazin committed
570
    /* MPEG-1 Video */
gbazin's avatar
   
gbazin committed
571
572
    { VLC_FOURCC('m','p','1','v'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
573
574
    { VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
575
576
577
578
579
580
    { VLC_FOURCC('m','p','g','1'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
    { VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
    { VLC_FOURCC('P','I','M','1'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "Pinnacle DC1000 (MPEG-1 Video)" },
gbazin's avatar
   
gbazin committed
581
582

    /* MPEG-2 Video */
gbazin's avatar
   
gbazin committed
583
584
    { VLC_FOURCC('m','p','2','v'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
585
586
    { VLC_FOURCC('M','P','E','G'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
gbazin's avatar
   
gbazin committed
587
588
    { VLC_FOURCC('m','p','g','v'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
589
590
591
592
593
594
595
596
    { VLC_FOURCC('m','p','g','2'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
    { VLC_FOURCC('h','d','v','1'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "HDV 720p30 (MPEG-2 Video)" },
    { VLC_FOURCC('h','d','v','2'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "Sony HDV (MPEG-2 Video)" },
    { VLC_FOURCC('h','d','v','3'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "FCP HDV (MPEG-2 Video)" },
597
598
    { VLC_FOURCC('h','d','v','5'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "HDV 720p25 (MPEG-2 Video)" },
599
600
601
602
603
604
605
606
607
608
609
610
    { VLC_FOURCC('m','x','5','n'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX NTSC 525/60 50mb/s (FCP)" },
    { VLC_FOURCC('m','x','5','p'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX PAL 625/50 50mb/s (FCP)" },
    { VLC_FOURCC('m','x','3','n'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX NTSC 525/60 30mb/s (FCP)" },
    { VLC_FOURCC('m','x','3','p'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX NTSC 625/50 30mb/s (FCP)" },
    { VLC_FOURCC('x','d','v','2'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "XDCAM HD 1080i60" },
    { VLC_FOURCC('A','V','m','p'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "AVID IMX PAL" },
611
612
613
    /* ATI VCR2 */
    { VLC_FOURCC('V','C','R','2'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "ATI VCR2 Video" },
614
615
616
617
    { VLC_FOURCC('M','M','E','S'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "Matrox MPEG-2" },
    { VLC_FOURCC('m','m','e','s'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "Matrox MPEG-2" },
gbazin's avatar
   
gbazin committed
618
619

    /* MPEG-4 Video */
gbazin's avatar
   
gbazin committed
620
621
622
623
624
625
626
627
628
629
630
631
    { VLC_FOURCC('D','I','V','X'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('d','i','v','x'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('M','P','4','S'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('m','p','4','s'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('M','4','S','2'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('m','4','s','2'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
632
    /* XVID flavours */
gbazin's avatar
   
gbazin committed
633
634
635
636
637
638
    { VLC_FOURCC('x','v','i','d'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('X','V','I','D'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('X','v','i','D'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
639
640
641
642
    { VLC_FOURCC('X','V','I','X'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('x','v','i','x'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
643
    /* DX50 */
gbazin's avatar
   
gbazin committed
644
645
646
647
    { VLC_FOURCC('D','X','5','0'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('d','x','5','0'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
648
649
    { VLC_FOURCC('B','L','Z','0'), CODEC_ID_MPEG4,
      VIDEO_ES, "Blizzard MPEG-4 Video" },
650
651
    { VLC_FOURCC('D','X','G','M'), CODEC_ID_MPEG4,
      VIDEO_ES, "Electronic Arts Game MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
652
653
    { VLC_FOURCC('m','p','4','v'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
654
655
    { VLC_FOURCC('M','P','4','V'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
656
657
658
659
660
661
    { VLC_FOURCC( 4,  0,  0,  0 ), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('m','4','c','c'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('M','4','C','C'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
662
663
    { VLC_FOURCC('F','M','P','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
664
665
    { VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
666
667
    /* 3ivx delta 3.5 Unsupported
     * putting it here gives extreme distorted images
gbazin's avatar
   
gbazin committed
668
669
670
671
    { VLC_FOURCC('3','I','V','1'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('3','i','v','1'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" }, */
gbazin's avatar
   
gbazin committed
672
    /* 3ivx delta 4 */
gbazin's avatar
   
gbazin committed
673
674
675
676
    { VLC_FOURCC('3','I','V','2'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('3','i','v','2'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
677
678
679
680
681
682
683
684
685
686
687
688
689
690
    { VLC_FOURCC('U','M','P','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "UB MPEG-4 Video" },
    { VLC_FOURCC('W','V','1','F'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
    { VLC_FOURCC('S','E','D','G'), CODEC_ID_MPEG4,
      VIDEO_ES, "Samsung MPEG-4 Video" },
    { VLC_FOURCC('R','M','P','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "REALmagic MPEG-4 Video" },
    { VLC_FOURCC('H','D','X','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
    { VLC_FOURCC('h','d','x','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "Jomigo HDX4 (MPEG-4 Video)" },
    { VLC_FOURCC('S','M','P','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "Samsung SMP4 (MPEG-4 Video)" },
691
692
693
694
    { VLC_FOURCC('f','v','f','w'), CODEC_ID_MPEG4,
      VIDEO_ES, "FFmpeg MPEG-4" },
    { VLC_FOURCC('F','V','F','W'), CODEC_ID_MPEG4,
      VIDEO_ES, "FFmpeg MPEG-4" },
gbazin's avatar
   
gbazin committed
695
696

    /* MSMPEG4 v1 */
gbazin's avatar
   
gbazin committed
697
698
699
700
701
702
703
704
    { VLC_FOURCC('D','I','V','1'), CODEC_ID_MSMPEG4V1,
      VIDEO_ES, "MS MPEG-4 Video v1" },
    { VLC_FOURCC('d','i','v','1'), CODEC_ID_MSMPEG4V1,
      VIDEO_ES, "MS MPEG-4 Video v1" },
    { VLC_FOURCC('M','P','G','4'), CODEC_ID_MSMPEG4V1,
      VIDEO_ES, "MS MPEG-4 Video v1" },
    { VLC_FOURCC('m','p','g','4'), CODEC_ID_MSMPEG4V1,
      VIDEO_ES, "MS MPEG-4 Video v1" },
gbazin's avatar
   
gbazin committed
705
706

    /* MSMPEG4 v2 */
gbazin's avatar
   
gbazin committed
707
708
709
710
711
712
713
714
    { VLC_FOURCC('D','I','V','2'), CODEC_ID_MSMPEG4V2,
      VIDEO_ES, "MS MPEG-4 Video v2" },
    { VLC_FOURCC('d','i','v','2'), CODEC_ID_MSMPEG4V2,
      VIDEO_ES, "MS MPEG-4 Video v2" },
    { VLC_FOURCC('M','P','4','2'), CODEC_ID_MSMPEG4V2,
      VIDEO_ES, "MS MPEG-4 Video v2" },
    { VLC_FOURCC('m','p','4','2'), CODEC_ID_MSMPEG4V2,
      VIDEO_ES, "MS MPEG-4 Video v2" },
gbazin's avatar
   
gbazin committed
715
716

    /* MSMPEG4 v3 / M$ mpeg4 v3 */
gbazin's avatar
   
gbazin committed
717
718
719
720
721
722
723
724
725
726
    { VLC_FOURCC('M','P','G','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('m','p','g','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('d','i','v','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('M','P','4','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('m','p','4','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
727
    /* DivX 3.20 */
gbazin's avatar
   
gbazin committed
728
729
730
731
732
733
734
735
736
737
738
739
740
741
    { VLC_FOURCC('D','I','V','3'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('D','I','V','4'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('d','i','v','4'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('D','I','V','5'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('d','i','v','5'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('D','I','V','6'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('d','i','v','6'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
742
    /* Cool Codec */
743
744
    { VLC_FOURCC('C','O','L','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
745
746
    { VLC_FOURCC('c','o','l','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
747
748
    { VLC_FOURCC('C','O','L','0'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
749
750
    { VLC_FOURCC('c','o','l','0'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
751
    /* AngelPotion stuff */
gbazin's avatar
   
gbazin committed
752
753
    { VLC_FOURCC('A','P','4','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
754
    /* 3ivx doctered divx files */
gbazin's avatar
   
gbazin committed
755
756
757
758
    { VLC_FOURCC('3','I','V','D'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('3','i','v','d'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
759
    /* who knows? */
gbazin's avatar
   
gbazin committed
760
761
762
763
    { VLC_FOURCC('3','V','I','D'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
    { VLC_FOURCC('3','v','i','d'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
764
765

    /* Sorenson v1 */
gbazin's avatar
   
gbazin committed
766
767
    { VLC_FOURCC('S','V','Q','1'), CODEC_ID_SVQ1,
      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
768
769
770
771
    { VLC_FOURCC('s','v','q','1'), CODEC_ID_SVQ1,
      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
    { VLC_FOURCC('s','v','q','i'), CODEC_ID_SVQ1,
      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
gbazin's avatar
   
gbazin committed
772
773

    /* Sorenson v3 */
gbazin's avatar
   
gbazin committed
774
775
    { VLC_FOURCC('S','V','Q','3'), CODEC_ID_SVQ3,
      VIDEO_ES, "SVQ-3 (Sorenson Video v3)" },
gbazin's avatar
   
gbazin committed
776

Laurent Aimar's avatar
Laurent Aimar committed
777
    /* h264 */
gbazin's avatar
   
gbazin committed
778
    { VLC_FOURCC('h','2','6','4'), CODEC_ID_H264,
779
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
gbazin's avatar
   
gbazin committed
780
    { VLC_FOURCC('H','2','6','4'), CODEC_ID_H264,
781
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
782
    { VLC_FOURCC('x','2','6','4'), CODEC_ID_H264,
783
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
784
    { VLC_FOURCC('X','2','6','4'), CODEC_ID_H264,
785
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
786
787
    /* avc1: special case h264 */
    { VLC_FOURCC('a','v','c','1'), CODEC_ID_H264,
788
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
789
790
    { VLC_FOURCC('A','V','C','1'), CODEC_ID_H264,
      VIDEO_ES, "H264 - MPEG-4 AVC (part 10)" },
Laurent Aimar's avatar
Laurent Aimar committed
791
    { VLC_FOURCC('V','S','S','H'), CODEC_ID_H264,
792
793
794
      VIDEO_ES, "Vanguard VSS H264" },
    { VLC_FOURCC('V','S','S','W'), CODEC_ID_H264,
      VIDEO_ES, "Vanguard VSS H264" },
Laurent Aimar's avatar
Laurent Aimar committed
795
    { VLC_FOURCC('v','s','s','h'), CODEC_ID_H264,
796
797
798
      VIDEO_ES, "Vanguard VSS H264" },
    { VLC_FOURCC('D','A','V','C'), CODEC_ID_H264,
      VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
799
800
    { VLC_FOURCC('d','a','v','c'), CODEC_ID_H264,
      VIDEO_ES, "Dicas MPEGable H.264/MPEG-4 AVC" },
Laurent Aimar's avatar
Laurent Aimar committed
801

gbazin's avatar
   
gbazin committed
802
803
/* H263 and H263i */
/* H263(+) is also known as Real Video 1.0 */
hartman's avatar
hartman committed
804

gbazin's avatar
   
gbazin committed
805
    /* H263 */
806
807
    { VLC_FOURCC('D','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "DEC H263" },
gbazin's avatar
   
gbazin committed
808
809
810
811
    { VLC_FOURCC('H','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "H263" },
    { VLC_FOURCC('h','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "H263" },
812
813
    { VLC_FOURCC('L','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "LEAD H263" },
814
    { VLC_FOURCC('s','2','6','3'), CODEC_ID_H263,
gbazin's avatar
   
gbazin committed
815
      VIDEO_ES, "H263" },
816
    { VLC_FOURCC('S','2','6','3'), CODEC_ID_H263,
817
      VIDEO_ES, "H263" },
818
819
820
821
    { VLC_FOURCC('M','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "Microsoft H263" },
    { VLC_FOURCC('X','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "Xirlink H263" },
gbazin's avatar
   
gbazin committed
822

823
824
825
826
    /* Zygo (partial) */
    { VLC_FOURCC('Z','y','G','o'), CODEC_ID_H263,
      VIDEO_ES, "ITU H263+" },

gbazin's avatar
   
gbazin committed
827
    /* H263i */
gbazin's avatar
   
gbazin committed
828
829
830
831
    { VLC_FOURCC('I','2','6','3'), CODEC_ID_H263I,
      VIDEO_ES, "I263.I" },
    { VLC_FOURCC('i','2','6','3'), CODEC_ID_H263I,
      VIDEO_ES, "I263.I" },
gbazin's avatar
   
gbazin committed
832

833
834
835
836
837
838
839
    /* H263P */
    { VLC_FOURCC('v','i','v','1'), CODEC_ID_H263P,
      VIDEO_ES, "H263+" },
    { VLC_FOURCC('v','i','v','O'), CODEC_ID_H263P,
      VIDEO_ES, "H263+" },
    { VLC_FOURCC('v','i','v','2'), CODEC_ID_H263P,
      VIDEO_ES, "H263+" },
840
841
842
843
    { VLC_FOURCC('U','2','6','3'), CODEC_ID_H263P,
      VIDEO_ES, "UB H263+" },
    { VLC_FOURCC('I','L','V','R'), CODEC_ID_H263P,
      VIDEO_ES, "ITU H263+" },
844

gbazin's avatar
   
gbazin committed
845
    /* Flash (H263) variant */
gbazin's avatar
   
gbazin committed
846
847
    { VLC_FOURCC('F','L','V','1'), CODEC_ID_FLV1,
      VIDEO_ES, "Flash Video" },
848

849
    /* H261 */
850
851
    { VLC_FOURCC('H','2','6','1'), CODEC_ID_H261,
      VIDEO_ES, "H.261" },