]> git.sesse.net Git - vlc/commitdiff
Let swscale handle video conversion when available (close #1695)
authorLaurent Aimar <fenrir@videolan.org>
Thu, 10 Jul 2008 20:05:53 +0000 (22:05 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 10 Jul 2008 20:06:30 +0000 (22:06 +0200)
modules/codec/avcodec/chroma.h
modules/codec/avcodec/video.c

index f5387618634b591acf246b1974ec2243991863a2..3e82aa6dce85ee818f2d692c6b6b41c533f2a6cb 100644 (file)
@@ -25,7 +25,7 @@
 /*****************************************************************************
  * Chroma fourcc -> ffmpeg_id mapping
  *****************************************************************************/
-static struct
+static const struct
 {
     vlc_fourcc_t  i_chroma;
     int  i_chroma_id;
@@ -74,7 +74,7 @@ static struct
     { 0, 0 }
 };
 
-static int GetFfmpegChroma( vlc_fourcc_t i_chroma )
+static inline int GetFfmpegChroma( vlc_fourcc_t i_chroma )
 {
     int i;
 
@@ -86,7 +86,7 @@ static int GetFfmpegChroma( vlc_fourcc_t i_chroma )
     return -1;
 }
 
-static vlc_fourcc_t GetVlcChroma( int i_ffmpeg_chroma )
+static inline vlc_fourcc_t GetVlcChroma( int i_ffmpeg_chroma )
 {
     int i;
 
index 17f5f34ece3a3333f72df220b43175d7be3e44da..8a8e1f88647448b0c62d68fb534f5456a04d7803 100644 (file)
@@ -45,6 +45,7 @@
 #endif
 
 #include "avcodec.h"
+#include "chroma.h"
 
 /*****************************************************************************
  * decoder_sys_t : decoder descriptor
@@ -150,9 +151,11 @@ static uint32_t ffmpeg_PixFmtToChroma( int i_ff_chroma )
     case PIX_FMT_GRAY8:
         return VLC_FOURCC('G','R','E','Y');
 
-    case PIX_FMT_YUV410P:
-    case PIX_FMT_YUV411P:
     default:
+#if defined(HAVE_LIBSWSCALE_SWSCALE_H)  || defined(HAVE_FFMPEG_SWSCALE_H)
+        if( GetVlcChroma( i_ff_chroma ) )
+            return GetVlcChroma( i_ff_chroma );
+#endif
         return 0;
     }
 }