author Karl Tomlinson <>
Wed, 02 Jul 2014 20:22:45 +1200
changeset 192471 0f1cea1a1a952c84d2a5758dbf9efc3ee6fe5dfc
parent 168822 8cdaaf3da9f84ba309429aee968d2f55a905c63d
child 206460 5f4035ff11653a321745ca2999c6a5b926f54f73
permissions -rw-r--r--
b=1033140 make speex_resampler declarations consistent with OUTSIDE_SPEEX implementation r=padenot Instead of defining OUTSIDE_SPEEX and RANDOM_PREFIX everywhere speex_resampler.h is included, it is easier to patch the header. Symbol names in gkmedias symbols.def are updated now that RANDOM_PREFIX is taking effect, and unused symbols are no longer exported.

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at

import sys
import binascii

def file_byte_generator(filename, block_size = 512):
  with open(filename, "rb") as f:
    while True:
      block =
      if block:
        for byte in block:
          yield byte

def create_header(array_name, in_filename):
  hexified = ["0x" + binascii.hexlify(byte) for byte in file_byte_generator(in_filename)]
  print "const uint8_t " + array_name + "[] = {"
  print ", ".join(hexified)
  print "};"
  return 0

if __name__ == '__main__':
  if len(sys.argv) < 3:
    print 'ERROR: usage: array_name in_filename'
  sys.exit(create_header(sys.argv[1], sys.argv[2]))