[FFmpeg-cvslog] r19279 - trunk/ffmpeg.c
darkshikari
subversion
Fri Jun 26 03:08:26 CEST 2009
Author: darkshikari
Date: Fri Jun 26 03:08:26 2009
New Revision: 19279
Log:
Handle variable input stream pixfmts using the same framework introduced
by the variable frame size patch. Fixes at least issue 1165.
Modified:
trunk/ffmpeg.c
Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c Fri Jun 26 01:21:40 2009 (r19278)
+++ trunk/ffmpeg.c Fri Jun 26 03:08:26 2009 (r19279)
@@ -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
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
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 **o
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;
More information about the ffmpeg-cvslog
mailing list