-#define TBM_LOG_I(fmt, ...) {\
- if (bDlog) {\
- LOGI("[TBM:I] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:I(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_LOG_W(fmt, ...) {\
- if (bDlog) {\
- LOGW("[TBM:W] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:W(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_LOG_E(fmt, ...) {\
- if (bDlog) {\
- LOGE("[TBM:E] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-
-#define TBM_DEBUG(fmt, ...) {\
- if (bDlog) {\
- LOGE("[TBM_DEBUG] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__);\
- } \
-}
-
-#ifdef TRACE
-#define TBM_TRACE(fmt, ...) {\
- if (bDlog) {\
- if (bTrace&0x1) LOGE("[TBM:TRACE] " fmt, ##__VA_ARGS__);\
- } \
- else {\
- if (bTrace&0x1) fprintf(stderr, "[TBM:TRACE(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\
- } \
-}
-#else
-#define TBM_TRACE(fmt, ...)
-#endif /* TRACE */
-
-#else
-#define TBM_LOG_D(fmt, ...) fprintf(stderr, "[TBM:D(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_I(fmt, ...) fprintf(stderr, "[TBM:I(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_W(fmt, ...) fprintf(stderr, "[TBM:W(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_LOG_E(fmt, ...) fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__)
-#define TBM_DEBUG(fmt, ...) fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__)
-#ifdef TRACE
-#define TBM_TRACE(fmt, ...) { if (bTrace&0x1) fprintf(stderr, "[TBM:TRACE(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__); }
-#else
-#define TBM_TRACE(fmt, ...)
-#endif /* TRACE */
-#endif /* HAVE_DLOG */
-
-/* check condition */
-#define TBM_RETURN_IF_FAIL(cond) {\
- if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
- return;\
- } \
-}
-#define TBM_RETURN_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
- return val;\
- } \
-}
-#define TBM_GOTO_VAL_IF_FAIL(cond, val) {\
- if (!(cond)) {\
- TBM_LOG_E("'%s' failed.\n", #cond);\
- goto val;\
- } \
-}
+#define C(b, m) (((b) >> (m)) & 0xFF)
+#define B(c, s) ((((unsigned int)(c)) & 0xff) << (s))
+#define FOURCC(a, b, c, d) (B(d, 24) | B(c, 16) | B(b, 8) | B(a, 0))
+#define FOURCC_STR(id) C(id, 0), C(id, 8), C(id, 16), C(id, 24)
+#define FOURCC_ID(str) FOURCC(((char*)str)[0], ((char*)str)[1], ((char*)str)[2], ((char*)str)[3])