]> git.sesse.net Git - vlc/commitdiff
Factorize avcodec table - spare about 5kb
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 19 Oct 2008 19:49:28 +0000 (22:49 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sun, 19 Oct 2008 19:49:28 +0000 (22:49 +0300)
modules/codec/avcodec/Modules.am
modules/codec/avcodec/avcodec.c
modules/codec/avcodec/avcodec.h
modules/codec/avcodec/encoder.c
modules/codec/avcodec/fourcc.c [moved from modules/codec/avcodec/fourcc.h with 98% similarity]

index 67cfb8ab7b9f67ece6a877cf913b5e5a3bd0c3b4..f68022933dd9d2a42524effdd9753592068b50b6 100644 (file)
@@ -5,7 +5,7 @@ SOURCES_avcodec = \
        audio.c \
        deinterlace.c \
        avutil.h \
-       fourcc.h \
+       fourcc.c \
        chroma.h \
        $(NULL)
 
index fda4da263b5f589f588c0fb8924a1d754df46660..59953ab82ab7e4eb21e29530b5daa209f264af23 100644 (file)
@@ -48,7 +48,6 @@
 #endif
 
 #include "avcodec.h"
-#include "fourcc.h"
 #include "avutil.h"
 
 /*****************************************************************************
index 2c467e8879f90cacaee2aae381055e68b8145560..6d8e08277d644ed99a425078f773a3cb2d7c1de4 100644 (file)
  * 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 ** );
 aout_buffer_t * DecodeAudio( decoder_t *, block_t ** );
 
index d9b828548801a83f846a5b27779056bd0caa3054..675c811c028fbdc04a080d15f784c5ef42a813bf 100644 (file)
@@ -51,7 +51,6 @@
 
 #include "avcodec.h"
 #include "chroma.h"
-#include "fourcc.h"
 
 #define HURRY_UP_GUARD1 (450000)
 #define HURRY_UP_GUARD2 (300000)
similarity index 98%
rename from modules/codec/avcodec/fourcc.h
rename to modules/codec/avcodec/fourcc.c
index 0fb2dd64b65315378eea7e35920d7149955db655..9175056d4572a538e9e349f50cc4f1ccb0bee4c2 100644 (file)
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * fourcc.h: libavcodec <-> libvlc conversion routines
+ * fourcc.c: libavcodec <-> libvlc conversion routines
  *****************************************************************************
  * Copyright (C) 1999-2008 the VideoLAN team
  * $Id$
  * 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
  *****************************************************************************/
@@ -30,7 +46,7 @@ static const struct
     vlc_fourcc_t  i_fourcc;
     int  i_codec;
     int  i_cat;
-    const char *psz_name;
+    const char psz_name[40];
 
 } codecs_table[] =
 {
@@ -1049,15 +1065,13 @@ static const struct
       SPU_ES, "SubStation Alpha subtitles" },
 #endif
 
-    { 0, 0, 0, 0 }
+    { 0, 0, 0, "" }
 };
 
-static int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
-                           int *pi_ffmpeg_codec, const char **ppsz_name )
+int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
+                    int *pi_ffmpeg_codec, const char **ppsz_name )
 {
-    int i;
-
-    for( i = 0; codecs_table[i].i_fourcc != 0; i++ )
+    for( unsigned i = 0; codecs_table[i].i_fourcc != 0; i++ )
     {
         if( codecs_table[i].i_fourcc == i_fourcc )
         {
@@ -1071,12 +1085,10 @@ static int GetFfmpegCodec( vlc_fourcc_t i_fourcc, int *pi_cat,
     return false;
 }
 
-static int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
-                         vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
+int GetVlcFourcc( int i_ffmpeg_codec, int *pi_cat,
+                  vlc_fourcc_t *pi_fourcc, const char **ppsz_name )
 {
-    int i;
-
-    for( i = 0; codecs_table[i].i_codec != 0; i++ )
+    for( unsigned i = 0; codecs_table[i].i_codec != 0; i++ )
     {
         if( codecs_table[i].i_codec == i_ffmpeg_codec )
         {