[FFmpeg-devel] [PATCH] lavfi/setpts: set SAMPLE_RATE to NAN when input is no audio

Stefano Sabatini stefasab at gmail.com
Mon Sep 10 12:06:49 CEST 2012


Should be more robust/consistent.
---
 libavfilter/f_setpts.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/f_setpts.c b/libavfilter/f_setpts.c
index 61446c1..2afdc65 100644
--- a/libavfilter/f_setpts.c
+++ b/libavfilter/f_setpts.c
@@ -106,8 +106,8 @@ static int config_input(AVFilterLink *inlink)
     setpts->type = inlink->type;
     setpts->var_values[VAR_TB] = av_q2d(inlink->time_base);
 
-    if (setpts->type == AVMEDIA_TYPE_AUDIO)
-        setpts->var_values[VAR_SAMPLE_RATE] = inlink->sample_rate;
+    setpts->var_values[VAR_SAMPLE_RATE] =
+        setpts->type == AVMEDIA_TYPE_AUDIO ? inlink->sample_rate : NAN;
 
     setpts->var_values[VAR_FRAME_RATE] = inlink->frame_rate.num && inlink->frame_rate.den ?
         av_q2d(inlink->frame_rate) : NAN;
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list