summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-07-28 17:31:55 +0200
committerwm4 <wm4@mplayer2.org>2012-07-28 20:44:07 +0200
commitf53dcf163da2d94b7fd2b1257ede8cf91e6ce301 (patch)
tree00fb0d0eaf1d8dfc48280f5db2982ca40e7dae1f
parent51e198c2a1e43b74ad35ef358628dcd8791158d9 (diff)
downloadmpv-f53dcf163da2d94b7fd2b1257ede8cf91e6ce301.tar.bz2
mpv-f53dcf163da2d94b7fd2b1257ede8cf91e6ce301.tar.xz
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.
-rw-r--r--Makefile4
-rw-r--r--bin_to_header.py43
-rw-r--r--libvo/vo_gl3.c4
3 files changed, 5 insertions, 46 deletions
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");