[FFmpeg-cvslog] fftools/ffmpeg_filter: use correct timebase for filter EOF timestamp
Anton Khirnov
git at videolan.org
Tue May 2 12:31:19 EEST 2023
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Wed Apr 26 00:00:02 2023 +0200| [5b3aeab1bd04e0c63b1c7a342874b5feefafa467] | committer: Anton Khirnov
fftools/ffmpeg_filter: use correct timebase for filter EOF timestamp
It does not need to be equal to demuxer timebase.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5b3aeab1bd04e0c63b1c7a342874b5feefafa467
---
fftools/ffmpeg.c | 5 +----
fftools/ffmpeg.h | 2 +-
fftools/ffmpeg_filter.c | 6 +++++-
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 453d3763be..eae0093cce 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1320,12 +1320,9 @@ static int transcode_subtitles(InputStream *ist, const AVPacket *pkt,
static int send_filter_eof(InputStream *ist)
{
int i, ret;
- /* TODO keep pts also in stream time base to avoid converting back */
- int64_t pts = av_rescale_q_rnd(ist->pts, AV_TIME_BASE_Q, ist->st->time_base,
- AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
for (i = 0; i < ist->nb_filters; i++) {
- ret = ifilter_send_eof(ist->filters[i], pts);
+ ret = ifilter_send_eof(ist->filters[i], ist->pts, AV_TIME_BASE_Q);
if (ret < 0)
return ret;
}
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 07322fdd79..c07a1b86b6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -788,7 +788,7 @@ int init_complex_filtergraph(FilterGraph *fg);
void sub2video_update(InputStream *ist, int64_t heartbeat_pts, AVSubtitle *sub);
int ifilter_send_frame(InputFilter *ifilter, AVFrame *frame, int keep_reference);
-int ifilter_send_eof(InputFilter *ifilter, int64_t pts);
+int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb);
int ifilter_parameters_from_codecpar(InputFilter *ifilter, AVCodecParameters *par);
int ifilter_has_all_input_formats(FilterGraph *fg);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 43eb8c94a5..8c408eb7c4 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1454,13 +1454,17 @@ int reap_filters(int flush)
return 0;
}
-int ifilter_send_eof(InputFilter *ifilter, int64_t pts)
+int ifilter_send_eof(InputFilter *ifilter, int64_t pts, AVRational tb)
{
+ InputFilterPriv *ifp = ifp_from_ifilter(ifilter);
int ret;
ifilter->eof = 1;
if (ifilter->filter) {
+ pts = av_rescale_q_rnd(pts, tb, ifp->time_base,
+ AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX);
+
ret = av_buffersrc_close(ifilter->filter, pts, AV_BUFFERSRC_FLAG_PUSH);
if (ret < 0)
return ret;
More information about the ffmpeg-cvslog
mailing list