From: Gildas Bazin Date: Sun, 7 Dec 2003 12:11:13 +0000 (+0000) Subject: * include/vlc_block_helper.h: small bugfix to block_FindStartcodeFromOffset(). X-Git-Tag: 0.7.0~200 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=3e59b60f0686a4a11bb3dca794586b394371cc56;p=vlc * include/vlc_block_helper.h: small bugfix to block_FindStartcodeFromOffset(). * modules/packetizer/mpegvideo.c: get aspect ratio for MPEG2 video streams (still needs to be done for MPEG1). * modules/codec/libmpeg2.c: use p_dec->fmt_in.video.i_aspect if available. * modules/stream_out/transcode.c, modules/codec/ffmpeg/encoder.c: respect aspect ratio during transcoding. --- diff --git a/include/vlc_block_helper.h b/include/vlc_block_helper.h index f22f7fcf44..69e5b46400 100644 --- a/include/vlc_block_helper.h +++ b/include/vlc_block_helper.h @@ -2,7 +2,7 @@ * vlc_block_helper.h: Helper functions for data blocks management. ***************************************************************************** * Copyright (C) 2003 VideoLAN - * $Id: vlc_block_helper.h,v 1.6 2003/12/06 23:25:23 gbazin Exp $ + * $Id: vlc_block_helper.h,v 1.7 2003/12/07 12:11:13 gbazin Exp $ * * Authors: Gildas Bazin * @@ -501,6 +501,7 @@ static inline int block_FindStartcodeFromOffset( *pi_offset += i_offset; } + *pi_offset -= i_match; return VLC_EGENERIC; } diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c index e290803f8c..8e33375dda 100644 --- a/modules/codec/ffmpeg/encoder.c +++ b/modules/codec/ffmpeg/encoder.c @@ -2,7 +2,7 @@ * encoder.c: video and audio encoder using the ffmpeg library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: encoder.c,v 1.18 2003/12/04 23:15:01 gbazin Exp $ + * $Id: encoder.c,v 1.19 2003/12/07 12:11:13 gbazin Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -183,8 +183,9 @@ int E_(OpenEncoder)( vlc_object_t *p_this ) #if LIBAVCODEC_BUILD >= 4687 p_context->sample_aspect_ratio = - av_d2q( p_enc->fmt_in.video.i_aspect * p_context->height / - p_context->width / VOUT_ASPECT_FACTOR, 255 ); + (AVRational){ p_enc->fmt_in.video.i_aspect * + (int64_t)p_context->height / p_context->width, + VOUT_ASPECT_FACTOR }; #else p_context->aspect_ratio = ((float)p_enc->fmt_in.video.i_aspect) / VOUT_ASPECT_FACTOR; diff --git a/modules/codec/libmpeg2.c b/modules/codec/libmpeg2.c index 8734f0abd9..be775ebf4e 100755 --- a/modules/codec/libmpeg2.c +++ b/modules/codec/libmpeg2.c @@ -2,7 +2,7 @@ * libmpeg2.c: mpeg2 video decoder module making use of libmpeg2. ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: libmpeg2.c,v 1.36 2003/12/05 14:58:03 gbazin Exp $ + * $Id: libmpeg2.c,v 1.37 2003/12/07 12:11:13 gbazin Exp $ * * Authors: Gildas Bazin * Christophe Massiot @@ -233,6 +233,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) if( p_dec->fmt_in.video.i_aspect ) { p_sys->i_aspect = p_dec->fmt_in.video.i_aspect; + if( p_sys->i_aspect <= AR_221_1_PICTURE ) switch( p_sys->i_aspect ) { case AR_3_4_PICTURE: @@ -245,7 +246,6 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block ) p_sys->i_aspect = VOUT_ASPECT_FACTOR * 221 / 100; break; case AR_SQUARE_PICTURE: - default: p_sys->i_aspect = VOUT_ASPECT_FACTOR * p_sys->p_info->sequence->width / p_sys->p_info->sequence->height; diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c index f612389773..0999f96a6a 100644 --- a/modules/packetizer/mpegvideo.c +++ b/modules/packetizer/mpegvideo.c @@ -2,7 +2,7 @@ * mpegvideo.c: parse and packetize an MPEG1/2 video stream ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: mpegvideo.c,v 1.24 2003/12/06 23:25:23 gbazin Exp $ + * $Id: mpegvideo.c,v 1.25 2003/12/07 12:11:13 gbazin Exp $ * * Authors: Laurent Aimar * Eric Petit @@ -512,12 +512,10 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag ) p_frag->p_buffer[9]&0x80 ? VLC_TRUE : VLC_FALSE; } -#if 0 p_dec->fmt_out.video.i_aspect = mpeg2_aspect[p_sys->i_aspect_ratio_info][0] * VOUT_ASPECT_FACTOR / mpeg2_aspect[p_sys->i_aspect_ratio_info][1]; -#endif } else if( i_type == 0x08 ) diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index 321e5d6b73..3a2b8fd7c4 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -2,7 +2,7 @@ * transcode.c ***************************************************************************** * Copyright (C) 2001, 2002 VideoLAN - * $Id: transcode.c,v 1.59 2003/12/06 22:53:07 jpsaman Exp $ + * $Id: transcode.c,v 1.60 2003/12/07 12:11:13 gbazin Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -1057,7 +1057,13 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, id->p_encoder->fmt_in.video.i_aspect = VOUT_ASPECT_FACTOR * id->ff_dec_c->aspect_ratio; #endif + } + /* Check whether a particular aspect ratio was requested */ + if( id->f_src.video.i_aspect ) + { + id->p_encoder->fmt_in.video.i_aspect = id->f_src.video.i_aspect; + id->f_dst.video.i_aspect = id->f_src.video.i_aspect; } id->p_encoder->fmt_out = id->p_encoder->fmt_in;