summaryrefslogtreecommitdiffstats
path: root/common/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/common.h')
-rw-r--r--common/common.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/common.h b/common/common.h
index dfb2ba7b7a..de4c751baf 100644
--- a/common/common.h
+++ b/common/common.h
@@ -44,6 +44,14 @@
#define MP_ALIGN_UP(x, align) (((x) + (align) - 1) & ~((align) - 1))
#define MP_ALIGN_DOWN(x, align) ((x) & ~((align) - 1))
+// Return "a", or if that is NOPTS, return "def".
+#define MP_PTS_OR_DEF(a, def) ((a) == MP_NOPTS_VALUE ? (def) : (a))
+// If one of the values is NOPTS, always pick the other one.
+#define MP_PTS_MIN(a, b) MPMIN(MP_PTS_OR_DEF(a, b), MP_PTS_OR_DEF(b, a))
+#define MP_PTS_MAX(a, b) MPMAX(MP_PTS_OR_DEF(a, b), MP_PTS_OR_DEF(b, a))
+// Return a+b, unless a is NOPTS. b must not be NOPTS.
+#define MP_ADD_PTS(a, b) ((a) == MP_NOPTS_VALUE ? (a) : ((a) + (b)))
+
#define CONTROL_OK 1
#define CONTROL_TRUE 1
#define CONTROL_FALSE 0