mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
clang-format: Apply formatting
Code submissions have continually suffered from formatting inconsistencies that constantly have to be addressed. Using clang-format simplifies this by making code formatting more consistent, and allows automation of the code formatting so that maintainers can focus more on the code itself instead of code formatting.
This commit is contained in:
+31
-44
@@ -55,9 +55,9 @@
|
||||
#define do_log(level, format, ...) \
|
||||
blog(level, "[Python] " format, ##__VA_ARGS__)
|
||||
|
||||
#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__)
|
||||
#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__)
|
||||
#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__)
|
||||
#define warn(format, ...) do_log(LOG_WARNING, format, ##__VA_ARGS__)
|
||||
#define info(format, ...) do_log(LOG_INFO, format, ##__VA_ARGS__)
|
||||
#define debug(format, ...) do_log(LOG_DEBUG, format, ##__VA_ARGS__)
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
@@ -90,43 +90,40 @@ struct python_obs_callback {
|
||||
PyObject *func;
|
||||
};
|
||||
|
||||
static inline struct python_obs_callback *add_python_obs_callback_extra(
|
||||
struct obs_python_script *script,
|
||||
PyObject *func,
|
||||
size_t extra_size)
|
||||
static inline struct python_obs_callback *
|
||||
add_python_obs_callback_extra(struct obs_python_script *script, PyObject *func,
|
||||
size_t extra_size)
|
||||
{
|
||||
struct python_obs_callback *cb = add_script_callback(
|
||||
&script->first_callback,
|
||||
(obs_script_t *)script,
|
||||
sizeof(*cb) + extra_size);
|
||||
&script->first_callback, (obs_script_t *)script,
|
||||
sizeof(*cb) + extra_size);
|
||||
|
||||
Py_XINCREF(func);
|
||||
cb->func = func;
|
||||
return cb;
|
||||
}
|
||||
|
||||
static inline struct python_obs_callback *add_python_obs_callback(
|
||||
struct obs_python_script *script,
|
||||
PyObject *func)
|
||||
static inline struct python_obs_callback *
|
||||
add_python_obs_callback(struct obs_python_script *script, PyObject *func)
|
||||
{
|
||||
return add_python_obs_callback_extra(script, func, 0);
|
||||
}
|
||||
|
||||
static inline void *python_obs_callback_extra_data(
|
||||
struct python_obs_callback *cb)
|
||||
static inline void *
|
||||
python_obs_callback_extra_data(struct python_obs_callback *cb)
|
||||
{
|
||||
return (void*)&cb[1];
|
||||
return (void *)&cb[1];
|
||||
}
|
||||
|
||||
static inline struct obs_python_script *python_obs_callback_script(
|
||||
struct python_obs_callback *cb)
|
||||
static inline struct obs_python_script *
|
||||
python_obs_callback_script(struct python_obs_callback *cb)
|
||||
{
|
||||
return (struct obs_python_script *)cb->base.script;
|
||||
}
|
||||
|
||||
static inline struct python_obs_callback *find_next_python_obs_callback(
|
||||
struct obs_python_script *script,
|
||||
struct python_obs_callback *cb, PyObject *func)
|
||||
static inline struct python_obs_callback *
|
||||
find_next_python_obs_callback(struct obs_python_script *script,
|
||||
struct python_obs_callback *cb, PyObject *func)
|
||||
{
|
||||
cb = cb ? (struct python_obs_callback *)cb->base.next
|
||||
: (struct python_obs_callback *)script->first_callback;
|
||||
@@ -140,9 +137,8 @@ static inline struct python_obs_callback *find_next_python_obs_callback(
|
||||
return cb;
|
||||
}
|
||||
|
||||
static inline struct python_obs_callback *find_python_obs_callback(
|
||||
struct obs_python_script *script,
|
||||
PyObject *func)
|
||||
static inline struct python_obs_callback *
|
||||
find_python_obs_callback(struct obs_python_script *script, PyObject *func)
|
||||
{
|
||||
return find_next_python_obs_callback(script, NULL, func);
|
||||
}
|
||||
@@ -167,7 +163,8 @@ static inline void free_python_obs_callback(struct python_obs_callback *cb)
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
||||
static int parse_args_(PyObject *args, const char *func, const char *format, ...)
|
||||
static int parse_args_(PyObject *args, const char *func, const char *format,
|
||||
...)
|
||||
{
|
||||
char new_format[128];
|
||||
va_list va_args;
|
||||
@@ -197,15 +194,13 @@ static inline bool py_error_(const char *func, int line)
|
||||
|
||||
#define py_error() py_error_(__FUNCTION__, __LINE__)
|
||||
|
||||
#define lock_python() \
|
||||
PyGILState_STATE gstate = PyGILState_Ensure()
|
||||
#define unlock_python() \
|
||||
PyGILState_Release(gstate)
|
||||
#define lock_python() PyGILState_STATE gstate = PyGILState_Ensure()
|
||||
#define unlock_python() PyGILState_Release(gstate)
|
||||
|
||||
struct py_source;
|
||||
typedef struct py_source py_source_t;
|
||||
|
||||
extern PyObject* py_libobs;
|
||||
extern PyObject *py_libobs;
|
||||
extern struct python_obs_callback *cur_python_cb;
|
||||
extern struct obs_python_script *cur_python_script;
|
||||
|
||||
@@ -213,25 +208,17 @@ extern void py_to_obs_source_info(py_source_t *py_info);
|
||||
extern PyObject *py_obs_register_source(PyObject *self, PyObject *args);
|
||||
extern PyObject *py_obs_get_script_config_path(PyObject *self, PyObject *args);
|
||||
extern void add_functions_to_py_module(PyObject *module,
|
||||
PyMethodDef *method_list);
|
||||
PyMethodDef *method_list);
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
/* Warning: the following functions expect python to be locked! */
|
||||
|
||||
extern bool py_to_libobs_(const char *type,
|
||||
PyObject * py_in,
|
||||
void * libobs_out,
|
||||
const char *id,
|
||||
const char *func,
|
||||
int line);
|
||||
extern bool py_to_libobs_(const char *type, PyObject *py_in, void *libobs_out,
|
||||
const char *id, const char *func, int line);
|
||||
|
||||
extern bool libobs_to_py_(const char *type,
|
||||
void * libobs_in,
|
||||
bool ownership,
|
||||
PyObject ** py_out,
|
||||
const char *id,
|
||||
const char *func,
|
||||
int line);
|
||||
extern bool libobs_to_py_(const char *type, void *libobs_in, bool ownership,
|
||||
PyObject **py_out, const char *id, const char *func,
|
||||
int line);
|
||||
|
||||
extern bool py_call(PyObject *call, PyObject **ret, const char *arg_def, ...);
|
||||
extern bool py_import_script(const char *name);
|
||||
|
||||
Reference in New Issue
Block a user