示例#1
0
def test_box_header_w_drop():
    bs = pack("uintbe:32, bytes:4", 100, b"abcd")

    box_header = BoxHeader()
    box_header.type = b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00"
    box_header.box_size = MAX_UINT_32 + 1

    box_header.type = b"abcd"
    box_header.box_size = 100

    assert box_header.type == b"abcd"
    assert box_header.box_size == 100
    assert box_header.header_size == 8
    assert box_header.content_size == 92
    assert bytes(box_header) == bs.bytes
示例#2
0
def test_box_header_extended_user_type_w_drop():
    bs = pack("uintbe:32, bytes:4, uintbe:64, bytes:16", 1, b"uuid",
              MAX_UINT_32 + 1, b":benzina\x00\x00\x00\x00\x00\x00\x00\x00")

    box_header = BoxHeader()
    box_header.type = b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00"
    box_header.box_size = MAX_UINT_32 + 1

    box_header.type = b"abcd"
    box_header.box_size = 100

    box_header.type = b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00"
    box_header.box_size = MAX_UINT_32 + 1

    assert box_header.type == b"uuid:benzina\x00\x00\x00\x00\x00\x00\x00\x00"
    assert box_header.box_size == MAX_UINT_32 + 1
    assert box_header.header_size == 32
    assert box_header.content_size == MAX_UINT_32 + 1 - 32
    assert bytes(box_header) == bs.bytes
示例#3
0
def test_box_header():
    bs = pack("uintbe:32, bytes:4", 100, b"abcd")

    box_header = BoxHeader()
    box_header.type = b"abcd"
    box_header.box_size = 100

    assert box_header.type == b"abcd"
    assert box_header.box_size == 100
    assert box_header.header_size == 8
    assert box_header.content_size == 92
    assert bytes(box_header) == bs.bytes

    box_header = BoxHeader()
    box_header.box_size = 100
    box_header.type = b"abcd"

    assert box_header.type == b"abcd"
    assert box_header.box_size == 100
    assert box_header.header_size == 8
    assert box_header.content_size == 92
    assert bytes(box_header) == bs.bytes
示例#4
0
def test_box_header_force_box_extended_size():
    bs = pack("uintbe:32, bytes:4, uintbe:64", 1, b"abcd", 32)

    box_header = BoxHeader()
    box_header.type = b"abcd"
    box_header.box_ext_size = 32

    assert box_header.type == b"abcd"
    assert box_header.box_size == 32
    assert box_header.box_ext_size == 32
    assert box_header.header_size == 16
    assert box_header.content_size == 16
    assert bytes(box_header) == bs.bytes