mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 08:12:17 +00:00
build: remove bin_to_header.py and use TOOLS/file2string.py instead
TOOLS/file2string.py was recently added upstream, so bin_to_header.py is not needed anymore. Also fix vo_gl3.c, since file2string.py works slightly different from my script.
This commit is contained in:
parent
51e198c2a1
commit
f53dcf163d
4
Makefile
4
Makefile
@ -608,8 +608,8 @@ libmpdemux/ebml_types.h: TOOLS/matroska.py
|
||||
libmpdemux/ebml_defs.c: TOOLS/matroska.py
|
||||
./$< --generate-definitions > $@
|
||||
|
||||
libvo/vo_gl3_shaders.h: libvo/vo_gl3_shaders.glsl
|
||||
python ./bin_to_header.py $^ $@
|
||||
libvo/vo_gl3_shaders.h: TOOLS/file2string.py libvo/vo_gl3_shaders.glsl
|
||||
./$^ >$@
|
||||
|
||||
libvo/vo_gl3.c: libvo/vo_gl3_shaders.h
|
||||
|
||||
|
@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Script to embed arbitrary binary files in C header files.
|
||||
|
||||
CHARS_PER_LINE = 19
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print("Embed binary files in C headers.")
|
||||
print("Usage: ")
|
||||
print(" bin_to_header.py infile outfile.h")
|
||||
print("outfile.h will be overwritten with the new contents.")
|
||||
sys.exit(1)
|
||||
|
||||
infile_name = sys.argv[1]
|
||||
outfile_name = sys.argv[2]
|
||||
|
||||
varname = os.path.splitext(os.path.basename(outfile_name))[0]
|
||||
|
||||
infile = open(infile_name, "rb")
|
||||
outfile = open(outfile_name, "w")
|
||||
|
||||
outfile.write("// Generated with " + " ".join(sys.argv) + "\n")
|
||||
outfile.write("\nstatic const unsigned char " + varname + "[] = {\n")
|
||||
|
||||
while True:
|
||||
data = infile.read(CHARS_PER_LINE)
|
||||
if len(data) == 0:
|
||||
break
|
||||
outfile.write(" ")
|
||||
for c in data:
|
||||
# make it work both in Python 2.x (c is str) and 3.x (c is int)
|
||||
if type(c) != int:
|
||||
c = ord(c)
|
||||
outfile.write("{0:3},".format(c))
|
||||
outfile.write("\n")
|
||||
|
||||
outfile.write("};\n")
|
||||
|
||||
infile.close()
|
||||
outfile.close()
|
@ -55,8 +55,10 @@
|
||||
#include "fastmemcpy.h"
|
||||
#include "sub/ass_mp.h"
|
||||
|
||||
static const char vo_gl3_shaders[] =
|
||||
// Generated from libvo/vo_gl3_shaders.glsl
|
||||
#include "libvo/vo_gl3_shaders.h"
|
||||
;
|
||||
|
||||
// How many parts the OSD may consist of at most.
|
||||
#define MAX_OSD_PARTS 20
|
||||
@ -630,7 +632,7 @@ static void compile_shaders(struct gl_priv *p)
|
||||
|
||||
void *tmp = talloc_new(NULL);
|
||||
|
||||
struct bstr src = { (char*)vo_gl3_shaders, sizeof(vo_gl3_shaders) };
|
||||
struct bstr src = bstr(vo_gl3_shaders);
|
||||
char *vertex_shader = get_section(tmp, src, "vertex_all");
|
||||
char *shader_prelude = get_section(tmp, src, "prelude");
|
||||
char *s_video = get_section(tmp, src, "frag_video");
|
||||
|
Loading…
Reference in New Issue
Block a user