[vlc-devel] commit: Let swscale handle video conversion when available (close #1695) ( Laurent Aimar )

git version control git at videolan.org
Thu Jul 10 22:11:56 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jul 10 22:05:53 2008 +0200| [14cc9765ed844fa23d245a60e46f3e0b30ca81d1]

Let swscale handle video conversion when available (close #1695)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=14cc9765ed844fa23d245a60e46f3e0b30ca81d1
---

 modules/codec/avcodec/chroma.h |    6 +++---
 modules/codec/avcodec/video.c  |    7 +++++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/codec/avcodec/chroma.h b/modules/codec/avcodec/chroma.h
index f538761..3e82aa6 100644
--- a/modules/codec/avcodec/chroma.h
+++ b/modules/codec/avcodec/chroma.h
@@ -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;
 
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 17f5f34..8a8e1f8 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -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;
     }
 }




More information about the vlc-devel mailing list