[FFmpeg-cvslog] r20730 - trunk/ffmpeg.c
michael
subversion
Fri Dec 4 17:20:00 CET 2009
Author: michael
Date: Fri Dec 4 17:20:00 2009
New Revision: 20730
Log:
Do not crash on frame size changes.
Fixes issue1481.
Modified:
trunk/ffmpeg.c
Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c Fri Dec 4 16:12:09 2009 (r20729)
+++ trunk/ffmpeg.c Fri Dec 4 17:20:00 2009 (r20730)
@@ -941,6 +941,15 @@ static void do_video_out(AVFormatContext
}
}
+ 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
|| (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 **o
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;
More information about the ffmpeg-cvslog
mailing list