From: Gildas Bazin Date: Wed, 5 Nov 2003 18:59:01 +0000 (+0000) Subject: * include/vlc_codec.h, modules/codec/ffmpeg/encoder.c, modules/stream_out/transcode... X-Git-Tag: 0.7.0~616 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8331d3636cf6be25da00f7ac7077f8aabe467522;p=vlc * include/vlc_codec.h, modules/codec/ffmpeg/encoder.c, modules/stream_out/transcode.c: tell the encoder to respect the aspect ratio of the input. * modules/gui/wxwindows/preferences_widgets.cpp: compilation fix. * src/misc/configuration.c: use strtol() instead of atoi(). --- diff --git a/include/vlc_codec.h b/include/vlc_codec.h index 466e1060ed..5acb0746ee 100644 --- a/include/vlc_codec.h +++ b/include/vlc_codec.h @@ -2,7 +2,7 @@ * vlc_codec.h: codec related structures ***************************************************************************** * Copyright (C) 1999-2003 VideoLAN - * $Id: vlc_codec.h,v 1.2 2003/10/27 01:04:38 gbazin Exp $ + * $Id: vlc_codec.h,v 1.3 2003/11/05 18:59:01 gbazin Exp $ * * Authors: Gildas Bazin * @@ -94,6 +94,7 @@ struct encoder_t /* FIXME: move these to the ffmpeg encoder */ int i_frame_rate; int i_frame_rate_base; + int i_aspect; int i_key_int; int i_b_frames; int i_vtolerance; diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c index 82c4f67efb..230833988f 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.4 2003/11/05 17:46:21 gbazin Exp $ + * $Id: encoder.c,v 1.5 2003/11/05 18:59:01 gbazin Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -150,7 +150,17 @@ int E_(OpenVideoEncoder)( vlc_object_t *p_this ) p_context->bit_rate = p_enc->i_bitrate; p_context->frame_rate = p_enc->i_frame_rate; +#if LIBAVCODEC_BUILD >= 4662 p_context->frame_rate_base= p_enc->i_frame_rate_base; +#endif + +#if LIBAVCODEC_BUILD >= 4687 + p_context->sample_aspect_ratio = + av_d2q( p_enc->i_aspect * p_context->height / p_context->width / + VOUT_ASPECT_FACTOR, 255 ); +#else + p_context->aspect_ratio = ((float)p_enc->i_aspect) / VOUT_ASPECT_FACTOR ); +#endif p_context->gop_size = p_enc->i_key_int >= 0 ? p_enc->i_key_int : 50; p_context->max_b_frames = diff --git a/modules/gui/wxwindows/preferences_widgets.cpp b/modules/gui/wxwindows/preferences_widgets.cpp index 56667a630b..4a47dcaadf 100644 --- a/modules/gui/wxwindows/preferences_widgets.cpp +++ b/modules/gui/wxwindows/preferences_widgets.cpp @@ -2,7 +2,7 @@ * preferences_widgets.cpp : wxWindows plugin for vlc ***************************************************************************** * Copyright (C) 2000-2001 VideoLAN - * $Id: preferences_widgets.cpp,v 1.12 2003/11/05 17:46:21 gbazin Exp $ + * $Id: preferences_widgets.cpp,v 1.13 2003/11/05 18:59:01 gbazin Exp $ * * Authors: Gildas Bazin * Sigmund Augdal @@ -442,7 +442,7 @@ wxString StringListConfigControl::GetPszValue() int selected = combo->GetSelection(); if( selected != -1 ) { - return (char *)combo->GetClientData( selected ); + return wxU((char *)combo->GetClientData( selected )); } return wxString(); } diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index 824bd40127..a693e40347 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.48 2003/10/30 12:01:01 gbazin Exp $ + * $Id: transcode.c,v 1.49 2003/11/05 18:59:01 gbazin Exp $ * * Authors: Laurent Aimar * Gildas Bazin @@ -988,6 +988,16 @@ static int transcode_video_ffmpeg_new( sout_stream_t *p_stream, #if LIBAVCODEC_BUILD >= 4662 id->p_encoder->i_frame_rate_base= id->ff_dec_c->frame_rate_base; #endif + +#if LIBAVCODEC_BUILD >= 4687 + id->p_encoder->i_aspect = VOUT_ASPECT_FACTOR * + ( av_q2d(id->ff_dec_c->sample_aspect_ratio) * + id->ff_dec_c->width / id->ff_dec_c->height ); +#else + id->p_encoder->i_aspect = VOUT_ASPECT_FACTOR * + id->ff_dec_c->aspect_ratio; +#endif + } else { diff --git a/src/misc/configuration.c b/src/misc/configuration.c index 8f153257f8..ebeeeedb3a 100644 --- a/src/misc/configuration.c +++ b/src/misc/configuration.c @@ -2,7 +2,7 @@ * configuration.c management of the modules configuration ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: configuration.c,v 1.68 2003/11/05 17:57:29 gbazin Exp $ + * $Id: configuration.c,v 1.69 2003/11/05 18:59:01 gbazin Exp $ * * Authors: Gildas Bazin * @@ -815,7 +815,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name ) case CONFIG_ITEM_INTEGER: if( !*psz_option_value ) break; /* ignore empty option */ - p_item->i_value = atoi( psz_option_value); + p_item->i_value = strtol( psz_option_value, 0, 0 ); #if 0 msg_Dbg( p_this, "option \"%s\", value %i", p_item->psz_name, p_item->i_value ); @@ -1387,7 +1387,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], config_PutPsz( p_this, psz_name, optarg ); break; case CONFIG_ITEM_INTEGER: - config_PutInt( p_this, psz_name, atoi(optarg)); + config_PutInt( p_this, psz_name, strtol(optarg, 0, 0)); break; case CONFIG_ITEM_FLOAT: config_PutFloat( p_this, psz_name, (float)atof(optarg) ); @@ -1443,7 +1443,7 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], else { config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, - atoi(optarg) ); + strtol(optarg, 0, 0) ); } break; case CONFIG_ITEM_BOOL: