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;
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;
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);
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;
if (!codec)
codec = avcodec_find_encoder(ost->st->codec->codec_id);
if (!codec) {
- snprintf(error, sizeof(error), "Unsupported codec for output stream #%d.%d",
- ost->file_index, ost->index);
+ snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d",
+ ost->st->codec->codec_id, ost->file_index, ost->index);
ret = AVERROR(EINVAL);
goto dump_format;
}
if (avcodec_open(ost->st->codec, codec) < 0) {
- snprintf(error, sizeof(error), "Error while opening codec for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
+ snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height",
ost->file_index, ost->index);
ret = AVERROR(EINVAL);
goto dump_format;
if (!codec)
codec = avcodec_find_decoder(ist->st->codec->codec_id);
if (!codec) {
- snprintf(error, sizeof(error), "Unsupported codec (id=%d) for input stream #%d.%d",
+ snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d",
ist->st->codec->codec_id, ist->file_index, ist->index);
ret = AVERROR(EINVAL);
goto dump_format;
}
if (avcodec_open(ist->st->codec, codec) < 0) {
- snprintf(error, sizeof(error), "Error while opening codec for input stream #%d.%d",
+ snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d",
ist->file_index, ist->index);
ret = AVERROR(EINVAL);
goto dump_format;
{
AVStream *st;
AVCodecContext *video_enc;
- int codec_id;
+ enum CodecID codec_id;
st = av_new_stream(oc, oc->nb_streams);
if (!st) {
{
AVStream *st;
AVCodecContext *audio_enc;
- int codec_id;
+ enum CodecID codec_id;
st = av_new_stream(oc, oc->nb_streams);
if (!st) {