forked from DeaDBeeF-Player/deadbeef
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
86 lines (72 loc) · 3.18 KB
/
common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
This file is part of Deadbeef Player source code
http://deadbeef.sourceforge.net
utility routines and global variables
Copyright (C) 2009-2013 Alexey Yakovenko
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Alexey Yakovenko [email protected]
*/
#ifndef __COMMON_H
#define __COMMON_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <limits.h>
#include "deadbeef.h"
#define min(x,y) ((x)<(y)?(x):(y))
#define max(x,y) ((x)>(y)?(x):(y))
// specific directories
#ifdef __MINGW32__
#define HOMEDIR "USERPROFILE"
#define LOCALDIR "XDG_LOCAL_HOME"
#define CONFIGDIR "APPDATA"
#define CACHEDIR "LOCALAPPDATA"
#define RUNTIMEDIR "NORUNTIMEDIR"
// used in plugins.c (%s is home directory, %d is arch bit number)
#define LOCAL_PLUGINS_DIR "%s/AppData/Roaming/deadbeef/plugins"
#define LOCAL_ARCH_PLUGINS_DIR "%s/AppData/Roaming/deadbeef/plugins%d"
#else
#define HOMEDIR "HOME"
#define LOCALDIR "XDG_LOCAL_HOME"
#define CONFIGDIR "XDG_CONFIG_HOME"
#define CACHEDIR "XDG_CACHE_HOME"
#define RUNTIMEDIR "XDG_RUNTIME_DIR"
// used in plugins.c (%s is home directory, %d is arch bit number)
#define LOCAL_PLUGINS_DIR "%s/.local/lib/deadbeef"
#define LOCAL_ARCH_PLUGINS_DIR "%s/.local/lib%d/deadbeef"
#endif
// those are defined in main.c
extern char confdir[PATH_MAX]; // $HOME/.config
extern char dbconfdir[PATH_MAX]; // $HOME/.config/deadbeef
extern char dbinstalldir[PATH_MAX]; // see deadbeef->get_prefix
extern char dbdocdir[PATH_MAX]; // see deadbeef->get_doc_dir
extern char dbplugindir[PATH_MAX]; // see deadbeef->get_plugin_dir
extern char dbpixmapdir[PATH_MAX]; // see deadbeef->get_pixmap_dir
extern char dbcachedir[PATH_MAX];
// parses a list of paths and adds them to playlist
// 0 - no error, files loaded
// 1 - no error, but files not loaded
int
add_paths(const char *paths, int len, int queue, char *sendback, int sbsize);
// This is a fake plugin, representing the deadbeef core module.
// The intention is that it's only used in combination with logger,
// which is based on the plugin interface.
extern DB_plugin_t main_plugin;
// In the core, we want the "trace" to be low priority messages,
// and "trace_err" is for criticals, needing extra attention
extern DB_functions_t *deadbeef;
#define trace(...) { deadbeef->log_detailed (&main_plugin, DDB_LOG_LAYER_INFO, __VA_ARGS__); }
#define trace_err(...) { deadbeef->log_detailed (&main_plugin, DDB_LOG_LAYER_DEFAULT, __VA_ARGS__); }
#endif // __COMMON_H