Debian Codegraph @

src/util/logging.h

raw
1 /*
2 * This file is part of libbdplus
3 * Copyright (C) 2008-2010 Accident
4 * Copyright (C) 2009-2010 Obliter0n
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
19 */
20
21 #ifndef LOGGING_H_
22 #define LOGGING_H_
23
24 #include "attributes.h"
25
26 #include <stdint.h>
27
28 enum debug_mask_enum {
29 DBG_RESERVED = 0x0001,
30 DBG_CONFIGFILE = 0x0002,
31 DBG_FILE = 0x0004,
32 //DBG_AACS = 0x0008,
33 //DBG_MKB = 0x0010,
34 //DBG_MMC = 0x0020,
35 DBG_BLURAY = 0x0040,
36 DBG_DIR = 0x0080,
37 //DBG_NAV = 0x0100,
38 DBG_BDPLUS = 0x0200,
39 DBG_DLX = 0x0400,
40 DBG_CRIT = 0x0800, // this is libbluray's default debug mask so use this if you want to display critical info
41 //DBG_HDMV = 0x1000,
42
43 DBG_BDPLUS_TRAP = 0x100000 | DBG_BDPLUS,
44 DBG_BDPLUS_EVENT = 0x200000 | DBG_BDPLUS,
45 };
46
47 typedef enum debug_mask_enum debug_mask_t;
48
49 BD_PRIVATE extern uint32_t debug_mask;
50
51 #define BD_DEBUG(MASK,...) \
52 do { \
53 if (BD_UNLIKELY((MASK) & debug_mask)) { \
54 bd_debug(__FILE__,__LINE__,MASK,__VA_ARGS__); \
55 } \
56 } while (0)
57
58 BD_PRIVATE void bd_debug(const char *file, int line, uint32_t mask, const char *format, ...) BD_ATTR_FORMAT_PRINTF(4,5);
59
60
61 #endif /* LOGGING_H_ */