Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Unpacks MPEG Frame header bytes from chunk of data.

Value can then be used to parse and verify the bits.
    
:param header_offset: Position *within a chunk* where to look for header 
    bytes.
:type header_offset: int

:param chunk: Chunk of data where to get header bytes.
:type chunk: string(more...)

        def get_bytes(header_offset, chunk):
    """Unpacks MPEG Frame header bytes from chunk of data.
    
    Value can then be used to parse and verify the bits.
        
    :param header_offset: Position *within a chunk* where to look for header 
        bytes.
    :type header_offset: int
    
    :param chunk: Chunk of data where to get header bytes.
    :type chunk: string
    
    :return: Header bytes. Used by :func:`MPEGAudioFrame.parse`.
    :rtype: int
    
    :raise mpeg1audio.MPEGAudioHeaderEOFException: Raised when end of chunk was 
        reached.
        
    :see: :func:`MPEGAudioFrame.parse`
    :see: :func:`MPEGAudioFrame.find_and_parse`

    """
    # Get first four bytes
    header = chunk[header_offset:header_offset + 4]
    if len(header) != 4:
        raise MPEGAudioHeaderEOFException(
                                'End of chunk reached, header not found.')

    # Unpack 4 bytes (the header size)
    (header_bytes,) = struct.unpack(">I", header)
    return header_bytes
        


src/m/p/mpeg1audio-0.5.2/src/mpeg1audio/__init__.py   mpeg1audio(Download)
                # Get header bytes within chunk
                try:
                    header_bytes = headers.get_bytes(next_header_offset, chunk)
                except MPEGAudioHeaderEOFException:
                    # We need next chunk, end of this chunk was reached

src/m/p/mpeg1audio-HEAD/src/mpeg1audio/__init__.py   mpeg1audio(Download)
                # Get header bytes within chunk
                try:
                    header_bytes = headers.get_bytes(next_header_offset, chunk)
                except MPEGAudioHeaderEOFException:
                    # We need next chunk, end of this chunk was reached