Commit 15025553 authored by Aurelien Jacobs's avatar Aurelien Jacobs

disable reference to msmpeg4 and wmv2 code when those codecs are not compiled in

Originally committed as revision 8975 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent b484ec78
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263_parser.h" #include "h263_parser.h"
#include "mpeg4video_parser.h" #include "mpeg4video_parser.h"
#include "msmpeg4.h"
//#define DEBUG //#define DEBUG
//#define PRINT_FRAME_TIME //#define PRINT_FRAME_TIME
...@@ -110,7 +111,7 @@ int ff_h263_decode_init(AVCodecContext *avctx) ...@@ -110,7 +111,7 @@ int ff_h263_decode_init(AVCodecContext *avctx)
if (MPV_common_init(s) < 0) if (MPV_common_init(s) < 0)
return -1; return -1;
if (s->h263_msmpeg4) if (ENABLE_MSMPEG4_DECODER && s->h263_msmpeg4)
ff_msmpeg4_decode_init(s); ff_msmpeg4_decode_init(s);
else else
h263_decode_init_vlc(s); h263_decode_init_vlc(s);
...@@ -388,9 +389,9 @@ retry: ...@@ -388,9 +389,9 @@ retry:
} }
/* let's go :-) */ /* let's go :-) */
if (s->msmpeg4_version==5) { if (ENABLE_WMV2_DECODER && s->msmpeg4_version==5) {
ret= ff_wmv2_decode_picture_header(s); ret= ff_wmv2_decode_picture_header(s);
} else if (s->msmpeg4_version) { } else if (ENABLE_MSMPEG4_DECODER && s->msmpeg4_version) {
ret = msmpeg4_decode_picture_header(s); ret = msmpeg4_decode_picture_header(s);
} else if (s->h263_pred) { } else if (s->h263_pred) {
if(s->avctx->extradata_size && s->picture_number==0){ if(s->avctx->extradata_size && s->picture_number==0){
...@@ -622,7 +623,7 @@ retry: ...@@ -622,7 +623,7 @@ retry:
//the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type //the second part of the wmv2 header contains the MB skip bits which are stored in current_picture->mb_type
//which isnt available before MPV_frame_start() //which isnt available before MPV_frame_start()
if (s->msmpeg4_version==5){ if (s->msmpeg4_version==5){
if(ff_wmv2_decode_secondary_picture_header(s) < 0) if(!ENABLE_WMV2_DECODER || ff_wmv2_decode_secondary_picture_header(s) < 0)
return -1; return -1;
} }
...@@ -647,7 +648,7 @@ retry: ...@@ -647,7 +648,7 @@ retry:
} }
if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE) if (s->h263_msmpeg4 && s->msmpeg4_version<4 && s->pict_type==I_TYPE)
if(msmpeg4_decode_ext_header(s, buf_size) < 0){ if(!ENABLE_MSMPEG4_DECODER || msmpeg4_decode_ext_header(s, buf_size) < 0){
s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR; s->error_status_table[s->mb_num-1]= AC_ERROR|DC_ERROR|MV_ERROR;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "msmpeg4.h"
#include "faandct.h" #include "faandct.h"
#include <limits.h> #include <limits.h>
...@@ -1354,7 +1355,7 @@ int MPV_encode_init(AVCodecContext *avctx) ...@@ -1354,7 +1355,7 @@ int MPV_encode_init(AVCodecContext *avctx)
#endif #endif
if (s->out_format == FMT_H263) if (s->out_format == FMT_H263)
h263_encode_init(s); h263_encode_init(s);
if(s->msmpeg4_version) if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version)
ff_msmpeg4_encode_init(s); ff_msmpeg4_encode_init(s);
if (s->out_format == FMT_MPEG1) if (s->out_format == FMT_MPEG1)
ff_mpeg1_encode_init(s); ff_mpeg1_encode_init(s);
...@@ -3552,7 +3553,7 @@ static inline void MPV_motion(MpegEncContext *s, ...@@ -3552,7 +3553,7 @@ static inline void MPV_motion(MpegEncContext *s,
0, 0, 0, 0, 0, 0,
ref_picture, pix_op, qpix_op, ref_picture, pix_op, qpix_op,
s->mv[dir][0][0], s->mv[dir][0][1], 16); s->mv[dir][0][0], s->mv[dir][0][1], 16);
}else if(s->mspel){ }else if(ENABLE_WMV2 && s->mspel){
ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ff_mspel_motion(s, dest_y, dest_cb, dest_cr,
ref_picture, pix_op, ref_picture, pix_op,
s->mv[dir][0][0], s->mv[dir][0][1], 16); s->mv[dir][0][0], s->mv[dir][0][1], 16);
...@@ -4076,7 +4077,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b ...@@ -4076,7 +4077,7 @@ static av_always_inline void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM b
} }
}//fi gray }//fi gray
} }
else{ else if (ENABLE_WMV2) {
ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr); ff_wmv2_add_mb(s, block, dest_y, dest_cb, dest_cr);
} }
} else { } else {
...@@ -4581,8 +4582,10 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, ...@@ -4581,8 +4582,10 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x,
case CODEC_ID_MSMPEG4V2: case CODEC_ID_MSMPEG4V2:
case CODEC_ID_MSMPEG4V3: case CODEC_ID_MSMPEG4V3:
case CODEC_ID_WMV1: case CODEC_ID_WMV1:
if (ENABLE_MSMPEG4_ENCODER)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break;
case CODEC_ID_WMV2: case CODEC_ID_WMV2:
if (ENABLE_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break;
#ifdef CONFIG_H261_ENCODER #ifdef CONFIG_H261_ENCODER
case CODEC_ID_H261: case CODEC_ID_H261:
...@@ -5508,7 +5511,7 @@ static int encode_thread(AVCodecContext *c, void *arg){ ...@@ -5508,7 +5511,7 @@ static int encode_thread(AVCodecContext *c, void *arg){
} }
//not beautiful here but we must write it before flushing so it has to be here //not beautiful here but we must write it before flushing so it has to be here
if (s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == I_TYPE) if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == I_TYPE)
msmpeg4_encode_ext_header(s); msmpeg4_encode_ext_header(s);
write_slice_end(s); write_slice_end(s);
...@@ -5772,9 +5775,9 @@ static int encode_picture(MpegEncContext *s, int picture_number) ...@@ -5772,9 +5775,9 @@ static int encode_picture(MpegEncContext *s, int picture_number)
break; break;
#endif #endif
case FMT_H263: case FMT_H263:
if (s->codec_id == CODEC_ID_WMV2) if (ENABLE_WMV2_ENCODER && s->codec_id == CODEC_ID_WMV2)
ff_wmv2_encode_picture_header(s, picture_number); ff_wmv2_encode_picture_header(s, picture_number);
else if (s->h263_msmpeg4) else if (ENABLE_MSMPEG4_ENCODER && s->h263_msmpeg4)
msmpeg4_encode_picture_header(s, picture_number); msmpeg4_encode_picture_header(s, picture_number);
else if (s->h263_pred) else if (s->h263_pred)
mpeg4_encode_picture_header(s, picture_number); mpeg4_encode_picture_header(s, picture_number);
......
/*
* MSMPEG4 backend for ffmpeg encoder and decoder
* copyright (c) 2007 Aurelien Jacobs <aurel@gnuage.org>
*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file msmpeg4.h
*/
#ifndef MSMPEG4_H
#define MSMPEG4_H
#include "config.h"
#define ENABLE_MSMPEG4_DECODER (ENABLE_MSMPEG4V1_DECODER || \
ENABLE_MSMPEG4V2_DECODER || \
ENABLE_MSMPEG4V3_DECODER || \
ENABLE_WMV2_DECODER)
#define ENABLE_MSMPEG4_ENCODER (ENABLE_MSMPEG4V1_ENCODER || \
ENABLE_MSMPEG4V2_ENCODER || \
ENABLE_MSMPEG4V3_ENCODER || \
ENABLE_WMV2_ENCODER)
#define ENABLE_MSMPEG4 (ENABLE_MSMPEG4_DECODER || ENABLE_MSMPEG4_ENCODER)
#define ENABLE_WMV2 (ENABLE_WMV2_DECODER || ENABLE_WMV2_ENCODER)
#endif /* MSMPEG4_H */
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