diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-09-10 11:58:53 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-09-10 18:52:28 +0200 |
commit | 722762f7e1212b4d02142778fabfdd73375722e0 (patch) | |
tree | bed791c1259c4fc4c390edc2dbb1cdc6c4badfb8 /libavfilter/f_setpts.c | |
parent | e14725cecc1941f5b87209b8846dbea34b64a3c1 (diff) | |
download | ffmpeg-722762f7e1212b4d02142778fabfdd73375722e0.tar.gz |
lavfi/setpts: add FRAME_RATE constant
Useful for dealing with constant frame-rate video.
Diffstat (limited to 'libavfilter/f_setpts.c')
-rw-r--r-- | libavfilter/f_setpts.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libavfilter/f_setpts.c b/libavfilter/f_setpts.c index 177d29b383..6227fe02a4 100644 --- a/libavfilter/f_setpts.c +++ b/libavfilter/f_setpts.c @@ -35,6 +35,7 @@ #include "video.h" static const char *const var_names[] = { + "FRAME_RATE", ///< defined only for constant frame-rate video "INTERLACED", ///< tell if the current frame is interlaced "N", ///< frame number (starting at zero) "NB_CONSUMED_SAMPLES", ///< number of samples consumed by the filter (only audio) @@ -54,6 +55,7 @@ static const char *const var_names[] = { }; enum var_name { + VAR_FRAME_RATE, VAR_INTERLACED, VAR_N, VAR_NB_CONSUMED_SAMPLES, @@ -107,8 +109,13 @@ static int config_input(AVFilterLink *inlink) if (setpts->type == AVMEDIA_TYPE_AUDIO) setpts->var_values[VAR_SAMPLE_RATE] = inlink->sample_rate; - av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f SAMPLE_RATE:%f\n", - setpts->var_values[VAR_TB], setpts->var_values[VAR_SAMPLE_RATE]); + setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num && inlink->frame_rate.den ? + av_q2d(inlink->frame_rate) : NAN; + + av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f FRAME_RATE:%f SAMPLE_RATE:%f\n", + setpts->var_values[VAR_TB], + setpts->var_values[VAR_FRAME_RATE], + setpts->var_values[VAR_SAMPLE_RATE]); return 0; } |