Will be useful in following commits. --- fftools/ffmpeg_filter.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index 6b92bc074e..3c6c580093 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -55,6 +55,8 @@ static FilterGraphPriv *fgp_from_fg(FilterGraph *fg) typedef struct InputFilterPriv { InputFilter ifilter; + AVRational time_base; + AVFifo *frame_queue; } InputFilterPriv; @@ -969,13 +971,13 @@ static int sub2video_prepare(InputStream *ist, InputFilter *ifilter) static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); + AVFilterContext *last_filter; const AVFilter *buffer_filt = avfilter_get_by_name("buffer"); const AVPixFmtDescriptor *desc; InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; - AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : - ist->st->time_base; AVRational fr = ist->framerate; AVRational sar; AVBPrint args; @@ -1004,6 +1006,9 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, goto fail; } + ifp->time_base = ist->framerate.num ? av_inv_q(ist->framerate) : + ist->st->time_base; + sar = ifilter->sample_aspect_ratio; if(!sar.den) sar = (AVRational){0,1}; @@ -1012,7 +1017,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:" "pixel_aspect=%d/%d", ifilter->width, ifilter->height, ifilter->format, - tb.num, tb.den, sar.num, sar.den); + ifp->time_base.num, ifp->time_base.den, sar.num, sar.den); if (fr.num && fr.den) av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, @@ -1094,6 +1099,7 @@ fail: static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { + InputFilterPriv *ifp = ifp_from_ifilter(ifilter); AVFilterContext *last_filter; const AVFilter *abuffer_filt = avfilter_get_by_name("abuffer"); InputStream *ist = ifilter->ist; @@ -1108,9 +1114,11 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, return AVERROR(EINVAL); } + ifp->time_base = (AVRational){ 1, ifilter->sample_rate }; + av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprintf(&args, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s", - 1, ifilter->sample_rate, + ifp->time_base.num, ifp->time_base.den, ifilter->sample_rate, av_get_sample_fmt_name(ifilter->format)); if (av_channel_layout_check(&ifilter->ch_layout) && -- 2.39.2 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".