1
mirror of https://github.com/mpv-player/mpv synced 2025-05-01 10:07:24 +02:00

various: reduce the include scope of some public headers

This commit is contained in:
Kacper Michajłow 2025-02-22 07:25:55 +01:00
parent b848ffad12
commit 77313f73a2
16 changed files with 30 additions and 24 deletions

@ -1,6 +1,8 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <time.h> #include <time.h>
#include <libmpv/client.h>
#include "common.h" #include "common.h"
#include "global.h" #include "global.h"
#include "misc/linked_list.h" #include "misc/linked_list.h"

@ -23,8 +23,6 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <unistd.h> #include <unistd.h>
#include <libmpv/client.h>
#include "common.h" #include "common.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)

@ -20,8 +20,6 @@
#include <unistd.h> #include <unistd.h>
#include <libmpv/client.h>
#include "common.h" #include "common.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)

@ -15,8 +15,6 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>. * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <libmpv/client.h>
#include "common.h" #include "common.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)

@ -28,6 +28,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <assert.h> #include <assert.h>
#include <libmpv/client.h>
#include "osdep/io.h" #include "osdep/io.h"
#include "misc/rendezvous.h" #include "misc/rendezvous.h"

@ -15,6 +15,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>. * License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <libmpv/client.h>
#include "common/msg.h" #include "common/msg.h"
#include "input/input.h" #include "input/input.h"
#include "misc/json.h" #include "misc/json.h"

@ -48,6 +48,8 @@
#include <inttypes.h> #include <inttypes.h>
#include <assert.h> #include <assert.h>
#include <libmpv/client.h>
#include "common/common.h" #include "common/common.h"
#include "misc/bstr.h" #include "misc/bstr.h"
#include "misc/ctype.h" #include "misc/ctype.h"

@ -18,12 +18,10 @@
#ifndef MP_JSON_H #ifndef MP_JSON_H
#define MP_JSON_H #define MP_JSON_H
// We reuse mpv_node.
#include "libmpv/client.h"
#define MAX_JSON_DEPTH 50 #define MAX_JSON_DEPTH 50
struct bstr; struct bstr;
struct mpv_node;
int json_parse(void *ta_parent, struct mpv_node *dst, char **src, int max_depth); int json_parse(void *ta_parent, struct mpv_node *dst, char **src, int max_depth);
int json_append(struct bstr *b, const struct mpv_node *src, int indent); int json_append(struct bstr *b, const struct mpv_node *src, int indent);

