summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Garrett-Glaser <darkshikari@gmail.com>2009-06-26 01:08:26 +0000
committerJason Garrett-Glaser <darkshikari@gmail.com>2009-06-26 01:08:26 +0000
commit01a3c821a2e07e9df241c35103adb7e3ed23ecad (patch)
treef531a449463aacb8f8410ff350d009c203d86096
parentc2b3565e4a1b97194796f8966ca1f2383729ee9b (diff)
Handle variable input stream pixfmts using the same framework introduced
by the variable frame size patch. Fixes at least issue 1165. Originally committed as revision 19279 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--ffmpeg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 525a05796b..18bf949394 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -256,6 +256,7 @@ typedef struct AVOutputStream {
struct SwsContext *img_resample_ctx; /* for image resampling */
int resample_height;
int resample_width;
+ int resample_pix_fmt;
/* full frame size of first frame */
int original_height;
@@ -938,9 +939,10 @@ static void do_video_out(AVFormatContext *s,
padding_src = NULL;
final_picture = &ost->pict_tmp;
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_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\n", ist->file_index, ist->index, ist->st->codec->width, ist->st->codec->height);
+ 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;
@@ -960,6 +962,7 @@ static void do_video_out(AVFormatContext *s,
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;
/* initialize a new scaler context */
sws_freeContext(ost->img_resample_ctx);
@@ -1937,6 +1940,7 @@ static int av_encode(AVFormatContext **output_files,
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->encoding_needed = 1;