[FFmpeg-cvslog] avfilter: add D2TS, TS2D, TS2T as a common macro in internal.h

Limin Wang git at videolan.org
Sat Jun 20 02:56:51 EEST 2020


ffmpeg | branch: master | Limin Wang <lance.lmwang at gmail.com> | Tue Jun  2 00:14:45 2020 +0800| [548ef7a12b565dff5dc418b378ec158a5566a127] | committer: Limin Wang

avfilter: add D2TS, TS2D, TS2T as a common macro in internal.h

Signed-off-by: Limin Wang <lance.lmwang at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=548ef7a12b565dff5dc418b378ec158a5566a127
---

 libavfilter/aeval.c       | 2 --
 libavfilter/af_volume.c   | 4 ----
 libavfilter/f_select.c    | 3 ---
 libavfilter/f_sendcmd.c   | 3 ---
 libavfilter/internal.h    | 4 ++++
 libavfilter/setpts.c      | 4 ----
 libavfilter/vf_delogo.c   | 1 -
 libavfilter/vf_eq.c       | 2 --
 libavfilter/vf_hue.c      | 3 ---
 libavfilter/vf_rotate.c   | 2 --
 libavfilter/vf_scale.c    | 2 --
 libavfilter/vf_vignette.c | 3 ---
 12 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/libavfilter/aeval.c b/libavfilter/aeval.c
index 32cd6de043..855dc0009d 100644
--- a/libavfilter/aeval.c
+++ b/libavfilter/aeval.c
@@ -416,8 +416,6 @@ static int aeval_config_output(AVFilterLink *outlink)
     return 0;
 }
 
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
     EvalContext *eval     = inlink->dst->priv;
diff --git a/libavfilter/af_volume.c b/libavfilter/af_volume.c
index 213c57195a..5fc00d82a4 100644
--- a/libavfilter/af_volume.c
+++ b/libavfilter/af_volume.c
@@ -335,10 +335,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
     return ret;
 }
 
-#define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
 {
     AVFilterContext *ctx = inlink->dst;
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index 755e10a399..92938c33aa 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -325,9 +325,6 @@ static double get_concatdec_select(AVFrame *frame, int64_t pts)
     return NAN;
 }
 
-#define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-
 static void select_frame(AVFilterContext *ctx, AVFrame *frame)
 {
     SelectContext *select = ctx->priv;
diff --git a/libavfilter/f_sendcmd.c b/libavfilter/f_sendcmd.c
index 0ac87e07ef..6b02669afa 100644
--- a/libavfilter/f_sendcmd.c
+++ b/libavfilter/f_sendcmd.c
@@ -475,9 +475,6 @@ static av_cold void uninit(AVFilterContext *ctx)
     av_freep(&s->intervals);
 }
 
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
 {
     AVFilterContext *ctx = inlink->dst;
diff --git a/libavfilter/internal.h b/libavfilter/internal.h
index abe7537b5d..6cb601f36f 100644
--- a/libavfilter/internal.h
+++ b/libavfilter/internal.h
@@ -234,6 +234,10 @@ void ff_avfilter_link_set_out_status(AVFilterLink *link, int status, int64_t pts
 
 void ff_command_queue_pop(AVFilterContext *filter);
 
+#define D2TS(d)      (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
+#define TS2D(ts)     ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
+#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
+
 /* misc trace functions */
 
 #define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
diff --git a/libavfilter/setpts.c b/libavfilter/setpts.c
index c7c3836274..6506653c18 100644
--- a/libavfilter/setpts.c
+++ b/libavfilter/setpts.c
@@ -142,10 +142,6 @@ static int config_input(AVFilterLink *inlink)
     return 0;
 }
 
-#define D2TS(d)  (isnan(d) ? AV_NOPTS_VALUE : (int64_t)(d))
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 #define BUF_SIZE 64
 
 static inline char *double2int64str(char *buf, double v)
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index e55673d5ad..6069c30163 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -55,7 +55,6 @@ enum var_name {
     VAR_T,
     VAR_VARS_NB
 };
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
 
 static int set_expr(AVExpr **pexpr, const char *expr, const char *option, void *log_ctx)
 {
diff --git a/libavfilter/vf_eq.c b/libavfilter/vf_eq.c
index c8c3d5b340..114781fcaf 100644
--- a/libavfilter/vf_eq.c
+++ b/libavfilter/vf_eq.c
@@ -249,8 +249,6 @@ static int query_formats(AVFilterContext *ctx)
     return ff_set_common_formats(ctx, fmts_list);
 }
 
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 {
     AVFilterContext *ctx = inlink->dst;
diff --git a/libavfilter/vf_hue.c b/libavfilter/vf_hue.c
index b75ef21058..1499c05cbd 100644
--- a/libavfilter/vf_hue.c
+++ b/libavfilter/vf_hue.c
@@ -363,9 +363,6 @@ static void apply_lut10(HueContext *s,
     }
 }
 
-#define TS2D(ts) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
-
 static int filter_frame(AVFilterLink *inlink, AVFrame *inpic)
 {
     HueContext *hue = inlink->dst->priv;
diff --git a/libavfilter/vf_rotate.c b/libavfilter/vf_rotate.c
index 02f56c6ebc..65c6cc411a 100644
--- a/libavfilter/vf_rotate.c
+++ b/libavfilter/vf_rotate.c
@@ -415,8 +415,6 @@ static av_always_inline void simple_rotate(uint8_t *dst, const uint8_t *src, int
     }
 }
 
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts)*av_q2d(tb))
-
 static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
 {
     ThreadData *td = arg;
diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index f92529e7c8..ff69bb138f 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -647,8 +647,6 @@ static int scale_slice(AVFilterLink *link, AVFrame *out_buf, AVFrame *cur_pic, s
                          out,out_stride);
 }
 
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
-
 static int scale_frame(AVFilterLink *link, AVFrame *in, AVFrame **frame_out)
 {
     AVFilterContext *ctx = link->dst;
diff --git a/libavfilter/vf_vignette.c b/libavfilter/vf_vignette.c
index 47b59e5ba0..ecb04a9643 100644
--- a/libavfilter/vf_vignette.c
+++ b/libavfilter/vf_vignette.c
@@ -155,9 +155,6 @@ static double get_natural_factor(const VignetteContext *s, int x, int y)
     }
 }
 
-#define TS2D(ts)     ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts))
-#define TS2T(ts, tb) ((ts) == AV_NOPTS_VALUE ? NAN : (double)(ts) * av_q2d(tb))
-
 static void update_context(VignetteContext *s, AVFilterLink *inlink, AVFrame *frame)
 {
     int x, y;



More information about the ffmpeg-cvslog mailing list