@ -1,7 +1,10 @@
#include "common/common.h"
#include "node.h" #include "node.h"
#include <libmpv/client.h>
#include "common/common.h"
#include "bstr.h"
// Init a node with the given format. If parent is not NULL, it is set as // Init a node with the given format. If parent is not NULL, it is set as
// parent allocation according to m_option_type_node rules (which means // parent allocation according to m_option_type_node rules (which means
// the mpv_node_list allocs are used for chaining the TA allocations). // the mpv_node_list allocs are used for chaining the TA allocations).
@ -117,7 +120,7 @@ mpv_node *node_map_bget(mpv_node *src, struct bstr key)
// Note: for MPV_FORMAT_NODE_MAP, this (incorrectly) takes the order into // Note: for MPV_FORMAT_NODE_MAP, this (incorrectly) takes the order into
// account, instead of treating it as set. // account, instead of treating it as set.
bool equal_mpv_value(const void *a, const void *b, mpv_format format) bool equal_mpv_value(const void *a, const void *b, int format)
{ {
switch (format) { switch (format) {
case MPV_FORMAT_NONE: case MPV_FORMAT_NONE:

@ -1,21 +1,24 @@
#ifndef MP_MISC_NODE_H_ #ifndef MP_MISC_NODE_H_
#define MP_MISC_NODE_H_ #define MP_MISC_NODE_H_
#include "libmpv/client.h" #include <stdbool.h>
#include "misc/bstr.h" #include <stdint.h>
struct bstr;
struct mpv_node;
void node_init(struct mpv_node *dst, int format, struct mpv_node *parent); void node_init(struct mpv_node *dst, int format, struct mpv_node *parent);
struct mpv_node *node_array_add(struct mpv_node *dst, int format); struct mpv_node *node_array_add(struct mpv_node *dst, int format);
struct mpv_node *node_map_add(struct mpv_node *dst, const char *key, int format); struct mpv_node *node_map_add(struct mpv_node *dst, const char *key, int format);
struct mpv_node *node_map_badd(struct mpv_node *dst, struct bstr key, int format); struct mpv_node *node_map_badd(struct mpv_node *dst, struct bstr key, int format);
void node_map_add_string(struct mpv_node *dst, const char *key, const char *val); void node_map_add_string(struct mpv_node *dst, const char *key, const char *val);
void node_map_add_bstr(struct mpv_node *dst, const char *key, bstr val); void node_map_add_bstr(struct mpv_node *dst, const char *key, struct bstr val);
void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v); void node_map_add_int64(struct mpv_node *dst, const char *key, int64_t v);
void node_map_add_double(struct mpv_node *dst, const char *key, double v); void node_map_add_double(struct mpv_node *dst, const char *key, double v);
void node_map_add_flag(struct mpv_node *dst, const char *key, bool v); void node_map_add_flag(struct mpv_node *dst, const char *key, bool v);
mpv_node *node_map_get(mpv_node *src, const char *key); struct mpv_node *node_map_get(struct mpv_node *src, const char *key);
mpv_node *node_map_bget(mpv_node *src, struct bstr key); struct mpv_node *node_map_bget(struct mpv_node *src, struct bstr key);
bool equal_mpv_value(const void *a, const void *b, mpv_format format); bool equal_mpv_value(const void *a, const void *b, int format);
bool equal_mpv_node(const struct mpv_node *a, const struct mpv_node *b); bool equal_mpv_node(const struct mpv_node *a, const struct mpv_node *b);
#endif #endif

@ -4,7 +4,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "libmpv/client.h"
#include "libmpv/stream_cb.h" #include "libmpv/stream_cb.h"
#include "misc/bstr.h" #include "misc/bstr.h"

@ -21,8 +21,6 @@
#include <stdatomic.h> #include <stdatomic.h>
#include <stdbool.h> #include <stdbool.h>
#include "libmpv/client.h"
#include "audio/aframe.h" #include "audio/aframe.h"
#include "clipboard/clipboard.h" #include "clipboard/clipboard.h"
#include "common/common.h" #include "common/common.h"

@ -60,7 +60,6 @@
#include "core.h" #include "core.h"
#include "command.h" #include "command.h"
#include "libmpv/client.h"
// Called from the demuxer thread if a new packet is available, or other changes. // Called from the demuxer thread if a new packet is available, or other changes.
static void wakeup_demux(void *pctx) static void wakeup_demux(void *pctx)

@ -1,3 +1,5 @@
#include <libmpv/client.h>
#include "misc/json.h" #include "misc/json.h"
#include "misc/node.h" #include "misc/node.h"
#include "test_utils.h" #include "test_utils.h"

@ -16,13 +16,14 @@
*/ */
#include <inttypes.h> #include <inttypes.h>
#include <libmpv/client.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <libmpv/client.h>
// Stolen from osdep/compiler.h // Stolen from osdep/compiler.h
#ifdef __GNUC__ #ifdef __GNUC__
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2))) #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2)))

@ -16,7 +16,6 @@
*/ */
#include <inttypes.h> #include <inttypes.h>
#include <libmpv/client.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -29,6 +28,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <libmpv/client.h>
// Stolen from osdep/compiler.h // Stolen from osdep/compiler.h
#ifdef __GNUC__ #ifdef __GNUC__
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2))) #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2)))