[FFmpeg-devel] [PATCH 2/2] lavc: build some codecs only if they are actually enabled

Paul B Mahol onemda at gmail.com
Thu Jun 14 05:02:03 CEST 2012


Saves few bytes if only some of them in same file are enabled.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavcodec/8svx.c        |    8 ++++++--
 libavcodec/a64multienc.c |    5 ++++-
 libavcodec/asv1.c        |    4 ++++
 libavcodec/mjpegdec.c    |    5 ++++-
 libavcodec/mjpegenc.c    |    5 ++++-
 libavcodec/sp5xdec.c     |    5 ++++-
 libavcodec/wmadec.c      |    5 ++++-
 libavcodec/wmaenc.c      |    5 ++++-
 8 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index e220ad1..6aa52d1 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -208,6 +208,7 @@ static av_cold int eightsvx_decode_close(AVCodecContext *avctx)
     return 0;
 }
 
+#if CONFIG_EIGHTSVX_FIB_DECODER
 AVCodec ff_eightsvx_fib_decoder = {
   .name           = "8svx_fib",
   .type           = AVMEDIA_TYPE_AUDIO,
@@ -219,7 +220,8 @@ AVCodec ff_eightsvx_fib_decoder = {
   .capabilities   = CODEC_CAP_DR1,
   .long_name      = NULL_IF_CONFIG_SMALL("8SVX fibonacci"),
 };
-
+#endif
+#if CONFIG_EIGHTSVX_EXP_DECODER
 AVCodec ff_eightsvx_exp_decoder = {
   .name           = "8svx_exp",
   .type           = AVMEDIA_TYPE_AUDIO,
@@ -231,7 +233,8 @@ AVCodec ff_eightsvx_exp_decoder = {
   .capabilities   = CODEC_CAP_DR1,
   .long_name      = NULL_IF_CONFIG_SMALL("8SVX exponential"),
 };
-
+#endif
+#if CONFIG_PCM_S8_PLANAR_DECODER
 AVCodec ff_pcm_s8_planar_decoder = {
     .name           = "pcm_s8_planar",
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -243,3 +246,4 @@ AVCodec ff_pcm_s8_planar_decoder = {
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"),
 };
+#endif
diff --git a/libavcodec/a64multienc.c b/libavcodec/a64multienc.c
index 09aaf0c..baa4846 100644
--- a/libavcodec/a64multienc.c
+++ b/libavcodec/a64multienc.c
@@ -368,6 +368,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     return 0;
 }
 
+#if CONFIG_A64MULTI_ENCODER
 AVCodec ff_a64multi_encoder = {
     .name           = "a64multi",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -380,7 +381,8 @@ AVCodec ff_a64multi_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
     .capabilities   = CODEC_CAP_DELAY,
 };
-
+#endif
+#if CONFIG_A64MULTI5_ENCODER
 AVCodec ff_a64multi5_encoder = {
     .name           = "a64multi5",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -393,3 +395,4 @@ AVCodec ff_a64multi5_encoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),
     .capabilities   = CODEC_CAP_DELAY,
 };
+#endif
diff --git a/libavcodec/asv1.c b/libavcodec/asv1.c
index 702a59e..571af56 100644
--- a/libavcodec/asv1.c
+++ b/libavcodec/asv1.c
@@ -614,6 +614,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
     return 0;
 }
 
