aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-12-04 16:20:00 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-12-04 16:20:00 +0000
commitb83ccbffe9b109fcd18dbd178d6b4f300e6d6799 (patch)
tree4db2f2bea0b9cad363eb8be557d1620b042931b8
parentd09f65c7ec0339bcf3b1a3c579e42a8133740bbd (diff)
downloadffmpeg-b83ccbffe9b109fcd18dbd178d6b4f300e6d6799.tar.gz
Do not crash on frame size changes.
Fixes issue1481. Originally committed as revision 20730 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index d3a90ccda6..061d65bd6f 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -941,6 +941,15 @@ static void do_video_out(AVFormatContext *s,
}
}
+ if( (ost->resample_height != (ist->st->codec->height - (ost->topBand + ost->bottomBand)))
+ || (ost->resample_width != (ist->st->codec->width - (ost->leftBand + ost->rightBand)))
+ || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
+
+ fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
+ if(!ost->video_resample)
+ av_exit(1);
+ }
+
if (ost->video_resample) {
padding_src = NULL;
final_picture = &ost->pict_tmp;
@@ -948,7 +957,6 @@ static void do_video_out(AVFormatContext *s,
|| (ost->resample_width != (ist->st->codec->width - (ost->leftBand + ost->rightBand)))
|| (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
- fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
/* keep bands proportional to the frame size */
topBand = ((int64_t)ist->st->codec->height * ost->original_topBand / ost->original_height) & ~1;
bottomBand = ((int64_t)ist->st->codec->height * ost->original_bottomBand / ost->original_height) & ~1;
@@ -1940,11 +1948,11 @@ static int av_encode(AVFormatContext **output_files,
ost->original_height = icodec->height;
ost->original_width = icodec->width;
- ost->resample_height = icodec->height - (frame_topBand + frame_bottomBand);
- ost->resample_width = icodec->width - (frame_leftBand + frame_rightBand);
- ost->resample_pix_fmt= icodec->pix_fmt;
codec->bits_per_raw_sample= 0;
}
+ ost->resample_height = icodec->height - (frame_topBand + frame_bottomBand);
+ ost->resample_width = icodec->width - (frame_leftBand + frame_rightBand);
+ ost->resample_pix_fmt= icodec->pix_fmt;
ost->encoding_needed = 1;
ist->decoding_needed = 1;
break;