summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-16 23:11:01 +0200
committerAnton Khirnov <anton@khirnov.net>2011-05-11 07:32:37 +0200
commit9aa797cd2873562e85d04ea45ef7f49ad2cb07b9 (patch)
treeb82832b1913ac54a0733fe032c761d5d6a9e1434 /ffmpeg.c
parentc29c2eea8fb35682fdfdcb64c4890e8a25137b2a (diff)
ffmpeg: factorize resampling condition check in do_video_out()
Simplify and improve readability. Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it> Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index a5d877a022..647018c083 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1078,7 +1078,7 @@ static void do_video_out(AVFormatContext *s,
AVFrame *in_picture,
int *frame_size)
{
- int nb_frames, i, ret;
+ int nb_frames, i, ret, resample_changed;
AVFrame *final_picture, *formatted_picture, *resampling_dst;
AVCodecContext *enc, *dec;
double sync_ipts;
@@ -1126,9 +1126,11 @@ static void do_video_out(AVFormatContext *s,
final_picture = formatted_picture;
resampling_dst = &ost->pict_tmp;
- if ( ost->resample_height != ist->st->codec->height
- || ost->resample_width != ist->st->codec->width
- || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
+ resample_changed = ost->resample_width != dec->width ||
+ ost->resample_height != dec->height ||
+ ost->resample_pix_fmt != dec->pix_fmt;
+
+ if (resample_changed) {
av_log(NULL, AV_LOG_INFO,
"Input stream #%d.%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
ist->file_index, ist->index,
@@ -1141,10 +1143,7 @@ static void do_video_out(AVFormatContext *s,
#if !CONFIG_AVFILTER
if (ost->video_resample) {
final_picture = &ost->pict_tmp;
- if( ost->resample_height != ist->st->codec->height
- || ost->resample_width != ist->st->codec->width
- || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
-
+ if (resample_changed) {
/* initialize a new scaler context */
sws_freeContext(ost->img_resample_ctx);
ost->img_resample_ctx = sws_getContext(