diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2015-11-03 09:57:23 -0800 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2015-11-09 08:09:41 +0100 |
commit | 018bdaed37d2f1735dbecfc58309a1a164abadd5 (patch) | |
tree | e7eba4b2846374f78d06ea792539c6660a15f483 /libavfilter/setpts.c | |
parent | 5e91a5c5cf1db88f254b4c358eb1b06ff6ca274f (diff) | |
download | ffmpeg-018bdaed37d2f1735dbecfc58309a1a164abadd5.tar.gz |
setpts: add FRAME_RATE constant
Useful for dealing with constant frame-rate video.
(cherry picked from ffmpeg commit 722762f7e1212b4d02142778fabfdd73375722e0)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/setpts.c')
-rw-r--r-- | libavfilter/setpts.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c index 98bafc284a..6519790ba6 100644 --- a/libavfilter/setpts.c +++ b/libavfilter/setpts.c @@ -41,6 +41,7 @@ static const char *const var_names[] = { "E", ///< Euler number + "FRAME_RATE", ///< defined only for constant frame-rate video "INTERLACED", ///< tell if the current frame is interlaced "N", ///< frame / sample number (starting at zero) "PHI", ///< golden ratio @@ -59,6 +60,7 @@ static const char *const var_names[] = { enum var_name { VAR_E, + VAR_FRAME_RATE, VAR_INTERLACED, VAR_N, VAR_PHI, @@ -115,6 +117,13 @@ static int config_input(AVFilterLink *inlink) setpts->var_values[VAR_SR] = inlink->sample_rate; } + setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num && + inlink->frame_rate.den ? + av_q2d(inlink->frame_rate) : NAN; + + // Indicate the output can be variable framerate. + inlink->frame_rate = (AVRational){1, 0}; + av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f\n", setpts->var_values[VAR_TB]); return 0; } |