-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build, codec-cfg.c: simplify builtin codecs.conf handling
The player can read codec mapping (codecs.conf) from an external file or use embedded defaults. Before, the defaults were stored in the player binary in the form of final already-parsed data structures. Simplify things by storing the text of the codecs.conf file instead, and parse that at runtime the same way an external file would be parsed. To create the previous parsed form, the build system first compiled a separate binary named "codec-cfg", which parsed etc/codecs.conf and then wrote the results as a C data structure that could be compiled into the program. The new simple conversion of codecs.conf into a C string is handled by the new script TOOLS/file2string.py. After removing the codec-cfg binary, HOST_CC is no longer used for anything. Remove the --host-cc configure option and associated logic. Also remove the codec2html and codec-cfg-test functionality. Building those was already broken and nobody cared. There was a broken 3-character-long "fourcc" entry in etc/codecs.conf. This happened to be accepted before but triggered a parse error after the changes. Remove the broken entry and make the parsing functions explicitly test for this error.
- Loading branch information
Uoti Urpala
committed
Jul 16, 2012
1 parent
39a45c7
commit 2ba8b91
Showing
9 changed files
with
96 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,6 @@ | |
/version.h | ||
/codecs.conf.h | ||
/codec-cfg | ||
/codec-cfg-test | ||
/codecs2html | ||
/cpuinfo | ||
/tags | ||
/TAGS | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.