From 176629551635fc74e0cba50e0fbe6ebb9c6a2565 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier Date: Tue, 7 Nov 2006 09:46:57 +0000 Subject: [PATCH] add codec_tag and codec_stream_tag to MpegEncContext to not alter avctx values Originally committed as revision 6930 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/h263.c | 8 ++++---- libavcodec/h263dec.c | 14 +++++++------- libavcodec/mpegvideo.c | 4 ++-- libavcodec/mpegvideo.h | 2 ++ 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/libavcodec/h263.c b/libavcodec/h263.c index e5c7238..6a934b5 100644 --- a/libavcodec/h263.c +++ b/libavcodec/h263.c @@ -113,7 +113,7 @@ max run: 29/41 #endif #if 0 //3IV1 is quite rare and it slows things down a tiny bit -#define IS_3IV1 s->avctx->codec_tag == ff_get_fourcc("3IV1") +#define IS_3IV1 s->codec_tag == ff_get_fourcc("3IV1") #else #define IS_3IV1 0 #endif @@ -5294,7 +5294,7 @@ int h263_decode_picture_header(MpegEncContext *s) ); } #if 1 - if (s->pict_type == I_TYPE && s->avctx->codec_tag == ff_get_fourcc("ZYGO")){ + if (s->pict_type == I_TYPE && s->codec_tag == ff_get_fourcc("ZYGO")){ int i,j; for(i=0; i<85; i++) av_log(s->avctx, AV_LOG_DEBUG, "%d", get_bits1(&s->gb)); av_log(s->avctx, AV_LOG_DEBUG, "\n"); @@ -5619,7 +5619,7 @@ static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ skip_bits1(gb); /* marker */ height = get_bits(gb, 13); skip_bits1(gb); /* marker */ - if(width && height && !(s->width && s->avctx->codec_tag == ff_get_fourcc("MP4S"))){ /* they should be non zero but who knows ... */ + if(width && height && !(s->width && s->codec_tag == ff_get_fourcc("MP4S"))){ /* they should be non zero but who knows ... */ s->width = width; s->height = height; // printf("width/height: %d %d\n", width, height); @@ -6063,7 +6063,7 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb) /* search next start code */ align_get_bits(gb); - if(s->avctx->codec_tag == ff_get_fourcc("WV1F") && show_bits(gb, 24) == 0x575630){ + if(s->codec_tag == ff_get_fourcc("WV1F") && show_bits(gb, 24) == 0x575630){ skip_bits(gb, 24); if(get_bits(gb, 8) == 0xF0) return decode_vop_header(s, gb); diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index d691073..66370c1 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -518,19 +518,19 @@ retry: avctx->has_b_frames= !s->low_delay; if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ - if(s->avctx->stream_codec_tag == ff_get_fourcc("XVID") || - s->avctx->codec_tag == ff_get_fourcc("XVID") || s->avctx->codec_tag == ff_get_fourcc("XVIX") || - s->avctx->codec_tag == ff_get_fourcc("RMP4")) + if(s->stream_codec_tag == ff_get_fourcc("XVID") || + s->codec_tag == ff_get_fourcc("XVID") || s->codec_tag == ff_get_fourcc("XVIX") || + s->codec_tag == ff_get_fourcc("RMP4")) s->xvid_build= -1; #if 0 - if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==1 + if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==1 && s->padding_bug_score > 0 && s->low_delay) // XVID with modified fourcc s->xvid_build= -1; #endif } if(s->xvid_build==0 && s->divx_version==0 && s->lavc_build==0){ - if(s->avctx->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) + if(s->codec_tag == ff_get_fourcc("DIVX") && s->vo_type==0 && s->vol_control_parameters==0) s->divx_version= 400; //divx 4 } @@ -540,10 +540,10 @@ retry: } if(s->workaround_bugs&FF_BUG_AUTODETECT){ - if(s->avctx->codec_tag == ff_get_fourcc("XVIX")) + if(s->codec_tag == ff_get_fourcc("XVIX")) s->workaround_bugs|= FF_BUG_XVID_ILACE; - if(s->avctx->codec_tag == ff_get_fourcc("UMP4")){ + if(s->codec_tag == ff_get_fourcc("UMP4")){ s->workaround_bugs|= FF_BUG_UMP4; } diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index dd5565d..8f8c2c1 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -698,12 +698,12 @@ int MPV_common_init(MpegEncContext *s) yc_size = y_size + 2 * c_size; /* convert fourcc to upper case */ - s->avctx->codec_tag= toupper( s->avctx->codec_tag &0xFF) + s->codec_tag= toupper( s->avctx->codec_tag &0xFF) + (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->codec_tag>>24)&0xFF)<<24); - s->avctx->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF) + (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 ) + (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16) + (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24); diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index edeef11..fe53311 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -225,6 +225,8 @@ typedef struct MpegEncContext { int chroma_elim_threshold; int strict_std_compliance; ///< strictly follow the std (MPEG4, ...) int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically + int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag + int stream_codec_tag; ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag /* the following fields are managed internally by the encoder */ /** bit output */ -- 2.7.4