Do not crash on frame size changes.
Fixes issue1481. Originally committed as revision 20730 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d09f65c7ec
commit
b83ccbffe9
16
ffmpeg.c
16
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user