+#if CONFIG_ASV1_DECODER
 AVCodec ff_asv1_decoder = {
     .name           = "asv1",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -625,7 +626,9 @@ AVCodec ff_asv1_decoder = {
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("ASUS V1"),
 };
+#endif
 
+#if CONFIG_ASV2_DECODER
 AVCodec ff_asv2_decoder = {
     .name           = "asv2",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -637,6 +640,7 @@ AVCodec ff_asv2_decoder = {
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("ASUS V2"),
 };
+#endif
 
 #if CONFIG_ASV1_ENCODER
 AVCodec ff_asv1_encoder = {
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 05e58f7..f24b279 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1804,6 +1804,7 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
+#if CONFIG_MJPEG_DECODER
 #define OFFSET(x) offsetof(MJpegDecodeContext, x)
 #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
 static const AVOption options[] = {
@@ -1832,7 +1833,8 @@ AVCodec ff_mjpeg_decoder = {
     .long_name      = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
     .priv_class     = &mjpegdec_class,
 };
-
+#endif
+#if CONFIG_THP_DECODER
 AVCodec ff_thp_decoder = {
     .name           = "thp",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -1845,3 +1847,4 @@ AVCodec ff_thp_decoder = {
     .max_lowres     = 3,
     .long_name      = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"),
 };
+#endif
diff --git a/libavcodec/mjpegenc.c b/libavcodec/mjpegenc.c
index 7eb4a52..156e52a 100644
--- a/libavcodec/mjpegenc.c
+++ b/libavcodec/mjpegenc.c
@@ -477,6 +477,7 @@ static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
     return ff_MPV_encode_picture(avctx, pkt, &pic, got_packet);
 }
 
+#if CONFIG_MJPEG_ENCODER
 AVCodec ff_mjpeg_encoder = {
     .name           = "mjpeg",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -490,7 +491,8 @@ AVCodec ff_mjpeg_encoder = {
     },
     .long_name      = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
 };
-
+#endif
+#if CONFIG_AMV_ENCODER
 AVCodec ff_amv_encoder = {
     .name           = "amv",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -504,3 +506,4 @@ AVCodec ff_amv_encoder = {
     },
     .long_name      = NULL_IF_CONFIG_SMALL("AMV Video"),
 };
+#endif
diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c
index 4aca0cc..04ddf09 100644
--- a/libavcodec/sp5xdec.c
+++ b/libavcodec/sp5xdec.c
@@ -93,6 +93,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx,
     return i;
 }
 
+#if CONFIG_SP5X_DECODER
 AVCodec ff_sp5x_decoder = {
     .name           = "sp5x",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -105,7 +106,8 @@ AVCodec ff_sp5x_decoder = {
     .max_lowres     = 3,
     .long_name      = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"),
 };
-
+#endif
+#if CONFIG_AMV_DECODER
 AVCodec ff_amv_decoder = {
     .name           = "amv",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -116,3 +118,4 @@ AVCodec ff_amv_decoder = {
     .decode         = sp5x_decode_frame,
     .long_name      = NULL_IF_CONFIG_SMALL("AMV Video"),
 };
+#endif
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index f26a143..2152c9f 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -954,6 +954,7 @@ static av_cold void flush(AVCodecContext *avctx)
     s->last_superframe_len= 0;
 }
 
+#if CONFIG_WMAV1_DECODER
 AVCodec ff_wmav1_decoder = {
     .name           = "wmav1",
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -966,7 +967,8 @@ AVCodec ff_wmav1_decoder = {
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
-
+#endif
+#if CONFIG_WMAV2_DECODER
 AVCodec ff_wmav2_decoder = {
     .name           = "wmav2",
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -979,3 +981,4 @@ AVCodec ff_wmav2_decoder = {
     .capabilities   = CODEC_CAP_DR1,
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
 };
+#endif
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 71446e1..7fb8479 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -417,6 +417,7 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
     return 0;
 }
 
+#if CONFIG_WMAV1_ENCODER
 AVCodec ff_wmav1_encoder = {
     .name           = "wmav1",
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -429,7 +430,8 @@ AVCodec ff_wmav1_encoder = {
                                                      AV_SAMPLE_FMT_NONE },
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"),
 };
-
+#endif
+#if CONFIG_WMAV2_ENCODER
 AVCodec ff_wmav2_encoder = {
     .name           = "wmav2",
     .type           = AVMEDIA_TYPE_AUDIO,
@@ -442,3 +444,4 @@ AVCodec ff_wmav2_encoder = {
                                                      AV_SAMPLE_FMT_NONE },
     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"),
 };
+#endif
-- 
1.7.7



More information about the ffmpeg-devel mailing list