[vlc-commits] commit: Split Avutil<->VLC chroma conversions functions from avcodec. h so that swscale doesn't depend on libavcodec (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Thu Jul 22 12:59:58 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Jul 22 12:59:03 2010 +0200| [5f919fba48847669640f999dd72bb32df2cd17b8] | committer: Jean-Baptiste Kempf 

Split Avutil<->VLC chroma conversions functions from avcodec.h so that swscale doesn't depend on libavcodec

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

 modules/codec/avcodec/Modules.am |    1 +
 modules/codec/avcodec/avcodec.c  |    1 +
 modules/codec/avcodec/avcodec.h  |    5 +----
 modules/codec/avcodec/chroma.c   |   10 ++--------
 modules/codec/avcodec/chroma.h   |   33 +++++++++++++++++++++++++++++++++
 modules/demux/avformat/demux.c   |    1 +
 modules/video_filter/swscale.c   |    6 ++----
 7 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/modules/codec/avcodec/Modules.am b/modules/codec/avcodec/Modules.am
index 2a40979..4ffe18d 100644
--- a/modules/codec/avcodec/Modules.am
+++ b/modules/codec/avcodec/Modules.am
@@ -7,6 +7,7 @@ libavcodec_plugin_la_SOURCES = \
 	deinterlace.c \
 	avutil.h \
 	fourcc.c \
+	chroma.h \
 	chroma.c \
 	vaapi.c \
 	dxva2.c \
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index b3b3feb..c5b844f 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -47,6 +47,7 @@
 
 #include "avcodec.h"
 #include "avutil.h"
+#include "chroma.h"
 
 #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 25, 0 )
 #   error You must update libavcodec to a version >= 52.25.0
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 6051680..33c4c17 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -21,17 +21,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "chroma.h"
 /* VLC <-> avcodec tables */
 int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
                     int *pi_ffmpeg_codec, const char **ppsz_name );
 int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
-int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
-int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
-int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
 void GetVlcAudioFormat( vlc_fourcc_t *, unsigned *pi_bits, int i_sample_fmt );
 
-
 picture_t * DecodeVideo    ( decoder_t *, block_t ** );
 aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
 subpicture_t *DecodeSubtitle( decoder_t *p_dec, block_t ** );
diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
index 2a248b4..4c198f6 100644
--- a/modules/codec/avcodec/chroma.c
+++ b/modules/codec/avcodec/chroma.c
@@ -29,14 +29,8 @@
 #include <vlc_common.h>
 #include <vlc_codec.h>
 
-#ifdef HAVE_LIBAVCODEC_AVCODEC_H
-#   include <libavcodec/avcodec.h>
-#elif defined(HAVE_FFMPEG_AVCODEC_H)
-#   include <ffmpeg/avcodec.h>
-#else
-#   include <avcodec.h>
-#endif
-#include "avcodec.h"
+#include <libavutil/avutil.h>
+#include "chroma.h"
 
 /*****************************************************************************
  * Chroma fourcc -> ffmpeg_id mapping
diff --git a/modules/codec/avcodec/chroma.h b/modules/codec/avcodec/chroma.h
new file mode 100644
index 0000000..0a0970a
--- /dev/null
+++ b/modules/codec/avcodec/chroma.h
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * avcodec.h: decoder and encoder using libavcodec
+ *****************************************************************************
+ * Copyright (C) 2001-2008 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Laurent Aimar <fenrir at via.ecp.fr>
+ *
+ * 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.
+ *
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/* VLC <-> avutil tables */
+
+#ifndef _VLC_AVUTIL_CHROMA_H
+#define _VLC_AVUTIL_CHROMA_H 1
+
+int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc );
+int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt );
+int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma );
+
+#endif
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 4ad3ccb..a8042b8 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -46,6 +46,7 @@
 #endif
 
 #include "../../codec/avcodec/avcodec.h"
+#include "../../codec/avcodec/chroma.h"
 #include "avformat.h"
 #include "../xiph.h"
 #include "../vobsub.h"
diff --git a/modules/video_filter/swscale.c b/modules/video_filter/swscale.c
index 8c1d879..421c84e 100644
--- a/modules/video_filter/swscale.c
+++ b/modules/video_filter/swscale.c
@@ -37,16 +37,14 @@
 
 #ifdef HAVE_LIBSWSCALE_SWSCALE_H
 #   include <libswscale/swscale.h>
-#   include <libavcodec/avcodec.h>
 #elif defined(HAVE_FFMPEG_SWSCALE_H)
 #   include <ffmpeg/swscale.h>
-#   include <ffmpeg/avcodec.h>
 #endif
 
+#include "../codec/avcodec/chroma.h" // Chroma Avutil <-> VLC conversion
+
 /* Gruikkkkkkkkkk!!!!! */
-#include "../codec/avcodec/avcodec.h"
 #undef AVPALETTE_SIZE
-
 #define AVPALETTE_SIZE (256 * sizeof(uint32_t))
 
 /*****************************************************************************



More information about the vlc-commits mailing list