diff --git a/tools/generate_stubs/generate_stubs.py b/tools/generate_stubs/generate_stubs.py index 7d2f91b8b6787..141a608b995eb 100755 --- a/tools/generate_stubs/generate_stubs.py +++ b/tools/generate_stubs/generate_stubs.py @@ -382,7 +382,7 @@ def ExtractModuleName(infile_path): return basename -def ParseSignatures(infile): +def ParseSignaturesReal(infile): """Parses function signatures in the input file. This function parses a file of signatures into a list of dictionaries that @@ -426,6 +426,27 @@ def ParseSignatures(infile): return signatures +# Sometimes additional signatures other than what is exposed to Chromium are +# needed, in particular for ffmpeg. If we ever make a fork of ffmpeg, is +# probably a good idea to remove this patch and add the signatures directly on +# the .sigs file at the dependency repository. In order to expose additional +# signatures of a library foobar, just add a .sig file prefixed with "xwalk_" at +# the root folder of the directory containing this script. +def ParseSignatures(infile): + signatures = ParseSignaturesReal(infile) + + xwalk_sig_dir = os.path.dirname(os.path.realpath(__file__)) + xwalk_sig_file = os.path.join(xwalk_sig_dir, + 'xwalk_' + os.path.basename(infile.name)) + + if os.path.exists(xwalk_sig_file): + xwalk_infile = open(xwalk_sig_file, 'r') + signatures += ParseSignaturesReal(xwalk_infile) + xwalk_infile.close() + + return signatures + + def WriteWindowsDefFile(module_name, signatures, outfile): """Writes a windows def file to the given output file object. diff --git a/tools/generate_stubs/xwalk_ffmpegsumo.sigs b/tools/generate_stubs/xwalk_ffmpegsumo.sigs new file mode 100644 index 0000000000000..ab8f2f940360a --- /dev/null +++ b/tools/generate_stubs/xwalk_ffmpegsumo.sigs @@ -0,0 +1,7 @@ +# Copyright (c) 2013 Intel Corporation. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +AVCodec *av_codec_next(const AVCodec *c); +int av_codec_is_encoder(const AVCodec *c); +int av_codec_is_decoder(const AVCodec *c);