[FFmpeg-devel] [PATCH] ffmpeg: simplify mid-stream reconfiguration when libavfilter is disabled
Stefano Sabatini
stefano.sabatini-lala at poste.it
Fri May 6 11:36:29 CEST 2011
On date Friday 2011-05-06 11:16:00 +0200, Stefano Sabatini encoded:
> Implement lazy initialization of the image resample context, so that
> the initialization code does not need to be duplicated.
>
> Also manage the case in which resample/size change mid-stream. For
> each packet the code computes if resampling is needed.
>
> Previously the resample check was done only at the initialization, in
> case size/format changed and no resample was detected at the init
> stage ffmpeg was silently exiting.
> ---
> ffmpeg.c | 41 +++++++++++++++++------------------------
> 1 files changed, 17 insertions(+), 24 deletions(-)
>
> diff --git a/ffmpeg.c b/ffmpeg.c
[...]
> @@ -2290,27 +2304,6 @@ static int transcode(AVFormatContext **output_files,
> codec->height != icodec->height ||
> codec->pix_fmt != icodec->pix_fmt;
> if (ost->video_resample) {
> -#if !CONFIG_AVFILTER
> - avcodec_get_frame_defaults(&ost->pict_tmp);
> - if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt,
> - codec->width, codec->height)) {
> - fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
> - ffmpeg_exit(1);
> - }
> - sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
> - ost->img_resample_ctx = sws_getContext(
> - icodec->width,
> - icodec->height,
> - icodec->pix_fmt,
> - codec->width,
> - codec->height,
> - codec->pix_fmt,
> - sws_flags, NULL, NULL, NULL);
> - if (ost->img_resample_ctx == NULL) {
> - fprintf(stderr, "Cannot get resampling context\n");
> - ffmpeg_exit(1);
> - }
> -#endif
> codec->bits_per_raw_sample= frame_bits_per_raw_sample;
BTW what's the point of this? Is it really required? Why is it set
only in case of video resampling?
--
FFmpeg = Fiendish and Free Meaningless Practical Elitarian Guide
More information about the ffmpeg-devel
mailing list