From 5f919fba48847669640f999dd72bb32df2cd17b8 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Thu, 22 Jul 2010 12:59:03 +0200 Subject: [PATCH] Split Avutil<->VLC chroma conversions functions from avcodec.h so that swscale doesn't depend on libavcodec --- 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(-) create mode 100644 modules/codec/avcodec/chroma.h diff --git a/modules/codec/avcodec/Modules.am b/modules/codec/avcodec/Modules.am index 2a40979a0f..4ffe18d7d2 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 b3b3feb54c..c5b844f21c 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 605168034a..33c4c17817 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 2a248b4dbb..4c198f666c 100644 --- a/modules/codec/avcodec/chroma.c +++ b/modules/codec/avcodec/chroma.c @@ -29,14 +29,8 @@ #include #include -#ifdef HAVE_LIBAVCODEC_AVCODEC_H -# include -#elif defined(HAVE_FFMPEG_AVCODEC_H) -# include -#else -# include -#endif -#include "avcodec.h" +#include +#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 0000000000..0a0970af23 --- /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 + * + * 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 4ad3ccbe82..a8042b8e5d 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 8c1d879908..421c84e05e 100644 --- a/modules/video_filter/swscale.c +++ b/modules/video_filter/swscale.c @@ -37,16 +37,14 @@ #ifdef HAVE_LIBSWSCALE_SWSCALE_H # include -# include #elif defined(HAVE_FFMPEG_SWSCALE_H) # include -# include #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)) /***************************************************************************** -- 2.39.5