Revision 2beac7c3 ffmpeg.c
ffmpeg.c | ||
---|---|---|
285 | 285 |
AVBitStreamFilterContext *bitstream_filters; |
286 | 286 |
/* video only */ |
287 | 287 |
int video_resample; |
288 |
AVFrame pict_tmp; /* temporary image for resampling */
|
|
288 |
AVFrame resample_frame; /* temporary frame for image resampling */
|
|
289 | 289 |
struct SwsContext *img_resample_ctx; /* for image resampling */ |
290 | 290 |
int resample_height; |
291 | 291 |
int resample_width; |
... | ... | |
1214 | 1214 |
dec->pix_fmt != enc->pix_fmt; |
1215 | 1215 |
|
1216 | 1216 |
if (ost->video_resample) { |
1217 |
final_picture = &ost->pict_tmp;
|
|
1217 |
final_picture = &ost->resample_frame;
|
|
1218 | 1218 |
if (!ost->img_resample_ctx || resample_changed) { |
1219 | 1219 |
/* initialize the destination picture */ |
1220 |
if (!ost->pict_tmp.data[0]) {
|
|
1221 |
avcodec_get_frame_defaults(&ost->pict_tmp);
|
|
1222 |
if (avpicture_alloc((AVPicture *)&ost->pict_tmp, enc->pix_fmt,
|
|
1220 |
if (!ost->resample_frame.data[0]) {
|
|
1221 |
avcodec_get_frame_defaults(&ost->resample_frame);
|
|
1222 |
if (avpicture_alloc((AVPicture *)&ost->resample_frame, enc->pix_fmt,
|
|
1223 | 1223 |
enc->width, enc->height)) { |
1224 | 1224 |
fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n"); |
1225 | 1225 |
ffmpeg_exit(1); |
... | ... | |
1237 | 1237 |
} |
1238 | 1238 |
} |
1239 | 1239 |
sws_scale(ost->img_resample_ctx, formatted_picture->data, formatted_picture->linesize, |
1240 |
0, ost->resample_height, ost->pict_tmp.data, ost->pict_tmp.linesize);
|
|
1240 |
0, ost->resample_height, ost->resample_frame.data, ost->resample_frame.linesize);
|
|
1241 | 1241 |
} |
1242 | 1242 |
#endif |
1243 | 1243 |
|
... | ... | |
2789 | 2789 |
av_fifo_free(ost->fifo); /* works even if fifo is not |
2790 | 2790 |
initialized but set to zero */ |
2791 | 2791 |
av_freep(&ost->st->codec->subtitle_header); |
2792 |
av_free(ost->pict_tmp.data[0]);
|
|
2792 |
av_free(ost->resample_frame.data[0]);
|
|
2793 | 2793 |
av_free(ost->forced_kf_pts); |
2794 | 2794 |
if (ost->video_resample) |
2795 | 2795 |
sws_freeContext(ost->img_resample_ctx); |
Also available in: Unified diff