changeset 4995:2f1d87a1dbc6 libavcodec

make compilation of mjpeg.c optional
author aurel
date Sat, 12 May 2007 23:42:07 +0000
parents 3fa689636240
children 46dc32176144
files Makefile mpegvideo.c
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sat May 12 23:33:53 2007 +0000
+++ b/Makefile	Sat May 12 23:42:07 2007 +0000
@@ -13,7 +13,6 @@
       jrevdct.o \
       jfdctfst.o \
       jfdctint.o\
-      mjpeg.o \
       resample.o \
       resample2.o \
       dsputil.o \
@@ -101,10 +100,15 @@
 OBJS-$(CONFIG_INDEO3_DECODER)          += indeo3.o
 OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
 OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER)  += dpcm.o
+OBJS-$(CONFIG_JPEGLS_ENCODER)          += mjpeg.o
 OBJS-$(CONFIG_KMVC_DECODER)            += kmvc.o
+OBJS-$(CONFIG_LJPEG_ENCODER)           += mjpeg.o
 OBJS-$(CONFIG_LOCO_DECODER)            += loco.o
 OBJS-$(CONFIG_MACE3_DECODER)           += mace.o
 OBJS-$(CONFIG_MACE6_DECODER)           += mace.o
+OBJS-$(CONFIG_MJPEG_DECODER)           += mjpeg.o
+OBJS-$(CONFIG_MJPEG_ENCODER)           += mjpeg.o mpegvideo.o
+OBJS-$(CONFIG_MJPEGB_DECODER)          += mjpeg.o
 OBJS-$(CONFIG_MMVIDEO_DECODER)         += mmvideo.o
 OBJS-$(CONFIG_MP2_ENCODER)             += mpegaudio.o
 OBJS-$(CONFIG_MPC7_DECODER)            += mpc.o
@@ -152,12 +156,14 @@
 OBJS-$(CONFIG_SONIC_DECODER)           += sonic.o
 OBJS-$(CONFIG_SONIC_ENCODER)           += sonic.o
 OBJS-$(CONFIG_SONIC_LS_DECODER)        += sonic.o
+OBJS-$(CONFIG_SP5X_DECODER)            += mjpeg.o
 OBJS-$(CONFIG_SVQ1_DECODER)            += svq1.o
 OBJS-$(CONFIG_SVQ1_ENCODER)            += svq1.o
 OBJS-$(CONFIG_SVQ3_DECODER)            += h264.o
 OBJS-$(CONFIG_TARGA_DECODER)           += targa.o
 OBJS-$(CONFIG_TARGA_ENCODER)           += targaenc.o rle.o
 OBJS-$(CONFIG_THEORA_DECODER)          += vp3.o xiph.o
+OBJS-$(CONFIG_THP_DECODER)             += mjpeg.o
 OBJS-$(CONFIG_TIERTEXSEQVIDEO_DECODER) += tiertexseqv.o
 OBJS-$(CONFIG_TIFF_DECODER)            += tiff.o lzw.o
 OBJS-$(CONFIG_TIFF_ENCODER)            += tiffenc.o rle.o lzwenc.o
--- a/mpegvideo.c	Sat May 12 23:33:53 2007 +0000
+++ b/mpegvideo.c	Sat May 12 23:42:07 2007 +0000
@@ -1205,7 +1205,7 @@
         s->mjpeg_hsample[0] = 2;
         s->mjpeg_hsample[1] = 2>>chroma_h_shift;
         s->mjpeg_hsample[2] = 2>>chroma_h_shift;
-        if (mjpeg_init(s) < 0)
+        if (!(ENABLE_MJPEG_ENCODER || ENABLE_LJPEG_ENCODER) || mjpeg_init(s) < 0)
             return -1;
         avctx->delay=0;
         s->low_delay=1;
@@ -1401,7 +1401,7 @@
     ff_rate_control_uninit(s);
 
     MPV_common_end(s);
-    if (s->out_format == FMT_MJPEG)
+    if ((ENABLE_MJPEG_ENCODER || ENABLE_LJPEG_ENCODER) && s->out_format == FMT_MJPEG)
         mjpeg_close(s);
 
     av_freep(&avctx->extradata);
@@ -2547,7 +2547,7 @@
 
         MPV_frame_end(s);
 
-        if (s->out_format == FMT_MJPEG)
+        if (ENABLE_MJPEG_ENCODER && s->out_format == FMT_MJPEG)
             mjpeg_picture_trailer(s);
 
         if(avctx->rc_buffer_size){
@@ -4599,6 +4599,7 @@
     case CODEC_ID_RV20:
         h263_encode_mb(s, s->block, motion_x, motion_y); break;
     case CODEC_ID_MJPEG:
+        if (ENABLE_MJPEG_ENCODER)
         mjpeg_encode_mb(s, s->block); break;
     default:
         assert(0);
@@ -4899,7 +4900,7 @@
         }
 
         ff_mpeg4_stuffing(&s->pb);
-    }else if(s->out_format == FMT_MJPEG){
+    }else if(ENABLE_MJPEG_ENCODER && s->out_format == FMT_MJPEG){
         ff_mjpeg_stuffing(&s->pb);
     }
 
@@ -5768,6 +5769,7 @@
     s->last_bits= put_bits_count(&s->pb);
     switch(s->out_format) {
     case FMT_MJPEG:
+        if (ENABLE_MJPEG_ENCODER)
         mjpeg_picture_header(s);
         break;
 #ifdef CONFIG_H261_ENCODER
@@ -6939,6 +6941,7 @@
     .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUV420P, -1},
 };
 
+#ifdef CONFIG_MJPEG_ENCODER
 AVCodec mjpeg_encoder = {
     "mjpeg",
     CODEC_TYPE_VIDEO,
@@ -6949,5 +6952,6 @@
     MPV_encode_end,
     .pix_fmts= (enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, -1},
 };
+#endif
 
 #endif //CONFIG_ENCODERS