From c395e1326135317317119ff1ff8a995881d40fff Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 3 Jan 2017 22:50:30 -0500 Subject: [PATCH] allow downscaling too --- record/drivers/record_ffmpeg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/record/drivers/record_ffmpeg.c b/record/drivers/record_ffmpeg.c index c1213d3a40..21a1ee5fdf 100644 --- a/record/drivers/record_ffmpeg.c +++ b/record/drivers/record_ffmpeg.c @@ -183,7 +183,7 @@ struct ff_config_param unsigned threads; unsigned frame_drop_ratio; unsigned sample_rate; - unsigned scale_factor; + float scale_factor; bool audio_enable; /* Keep same naming conventions as libavcodec. */ @@ -477,8 +477,8 @@ static bool ffmpeg_init_video(ffmpeg_t *handle) /* Useful to set scale_factor to 2 for chroma subsampled formats to * maintain full chroma resolution. (Or just use 4:4:4 or RGB ...) */ - param->out_width *= params->scale_factor; - param->out_height *= params->scale_factor; + param->out_width = (float)param->out_width * params->scale_factor; + param->out_height = (float)param->out_height * params->scale_factor; video->codec->codec_type = AVMEDIA_TYPE_VIDEO; video->codec->width = param->out_width; @@ -567,7 +567,7 @@ static bool ffmpeg_init_config(struct ff_config_param *params, params->audio_enable = true; config_get_uint(params->conf, "sample_rate", ¶ms->sample_rate); - config_get_uint(params->conf, "scale_factor", ¶ms->scale_factor); + config_get_float(params->conf, "scale_factor", ¶ms->scale_factor); params->audio_qscale = config_get_int(params->conf, "audio_global_quality", ¶ms->audio_global_quality);