fftools/ffmpeg_filter: use correct timebase for filter EOF timestamp

It does not need to be equal to demuxer timebase.
pull/389/head
Anton Khirnov 2 years ago
parent 0aada80e73
commit 5b3aeab1bd
  1. 5
      fftools/ffmpeg.c
  2. 2
      fftools/ffmpeg.h
  3. 6
      fftools/ffmpeg_filter.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;
}

@ -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);

@ -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;

Loading…
Cancel
Save