Commit 3e59b60f authored by Gildas Bazin's avatar Gildas Bazin

* 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.
parent e9a76497
......@@ -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 <gbazin@netcourrier.com>
*
......@@ -501,6 +501,7 @@ static inline int block_FindStartcodeFromOffset(
*pi_offset += i_offset;
}
*pi_offset -= i_match;
return VLC_EGENERIC;
}
......
......@@ -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 <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -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;
......
......@@ -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 <gbazin@netcourrier.com>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -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;
......
......@@ -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 <fenrir@via.ecp.fr>
* Eric Petit <titer@videolan.org>
......@@ -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 )
......
......@@ -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 <fenrir@via.ecp.fr>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -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;
......
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