diff options
author | wm4 <wm4@nowhere> | 2019-05-31 14:47:18 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:05 +0200 |
commit | 6646e82daaad4b9febe3b3ae4fd77f573d309cd8 (patch) | |
tree | c96ae3ce69563f2bff234e31cd3676c9998993cb /common | |
parent | 7d3bdb91da4a74ff22fa34c9b0098c56ea165485 (diff) | |
download | mpv-6646e82daaad4b9febe3b3ae4fd77f573d309cd8.tar.bz2 mpv-6646e82daaad4b9febe3b3ae4fd77f573d309cd8.tar.xz |
demux: move timestamp helper macros to common.h
These are probably generally useful.
Diffstat (limited to 'common')
-rw-r--r-- | common/common.h | 8 |
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 |