parameters: (fp)
return_statement: return (data_size, encoding, sample_rate, channels, info)
docstring: Read a sound header from an open file.
docstring_summary: Read a sound header from an open file.
docstring_tokens: Read a sound header from an open file .
function: def gethdr(fp):
      """Read a sound header from an open file."""
      if fp.read(4) != MAGIC:
          raise error, 'gethdr: bad magic word'
      hdr_size = get_long_be(fp.read(4))
      data_size = get_long_be(fp.read(4))
      encoding = get_long_be(fp.read(4))
      sample_rate = get_long_be(fp.read(4))
      channels = get_long_be(fp.read(4))
      excess = hdr_size - 24
      if excess < 0:
          raise error, 'gethdr: bad hdr_size'
      if excess > 0:
          info = fp.read(excess)
      else:
          info = ''
      return (data_size, encoding, sample_rate, channels, info)
function_tokens: def gethdr ( fp ) : if fp . read ( 4 ) != MAGIC : raise error , 'gethdr: bad magic word' hdr_size = get_long_be ( fp . read ( 4 ) ) data_size = get_long_be ( fp . read ( 4 ) ) encoding = get_long_be ( fp . read ( 4 ) ) sample_rate = get_long_be ( fp . read ( 4 ) ) channels = get_long_be ( fp . read ( 4 ) ) excess = hdr_size - 24 if excess < 0 : raise error , 'gethdr: bad hdr_size' if excess > 0 : info = fp . read ( excess ) else : info = '' return ( data_size , encoding , sample_rate , channels , info )