]> git.sesse.net Git - vlc/blobdiff - modules/codec/ffmpeg/ffmpeg.c
* ffmpeg/encoder.c: if p_codec->pix_ftms is not yet available in this version of...
[vlc] / modules / codec / ffmpeg / ffmpeg.c
index e7855054d45544e27278a3ebd8cddce452df3972..3d021bd03d1922ea8255fc3bebd62d36df544dda 100644 (file)
@@ -77,16 +77,19 @@ static char *enc_hq_list_text[] = { N_("rd"), N_("bits"), N_("simple") };
  *****************************************************************************/
 vlc_module_begin();
 
+    set_category( CAT_INPUT );
+    set_subcategory( SUBCAT_INPUT_SCODEC );
     /* decoder main module */
 #if defined(MODULE_NAME_is_ffmpegaltivec) \
      || (defined(CAN_COMPILE_ALTIVEC) && !defined(NO_ALTIVEC_IN_FFMPEG))
     set_description( _("AltiVec ffmpeg audio/video decoder ((MS)MPEG4,SVQ1,H263,WMV,WMA)") );
-    add_requirement( ALTIVEC );
+    /*add_requirement( ALTIVEC );*/
     set_capability( "decoder", 71 );
 #else
     set_description( _("ffmpeg audio/video decoder ((MS)MPEG4,SVQ1,H263,WMV,WMA)") );
     set_capability( "decoder", 70 );
 #endif
+    set_section( N_("Decoding") , NULL );
     set_callbacks( OpenDecoder, CloseDecoder );
 
     add_bool( "ffmpeg-dr", 1, NULL, DR_TEXT, DR_TEXT, VLC_TRUE );
@@ -98,6 +101,9 @@ vlc_module_begin();
         VLC_FALSE );
     add_integer ( "ffmpeg-vismv", 0, NULL, VISMV_TEXT, VISMV_LONGTEXT,
         VLC_TRUE );
+    add_integer ( "ffmpeg-lowres", 0, NULL, LOWRES_TEXT, LOWRES_LONGTEXT,
+        VLC_TRUE );
+        change_integer_range( 0, 2 );
 
 #ifdef LIBAVCODEC_PP
     add_integer( "ffmpeg-pp-q", 0, NULL, PP_Q_TEXT, PP_Q_LONGTEXT, VLC_FALSE );
@@ -115,6 +121,7 @@ vlc_module_begin();
 
     /* encoder submodule */
     add_submodule();
+    set_section( N_("Encoding") , NULL );
     set_description( _("ffmpeg audio/video encoder") );
     set_capability( "encoder", 100 );
     set_callbacks( E_(OpenEncoder), E_(CloseEncoder) );
@@ -169,6 +176,13 @@ vlc_module_begin();
     set_callbacks( E_(OpenFilter), E_(CloseFilter) );
     set_description( _("ffmpeg video filter") );
 
+    /* video filter submodule */
+    add_submodule();
+    set_capability( "video filter2", 0 );
+    set_callbacks( E_(OpenDeinterlace), E_(CloseDeinterlace) );
+    set_description( _("ffmpeg deinterlace video filter") );
+    add_shortcut( "deinterlace" );
+
     var_Create( p_module->p_libvlc, "avcodec", VLC_VAR_MUTEX );
 vlc_module_end();
 
@@ -230,6 +244,9 @@ static int OpenDecoder( vlc_object_t *p_this )
     if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_SSE) )
     {
         p_context->dsp_mask |= FF_MM_SSE;
+    }
+    if( !(p_dec->p_libvlc->i_cpu & CPU_CAPABILITY_SSE2) )
+    {
         p_context->dsp_mask |= FF_MM_SSE2;
     }
 
@@ -250,7 +267,7 @@ static int OpenDecoder( vlc_object_t *p_this )
         i_result = VLC_EGENERIC;
     }
 
-    p_dec->p_sys->i_cat = i_cat;
+    if( i_result == VLC_SUCCESS ) p_dec->p_sys->i_cat = i_cat;
 
     return i_result;
 }
@@ -263,16 +280,6 @@ static void CloseDecoder( vlc_object_t *p_this )
     decoder_t *p_dec = (decoder_t *)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
