From f53dcf163da2d94b7fd2b1257ede8cf91e6ce301 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 28 Jul 2012 17:31:55 +0200 Subject: 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. --- Makefile | 4 ++-- bin_to_header.py | 43 ------------------------------------------- libvo/vo_gl3.c | 4 +++- 3 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 bin_to_header.py diff --git a/Makefile b/Makefile index ffec492a44..055e7d2c39 100644 --- a/Makefile +++ b/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 diff --git a/bin_to_header.py b/bin_to_header.py deleted file mode 100644 index 137a5b3728..0000000000 --- a/bin_to_header.py +++ /dev/null @@ -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() diff --git a/libvo/vo_gl3.c b/libvo/vo_gl3.c index adfe636909..d1b0540761 100644 --- a/libvo/vo_gl3.c +++ b/libvo/vo_gl3.c @@ -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"); -- cgit v1.2.3