Skip to content
Snippets Groups Projects
Commit 018bdaed authored by Stefano Sabatini's avatar Stefano Sabatini Committed by Anton Khirnov
Browse files

setpts: add FRAME_RATE constant


Useful for dealing with constant frame-rate video.

(cherry picked from ffmpeg commit 722762f7)

Signed-off-by: default avatarAnton Khirnov <anton@khirnov.net>
parent 5e91a5c5
No related branches found
No related tags found
No related merge requests found
...@@ -209,6 +209,9 @@ The expression is evaluated through the eval API and can contain the following ...@@ -209,6 +209,9 @@ The expression is evaluated through the eval API and can contain the following
constants: constants:
@table @option @table @option
@item FRAME_RATE
frame rate, only defined for constant frame-rate video
@item PTS @item PTS
the presentation timestamp in input the presentation timestamp in input
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
static const char *const var_names[] = { static const char *const var_names[] = {
"E", ///< Euler number "E", ///< Euler number
"FRAME_RATE", ///< defined only for constant frame-rate video
"INTERLACED", ///< tell if the current frame is interlaced "INTERLACED", ///< tell if the current frame is interlaced
"N", ///< frame / sample number (starting at zero) "N", ///< frame / sample number (starting at zero)
"PHI", ///< golden ratio "PHI", ///< golden ratio
...@@ -59,6 +60,7 @@ static const char *const var_names[] = { ...@@ -59,6 +60,7 @@ static const char *const var_names[] = {
enum var_name { enum var_name {
VAR_E, VAR_E,
VAR_FRAME_RATE,
VAR_INTERLACED, VAR_INTERLACED,
VAR_N, VAR_N,
VAR_PHI, VAR_PHI,
...@@ -115,6 +117,13 @@ static int config_input(AVFilterLink *inlink) ...@@ -115,6 +117,13 @@ static int config_input(AVFilterLink *inlink)
setpts->var_values[VAR_SR] = inlink->sample_rate; 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]); av_log(inlink->src, AV_LOG_VERBOSE, "TB:%f\n", setpts->var_values[VAR_TB]);
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment