summaryrefslogtreecommitdiffstats
path: root/TOOLS
diff options
context:
space:
mode:
authorwm4 <wm4@mplayer2.org>2012-07-28 17:07:49 +0200
committerwm4 <wm4@mplayer2.org>2012-07-28 17:24:05 +0200
commit51e198c2a1e43b74ad35ef358628dcd8791158d9 (patch)
tree60f6c2255ed912a7a4866b71728104a2cb2442f1 /TOOLS
parent2793e7eb70a342b346788f83e1ed660c8e0d491e (diff)
parent7dfaaa95104a8e6dc024fddaf1b49c71768f1be7 (diff)
downloadmpv-51e198c2a1e43b74ad35ef358628dcd8791158d9.tar.bz2
mpv-51e198c2a1e43b74ad35ef358628dcd8791158d9.tar.xz
Merge remote-tracking branch 'origin/master'
Conflicts: .gitignore bstr.c cfg-mplayer.h defaultopts.c libvo/video_out.c The conflict in bstr.c is due to uau adding a bstr_getline function in commit 2ba8b91a97e7e8. This function already existed in this branch. While uau's function is obviously derived from mine, it's incompatible. His function preserves line breaks, while mine strips them. Add a bstr_strip_linebreaks function, fix all other uses of bstr_getline, and pick uau's implementation. In .gitignore, change vo_gl3_shaders.h to use an absolute path additional to resolving the merge conflict.
Diffstat (limited to 'TOOLS')
-rwxr-xr-xTOOLS/file2string.py23
-rwxr-xr-xTOOLS/matroska.py2
-rwxr-xr-x[-rw-r--r--]TOOLS/vdpau_functions.py2
3 files changed, 26 insertions, 1 deletions
diff --git a/TOOLS/file2string.py b/TOOLS/file2string.py
new file mode 100755
index 0000000000..002ba4ab60
--- /dev/null
+++ b/TOOLS/file2string.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+# Convert the contents of a file into a C string constant.
+# Note that the compiler will implicitly add an extra 0 byte at the end
+# of every string, so code using the string may need to remove that to get
+# the exact contents of the original file.
+
+import sys
+
+def main(infile):
+ conv = ['\\' + oct(c)[2:] for c in range(256)]
+ safe_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" \
+ "0123456789!#%&'()*+,-./:;<=>?[]^_{|}~ "
+ for c in safe_chars:
+ conv[ord(c)] = c
+ for c, esc in ("\nn", "\tt", r"\\", '""'):
+ conv[ord(c)] = '\\' + esc
+ for line in infile:
+ sys.stdout.write('"' + ''.join(conv[c] for c in line) + '"\n')
+
+with open(sys.argv[1], 'rb') as infile:
+ sys.stdout.write("// Generated from %s\n\n" % sys.argv[1])
+ main(infile)
diff --git a/TOOLS/matroska.py b/TOOLS/matroska.py
index 375fb8b279..ffa388e47b 100755
--- a/TOOLS/matroska.py
+++ b/TOOLS/matroska.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
"""
Generate C definitions for parsing Matroska files.
Can also be used to directly parse Matroska files and display their contents.
diff --git a/TOOLS/vdpau_functions.py b/TOOLS/vdpau_functions.py
index 27d6ff45f3..39e38a8bbe 100644..100755
--- a/TOOLS/vdpau_functions.py
+++ b/TOOLS/vdpau_functions.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
# Generate vdpau_template.c
functions = """