Commit deeb99dc authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Factorize avcodec chroma table - another 2kb

parent a1f8e0eb
...@@ -6,7 +6,7 @@ SOURCES_avcodec = \ ...@@ -6,7 +6,7 @@ SOURCES_avcodec = \
deinterlace.c \ deinterlace.c \
avutil.h \ avutil.h \
fourcc.c \ fourcc.c \
chroma.h \ chroma.c \
$(NULL) $(NULL)
if ENABLE_SOUT if ENABLE_SOUT
......
...@@ -21,10 +21,15 @@ ...@@ -21,10 +21,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
/* VLC <-> avcodec tables */
int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat, int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
int *pi_ffmpeg_codec, const char **ppsz_name ); int *pi_ffmpeg_codec, const char **ppsz_name );
int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat, int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
vlc_fourcc_t *pi_fourcc, const char **ppsz_name ); 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 );
picture_t * DecodeVideo ( decoder_t *, block_t ** ); picture_t * DecodeVideo ( decoder_t *, block_t ** );
aout_buffer_t * DecodeAudio( decoder_t *, block_t ** ); aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
......
/***************************************************************************** /*****************************************************************************
* chroma.h: libavutil <-> libvlc conversion routines * chroma.c: libavutil <-> libvlc conversion routines
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2008 the VideoLAN team * Copyright (C) 1999-2008 the VideoLAN team
* $Id$ * $Id$
...@@ -22,6 +22,22 @@ ...@@ -22,6 +22,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 021100301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 021100301, USA.
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#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"
/***************************************************************************** /*****************************************************************************
* Chroma fourcc -> ffmpeg_id mapping * Chroma fourcc -> ffmpeg_id mapping
*****************************************************************************/ *****************************************************************************/
...@@ -101,7 +117,7 @@ static const struct ...@@ -101,7 +117,7 @@ static const struct
{ 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0 }
}; };
static inline int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc ) int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_vlc_fourcc )
{ {
for( int i = 0; chroma_table[i].i_chroma != 0; i++ ) for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
{ {
...@@ -112,7 +128,7 @@ static inline int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_ ...@@ -112,7 +128,7 @@ static inline int TestFfmpegChroma( const int i_ffmpeg_id, const vlc_fourcc_t i_
} }
/* FIXME special case the RGB formats */ /* FIXME special case the RGB formats */
static inline int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt ) int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fmt )
{ {
for( int i = 0; chroma_table[i].i_chroma != 0; i++ ) for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
{ {
...@@ -130,7 +146,7 @@ static inline int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fm ...@@ -130,7 +146,7 @@ static inline int GetFfmpegChroma( int *i_ffmpeg_chroma, const video_format_t fm
return VLC_EGENERIC; return VLC_EGENERIC;
} }
static inline int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma ) int GetVlcChroma( video_format_t *fmt, const int i_ffmpeg_chroma )
{ {
/* TODO FIXME for rgb format we HAVE to set rgb mask/shift */ /* TODO FIXME for rgb format we HAVE to set rgb mask/shift */
for( int i = 0; chroma_table[i].i_chroma != 0; i++ ) for( int i = 0; chroma_table[i].i_chroma != 0; i++ )
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#endif #endif
#include "avcodec.h" #include "avcodec.h"
#include "chroma.h"
static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic ); static picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic );
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
#endif #endif
#include "avcodec.h" #include "avcodec.h"
#include "chroma.h"
#define HURRY_UP_GUARD1 (450000) #define HURRY_UP_GUARD1 (450000)
#define HURRY_UP_GUARD2 (300000) #define HURRY_UP_GUARD2 (300000)
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#endif #endif
#include "avcodec.h" #include "avcodec.h"
#include "chroma.h"
/***************************************************************************** /*****************************************************************************
* decoder_sys_t : decoder descriptor * decoder_sys_t : decoder descriptor
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment