ffmpeg.c 55.8 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>
33
#include <vlc_plugin.h>
zorglub's avatar
zorglub committed
34
#include <vlc_codec.h>
35

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

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

50
#include "ffmpeg.h"
51

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

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

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

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

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

82
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)  || defined(HAVE_FFMPEG_SWSCALE_H)
83
static int pi_mode_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
84
static const char *ppsz_mode_descriptions[] =
85
86
87
88
{ 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") };
89
#endif
90

91
92
93
/*****************************************************************************
 * Module descriptor
 *****************************************************************************/
94
95
96
97
#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")

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

116

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

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

145
#ifdef ENABLE_SOUT
gbazin's avatar
   
gbazin committed
146
147
    /* encoder submodule */
    add_submodule();
zorglub's avatar
zorglub committed
148
    set_section( N_("Encoding") , NULL );
149
    set_description( N_("FFmpeg audio/video encoder") );
gbazin's avatar
   
gbazin committed
150
    set_capability( "encoder", 100 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
151
    set_callbacks( OpenEncoder, CloseEncoder );
gbazin's avatar
   
gbazin committed
152

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

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

212
#if defined(HAVE_LIBAVFORMAT_AVFORMAT_H) || defined(HAVE_FFMPEG_AVFORMAT_H)
213

gbazin's avatar
   
gbazin committed
214
    /* demux submodule */
gbazin's avatar
   
gbazin committed
215
    add_submodule();
216
    set_description( N_("FFmpeg demuxer" ) );
217
    set_capability( "demux", 2 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
218
    set_callbacks( OpenDemux, CloseDemux );
gbazin's avatar
   
gbazin committed
219

220
#ifdef ENABLE_SOUT
221
222
    /* mux submodule */
    add_submodule();
223
    set_description( N_("FFmpeg muxer" ) );
224
    set_capability( "sout mux", 2 );
225
    add_string( "ffmpeg-mux", NULL, NULL, MUX_TEXT,
226
                MUX_LONGTEXT, true );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
227
    set_callbacks( OpenMux, CloseMux );
228
#endif
229
#endif
230

231
#if defined(HAVE_LIBSWSCALE_SWSCALE_H)  || defined(HAVE_FFMPEG_SWSCALE_H)
232
233
    /* video filter submodule */
    add_submodule();
234
    set_description( N_("Video scaling filter") );
235
236
237
    set_capability( "video filter2", 1000 );
    set_category( CAT_VIDEO );
    set_subcategory( SUBCAT_VIDEO_VFILTER );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
238
    set_callbacks( OpenScaler, CloseScaler );
239
    add_integer( "swscale-mode", 0, NULL, SCALEMODE_TEXT, SCALEMODE_LONGTEXT, true );
240
241
        change_integer_list( pi_mode_values, ppsz_mode_descriptions, 0 );

242
#else
243
244
245
    /* video filter submodule */
    add_submodule();
    set_capability( "video filter2", 50 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
246
    set_callbacks( OpenFilter, CloseFilter );
247
    set_description( N_("FFmpeg video filter") );
248

249
250
251
    /* crop/padd submodule */
    add_submodule();
    set_capability( "crop padd", 10 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
252
    set_callbacks( OpenCropPadd, CloseFilter );
253
    set_description( N_("FFmpeg crop padd filter") );
254
#endif
255

256
257
258
    /* chroma conversion submodule */
    add_submodule();
    set_capability( "chroma", 50 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
259
    set_callbacks( OpenChroma, CloseChroma );
260
    set_description( N_("FFmpeg chroma conversion") );
261

262
263
264
    /* video filter submodule */
    add_submodule();
    set_capability( "video filter2", 0 );
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
265
    set_callbacks( OpenDeinterlace, CloseDeinterlace );
266
    set_description( N_("FFmpeg deinterlace video filter") );
267
    add_shortcut( "ffmpeg-deinterlace" );
268

269
270
271
272
273
274
275
vlc_module_end();

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

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

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

gbazin's avatar
   
gbazin committed
290
291
292
293
294
295
296
297
    /* 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
298
    /* Initialization must be done before avcodec_find_decoder() */
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
299
    InitLibavcodec(p_this);
gbazin's avatar
   
gbazin committed
300

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

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

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

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

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

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

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

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

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

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

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

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

398
/*****************************************************************************
399
 *
400
 *****************************************************************************/
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
401
void LibavcodecCallback( void *p_opaque, int i_level,
402
                             const char *psz_format, va_list va )
403
404
405
406
407
408
409
410
{
    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;

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

413
#define cln p_avc->class_name
414
    /* Make sure we can get p_this back */
415
416
417
    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' )
418
419
    {
        if( i_level == AV_LOG_ERROR ) vfprintf( stderr, psz_format, va );
420
        return;
421
    }
422
#undef cln
423

424
425
426
427
428
429
430
431
432
433
434
435
436
437
    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:
438
439
440
        /* Print debug messages if they were requested */
        if( p_avctx->debug ) vfprintf( stderr, psz_format, va );
        return;
441
442
443
444
445
446
    default:
        return;
    }

    psz_item_name = p_avc->item_name(p_opaque);
    psz_new_format = malloc( strlen(psz_format) + strlen(psz_item_name)
447
                              + 18 + 5 );
448
449
    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 );
450
    msg_GenericVa( p_this, i_vlc_level,
zorglub's avatar
zorglub committed
451
                    MODULE_STRING, psz_new_format, va );
452
453
454
    free( psz_new_format );
}

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
455
void InitLibavcodec( vlc_object_t *p_object )
gbazin's avatar
   
gbazin committed
456
457
{
    static int b_ffmpeginit = 0;
458
    vlc_mutex_t *lock = var_AcquireMutex( "avcodec" );
gbazin's avatar
   
gbazin committed
459
460
461
462
463
464

    /* *** init ffmpeg library (libavcodec) *** */
    if( !b_ffmpeginit )
    {
        avcodec_init();
        avcodec_register_all();
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
465
        av_log_set_callback( LibavcodecCallback );
gbazin's avatar
   
gbazin committed
466
        b_ffmpeginit = 1;
467

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

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

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

} chroma_table[] =
{
    /* Planar YUV formats */
490
    { VLC_FOURCC('Y','U','V','A'), PIX_FMT_YUV444P }, /* Hack */
491
    { VLC_FOURCC('I','4','4','4'), PIX_FMT_YUV444P },
492
    { VLC_FOURCC('J','4','4','4'), PIX_FMT_YUVJ444P },
493
    { VLC_FOURCC('I','4','2','2'), PIX_FMT_YUV422P },
494
    { VLC_FOURCC('J','4','2','2'), PIX_FMT_YUVJ422P },
495
496
497
    { 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 },
498
    { VLC_FOURCC('J','4','2','0'), PIX_FMT_YUVJ420P },
499
500
501
502
503
504
    { 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 },
505
    { VLC_FOURCC('Y','U','Y','V'), PIX_FMT_YUV422 },
506
    { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
507
508

    /* Packed RGB formats */
509
#if defined(WORDS_BIGENDIAN)
510
    { VLC_FOURCC('R','G','B','8'), PIX_FMT_BGR8 },
511
512
513
514
    { 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
515
#if defined(PIX_FMT_RGB8)
516
    { VLC_FOURCC('R','G','B','8'), PIX_FMT_RGB8 },
517
#endif
518
519
520
    { 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 },
521
#endif
522
    { VLC_FOURCC('R','V','3','2'), PIX_FMT_RGBA32 },
523
#if defined(PIX_FMT_RGBA)
524
525
    { VLC_FOURCC('R','G','B','A'), PIX_FMT_RGBA },
#endif
526
527
    { VLC_FOURCC('G','R','E','Y'), PIX_FMT_GRAY8 },

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

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
531
int GetFfmpegChroma( vlc_fourcc_t i_chroma )
532
533
534
535
536
537
538
539
540
541
542
{
    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;
}

Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
543
vlc_fourcc_t GetVlcChroma( int i_ffmpeg_chroma )
544
545
546
547
548
549
550
551
552
553
554
555
556
557
{
    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
558
559
560
561
562
static struct
{
    vlc_fourcc_t  i_fourcc;
    int  i_codec;
    int  i_cat;
563
    const char *psz_name;
gbazin's avatar
   
gbazin committed
564

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

gbazin's avatar
   
gbazin committed
571
    /* MPEG-1 Video */
gbazin's avatar
   
gbazin committed
572
573
    { VLC_FOURCC('m','p','1','v'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
574
575
    { VLC_FOURCC('m','p','e','g'), CODEC_ID_MPEG1VIDEO,
      VIDEO_ES, "MPEG-1 Video" },
576
577
578
579
    { VLC_FOURCC('m','p','g','1'), 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
580
581

    /* MPEG-2 Video */
gbazin's avatar
   
gbazin committed
582
583
    { VLC_FOURCC('m','p','2','v'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
584
585
    { VLC_FOURCC('M','P','E','G'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
gbazin's avatar
   
gbazin committed
586
587
    { VLC_FOURCC('m','p','g','v'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG-2 Video" },
588
589
590
591
592
593
594
595
    { 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)" },
596
597
    { VLC_FOURCC('h','d','v','5'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "HDV 720p25 (MPEG-2 Video)" },
598
599
600
    { 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,
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
601
602
603
604
605
606
      VIDEO_ES, "MPEG2 IMX PAL 625/60 50mb/s (FCP)" },
    { VLC_FOURCC('m','x','4','n'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX NTSC 525/60 40mb/s (FCP)" },
    { VLC_FOURCC('m','x','4','p'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "MPEG2 IMX PAL 625/50 40mb/s (FCP)" },
     { VLC_FOURCC('m','x','3','n'), CODEC_ID_MPEG2VIDEO,
607
608
609
610
611
612
613
      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" },
614
615
616
    /* ATI VCR2 */
    { VLC_FOURCC('V','C','R','2'), CODEC_ID_MPEG2VIDEO,
      VIDEO_ES, "ATI VCR2 Video" },
617
618
619
620
    { 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
621
622

    /* MPEG-4 Video */
gbazin's avatar
   
gbazin committed
623
624
625
626
627
628
629
630
631
632
633
634
    { 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" },
635
    /* XVID flavours */
gbazin's avatar
   
gbazin committed
636
637
638
639
640
641
    { 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" },
642
643
644
645
    { 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" },
646
    /* DX50 */
gbazin's avatar
   
gbazin committed
647
648
649
650
    { 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" },
651
652
    { VLC_FOURCC('B','L','Z','0'), CODEC_ID_MPEG4,
      VIDEO_ES, "Blizzard MPEG-4 Video" },
653
654
    { VLC_FOURCC('D','X','G','M'), CODEC_ID_MPEG4,
      VIDEO_ES, "Electronic Arts Game MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
655
656
    { VLC_FOURCC('m','p','4','v'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
657
658
    { VLC_FOURCC('M','P','4','V'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
659
660
661
662
663
664
    { 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" },
665
666
    { VLC_FOURCC('F','M','P','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
667
668
    { VLC_FOURCC('f','m','p','4'), CODEC_ID_MPEG4,
      VIDEO_ES, "MPEG-4 Video" },
gbazin's avatar
   
gbazin committed
669
670
    /* 3ivx delta 3.5 Unsupported
     * putting it here gives extreme distorted images
gbazin's avatar
   
gbazin committed
671
672
673
674
    { 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
675
    /* 3ivx delta 4 */
gbazin's avatar
   
gbazin committed
676
677
678
679
    { 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" },
680
681
682
683
684
685
686
687
688
689
690
691
692
693
    { 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)" },
694
695
696
697
    { 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
698
699

    /* MSMPEG4 v1 */
gbazin's avatar
   
gbazin committed
700
701
702
703
704
705
706
707
    { 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
708
709

    /* MSMPEG4 v2 */
gbazin's avatar
   
gbazin committed
710
711
712
713
714
715
716
717
    { 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
718
719

    /* MSMPEG4 v3 / M$ mpeg4 v3 */
gbazin's avatar
   
gbazin committed
720
721
722
723
724
725
726
727
728
729
    { 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
730
    /* DivX 3.20 */
gbazin's avatar
   
gbazin committed
731
732
733
734
735
736
737
738
739
740
741
742
743
744
    { 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" },
745
    /* Cool Codec */
746
747
    { VLC_FOURCC('C','O','L','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
748
749
    { VLC_FOURCC('c','o','l','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
750
751
    { VLC_FOURCC('C','O','L','0'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
752
753
    { VLC_FOURCC('c','o','l','0'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
754
    /* AngelPotion stuff */
gbazin's avatar
   
gbazin committed
755
756
    { VLC_FOURCC('A','P','4','1'), CODEC_ID_MSMPEG4V3,
      VIDEO_ES, "MS MPEG-4 Video v3" },
gbazin's avatar
   
gbazin committed
757
    /* 3ivx doctered divx files */
gbazin's avatar
   
gbazin committed
758
759
760
761
    { 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
762
    /* who knows? */
gbazin's avatar
   
gbazin committed
763
764
765
766
    { 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
767
768

    /* Sorenson v1 */
gbazin's avatar
   
gbazin committed
769
770
    { VLC_FOURCC('S','V','Q','1'), CODEC_ID_SVQ1,
      VIDEO_ES, "SVQ-1 (Sorenson Video v1)" },
771
772
773
774
    { 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
775
776

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

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

gbazin's avatar
   
gbazin committed
805
806
/* H263 and H263i */
/* H263(+) is also known as Real Video 1.0 */
hartman's avatar
hartman committed
807

gbazin's avatar
   
gbazin committed
808
    /* H263 */
809
810
    { VLC_FOURCC('D','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "DEC H263" },
gbazin's avatar
   
gbazin committed
811
812
813
814
    { VLC_FOURCC('H','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "H263" },
    { VLC_FOURCC('h','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "H263" },
815
816
    { VLC_FOURCC('L','2','6','3'), CODEC_ID_H263,
      VIDEO_ES, "LEAD H263" },