-    if( p_sys->p_context )
-    {
-        if( p_sys->p_context->extradata )
-            free( p_sys->p_context->extradata );
-
-        avcodec_close( p_sys->p_context );
-        msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
-        av_free( p_sys->p_context );
-    }
-
     switch( p_sys->i_cat )
     {
     case AUDIO_ES:
@@ -283,9 +290,19 @@ static void CloseDecoder( vlc_object_t *p_this )
         break;
     }
 
+    if( p_sys->p_context )
+    {
+        if( p_sys->p_context->extradata )
+            free( p_sys->p_context->extradata );
+
+        avcodec_close( p_sys->p_context );
+        msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
+        av_free( p_sys->p_context );
+    }
+
     free( p_sys );
 }
-  
+
 /*****************************************************************************
  * local Functions
  *****************************************************************************/
@@ -326,6 +343,7 @@ static struct
 } chroma_table[] =
 {
     /* Planar YUV formats */
+    { VLC_FOURCC('Y','U','V','A'), PIX_FMT_YUV444P }, /* Hack */
     { VLC_FOURCC('I','4','4','4'), PIX_FMT_YUV444P },
     { VLC_FOURCC('I','4','2','2'), PIX_FMT_YUV422P },
     { VLC_FOURCC('I','4','2','0'), PIX_FMT_YUV420P },
@@ -337,7 +355,9 @@ static struct
 
     /* Packed YUV formats */
     { VLC_FOURCC('Y','U','Y','2'), PIX_FMT_YUV422 },
-    { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_YUV422 },
+#if LIBAVCODEC_BUILD >= 4720
+    { VLC_FOURCC('U','Y','V','Y'), PIX_FMT_UYVY422 },
+#endif
 
     /* Packed RGB formats */
     { VLC_FOURCC('R','V','1','5'), PIX_FMT_RGB555 },
@@ -634,6 +654,11 @@ static struct
     { VLC_FOURCC('i','v','3','2'), CODEC_ID_INDEO3,
       VIDEO_ES, "Indeo Video v3" },
 
+#if LIBAVCODEC_BUILD >= 4721
+    { VLC_FOURCC('t','s','c','c'), CODEC_ID_TSCC,
+      VIDEO_ES, "TechSmith Camtasia Screen Capture Video" },
+#endif
+
     /* Huff YUV */
     { VLC_FOURCC('H','F','Y','U'), CODEC_ID_HUFFYUV,
       VIDEO_ES, "Huff YUV Video" },
@@ -731,6 +756,23 @@ static struct
       VIDEO_ES, "FFMpeg SNOW wavelet Video" },
 #endif
 
+    /*
+     *  Image codecs
+     */
+
+#if LIBAVCODEC_BUILD >= 4731
+    { VLC_FOURCC('p','n','g',' '), CODEC_ID_PNG,
+      VIDEO_ES, "PNG Image" },
+    { VLC_FOURCC('p','p','m',' '), CODEC_ID_PPM,
+      VIDEO_ES, "PPM Image" },
+    { VLC_FOURCC('p','g','m',' '), CODEC_ID_PGM,
+      VIDEO_ES, "PGM Image" },
+    { VLC_FOURCC('p','g','m','y'), CODEC_ID_PGMYUV,
+      VIDEO_ES, "PGM YUV Image" },
+    { VLC_FOURCC('p','a','m',' '), CODEC_ID_PAM,
+      VIDEO_ES, "PAM Image" },
+#endif
+
     /*
      *  Audio Codecs
      */
@@ -823,6 +865,14 @@ static struct
       AUDIO_ES, "G.726 ADPCM Audio" },
 #endif
 
+#if LIBAVCODEC_BUILD >= 4683
+    /* AMR */
+    { VLC_FOURCC('s','a','m','r'), CODEC_ID_AMR_NB,
+      AUDIO_ES, "AMR narrow band" },
+    { VLC_FOURCC('s','a','w','b'), CODEC_ID_AMR_WB,
+      AUDIO_ES, "AMR wide band" },
+#endif
+
     /* PCM */
     { VLC_FOURCC('s','8',' ',' '), CODEC_ID_PCM_S8,
       AUDIO_ES, "PCM S8" },