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

Factorize avcodec table - spare about 5kb

parent f70a9052
...@@ -5,7 +5,7 @@ SOURCES_avcodec = \ ...@@ -5,7 +5,7 @@ SOURCES_avcodec = \
audio.c \ audio.c \
deinterlace.c \ deinterlace.c \
avutil.h \ avutil.h \
fourcc.h \ fourcc.c \
chroma.h \ chroma.h \
$(NULL) $(NULL)
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#endif #endif
#include "avcodec.h" #include "avcodec.h"
#include "fourcc.h"
#include "avutil.h" #include "avutil.h"
/***************************************************************************** /*****************************************************************************
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
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 );
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 ** );
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include "avcodec.h" #include "avcodec.h"
#include "chroma.h" #include "chroma.h"
#include "fourcc.h"
#define HURRY_UP_GUARD1 (450000) #define HURRY_UP_GUARD1 (450000)
#define HURRY_UP_GUARD2 (300000) #define HURRY_UP_GUARD2 (300000)
......
/***************************************************************************** /*****************************************************************************
* fourcc.h: libavcodec <-> libvlc conversion routines * fourcc.c: libavcodec <-> 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 02110-1301, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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"
/***************************************************************************** /*****************************************************************************
* Codec fourcc -> ffmpeg_id mapping * Codec fourcc -> ffmpeg_id mapping
*****************************************************************************/ *****************************************************************************/
...@@ -30,7 +46,7 @@ static const struct ...@@ -30,7 +46,7 @@ static const struct
vlc_fourcc_t i_fourcc; vlc_fourcc_t i_fourcc;
int i_codec; int i_codec;
int i_cat; int i_cat;
const char *psz_name; const char psz_name[40];
} codecs_table[] = } codecs_table[] =
{ {
...@@ -1049,15 +1065,13 @@ static const struct ...@@ -1049,15 +1065,13 @@ static const struct
SPU_ES, "SubStation Alpha subtitles" }, SPU_ES, "SubStation Alpha subtitles" },
#endif #endif
{ 0, 0, 0, 0 } { 0, 0, 0, "" }
}; };
static 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 i; for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
for( i = 0; codecs_table[i].i_fourcc != 0; i++ )
{ {
if( codecs_table[i].i_fourcc == i_fourcc ) if( codecs_table[i].i_fourcc == i_fourcc )
{ {
...@@ -1071,12 +1085,10 @@ static int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat, ...@@ -1071,12 +1085,10 @@ static int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
return false; return false;
} }
static 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 i; for( unsigned i = 0; codecs_table[i].i_codec != 0; i++ )
for( i = 0; codecs_table[i].i_codec != 0; i++ )
{ {
if( codecs_table[i].i_codec == i_ffmpeg_codec ) if( codecs_table[i].i_codec == i_ffmpeg_codec )
{ {
......
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