X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fsetts_bsf.c;h=2558e38f51ce1bd0e000bdef6e651f1e5a9dd2d7;hb=e5af9203098a889f36b759652615046254d45102;hp=302f612412387c4254e69bebb93ceeeabad84a7f;hpb=48a0eb21aac062c3a65d22c48484a2420f452ec6;p=ffmpeg diff --git a/libavcodec/setts_bsf.c b/libavcodec/setts_bsf.c index 302f6124123..2558e38f51c 100644 --- a/libavcodec/setts_bsf.c +++ b/libavcodec/setts_bsf.c @@ -43,6 +43,7 @@ static const char *const var_names[] = { "STARTPTS", ///< PTS at start of movie "STARTDTS", ///< DTS at start of movie "TB", ///< timebase of the stream + "SR", ///< sample rate of the stream NULL }; @@ -59,6 +60,7 @@ enum var_name { VAR_STARTPTS, VAR_STARTDTS, VAR_TB, + VAR_SR, VAR_VARS_NB }; @@ -150,7 +152,8 @@ static int setts_filter(AVBSFContext *ctx, AVPacket *pkt) s->var_values[VAR_PREV_OUTDTS] = s->prev_outdts; s->var_values[VAR_STARTPTS] = s->start_pts; s->var_values[VAR_STARTDTS] = s->start_dts; - s->var_values[VAR_TB] = av_q2d(ctx->time_base_out); + s->var_values[VAR_TB] = ctx->time_base_out.den ? av_q2d(ctx->time_base_out) : 0; + s->var_values[VAR_SR] = ctx->par_in->sample_rate; new_ts = llrint(av_expr_eval(s->ts_expr, s->var_values, NULL));