- if (enc->pix_fmt != PIX_FMT_YUV420P) {
- int size;
-
- av_free(buf);
- /* create temporary picture */
- size = avpicture_get_size(enc->pix_fmt, enc->width, enc->height);
- buf = av_malloc(size);
- if (!buf)
- return;
- final_picture = &picture_format_temp;
- avpicture_fill((AVPicture*)final_picture, buf, enc->pix_fmt, enc->width, enc->height);
-
- if (img_convert((AVPicture*)final_picture, enc->pix_fmt,
- (AVPicture*)&ost->pict_tmp, PIX_FMT_YUV420P,
- enc->width, enc->height) < 0) {
-
- if (verbose >= 0)
- fprintf(stderr, "pixel format conversion not handled\n");
-
- goto the_end;
- }
- }
- } else if (ost->video_crop) {
- picture_crop_temp.data[0] = formatted_picture->data[0] +
- (ost->topBand * formatted_picture->linesize[0]) + ost->leftBand;
-
- picture_crop_temp.data[1] = formatted_picture->data[1] +
- ((ost->topBand >> 1) * formatted_picture->linesize[1]) +
- (ost->leftBand >> 1);
-
- picture_crop_temp.data[2] = formatted_picture->data[2] +
- ((ost->topBand >> 1) * formatted_picture->linesize[2]) +
- (ost->leftBand >> 1);
-
- picture_crop_temp.linesize[0] = formatted_picture->linesize[0];
- picture_crop_temp.linesize[1] = formatted_picture->linesize[1];
- picture_crop_temp.linesize[2] = formatted_picture->linesize[2];
- final_picture = &picture_crop_temp;
- } else if (ost->video_pad) {